A long long time ago, I started with Python 1.5 at web.de, founded the MoinMoin wiki project shortly thereafter, and am now enjoying the increased traction that Python recently gets from data science.
Using bare excepts in a series on pythonic code‽ 😁
The last example should IMHO show how to pass an object to the context, i.e. how to use yield something / with … as …:. You could smuggle in inspect.currentframe() and extend it to print "praise from {file}:{line}".
Ha, that's fair. I was focusing on with so I didn't want to muddy the example with specific exception classes, but I agree that I probably should have put something better in there.
This series is aimed pretty squarely at newer Python developers so I've tried to avoid more complex scenarios and give a gentle introduction to with since people may have never seen anything like it in their language of choice.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Using bare excepts in a series on pythonic code‽ 😁
The last example should IMHO show how to pass an object to the context, i.e. how to use
yield something
/with … as …:
. You could smuggle ininspect.currentframe()
and extend it to print "praise from {file}:{line}".Ha, that's fair. I was focusing on
with
so I didn't want to muddy the example with specific exception classes, but I agree that I probably should have put something better in there.This series is aimed pretty squarely at newer Python developers so I've tried to avoid more complex scenarios and give a gentle introduction to
with
since people may have never seen anything like it in their language of choice.