newbie: self.member syntax seems /really/ annoying
David
wizzardx at gmail.com
Wed Sep 12 06:36:21 EDT 2007
More information about the Python-list mailing list
Wed Sep 12 06:36:21 EDT 2007
- Previous message (by thread): Get Only the Last Items in a Traceback
- Next message (by thread): newbie: self.member syntax seems /really/ annoying
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 9/12/07, David <wizzardx at gmail.com> wrote: > > Please help if I am missing something -- this looks like a great > > language but I am going to mad trying to read numerical code full of > > 'self.'s breaking up the equations. > > You could try this in your functions: > > s = self > > Then you can use code like this: s.a_dot = s.k(s.a-s.u) > > Another option, if you use the vars a lot in a given function, is to > copy them to local vars. This can also slightly speed up your code > (fewer member lookups). > Also, there is no rule saying you need to use "self", it's just a convention. You can declare your methods like this instead: def foo(s, arg1, arg2): s.a_dot = s.k(s.a-s.u)
- Previous message (by thread): Get Only the Last Items in a Traceback
- Next message (by thread): newbie: self.member syntax seems /really/ annoying
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list