Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Basic] Various Python Gotchas
Python will trip you up at some point or another. It sometimes can feel like a bug when its not. What people define as a gotcha depends on who you are and a number of other variables. One person's common sense might be another's gotchas and vice versa. It can depend on what operating system you are using, what python version you are using, what IDE you are using, what language you learned before python, how much knowledge acquire regarding python, what your native speaking language is (language barrier), etc.

Multiple Expressions with or keyword
This is a trip up for so many it needs its own thread

range(len(sequence)) in for loops

Install the correct bittype version for a 3rd party library

Linux is case sensitive

Naming your scripts and directories

Forgetting in your sub-directories
Python2.x requires a file in all of your sub-directories. Python3.x it is optional.

Modifying a list (or other container) while iterating over it

Having circular module dependencies

Using global keyword when you should be using a class

empty list in a function argument 

Failing to address differences between Python 2 and Python 3

I cant find where python installed

index variables leak into enclosing scope
Truman likes this post
I feel like you should at least link to the post about the or gotchas. I looked for it on this forum and couldn't find it, btw.
metulburr likes this post
ah I didnt even think of that one Doh
Its in the tutorials.....added it.
Ha! I missed it because it was sticky and I skipped past those as I was looking...

By the way, that thread shows the admin history retro-actively.
Thats cause there really was 3 different thread splits. That was when snippsat merged all tutorials together, and then we decided to split them. For some reason this thread was the base for all the splits as opposed to each. In the same way the thread has 281K views because it took the sum of all the tutorial threads when he merged them, and split them again. When he merged them, for some reason it took certain threads as the base and just summed up the info for all merged threads to that one....and left it when it was split out again. I dont know how to fix it, but its just a result of a one time thing. The only way to remove it and keep that plugin is to delete that thread and make anew with the same info.

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)