Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The programming languages that would make me the most sad/angry/annoyed I don't use, so it's difficult to make a choice. I suppose I'll have to go with Javascript because it's the de facto 'Web language' which people use to force me to evaluate arbitrary code whenever I want to read anything on the Web. Even with a sandbox that seems a terrible idea.

If we're talking about programming languages I hate but still use, I'd have to go with Python. I spend most of my time writing Haskell, and Python's dynamic typing puts me on edge. I might spend half an hour evaluating a Python script only for it to throw an AttributeError because I mistyped some function name or passed the wrong type.

Does anyone know a static analysis tool for Python? I found one a while back but when I tried it it threw (you guessed it) an AttributeError on NoneType.



I'm going to sign in as a partisan here. I firmly believe that Python is the worst language that people actually use.

DuckTyping is the most deeply misguided aspect of python. With the discover of Hindley-Milner type inference 40 and 30 years ago, this sort of sloth is simply inexcusable.

Pythonistas will say "Oh, I don't care if it's a duck or a swan, as long as it quacks." Guess what? You can treat function calls as a statement that an object is an instance of some typeclass and that typecheck that. With a sufficiently intelligent compiler/interpreter author this is transparent to the programmer.


With fairness, no you can't, not truly. Please point me to the version of HM the works with inheritance. Plus, due to stuff like __getattr__, the interpreter may not know until the method is called if it even exists.

It would be totally possible in python to write a class where when any arbitrary method is called on a class, a function is randomly generated and called, with a random number of arguments, etc. It doesn't even have to be consistent from call to call. How on earth would H-M type inference cope with that?


I never said inheritance, or method for that matter. You can do H-M on typeclasses. Philip Wadler has a paper on it and it's alive and well in GHC: http://homepages.inf.ed.ac.uk/wadler/topics/type-classes.htm...

The fact that Python allows you to do something absurd is simply an argument against its design.

Edit: Uh oh, looks like I ruffled some snakeskin!


The point is you can't just bolt on H-M to a typical scripting language and expect it to work, like, at all. It's a pretty huge sea change, and it would warp the underlying language to the point where you'd just end up with some of non-lazy, non-pure Haskell.


Well, duck typing can still be statically checked, so I'd argue that dynamic typing is more misguided. That said, I do agree that duck typing is fundamentally flawed. I think swans actually don't quack, they honk, but so does a car. Here we can see a problem with both synonymous and homonymous verbs.

I think it comes down to namespacing: we use modules to prevent naming conflicts, allowing us to compose two modules, but if we do the same with objects their attributes conflict. In Haskell everything has a namespace — there are no methods, only functions — and type classes provide polymorphism without (henceforth) 'quack conflicts'.

Two terrible examples of quack conflicts from the Python standard library are '+' meaning both "add" and "append" (the latter being non-commutative), and the comparison operators '<', '<=', '>=', '>' actually meaning ⊂, ⊆, ⊇, ⊃ when dealing with sets.


Sorry for conflating duck typing with dynamic typing. I appreciate the correction!


I enjoy Python's aesthetics and extensive libraries, but wish it had (practical) static type inference. (RPython isn't really practical.)

And to confuse matters, Python 3 added optional type annotations that are ignored by the runtime!


Emacs with flymake mode or pycharm both do a great job at giving you real-time feedback on issues like that.


pylint catches most such common errors.


Editra with the PyStudio plugin has become my favorite development environment. It runs pylint every time you save a file and highlights lines with errors.


I believe vim + syntastic should do the same


Sublimetext 2 + sublime lint plugin makes for a very nice python programming experience




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: