Something not mentioned in list that I had never considered until a conversation last year: meaningful whitespace is biased towards sighted programmers. According to a blind acquaintance, it is much easier to keep track of opening and closing parentheses and braces. Meaningful whitespace forces blind programmers to always check the number of tabs at the beginning of each line to make sure scope hasn't changed.
Python is not a great programming language
71–80 of 156 posts
Re: Python is not a great programming language
#72Django is ok if you have a web site with content and forms that map nicely onto SQL tables. Any 1998 website, basically, with not too much of a load. Any other setup, and it gets messy. > Needing to put dict property names `{'in': 'quotes'}. Now that's a part I like.
The inclusion of that made me question the entire thing. It's just so...wrong. Does the author not realize that you can use (almost) anything as a dict key? a = 123 b = 'foo' d = {a:456, b:123, 2.3:'2.3'} print(d) >>> {123: 456, 'foo': 123, 2.3: '2.3'}
You can do that in JS too, it's just coerced to string, so you can do e.g.
{foo: "bar"}
where foo is not a variable, but assumed to be the string foo. In Python you can't, because you couldn't tell if it's foo the string, or a reference to an existing (or non-existing) foo variable.That said, in JS, not only you're limited to using (real or coerced) strings as keys to Objects, but you also need to use the square bracket:
{[foo]: "bar"}
syntax, so it can tell that you need it to use the value of the variable foo as the key (else it will understand {"foo": "bar"}).Re: Python is not a great programming language
#73Also "foo['bar'] returns a KeyError", then saying sometimes this is resolved by "getattr(foo, 'bar', None)" -- the split between attributes and items are one of the best things about python.
I don't know why list comprehensions are "magic syntax", and you can't complain about having to type list(map(...)) and then complain that you don't like list comprehensions!
"You have to cast your data back to a list/tuple after using enumerate() and map()." -- I don't know what that means
"Different syntaxes for lists and tuples." -- Again, what? They're different types!
How is r'a\nd' less "goofy" than String.raw`a\nd` in JS or any other language with prefixed strings?
Python is clearly not for everyone nor for every problem, but in my opinion it is a great programming language.
Re: Python is not a great programming language
#74I /feel/ like this gist is largely on the money, and also uninteresting at the same time. All languages suck, and often suck in different ways for different users. We just have to pick the one that is working best at the time, and that we're best at working with. I will say that I do like the act of writing a pro and con list for a language or tool though(which is why I read the linked doc), and I often push co-worke…
Re: Python is not a great programming language
#75This is a mistake based on thinking in Javascript: in JS the index operator is effectively the same as the dot operator, for example foo[“bar”] == foo.bar. In Python those are different. [] corresponds to get in dicts, and . corresponds to getattr in objects.
My personal biggest gripe with Python is that there isn’t a better story for typing as I’m spoiled by TypeScript and static languages that have a better development experience and prevent certain classes of mistakes.
Re: Python is not a great programming language
#76The biggest beefs I have with Python are inconsistent syntax and dynamic typing. But I've basically decided that dynamic types are a waste of time for me personally, so I'm not really the target audience anyways.
Re: Python is not a great programming language
#77I wish more languages did something like the D feature where method syntax and function syntax are really just syntax - i.e., str.len() is equivalent to len(str), and you use the syntax that best improves readability at your call site.
Re: Python is not a great programming language
#78Earlier quoted context omitted.
I remember our salesmen back in 90's cobbling together some Visual Basic or whatever it was called. So where it is now?
Has the same happened to Python yet? No? So bookmark this thread, and come back in here when the very same happens to Python :)
Re: Python is not a great programming language
#79Earlier quoted context omitted.
> lack of typing information isn't "free solo" hard but it certainly makes life a lot less pleasant. One of the projects I work on has switched to full type hinting along with heavy mypy¹ usage, and it has become an absolute pleasure to work with. Along with hypothesis², I can't recommend mypy enough. It must be said that retrofitting either to an existing project is a lot of work though. 1. http://www.mypy-lang.org/…
What I can't reconcile with myself is, if I'm going to add type hinting in Python, why not use a language where my efforts of adding type hints result in performance gains? I get why it's nice for a team, but it seems like a lot of work for half the potential benefit of a typed language.
Re: Python is not a great programming language
#80Earlier quoted context omitted.
How about how condescending of a programmer not knowing JS causes you to be :-) Either way, if the number of idiosyncracies in your language is confusing to junior developers it's absolutely something worth considering.
JavaScript is full of idiosyncrasies.
In python, I can have the
if __name__=='__main__': main()
at the end if a script, and easily import the script's functions into
- pytest for testing
- some other module for larger modules
- into a cli.py file to slap a Click interface on it.
What a great blend of flexibility while retaining coherence.