Suggestions for good programming practices?
David LeBlanc
whisper at oz.net
Mon Jun 24 22:10:57 EDT 2002
Somebody seems to be working overtime to miss the point here...
BTW, struct is a module name :->
David LeBlanc
Seattle, WA USA
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Peter Hansen
> Sent: Monday, June 24, 2002 18:51
> To: python-list at python.org
> Subject: Re: Suggestions for good programming practices?
>
>
> Brian Quinlan wrote:
> >
> > Peter Hansen wrote:
> > > You _are_ returning them "in a struct". It's spelled "tuple"
> > > but other than that what's the difference?
> >
> > struct members are access by name while tuple elements are accessed
> > positionally.
>
> Okay. So why is that a problem?
>
> Or to ask it from the other side, what's stopping you from
> returning items in an object?
>
> class Struct:
> pass
>
> def returnStruct():
> result = Struct()
>
> result.anInt = 5
> result.aString = 'foo bar baz'
> result.spam = ('eggs', 'brian')
>
> return result
>
> -Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list