News for hackers. Stuff that matters.
Re:Composing Programs – Python 3 in the tradition of SICP by Sirenos on Sunday April 10, 2016 @04:56AM (#11465466)
Just because it has those functions doesn't make it good at them. Have you ever seen a Pythonic program converted into functional style? It looks horrendous.
Re:Composing Programs – Python 3 in the tradition of SICP by icebraining on Sunday April 10, 2016 @02:28PM (#11467467)
If you define "functional style" as using immutable data structures, higher-order functions, avoiding side-effects and using referentially transparent variables, I think Python programs look fine, and I try to write all the code I can this way (although practicality beats purity).

If you define "functional style" as writing Lisp or Haskell programs using Python syntax, I agree they look horrendous.

Re:Composing Programs – Python 3 in the tradition of SICP by tome on Sunday April 10, 2016 @03:52PM (#11467837)
Where did you get immutable data structures from in Python, and what do you do when every third party library you interact with uses mutable ones?
Re:Composing Programs – Python 3 in the tradition of SICP by devishard on Sunday April 10, 2016 @09:54PM (#11469181)
> Where did you get immutable data structures from in Python

Here's my favored source (in the Standard Library) https://docs.python.org/2/library/collections.html#collectio...

> and what do you do when every third party library you interact with uses mutable ones?

That's situational; which library are you having a problem with? I haven't really had that problem (okay, sometimes the tooling around web frameworks do stupid things, but that's not common).

Note that just because something is mutable doesn't mean you have to mutate it. Yes, Python doesn't as widely enforce non-mutation as Haskell, OCaml, etc., but that doesn't mean that suddenly all the Python programmers lost their minds and started mutating all the things. We're not savages.

Re:Composing Programs – Python 3 in the tradition of SICP by tome on Monday April 11, 2016 @03:35AM (#11470125)
> Note that just because something is mutable doesn't mean you have to mutate it

I agree, and I don't mutate it, but my third party libraries and my collegues functions will. Not all of them, but enough to introduce annoying bugs.

Re:Composing Programs – Python 3 in the tradition of SICP by devishard on Monday April 11, 2016 @10:10AM (#11471567)
This is why I asked, "Which library are you having a problem with?"

You've claimed that third party libraries and your colleague's functions will mutate the data structures you pass them, but this has very rarely been my experience.

Re:Composing Programs – Python 3 in the tradition of SICP by tome on Monday April 11, 2016 @03:52PM (#11474581)
You must have much better colleagues than me!

[EDIT: I shouldn't impugn my coworkers: I had trouble resisting the siren call of side effecting functions!]

Re:Composing Programs – Python 3 in the tradition of SICP by devishard on Tuesday April 12, 2016 @07:23PM (#11484471)
So don't do that!
Re:Composing Programs – Python 3 in the tradition of SICP by icebraining on Sunday April 10, 2016 @05:30PM (#11468278)
Besides tuples, I mostly treat the standard data structures as if they were immutable, without relying on them actually being :) As for third-party libraries, very few of them actually mutate structures passed by my code, in my experience; if they do, I simply make a copy before passing it.
Re:Composing Programs – Python 3 in the tradition of SICP by cutler on Sunday April 10, 2016 @03:37PM (#11467770)
Or you can use Hy (http://hylang.org) and write Python in Lisp syntax.
Re:Composing Programs – Python 3 in the tradition of SICP by aidos on Sunday April 10, 2016 @05:36AM (#11465546)
I would imagine it depend on what extreme you take it to. You don't have pattern matching or tail recursion, which make certain styles impossible.

There's a much better discussion over here

http://stackoverflow.com/questions/1017621/why-isnt-python-v...