[Python-ideas] Default return values to int and float

Ron Adam ron3200 at gmail.com
Wed Oct 5 20:35:43 CEST 2011


On Wed, 2011-10-05 at 11:07 -0700, Ethan Furman wrote:
> Ron Adam wrote:
> > On Wed, 2011-10-05 at 07:31 -0700, Ethan Furman wrote:
> >>      for i in finding(x, s):
> >>          ...
> >>      else:
> >>          # unless for loop has a break, this will happen...
> >>          # not a problem until you want more than just the first
> >>          # occurrence of s in x
> > 
> > 
> >       for i in finding(x, s):
> >           if i > 25:
> >               break
> >           <build or get a result>
> >       else:
> >           return result
> >       raise(ValueError("string 's' had an 'x' after position 25")
> 
> And how did you decide on the magical number 25?

I knew I should have used 42. ;-)

Cheers,
   Ron






More information about the Python-ideas mailing list