Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72910

strange behaivor of nested function

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <1989lzhh@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.055
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'interpreter': 0.05; 'python': 0.11; 'def': 0.12; '2.7': 0.14; 'liu': 0.16; 'unbound': 0.16; 'fine': 0.24; 'pass': 0.26; 'function': 0.29; 'code': 0.31; 'thanks!': 0.32; 'received:google.com': 0.35; 'error.': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'header:Message- Id:1': 0.63; 'iphone': 0.65; 'here': 0.66; 'charset:gb2312': 0.80
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:content-type:message-id:date:to :content-transfer-encoding:mime-version; bh=S/5IM0K8Yf+L6thxrZjBFRjLXHgRb7meuBhmk8v0V9o=; b=GpUMFcikhS2KgL5zVIIuF21d7AZGi+3tNX67JZPK1enRdFxkjeSybJyRB5pyDlsX/5 +CBzYdB5ksBHUQYp7+8lwfy/2CQsrOxvxzI4GAwi9qFK5+2LdJWFVg6e0qoEyapDp4Ar Ftro4erDxeP1Rb9x96zJQh5BkU01e8bV6pRNYRIuYawJtABVDSxZaqbdbMkUDTXA8eqe BvGt00dTYXOMewqoz2/k2TXTlEwbHPgHk1qTqYFb51BtdF6JLpPZCacbvoDXXzGf2kj3 ELwQJoUJOIXdUEyVZlwAZCShnuxyLmEiEX6IZ7gA/bAe5De1bE6rVnAwOw8UhEYWc5qR RNjQ==
X-Received by 10.68.218.231 with SMTP id pj7mr11009569pbc.95.1402140201277; Sat, 07 Jun 2014 04:23:21 -0700 (PDT)
Subject strange behaivor of nested function
From 1989lzhh <1989lzhh@gmail.com>
Content-Type text/plain; charset=gb2312
X-Mailer iPhone Mail (11D201)
Date Sat, 7 Jun 2014 19:17:23 +0800
To python_list <python-list@python.org>
Content-Transfer-Encoding quoted-printable
Mime-Version 1.0 (1.0)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10849.1402140210.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402140210 news.xs4all.nl 2927 [2001:888:2000:d::a6]:42250
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72910

Show key headers only | View raw


here is code

def make():
    def jit(sig):
        def wrap(function):
            sig=sig[0] # unbound local error, if change to sig='' would be just fine
            return function 
        return wrap
    return jit
jit=make()
@jit('')
def f():
    pass

It is strange that the interpreter complain about unbound local error. 
please give me some suggestion, thanks!
Ps: I am using python 2.7
                                  Liu Zhenhai


       

发自我的 iPhone

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

strange behaivor of nested function 1989lzhh <1989lzhh@gmail.com> - 2014-06-07 19:17 +0800
  Re: strange behaivor of nested function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-07 15:06 +0000

csiph-web