Python Forum
Reasons to choose Python over C++?
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reasons to choose Python over C++?
#61
RE: Java / Scala / FP - I feel embarrassed to say this but Java's lambdas put Python's to shame, and Scala wins FP hands-down. I had to write something where I applied a map, filter, map, filter and nested comprehensions are gnarly. Python's FP support is alright unless you want to really embrace FP.

I think FP and procedural have their places. But Scala has better multi-paradigm support, at least in the FP realm. Python is still my go-to language and I didn't know what I was missing FP-wise until the last year or so, but Python could stand to learn a thing or two (maybe pattern matching? definitely better lambdas).
Reply
#62
(May-03-2017, 04:51 AM)micseydel Wrote: I feel embarrassed to say this but Java's lambdas put Python's to shame

You shouldn't be embarrassed about that, it's pretty common knowledge that python has some of the worst lambda support.  Every time someone tries different syntax for it, gvr shoots it down.  And for good reason, because they all look pretty ugly (similar to what I'm running into here: https://python-forum.io/Thread-How-do-yo...d-chaining).

Which kind of just kills fp, since naming all the little functions you pass around loses a lot of meaning, since you end up giving the functions stupid names like "temp" or "item_filter" just so you can have two line functions in a few places.

Even for single line functions, lambda is a heck of a lot of characters.  I think I'd just prefer parenthases personally, maybe like: items = filter( (item): len(item)>2, items).

But these are all minor arguments.  Really, I'm not sure what a good answer would look like while still having whitespace matter.
Reply
#63
(May-03-2017, 04:26 PM)nilamo Wrote: You shouldn't be embarrassed about that, it's pretty common knowledge that python has some of the worst lambda support.
Sorry, meant to say I'm embarrassed for Python, especially at this point in time. Like it should have been figured out by now. And Java isn't known as a great or progressive language.

I almost cited your method chaining thread as a FP deficiency of Python. I also prefer Scala (and Java for that matter) making map, reduce, filter, etc. be methods rather than functions. There's gotta be a way for whitespace and lambdas to work.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mac os choose file name howard687 1 1,858 Jan-05-2022, 06:54 AM
Last Post: Larz60+
  Loop with choose Irv1n 5 3,223 Sep-16-2021, 09:31 PM
Last Post: deanhystad
  Choose an element from multidimensional array quest_ 2 2,618 Nov-25-2020, 12:59 AM
Last Post: quest_
  Need help implmenting if/else or case statements for option to choose file format. samlee916 1 2,003 Jul-22-2020, 06:06 PM
Last Post: Larz60+
  Choose your own adventure game noahc2004 2 2,570 Jun-26-2020, 02:06 PM
Last Post: DPaul
  Please help a newbie choose which programming language to learn. yeto 2 3,490 Feb-25-2019, 12:56 AM
Last Post: yeto
  User Input to Choose from Dictionary anelliaf 9 25,744 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  Need a little more help in a Choose Your Own Adventure Program Goldberg291 13 18,471 Jan-31-2017, 08:33 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020