Christos Georgiou wrote:
> I haven't followed the complete discussion about once, but I would assume it
> would be used as such:
>
> once =
>
> that is, always an assignment, with the value stored as a cellvar, perhaps,
> on first execution 0f the code.
>
> Typically I would use it as:
>
>
I haven't followed the complete discussion about once, but I would assume it
would be used as such:
once =
that is, always an assignment, with the value stored as a cellvar, perhaps,
on first execution 0f the code.
Typically I would use it as:
def function(a):
once pathjoin = os.path.jo
Guido van Rossum wrote:
> So we have what seems to be an impasse. Some people would really like
> once-expressions to be captured at def-time rather than at the first
> execution per def; this is the only way to use it so solve the "outer
> loop variable reference" problem. Others would really hate
> I believe at least one poster has pointed out that 'once' (if defined
> suitably) could be used as a better way to do this:
>
> def index_functions(n):
> return [(lambda: once i) for i in range(n)]
>
> But delaying the evaluation of the once argument until the function is
> called would b
On 6/28/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> On 6/28/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > On 6/28/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> It basically requires a reserved word.
>
> def f(a, b="key", __func__.extra=i):
> if __func__.extra < 43: ...
>
> > And an
On 6/28/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 6/28/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> > On 6/28/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > > def index_functions(n):
> > > return [(lambda i=i: i) for i in range(n)]
> > > which works but has the disadvantage o
On 6/28/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> On 6/28/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>
> > def index_functions(n):
> > return [(lambda i=i: i) for i in range(n)]
>
> > which works but has the disadvantage of returning a list of functions
> > of 0 or 1 argument
>
> > I b
On 6/28/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> def index_functions(n):
> return [(lambda i=i: i) for i in range(n)]
> which works but has the disadvantage of returning a list of functions
> of 0 or 1 argument
> I believe at least one poster has pointed out that 'once' (if define
On 6/28/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> On 6/25/06, Ka-Ping Yee wrote:
>
> > def f(x):
> > def g(y):
> > return y + once x
> > return g
>
> > Does "once" mean not really once here, but "once for each new function
> > object that's created for g"?
>
> Unt