easy question, how to double a variable

Iain King iainking at gmail.com
Thu Sep 24 06:51:21 EDT 2009


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



More information about the Python-list mailing list