News for hackers. Stuff that matters.
Re:The most underrated feature in Python 3 by AndrewOMartin on Thursday June 18, 2015 @10:13AM (#9738598)
I may be just a bit tired right now but I had to keep nipping to the top of the article to remind myself which was foo and which was bar.

There are good times to use foo and bar, rather than more self-documenting style placeholder names, but this was not one of them for me.

Re:The most underrated feature in Python 3 by xahrepap on Thursday June 18, 2015 @11:28AM (#9739160)
I had the same problem. My first thought was, why can't we just name them something like 'dependency' and 'app' or whatever. So much clearer.
Re:The most underrated feature in Python 3 by rprospero on Thursday June 18, 2015 @11:59AM (#9739426)
Similarly, the author's definition of foo.py does not seem to actually define functions d, e, and f as referred to the traceback. That confused me for a bit.
Re:The most underrated feature in Python 3 by sylvinus on Thursday June 18, 2015 @08:20AM (#9738077)
Sad to see this PEP dates back to 2005, and 10 years later the majority of Python developers are still on 2.x and don't benefit from it :-/
Re:The most underrated feature in Python 3 by lmm on Thursday June 18, 2015 @08:49AM (#9738184)
I think the majority are using 3.x for new projects? Of course there's still a lot of 2.x around.
Re:The most underrated feature in Python 3 by jahnu on Thursday June 18, 2015 @10:46AM (#9738812)
A lot of us who came to Python late have only ever used 3. I can't imagine the horror of dealing with multiple charsets and bytes in 2.x
Re:The most underrated feature in Python 3 by bpicolo on Thursday June 18, 2015 @11:56AM (#9739397)
You don't really have to deal with bytes in py2. That's part of the problem.
Re:The most underrated feature in Python 3 by merb on Thursday June 18, 2015 @03:47PM (#9741170)
You have to. And even some http libs only use Bytes in py3. Dealing with Sockets also only works without unicode. Thats just horrible.
Re:The most underrated feature in Python 3 by mrkmcknz on Thursday June 18, 2015 @10:23AM (#9738656)
3years ago I would probably argue that you should just use Python 2.X. But most packages you will use are now ported to Python 3.
Re:The most underrated feature in Python 3 by theVirginian on Thursday June 18, 2015 @10:52AM (#9738865)
One issue is that almost every google search for documentation points to the 2.x version, sometimes even if you search for Python 3 meaning you have to manually find the dropdown and switch to a new version. I imagine this is cumbersome for many new developers.
Re:The most underrated feature in Python 3 by yuvadam on Thursday June 18, 2015 @10:58AM (#9738917)
It's all about what OSs ship with, and we're getting to the point where Python 3.x is the default.
Re:The most underrated feature in Python 3 by aurelianito on Thursday June 18, 2015 @07:58AM (#9737995)
Java had this feature since the last millenium (java 1.3, i think). I really miss it programming in python 2.7.
Re:The most underrated feature in Python 3 by Latty on Thursday June 18, 2015 @09:21AM (#9738316)
Python's is actually a little nicer too, in 3.x - it has two types of chains, the 'root cause' one like Java, and a 'this is what I was handling when this exception happened' - to stop an error in your exception handling code hide the original error.
Re:The most underrated feature in Python 3 by pacofvf on Thursday June 18, 2015 @10:36AM (#9738738)
by reading this I just learned about the concept of chained exceptions, although I can't see why is so useful, the built-in traceback and sys module has always been good enough:

    import sys,traceback
    try:
        ...
    except Exception as ex:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        logger.error("%s:%s" % (str(ex),  str(traceback.format_exception(exc_type, exc_value, exc_traceback))))
        raise MyException(" :( ")
Re:The most underrated feature in Python 3 by baq on Thursday June 18, 2015 @10:47AM (#9738814)
that's not nearly good enough, it's barely acceptable. i've been programming python for a decade and the fact you have to do this with exceptions was plainly dumb. as a programmer you should never have to worry about preserving tracebacks.
Re:The most underrated feature in Python 3 by MrBuddyCasino on Thursday June 18, 2015 @08:38AM (#9738136)
For anyone wondering: its chained exceptions.
Re:The most underrated feature in Python 3 by santiagobasulto on Thursday June 18, 2015 @07:48AM (#9737954)
Great post. I'm a python dev and had never noticed that.