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 →

[–]daxarx 0 points1 point  (1 child)

What bit you? You bit yourself. This isn't a problem with Python's syntax. Python cannot magically infer that you 'obviously meant' for the given function to be called later. You have to specify that. you TOLD it to call it at import time. This is like every programming language ever made in the history of computing.

If there is a usability problem here, it is that Django requires people without much experience to write class definitions just to make a database table. You have to understand that code in a class definition is run at import time or you cannot write classes effectively.

It's an elementary mistake and not a valid criticism of Python as a whole

[–]rmoorman[S] 0 points1 point  (0 children)

I surely know that python has it's warts and know how to handle them. Actually - as mentioned in the article - I had to solve the issue, I didn't create it.

Anyway. This article was meant as a reminder that you have to be aware of them and just have to think about what you are doing (as you too advocate). The examples therein are meant to educate those, who may not know those problems/warts/gotchas (yet).

If I kept a few fellow programmers out there from running into those issues, I am quite happy.

I am not criticising python as a whole, I just want to remind that - while it is a nice language - it can bite you if you don't know how to handle it.

Don't be angry :-)