easy question, how to double a variable

Pablo Torres N. tn.pablo at gmail.com
Thu Sep 24 09:32:58 EDT 2009


On Sep 24, 5:51 am, Iain King <iaink... at gmail.com> wrote:
> On Sep 23, 7:36 pm, David C Ullrich <dullr... at sprynet.com> wrote:
>
>
>
> > On Tue, 22 Sep 2009 02:34:53 +0000, Steven D'Aprano wrote:
> > > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote:
>
> > >> But you actually want to return twice the value. I don't see how to do
> > >> that.
>
> > > What?
>
> > > Seriously?
>
> > You're saying it _can_ be done in Python? They must have added
> > something to the standard library again. I mean how can you return
> > twice a value without a twice function to start with? I've tried.
> > You'd think
>
> > def twice(n):
> >   return twice(n)
>
> > would work, but I get this really long error message.
>
> > > You're not just yanking the OP's chain???
>
> > That would be cruel. I mean the guy has enough problems already...
>
> Sorry, there is no 'twice' builtin.  I think what you are looking for
> is:
>
> def twice(n):
>     return return n
>
> Iain

Actually, what he wants is:

(def twice (x)
  (+ (once x) (once x)))



More information about the Python-list mailing list