Python Tips and Tricks, You Haven’t Already Seen(towardsdatascience.com)
towardsdatascience.com
Python Tips and Tricks, You Haven’t Already Seen
https://towardsdatascience.com/python-tips-and-trick-you-havent-already-seen-37825547544f
7 comments
Wow thank you very much MartinHeinz -- I've been using Python for years and the only two of these I knew were the __enter__ and comparator dunders! Saved, bookmarked, and shared with friends.
I was happy to see some Python tips I actually haven't already seen. That was a good, short, interesting read. Thanks for writing it up!
I'd heard of __slots__ long ago but I didn't know enough to use it. The example is good!
Did not know about the kwarg only function. Neat. Although I wonder what it means for readability esp if the idiom is not well known.
A general observation is that the itertools module is full interesting nuggets. I am always finding something new.
A general observation is that the itertools module is full interesting nuggets. I am always finding something new.
Edit: Also just tried to `import * ` with `_all__ = []` and no AttributeError is raised as is stated. Python 3.7.4