d = {}
for key, d[key] in ((this,18), (that,17), (other,38)):
print key
do_something(d)
Why not use a dict comprehension?
d = {k:v for k,v in ((this,18), (that,17), (other,38))}
I feel this is more straightforward and easier to read. the results are the
same however.
--
In the particular case I did it in, I needed the incremental results
passed to a function, not just the final result. I don't think this
made it into the final code, rather it was expanded to be more
readable. But the discovery made me feel a disturbance in the
Pythonic force of the
However, ignored() is actually implemented as a generator function
with the @contextmanager decorator shortcut. This decorator takes a
generator function and wraps it up as a class with the necessary
__enter__ and __exit__ methods. The __enter__ method in this case
calls the .next() method
I am viewing it on Chrome Version 26.0.1410.43 m for windows and it works
perfectly for me.
On Mon, Apr 8, 2013 at 12:32 AM, Chris Angelico ros...@gmail.com wrote:
On Mon, Apr 8, 2013 at 4:38 PM, Barrett Lewis musikal.fus...@gmail.com
wrote:
I looked up the source to the decorator
found
For example, if the input stream contained the text:
[1, # python should ignore this comment
2]
and I do a read on it, I should obtain the result
[1, 2]
--
I don't know much about lisp but given that input and the desired output
you can write functions like the following
def
Do you happen to be on windows? Because if you are then you need to edit
the registry. If you are on windows let me know and I will walk you through
the fix, but if not then it would be a waste of time for me to explain it.
--
http://mail.python.org/mailman/listinfo/python-list
I was recently watching that Raymond Hettinger video on creating Beautiful
Python from this years PyCon.
He mentioned pushing up the new idiom
with ignored(ignored_exceptions):
# do some work
I tracked down his commit here http://hg.python.org/cpython/rev/406b47c64480
But am unsure how the