Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19730
| From | Christian Heimes <lists@cheimes.de> |
|---|---|
| Subject | Re: Question about name scope |
| Date | 2012-02-01 18:50 +0100 |
| References | <20120201181117.5d35dddc@bigfoot.com> <4F297824.1000202@davea.name> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5314.1328118666.27778.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Find similar | Unroll 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