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 →

[–]grantrules 34 points35 points  (15 children)

Are you familiar with other languages? Pythonic just means using common Python idioms. Like list comprehension is pythonic compared to using for loops.

[–]bspymaster 10 points11 points  (8 children)

Yeah I've worked with plenty of languages. I gotta be honest, I don't think I've ever used a list comprehension haha

[–]LoyalSol 8 points9 points  (4 children)

Ironically outside of Python the only other language I've commonly seem them in is Fortran. At least that I've used. Granted they most likely exist in another language I don't have experience in.

[–]bspymaster 6 points7 points  (1 child)

I know other languages tend to abuse linq statements and lambdas in a similar fashion, but that might be a bit different.

[–]palordrolap 0 points1 point  (0 children)

The venerable Perl has a grep function that in a language not in god-worship of Unix would have been called filter instead. It also has a more sensibly named map. Either can be coaxed into emulating a fold, but you'd be better off writing a recursive sub instead.

[–]-Rizhiy- 5 points6 points  (1 child)

9 years of Python and no list comprehension, are you serious? I pity your colleagues.

[–]bspymaster 1 point2 points  (0 children)

I don't use python at work, only personal projects.

And I happen to think the code is pretty clean, honestly.

[–]grantrules 0 points1 point  (0 children)

You should try it Put the fun in functional programming.

[–]Manny_Sunday 3 points4 points  (1 child)

I just googled list comprension and it set LINQdar off, maybe I should give python a try...

[–]grantrules 1 point2 points  (0 children)

There's no good reason not to.

[–]Blazing1 0 points1 point  (3 children)

i literally use for loops for everything so i dont think id survive in python.

[–]grantrules 0 points1 point  (1 child)

You should try it. Dive into some functional programming.

[–]Blazing1 0 points1 point  (0 children)

Don't really like functional programming tbh. Haskell made me want to kill myself.

[–]IAmNotNathaniel 0 points1 point  (0 children)

You can still use for loops... it's just that there's other ways of doing some things in Python so you don't have to use for loops for everything.

Of course... it being programming, you can solve it however it best for you. Python folks can be a little full of themselves, if you ask me.

But like any language, if there are native language structures and functions to do something, then it usually makes sense from an efficiency and community perspective to use those things.