Live data from Hacker News

Advanced Python Features

blog.edward-li.com

181–183 of 183 posts

Re: Advanced Python Features

#181

Hey yall! Original author of the blog here! I did not expect to wake up at 4am seeing my post on front page HN, but here we are nevertheless :D As the intro mentioned, these started off as 14 small tweets I wrote a month prior to starting my blog. When I finally got that set up, I just thought, "hey, I just spent the better part of two weeks writing these nifty Python tricks, might as well reuse them as a fun first p…

I think the background of the post is very well explained on the blog.

But I’m surprised to read you went from idea to posting each day. I had expected maybe a week of preparation before starting execution.

Regardless it’s a great post, regardless of wether one think there is too much typing or too many new features in modern Python or one is a lover of niche solutions to shorten code.

Re: Advanced Python Features

#182
post #57
post #55

Earlier quoted context omitted.

I disagree. Adding "fancy stuff" by definition does not remove what made it attractive to you in the first place. You even acknowledge this in your second sentence. Something you don't know of is not capable to influence your opinion in any way. And when you know of it -- and dislike it -- just keep doing it the way you did before knowing it.

> And when you know of it -- and dislike it -- just keep doing it the way you did before knowing it. That breaks down as soon as you need to work with anyone else's code that uses the "fancy stuff".

No, it does not. There's always someone else better than you. That's no fault of the language

Re: Advanced Python Features

#183
post #50

Earlier quoted context omitted.

> did you know __init__.py is optional nowadays? It has an effect, and is usually worth including anyway. I used to omit it by default; now I include it by default. Also, you say "nowadays" but it's been almost 13 years now ( https://peps.python.org/pep-0420/ ). > since 3.13 there is a @deprecated decorator that does what you think it does Nice find. Probably worth mentioning it comes from the `warnings` standard lib…

do you know any other things you can think of that people might not be aware of? small tricks or some such, perhaps unrelated to type annotations?

I wouldn't really know what to count in that category. I usually think more about a) really beginner-level issues (and trying to figure out why they trip up beginners, and how best to teach them in detail) and b) making my own code more beautiful (a zen-like practice that mostly defies being reduced to a tips-and-tricks list).
Post reply on HN