When working with generators, AFAIK, there's currently no easy way to handle
the case of an empty generator (which can be useful if such case is an error).
Converting the generator to a, say, list, is not a solution if the generator is
intrinsically infinite.
I propose to have an "otherwise" cl
This should have been:
When working with generators in a for statement, AFAIK, there's currently no
easy way to handle the case of an empty generator (which can be useful if such
case is an error).
___
Python-ideas mailing list -- python-ideas@python.o
Your code has an unpacking error in the first line. I think you mean this,
right?
no_items = object()
item = no_items
for item in get_items():
frob(item)
if item is no_items:
raise ValueError()
___
Python-ideas mailing list -- python-ideas@pyt
Frequently, while globbing, one needs to work with multiple extensions. I’d
like to propose for fnmatch.filter to handle a tuple of patterns (while
preserving the single str argument functionality, alas str.endswith), as a
first step for glob.i?glob to accept multiple patterns as well.
Here is the
I believe this would make the code more legible. Serhiy's take is very
confusing to me (I get it, but don't think one should write like to get this
behavior).
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to pytho
A dict method to retrieve the key of a value from a bijective dict would have
come in handy to me in several occasions:
>>> names = {'one': 1}
>>> names.inverse()[1]
'one'
>>> names = {'one': 1, 'uno': 1}
>>> names.inverse()[1]
ValueError: dict is not bijective
My usual use case is when both key