Python Language Features and Tricks
sahandsaba.com
Python Language Features and Tricks
1–10 of 86 posts
Re: Python Language Features and Tricks
#2Re: Python Language Features and Tricks
#3Re: Python Language Features and Tricks
#4Wake me up when Python will support tail call elimination and will get rid of GIL. For now this language is no better than PHP.
Re: Python Language Features and Tricks
#5patterns / tricks = language deficiencies Wake me up when Python will support tail call elimination and will get rid of GIL. For now this language is no better than PHP.
For the GIL, there are alternative implementations of Python (Jython, IronPython, etc.)
Re: Python Language Features and Tricks
#6Python's unpacking is a poor man's pattern matching. I'd really love to see them extend it to support user-defined patterns like Scala's extractors or F#'s active patterns.
# let i = (1,2,3) ;;
val i : int * int * int = (1, 2, 3)
# let a,b,c = i;;
val a : int = 1
val b : int = 2
val c : int = 3
Re: Python Language Features and Tricks
#71. I'm unfamiliar with the term 'unpacking'. Is it any different from pattern matching in, say, Haskell (but perhaps not as feature-rich)?
2. Aren't slices pretty much a staple in Python? I didn't think using them was considered a 'trick'.
Re: Python Language Features and Tricks
#8Python's unpacking is a poor man's pattern matching. I'd really love to see them extend it to support user-defined patterns like Scala's extractors or F#'s active patterns.
I think unpacking is just unpacking, languages that have pattern matching allow you to do something identical: # let i = (1,2,3) ;; val i : int * int * int = (1, 2, 3) # let a,b,c = i;; val a : int = 1 val b : int = 2 val c : int = 3
I believe Python supports pattern matching other than Regex as well.
Re: Python Language Features and Tricks
#9I have two questions. 1. I'm unfamiliar with the term 'unpacking'. Is it any different from pattern matching in, say, Haskell (but perhaps not as feature-rich)? 2. Aren't slices pretty much a staple in Python? I didn't think using them was considered a 'trick'.
t = (1, 2)
a, b = t
# a == 1 and b == 2
Using slices is normal with listsRe: Python Language Features and Tricks
#10patterns / tricks = language deficiencies Wake me up when Python will support tail call elimination and will get rid of GIL. For now this language is no better than PHP.
It seems you have read some generic criticism of Python to copy from, and don't have much first-hand experience