Every once in a while, someone notices I don't like Python much and wants an itemized list of reasons. It's not very easy to come up with such a thing on demand. I don't usually sit around making lists of reasons I dislike a given programming language, believe it or not, so I don't usually have such reasons in front of me. The short, flippant
(
Read more... )
Comments 15
(The comment has been removed)
Reply
(The comment has been removed)
Reply
Reply
self is indeed like this, or even me, in some other languages.
Reply
hahah
Reply
Reply
Reply
Oh, I kill me.
Reply
As far as 'self' goes, it's generally considered good practice to explicitly reference the scope of the variable that you're using so that there's no confusion if you're referencing a local variable only valid for the current subroutine or a property that belongs to the instance of the object that you're using.
I can't do much without knowing more of the context but I've beautified part of that code for you. Is this less bleedy?
def getDefaults(self):
req = self.request().field
defaults = {
'active': req('active', 'true'),
'featured': req('featured', ''),
'categoryID': req('categoryID', ''),
'locationID': req('locationID', ''),
'year': req('year', str(DateTime.today().year)),
}
Reply
I take it you perlistas don't read much poetry ;-)
Reply
Reply
Reply
Leave a comment