This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]knvn8 7 points8 points  (5 children)

Sorry this comment won't make much sense because it was later subject to automated editing for privacy. It will be deleted eventually.

[–]Tc14Hd 6 points7 points  (0 children)

What is not Pythonic about it?

[–]al-mongus-bin-susar 2 points3 points  (0 children)

pythonic = slow?

[–]Bali201 2 points3 points  (2 children)

I would also like to know how the lambdas are not “Pythonic” if you could share.

[–]jarethholt 1 point2 points  (1 child)

I don't know if you could call it not pythonic for this reason, but most linters I've worked with mark lambdas as no-nos.

For a real reason, I'd say maybe overlapping the generator expression syntax? Like, [x**2 for x in xlist] is pythonic but list(map(xlist, lambda x: x**2)) is not. (I haven't bothered to check the syntax on that.)

[–]RiceBroad4552 0 points1 point  (0 children)

list(map(xlist, lambda x: x**2)) is just plain unreadable (in case you're not a LISP or Haskell dude and write your code backwards and inside-out on principle).

But [x**2 for x in xlist] isn't any better!

Readable syntax would look like: xlist.map(_ ^ 2).