Closed ueg1990 closed 9 years ago
Closest language I can find is in PEP 8:
If a function argument's name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption. Thus class_ is better than clss . (Perhaps better is to avoid such clashes by using a synonym.)
:+1:
that sounds good to me. i think the reason people use pk in place of id was because its short for primary key. but i dont know why the underscore is appended in the end instead of the beginning of the variable? is it because _id would make it a private variable?
It may be better to replace all variables named id because id is a keyword/function in python. For example in account.py, if you look at the code below:
class Account:
In self.id = id, id (not self.id) is the keyword that I am suggesting to replace. I have read somewhere that in some practices the variable name pk is used. Another alternative is _id. Hopefully only some files will need to be changed under imgur/models. Let me know what you think.