News for hackers. Stuff that matters.
Re:Python Language Features and Tricks by kriro on Saturday March 08, 2014 @11:47AM (#7365616)
Why are there so many negative comments? Maybe those posters are vastly underestimating how many people that just start out read HN. I think it's a pretty good post to read after something like "X in Y minutes - Python" to get a very quick grasp of what the language is like.

I'm also not ashamed to say that despite having written quite a few LOC of Python I wasn't aware of named slices for some reason and I think they can clear up some chunks of code I have produced (make it more readable)

Re:Python Language Features and Tricks by Bocker on Saturday March 08, 2014 @12:37PM (#7365746)
I've been programming in Python for about 3 years and learned a couple of tricks from this post, which was why I submitted it.

There's always tricks to learn, and it's hard to remember everything when you're first starting out with a new language.

Re:Python Language Features and Tricks by to3m on Saturday March 08, 2014 @05:57PM (#7366733)
Extended unpacking was a new one on me. Kind of like a simple version of pattern matching. I think this one will prove useful!

(I've been using python for many years, but not full time. It's the language I use for one-off scripts, small tools that make use of its handy standard library, or prototypes for things I'm going to write in some other language. That's my excuse for the gaps in my knowledge.)

Re:Python Language Features and Tricks by Estragon on Saturday March 08, 2014 @11:56AM (#7365641)
I've been using python since the 90s, and I learned a few things from this post.
Re:Python Language Features and Tricks by shiven on Sunday March 09, 2014 @07:31AM (#7368173)
Right after this string of replies, I was expecting Guido van Rossum would be next, saying he created Python and even he learnt something new...
Re:Python Language Features and Tricks by ggchappell on Sunday March 09, 2014 @09:04PM (#7370749)
> ... I wasn't aware of named slices for some reason ....

I wasn't either. But I wouldn't call them a hidden feature of the language. A slice object is an object. So you can make it the value of a named variable, just like any other object. Somehow that wasn't obvious, though.

Now I'm wondering how else I might be able to improve my code by giving names to non-obvious things.

Re:Python Language Features and Tricks by k3oni on Saturday March 08, 2014 @12:11PM (#7365675)
Same here, learned something new today.
Re:Python Language Features and Tricks by maxerickson on Saturday March 08, 2014 @06:13PM (#7366780)
A common theme running through named tuples, itertools and collections is Raymond Hettinger. He has also put together lots of tutorials and talks.
Re:Python Language Features and Tricks by kriro on Sunday March 09, 2014 @05:12AM (#7367953)
Great suggestion. Just searched for him on youtube and a couple of excellent looking talks popped up. Halfway through and this one seems great so far: https://www.youtube.com/watch?v=OSGv2VnC0go

Really enjoy his style as well :)

Re:Python Language Features and Tricks by k3oni on Sunday March 09, 2014 @12:34PM (#7368843)
Thank you sir, something else to go through on a quiet Sunday :).