Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix argument delegation of convenience functions. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix argument delegation of convenience functions. #1

wants to merge 1 commit into from

Conversation

blubberdiblub
Copy link

I was hoping to use the convenience functions with the same parameters as is possible when directly instantiating TextLorem() objects, but I was surprised this doesn't work.

i.e. this doesn't work:

import lorem
lorem.text(trange=(2, 2))

whereas this does:

from lorem.text import TextLorem
TextLorem(trange=(2, 2)).text()

However, this looks like a mistake rather than intention, as the delegation of the parameters is already present in __init__.py, only the parameters are handed over to the methods of the TextLorem class, which don't take arguments.

My changes make the former work as well, which is more convenient and very slightly easier to read for one-time usage.

The convenience functions now delegate the parameters they're called
with to the temporary instantiation of the `TextLorem` class instead of
the method calls, the latter of which don't have arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant