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


Groups > comp.lang.python > #19730

Re: Question about name scope

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.032
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.13; 'slightly': 0.19; 'subject:Question': 0.19; 'header:In-Reply-To:1': 0.22; 'math': 0.24; 'import': 0.27; 'needed,': 0.28; 'print': 0.29; 'lock': 0.30; 'threads.': 0.30; 'does': 0.32; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'approach.': 0.34; 'function.': 0.34; 'header:X-Complaints-To:1': 0.34; 'trouble': 0.35; 'received:org': 0.37; 'using': 0.37; 'received:de': 0.39; 'received:78': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'type': 0.60; 'cause': 0.66; 'subject:name': 0.67
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Christian Heimes <lists@cheimes.de>
Subject Re: Question about name scope
Date Wed, 01 Feb 2012 18:50:53 +0100
References <20120201181117.5d35dddc@bigfoot.com> <4F297824.1000202@davea.name>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host f048097078.adsl.alicedsl.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120129 Thunderbird/10.0
In-Reply-To <4F297824.1000202@davea.name>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5314.1328118666.27778.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328118667 news.xs4all.nl 6852 [2001:888:2000:d::a6]:43088
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19730

Show key headers only | View raw


Am 01.02.2012 18:36, schrieb Dave Angel:
> def f(a):
>     from math import sin, cos
>     return sin(a) + cos(a)
> 
> print f(45)
> 
> Does what you needed, and neatly.  The only name added to the global
> namspace is f, of type function.

I recommend against this approach. It's slightly slower and the global
import lock will cause trouble if you start using threads.

Christian

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


Thread

Question about name scope Olive <diolu@bigfoot.com> - 2012-02-01 18:11 +0100
  Re: Question about name scope Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-01 09:21 -0800
  Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 09:43 -0800
  Re: Question about name scope Dave Angel <d@davea.name> - 2012-02-01 12:36 -0500
    Re: Question about name scope Mel Wilson <mwilson@the-wire.com> - 2012-02-01 13:47 -0500
      Re: Question about name scope Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-01 14:49 -0700
      Re: Question about name scope Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-01 15:38 -0700
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 14:24 -0800
      Re: Question about name scope Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-01 16:00 -0700
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 15:08 -0800
      Re: Question about name scope Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-01 16:47 -0700
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 14:53 -0800
        Re: Question about name scope Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-02 00:34 +0000
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 15:59 -0800
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 15:41 -0800
      Re: Question about name scope Ethan Furman <ethan@stoneleaf.us> - 2012-02-01 15:51 -0800
  Re: Question about name scope Chris Rebert <clp2@rebertia.com> - 2012-02-01 09:38 -0800
  Re: Question about name scope Christian Heimes <lists@cheimes.de> - 2012-02-01 18:50 +0100

csiph-web