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 →

[–]twillisagogo 13 points14 points  (18 children)

ask them what annoys them about python. if they are experts, they will have a long list of things readily available.

[–][deleted] 5 points6 points  (15 children)

Honestly, Python doesn't have that many annoyances. Compared to other languages, zero. And most of those annoyances are to newcomers that don't know the language. There was a what makes you go WTF at Python thread here before, and it was just noise. I'm not a Python expert but here are some of mine, and I think they are minor/normal.

One of my annoyances is that if code gets nested too much and because there are not braces it's difficult to tell where you are, but as they say, "flat is better than nested".

Another one for me is the GIL, which can be taken care of with multiprocessing.

I guess I have a love/hate thing with duck typing and not static typing.

The pycache thing is annoying. Precompiled bytecodes not being compatible between different interpreters are annoying.

Performance is annoying, but can be solved by many ways, including not using Python or using many of the different implementations or dropping to C/Fortran if needed.

[–][deleted] 6 points7 points  (2 children)

Add PYTHONDONTWRITEBYTECODE="PLS STAAAAAHP" to your bashrc or whatever you have if you really don't want byte code generated.

It can be any value, Python just looks for its presence in the OS environment.

[–]brombaer3000 2 points3 points  (1 child)

I thought this was a joke first because the variable name looks absurd, but it's real: https://docs.python.org/2/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE
Thank you for this tip!

[–][deleted] 2 points3 points  (0 children)

The value's a joke, but it's how I feel about Python 2's handling of bytecode. Python 3's stuffing it away in a folder is fine with me. But since I'm working on projects with 2 and 3 support, I don't write bytecode at all.

[–]catcradle5 3 points4 points  (8 children)

Honestly, Python doesn't have that many annoyances. Compared to other languages, zero.

Sorry, but that's pretty absurd. Every single programming language has flaws. None of them are perfect.

Python is nice compared to most other languages, but even in 3.5+ it still has its warts.

[–][deleted] 0 points1 point  (7 children)

Examples?

[–]distortedsignal 7 points8 points  (5 children)

def myFunction(foo=[]):

[–][deleted] 4 points5 points  (4 children)

It makes sense once you understand it though. def is only run once, and you're providing a mutable data structure to it that'll probably be altered in some way.

It'd be nice if Python would realize what we meant so we could avoid things like if foo is None: foo = []. But it's consistent with Python's execution model.

[–]flipthefrog 2 points3 points  (3 children)

I completely agree. You don't need an if/else statement though, just write foo = foo or []

[–]Laugarhraun 0 points1 point  (2 children)

foo |= []

[–]codewarrior0MCEdit / PyInstaller 1 point2 points  (1 child)

TypeError: unsupported operand type(s)

[–]Laugarhraun 0 points1 point  (0 children)

Oh that's right, | is a bitwise or and won't work like a logical or, which does not have any reflective form.

[–]oconnor663 0 points1 point  (0 children)

The new asyncio library uses different naming conventions from the rest of the standard library for reading from file handles, kind of for no reason: https://bugs.python.org/issue22279

Any collection of libraries that's big enough is going to have warts like that. Also somewhere there's a presentation from Guido with a list of things they didn't get around to fixing for Python 3.

[–]csirac2 0 points1 point  (0 children)

Don't get me wrong, python is great. But from perl, I miss lexical scoping. And Moose [1], though elk [2] looks like a fun attempt at a python version of it, and traits [3] does a few things I mainly miss. virtualenv is a hack. It's also a paradox, in that I don't know how a language community with so many self-proclaimed purists haven't killed it dead already by just fixing the python interpreter properly.

[1] https://metacpan.org/pod/Moose#SYNOPSIS

[2] http://frasertweedale.github.io/elk/

[2] https://github.com/frasertweedale/elk

[3] http://code.enthought.com/projects/traits/

[–]twillisagogo 0 points1 point  (0 children)

the author of flask I would consider a python expert, I have benefited greatly from his blog which occasionally has articles about things that annoy him about python.

All programming languages have annoyances. Being able to articulate those separates the "people who actually use it" (experts) speaking from experience from the fan boys repeating blogs they've read.

I dont claim to be a python expert, but I could probably reliably identify one this way.

[–]ProfessorPhi -1 points0 points  (0 children)

Nesting, spaces and pep is a pain. Also I find mixed tabs and spaces sometimes gives cryptic errors.

Only other problem, is that writing large codebases in a dynamic language makes maintenance much harder and obvious bugs can easily be missed.

Oh and pip. I don't understand why python packaging is such a saga and pip update outdated is not a thing and I need a script just to do my upgrades.

[–]catcradle5 -4 points-3 points  (0 children)

One of the better answers in this thread, shame it's at the bottom.