Live data from Hacker News

Moka - Minimalist functional python library

github.com

31–37 of 37 posts

Re: Moka - Minimalist functional python library

#31
post #28
post #24

Earlier quoted context omitted.

Thanks for all the good points. To be honest, I'm not sure what you're trying to say. I've been coding in python for years and Moka was built from my annoyance using functional paradigms with the stdlib. As you clearly showed, Python doesn't have an uniform syntax to deal with this paradigm. I.e. there are lots of different constructs and, as you said, common idioms or patterns . Have you already argued with a Java p…

so you're admitting you're writing an incompatible dialect of python in python? that was my point. if you think it is worthwhile, well - enjoy :-) if you want to write in something with a uniform syntax, use scheme or clojure. python things look different for a reason.

Maybe I don't understand what you mean by "incompatible dialect". These are simple classes inheriting from list/dict. Basically, it simply add a couple methods to these objects. I.e. You can still use all the idioms/patterns; these are list/dict. I'm not creating a new paradigm, or writing a new language by tweaking the syntax. There's really nothing magic going down here. I.e. you can do

    return List(..).update(..).update(..) 
Instead of;

    l = List(...)
    l.update(...)
    l.update(...)
    return l
You can still use lisp comprehension, itertools, etc. In fact, I could pass a moka.List to your existing code and you wouldn't even notice it. (And you do, it's a mistake that I'd fix).

I do agree that I might have been overkill with some useless methods and I'm thinking about removing them. (I.e. such as 'join' as it's really not needed)

Re: Moka - Minimalist functional python library

#32
post #25
post #18

Earlier quoted context omitted.

if you are inventing a new way to do existing things outside the idioms of the language there is no conceivable way you can claim to be pythonic. you are replacing the pythonic style with your own taste. don't confuse the two.

