The thing I love about python is it’s elegance; and I thing that is partially due to its syntactic sugar. Between list comprehensions, destructuring, enumerators, generators with yield, and a bunch more, what is your favorite
- flatbield ( @furrowsofar@beehaw.org ) English2•11 months ago
Another useful one is static methods.
I just got into OOP with classes and stuff and I will say that
@staticmethod
is super nice from an organizational standpoint
- Walnut356 ( @Walnut356@programming.dev ) 2•1 year ago
Generators probably. It’s the one thing i genuinely miss about python when i work in rust.
- sebsch ( @sebsch@discuss.tchncs.de ) 1•11 months ago
You’re right. Having just
yield sth
in a function instead of defining the data structure is such a game changer.
- flatbield ( @furrowsofar@beehaw.org ) English2•1 year ago
I come from the school of thought that programs should look like what they do. So I have mixed felling about the complexity increase in Python. Also about those pushing types.
That said the subrange notation is one of the most important. I have used everything you mentioned in the appropriate places though. I find myself using list comprehensions and also the format method more often these days.
Yeah, I’m just learning about decorators in classes, and they’re super cool!
- KaczuH ( @KaczuH@lemmy.ml ) 1•11 months ago
Decorators are one of most useful features I’m using most frequently.