With or Using

Greg Ewing see at my.signature
Tue May 1 01:30:10 EDT 2001


<tim at worthy.demon.co.uk> wrote:
> Rather than typing jim each time,
> jim.born=1960
> jim.haircolour='Brown'
> jim.eyecolour='Green'

def with(subject, **args):
  for attr, value in args.items():
    setattr(subject, attr, value)

jim = person()
with(jim,
  born = 1960,
  haircolour = 'Brown',
  eyecolour = 'Green')

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list