a fairly ugly/kludgy way to get 'aliases' in Python
Jonathan P.
jbperez808 at yahoo.com
Thu Jan 16 18:52:58 EST 2003
More information about the Python-list mailing list
Thu Jan 16 18:52:58 EST 2003
- Previous message (by thread): a fairly ugly/kludgy way to get 'aliases' in Python
- Next message (by thread): a fairly ugly/kludgy way to get 'aliases' in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
class A:
def __init__(self):
self.long_descriptive_name=0
self.long_descriptive_name2=10
def x(self):
D_=self.__dict__
alias1='long_descriptive_name'
alias2='long_descriptive_name2'
D_[alias]=D_[alias2]*D_[alias1]
# instead of self.long_descriptive_name =
# self.long_descriptive_name*self.long_descriptive_name2
Question:
Will the dictionary lookup 'D_[alias]' impose a
performance penalty versus 'self.long_descriptive_name' or
will the compiler do the same thing internally anyway in
both cases?
- Previous message (by thread): a fairly ugly/kludgy way to get 'aliases' in Python
- Next message (by thread): a fairly ugly/kludgy way to get 'aliases' in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list