Like the articles? Buy the book! Dead Simple Python by Jason C. McDonald is available from No Starch Press.
Python has a reputation for looking...
For further actions, you may consider blocking this person and/or reporting abuse
Curious about "Functions should not have side effects; they should not modify anything external to themselves." If I had a function designed to take a dictionary as an argument, with the intention that other relevant functions would pass in a dictionary generated dynamically at each call, rather than an existing global, how much does it matter if the function mutates the dictionary to produce its results? (In this case, writing to an SQL database.) Should I bulletproof it, maybe by making a full copy of the input dictionary inside the function, warn about the behavior in the docstring, or does it not matter? I'd be surprised if anyone but me ever uses this code, but, who knows XD
That would still be considered impure, from a functional standpoint. If it makes sense in your code base, you might be able to get away with it, but it's still not recommended, as your unspoken intended rule may not be respected by future-you.
Probably worth doing something to idiot proof it then, who knows who might try to do something with my private project in the future o.o XD Better habit, anyway!
Usually the worst future idiots using our projects are our own overworked selves.
That's exactly who I'm most worried about 😅
Very useful article.
Regarding the default depth, it's interesting. Here and there I read 997, then I went to see the CPython implementation, there it's set to 1000.
Well, it doesn't change a lot of things. But probably it's worth mentioning that you actually change that limit, by using
sys.setrecursionlimit
.Great insight, thanks!
There will be no "Transfiguring frog into frog-orange." since you redefined 'partial_transfiguration'.
Thanks for the useful article.
Where specifically is it redefined?
😅
but before this, it was:
Ah, following you now. I've been working in C++ for the past couple of weeks, so "redefined" had a different connotation for me.
I had indeed removed the print statement in the second version! I'll go back and fix that. Thanks for the catch.
Great explanation of various concepts I see all the time in Python code, but wasn't sure how, or if, I wanted to make use of my own code. Now I can!
I love this guy. Respects.
Great article, thanks a lot.
I suggest reading dev.to/yawpitch/the-35-words-you-n... to people who like this article.