I'm not sure why you created a fake account to answer this but thanks again for your time. You're right that it was built for my own taste using simultaneously other languages (clojure, arc and js for instance). At the end of the day, what's important is that it increases the quality of the code and this is my goal with Moka. This is still in an alpha stage, but I'll definitely tweak it based on good feedback (Like y…

It's totally legitimate for you to write this according to your own taste and use it. I don't think it's bad for Python, or anything like that. You are not an idiot and I am sure you can write interesting and useful programs in Python.

But I do agree that it is not 'Pythonic' - except maybe in the trivial sense that it's written in Python.

I would be happy to go into more detail if you really want it.

Re: Moka - Minimalist functional python library

#33
Here's a gist comparing the Moka front page example to a slightly more typical Python way of doing things:

https://gist.github.com/1380898

EDIT: using the timeit module on these, the Moka version is about 18 times slower on my machine... not that this matters much if it's a much nicer way of expressing the program

Re: Moka - Minimalist functional python library

#34
post #23
post #20

Earlier quoted context omitted.

What is with all the hate lately on anyone who dares to write Python with different semantics than employed by the stdlib builtins? 'You've invented your own incompatible dialect of python. ' It isn't a "dialect." You don't need a different parser. There are no macros. It is simply a container with slightly different semantics than the stdlib ones. "You've broken composition, objects and the general design choices of…

tl;dr: you didn't read my post. I am pretty sure I made it clear how composition breaks. 'people are allowed to write Python however they want.' people are encouraged to write python other people understand.

No I did read your post. Actually I read all of them. My point is he didn't "break" composition. In isn't like you import this guy's library and suddenly function composition no longer works. Breaking isn't the right word. It is agressive and wrong on a semantic level.

You could say "You functional list does not properly support composition. Here are some problems." You posts were needlessly combative. I only spoke out because I have seen this kind of thing cropping up recently with respect to Python functional libraries.

"people are encouraged to write python other people understand."

As I said, the semantics of his library are reasonably clear on inspection doubly so if you read the docs.

EDIT:

I just re-read some of your other posts on this thread. You really do keep banging on "He made his own 'dialect.'" To clarify, no he didn't. Making a library isn't a dialect. A dialect needs to be a significant enough departure that you would actually need a different parser/interpreter. That is a "dialect." If you would like I can point you actual Python dialects. This is a library. Deal with it.

Re: Moka - Minimalist functional python library

#35

Here's a gist comparing the Moka front page example to a slightly more typical Python way of doing things: https://gist.github.com/1380898 EDIT: using the timeit module on these, the Moka version is about 18 times slower on my machine... not that this matters much if it's a much nicer way of expressing the program

Thanks for sharing. And ya, it's freaking slow right now.

Re: Moka - Minimalist functional python library

#36
post #34
post #23

Earlier quoted context omitted.

tl;dr: you didn't read my post. I am pretty sure I made it clear how composition breaks. 'people are allowed to write Python however they want.' people are encouraged to write python other people understand.

No I did read your post. Actually I read all of them. My point is he didn't "break" composition. In isn't like you import this guy's library and suddenly function composition no longer works. Breaking isn't the right word. It is agressive and wrong on a semantic level. You could say "You functional list does not properly support composition. Here are some problems." You posts were needlessly combative. I only spoke o…

"the semantics of his library are reasonably clear on inspection"

does .remove() mutate in place or not ? depends on the constructor!

this would be an example of breaking composition - you can no longer use a function built for an immutable list on a mutable list. I am sure I explained this too.

a dialect is a style, in linguistic terms, if I speak a dialect of english, I still speak english.

if I needed a different parser/interpreter I am pretty sure that is the stage of 'new language' where new syntax and semantics are introduced.

the 'dialect' he is introducing is a arc/clojure inspired syntax for what /already/ exists in python.

thanks for the semantic pedantry! the long and the short of it is that if you want to write python, write python that looks like python. not like scheme or clojure.

as someone who gets paid to maintain shitty code, i'd rather people stuck to the existing idioms of the language, rather than blindly copy paste them from another language.

Re: Moka - Minimalist functional python library

#37
post #36
post #34

Earlier quoted context omitted.

No I did read your post. Actually I read all of them. My point is he didn't "break" composition. In isn't like you import this guy's library and suddenly function composition no longer works. Breaking isn't the right word. It is agressive and wrong on a semantic level. You could say "You functional list does not properly support composition. Here are some problems." You posts were needlessly combative. I only spoke o…

"the semantics of his library are reasonably clear on inspection" does .remove() mutate in place or not ? depends on the constructor! this would be an example of breaking composition - you can no longer use a function built for an immutable list on a mutable list. I am sure I explained this too. a dialect is a style, in linguistic terms, if I speak a dialect of english, I still speak english. if I needed a different…

"if I needed a different parser/interpreter I am pretty sure that is the stage of 'new language' where new syntax and semantics are introduced.

the 'dialect' he is introducing is a arc/clojure inspired syntax for what /already/ exists in python."

No a dialect is another version of the language. For instance python3 is a dialect of python, just as python2 is. They are not 100% compatible.

"as someone who gets paid to maintain shitty code, i'd rather people stuck to the existing idioms of the language, rather than blindly copy paste them from another language."

It is not his problem you see a lot of shitty python. It is also not his problem if you want every one to stay stuck in the poor design choices that were made in the stdlib a long time ago. You can fight evolution of languages or you can embrace them. I don't see you advocating for "thou" in English ;-)

"the 'dialect' he is introducing is a arc/clojure inspired syntax for what /already/ exists in python."

"syntax" --> no thats is what is defined by the grammar of python. This is python syntax.

"a dialect is a style, in linguistic terms, if I speak a dialect of english, I still speak english."

No it is a mutation. But I agree with you if you speak a dialect you still speak the "language." Olde English is still English.

---

However my main point remains. You are needlessly combative in this thread. He made a library you attacked him like he insulted the Pope of Python. I am sorry you maintain shitty Python but you don't need to take you anger about that out on some poor guy on hacker news.

Post reply on HN