Live data from Hacker News

Problems I Have with Python

darkf.github.io

1–10 of 239 posts

Re: Problems I Have with Python

#2
A lot of the author's complaints, especially near the end, are personal preferences which explains by these "improvements" were never added. Not everyone would prefer a move to a significantly more functional style.

Arguably this difference is what caused Coconut to be made in the first place.

There's ample discussion on these topics to simply brush existing decisions off as "Incompetence? Politics? Both? Who knows."

For the fifth point, `list.index` works fine in Python 2 and 3 for me.

Re: Problems I Have with Python

#3
The one problem I have with Python and would like to solve, is to be able, from within a request rendering function/method of my web application (think Flask) to run something like:

    handle1 = call_webservice_1(args)
    handle2 = call_webservice_2(args)
    handle3 = call_webservice_3(args)
    (realres1, realres2, realres3) = wait_until_timeout(500, handle1, handle2, handle3) 
    # here, I have my results in realresX or None if timeout
    # the call_webservice_X would be non blocking
This way I can dispatch my requests to my backends and degrade gracefully if one request fails within the time. I was doing that in PHP using zeromq to send the requests and listening to the answers with a unique id on each request, but now I would prefer to stay with an HTTP based protocol to communicate with my backends.

Re: Problems I Have with Python

#4
Some of the author's points are valid. However, many are subjective preferences, and some are gripes without solutions, and others make it difficult to understand the author's underlying philosophy.

My main critique is that the author added this statement that puts a negative, entitled, and naive tone on the whole article:

>>> to which no real improvements are being made for some reason. (Incompetence? Politics? Both? Who knows.)

The author is not acknowledging that some of his points were not addressed because of reasons other than incompetence and/or politics. I imagine this statement could offend some of the smart and hard-working people who are working on improving the python language.

Reasons the author does not acknowledge:

- the community does not agree with the author's subjective idea of what Python should look like

- the solutions to a problem (I'm thinking GIL) come with a lot of consequences which are not readily acceptable

- solving some of the issues would exacerbate backwards compatibility. This would increase the author's problems even more, because, as he states "This is particularly a pain for libraries where I expect to pip install them and have them "Just Work"."

Re: Problems I Have with Python

#5
post #3

The one problem I have with Python and would like to solve, is to be able, from within a request rendering function/method of my web application (think Flask) to run something like: handle1 = call_webservice_1(args) handle2 = call_webservice_2(args) handle3 = call_webservice_3(args) (realres1, realres2, realres3) = wait_until_timeout(500, handle1, handle2, handle3) # here, I have my results in realresX or None if tim…

You could probably do that fine with coroutines and/or asyncio.

Re: Problems I Have with Python

#6
post #4

Some of the author's points are valid. However, many are subjective preferences, and some are gripes without solutions, and others make it difficult to understand the author's underlying philosophy. My main critique is that the author added this statement that puts a negative, entitled, and naive tone on the whole article: >>> to which no real improvements are being made for some reason. (Incompetence? Politics? Both…

>However, many are subjective preferences

Certainly, it is titled "Problems I Have" for a reason. :-) I do not expect everyone to agree with me, but it is what I feel I personally lack when using it quite a lot.

> I imagine this statement could offend some of the smart and hard-working people who are working on improving the python language.

That was certainly not my intention -- as stated, I do love the language and appreciate all work going into it. I do not intend to undermine their efforts, just point out some of my perceived design flaws.

>- the community does not agree with the author's subjective idea of what Python should look like

I think we all agree there should be a good solution to concurrency (and "stackless" variants which power eventlet, etc. have been used for ages; as has Twisted, of which asyncio is not a sufficient clone.), parallelism, etc.

The standard library in general encourages use of higher-order functions and concepts borrowed primarily from FPLs (see: comprehensions, map/reduce, sort, etc.) I could not imagine seeing them backtracking on this -- it only helps them to go further in that direction.

>- the solutions to a problem (I'm thinking GIL) come with a lot of consequences which are not readily acceptable

I did not propose a solution because there are many, as you note; there are, however, implementations with decent solutions like AFAIK Jython.

>- solving some of the issues would exacerbate backwards compatibility.

Such as what?

Re: Problems I Have with Python

#7
post #2

A lot of the author's complaints, especially near the end, are personal preferences which explains by these "improvements" were never added. Not everyone would prefer a move to a significantly more functional style. Arguably this difference is what caused Coconut to be made in the first place. There's ample discussion on these topics to simply brush existing decisions off as "Incompetence? Politics? Both? Who knows."…

>Arguably this difference is what caused Coconut to be made in the first place.

Sure, that and it's far easier to write a new language and transpile than it is to fork and modify existing implementations.

>There's ample discussion on these topics to simply brush existing decisions off as "Incompetence? Politics? Both? Who knows."

If you would like to link to such discussions I would not hesitate to add them as footnotes/amendments.

>For the fifth point, `list.index` works fine in Python 2 and 3 for me.

Sorry, mixed up `index` and `find`. `[].find` is not a function, but `[].index` is. Thanks for catching that, I keep confusing them (another minor annoyance of having both).

Re: Problems I Have with Python

#8
post #3

The one problem I have with Python and would like to solve, is to be able, from within a request rendering function/method of my web application (think Flask) to run something like: handle1 = call_webservice_1(args) handle2 = call_webservice_2(args) handle3 = call_webservice_3(args) (realres1, realres2, realres3) = wait_until_timeout(500, handle1, handle2, handle3) # here, I have my results in realresX or None if tim…

Quick two minute implementation:

    import multiprocessing
    
    import time
    
    
    NULL = object()
    
    
    def call_webservice(fail=False):
        if fail:
            time.sleep(10)
            return False
        else:
            return True
    
    
    def wait_until_timeout(timeout, *async_results):
        results = [NULL] * len(async_results)
        end = time.time() + timeout
        while time.time() 

Re: Problems I Have with Python

#9
Very short-sightedly written. It sounds like the author just wants a language with a different philosophy, and instead of realizing this goes on to call the differences "obvious flaws in design" that aren't improved because of "Incompetence? Politics? Who knows." This is especially bad given that Python (in my opinion) has a very well thought-out and transparent change process, with PEPs that usually consider most alternative solutions to a problem brought up, and being held to a high standard in order for the BFDL to approve them.

Especially regarding some of the points near the end, it seems that the author just doesn't understand Python. Python doesn't have or want a strong typing system, and it mostly wants an imperative style keeping lines short.

> Well... what's worse, having a slightly goofy looking inline "def", or having a gimped language?

Why is it such a problem to move your closure to its own line and give it a name?

Re: Problems I Have with Python

#10
post #9

Very short-sightedly written. It sounds like the author just wants a language with a different philosophy, and instead of realizing this goes on to call the differences "obvious flaws in design" that aren't improved because of "Incompetence? Politics? Who knows." This is especially bad given that Python (in my opinion) has a very well thought-out and transparent change process, with PEPs that usually consider most al…

>Very short-sightedly written. It sounds like the author just wants a language with a different philosophy

Which is not a priori bad to want, especially if a language has a broken philosophy (or partially broken) to begin with.

Post reply on HN