Re: [Tutor] returning two values continued

2008-03-23 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > def returning (): >a = 1 >b = 2 >return a, b > > > ab = returning() > > > does this work? > > if it does, is ab a tuple of 2 and [0] being a and [1] being b? Try it in the >>> prompt, thats what its there for and will give you an instant answ

Re: [Tutor] returning two values continued

2008-03-23 Thread Marc Tompkins
On Sun, Mar 23, 2008 at 4:41 PM, elis aeris <[EMAIL PROTECTED]> wrote: > def returning (): > a = 1 > b = 2 > return a, b > > > ab = returning() > > > does this work? > I cut and pasted into an interactive Python session: >>> def returning (): ... a = 1 ... b = 2 ... retur

[Tutor] returning two values continued

2008-03-23 Thread elis aeris
def returning (): a = 1 b = 2 return a, b ab = returning() does this work? if it does, is ab a tuple of 2 and [0] being a and [1] being b? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] returning two values

2008-03-21 Thread elis aeris
so just str(int) got it, thanks ! On Fri, Mar 21, 2008 at 5:11 PM, elis aeris <[EMAIL PROTECTED]> wrote: > > oh this is brillant, i LOVE python > > thank for replying > > > On Fri, Mar 21, 2008 at 5:11 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote: > > > elis aeris schrieb: > > > > is it possible

Re: [Tutor] returning two values

2008-03-21 Thread elis aeris
oh this is brillant, i LOVE python thank for replying On Fri, Mar 21, 2008 at 5:11 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote: > elis aeris schrieb: > > is it possible to return two values? > > Yes: > >>> def return2(): > return "this", "that" > > >>> return2() > ('this', 'that') > >>> a,b

Re: [Tutor] returning two values

2008-03-21 Thread Steve Willoughby
elis aeris wrote: > is it possible to return two values? Yes and no. You can return "a" value, but that value may itself be a tuple of values. Or a list, dictionary or other kind of object. > how do I create an empy int array of 10? If an int array has 10 things in it, it's not empty. You do

Re: [Tutor] returning two values

2008-03-21 Thread Gregor Lingl
elis aeris schrieb: is it possible to return two values? Yes: >>> def return2(): return "this", "that" >>> return2() ('this', 'that') >>> a,b=return2() >>> a 'this' >>> b 'that' >>> Regards, Gregor _

[Tutor] returning two values

2008-03-21 Thread elis aeris
is it possible to return two values? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor