Functional is the new pythonic! (edit: It actually is, half of the good things in Python, like list comprehensions and tuples and destructuring, were first seen in functional languages!)
What is Pythonic? (2005)
11–20 of 21 posts
Re: What is Pythonic? (2005)
#12I think it's important to think of Pythonic as something that's subjective and evolving. The C examples given are idiomatic in C. The reason they're idiomatic is because they fit with a mental model that most of the C community uses: data structures in an enumerated address space, and passing around hunks of mutable memory with handshake semantics. If your code interacts with code that was written with that in mind,…
But even in the second case, you have to do more than wave your hands around to show that Haskell is superior if you want to move beyond pure, substance-less snobbery. If you did that, you'd find that you were leaning on some assumed values - for example, the values of the Haskell community.
If all you have to say is that Python's values are subjective while Haskell's values are the actually important ones, this is really pure snobbery without any substance.
Re: What is Pythonic? (2005)
#13Functional is the new pythonic! (edit: It actually is, half of the good things in Python, like list comprehensions and tuples and destructuring, were first seen in functional languages!)
BDFL Guido van Rossum is not in favor of adding functional programming stuff to python. So, by fiat, functional programming is not very pythonic. :)
Re: What is Pythonic? (2005)
#14Functional is the new pythonic! (edit: It actually is, half of the good things in Python, like list comprehensions and tuples and destructuring, were first seen in functional languages!)
Re: What is Pythonic? (2005)
#15Earlier quoted context omitted.
BDFL Guido van Rossum is not in favor of adding functional programming stuff to python. So, by fiat, functional programming is not very pythonic. :)
You are both partially right. List comprehensions are considered pythonic, and they are similar to map and filter from the FP world. However the map and filter functions themselves are somewhat unpythonic.
Re: What is Pythonic? (2005)
#16Re: What is Pythonic? (2005)
#17I think it's important to think of Pythonic as something that's subjective and evolving. The C examples given are idiomatic in C. The reason they're idiomatic is because they fit with a mental model that most of the C community uses: data structures in an enumerated address space, and passing around hunks of mutable memory with handshake semantics. If your code interacts with code that was written with that in mind,…
You can't have this both ways. Either what is 'Pythonic' is subjective and community-based AND your arguments about Haskell are also subjective and based on the Haskell community, or some things are just better than others both within Python and among languages. But even in the second case, you have to do more than wave your hands around to show that Haskell is superior if you want to move beyond pure, substance-less…
Re: What is Pythonic? (2005)
#18Earlier quoted context omitted.
BDFL Guido van Rossum is not in favor of adding functional programming stuff to python. So, by fiat, functional programming is not very pythonic. :)
You are both partially right. List comprehensions are considered pythonic, and they are similar to map and filter from the FP world. However the map and filter functions themselves are somewhat unpythonic.
Re: What is Pythonic? (2005)
#19Earlier quoted context omitted.
In most of those cases there's no point thinking of them, just type the first one that comes to mind and move on
I hate poorly styled code. Edit: I don't know why I'm being downvoted for this. That kind of mentality inherently churns out bad code.
Re: What is Pythonic? (2005)
#20Earlier quoted context omitted.
I hate poorly styled code. Edit: I don't know why I'm being downvoted for this. That kind of mentality inherently churns out bad code.
They're all inconsequential to code quality except for some like i++ vs ++i which isn't even style, it's syntax. preincrement before, postincrement after, not hard to remember