[issue2527] Pass a namespace to timeit

2014-08-23 Thread Ben Roberts
Ben Roberts added the comment: Thanks Antoine. Cheers :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue2527] Pass a namespace to timeit

2014-08-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thank you, Ben! Your patch is now pushed to the default branch. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker __

[issue2527] Pass a namespace to timeit

2014-08-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset e0f681f4ade3 by Antoine Pitrou in branch 'default': Issue #2527: Add a *globals* argument to timeit functions, in order to override the globals namespace in which the timed code is executed. http://hg.python.org/cpython/rev/e0f681f4ade3 --

[issue2527] Pass a namespace to timeit

2014-08-21 Thread Ben Roberts
Ben Roberts added the comment: Ah yes. New patch improves the docs. -- Added file: http://bugs.python.org/file36432/timeit_global_arg_v2.patch ___ Python tracker ___

[issue2527] Pass a namespace to timeit

2014-08-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, good. The patch looks fine to me, except that you should add "versionchanged" tags in the documentation for the added parameter. -- stage: needs patch -> patch review ___ Python tracker

[issue2527] Pass a namespace to timeit

2014-08-21 Thread Ben Roberts
Ben Roberts added the comment: I did sign one right after I submitted the patch. Takes a few days for the asterisks to propagate I guess :) -- ___ Python tracker ___ ___

[issue2527] Pass a namespace to timeit

2014-08-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ben, thanks for the patch. Have you signed a contributor's agreement? You can find it at https://www.python.org/psf/contrib/contrib-form/ -- ___ Python tracker

[issue2527] Pass a namespace to timeit

2014-08-18 Thread Ben Roberts
Ben Roberts added the comment: Correction, the name of the argument is 'globals', not 'global'. -- ___ Python tracker ___ ___ Python-bu

[issue2527] Pass a namespace to timeit

2014-08-18 Thread Ben Roberts
Ben Roberts added the comment: Attached is a patch that adds a 'global' kwarg to the Timeit constructor, which does pretty much what it says on the tin: specifies a global namespace that exec() will use. I originally had a 'locals' arg as well (to mirror the signature of eval/exec), but reali

[issue2527] Pass a namespace to timeit

2014-08-17 Thread Ben Roberts
Changes by Ben Roberts : -- nosy: +roippi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue2527] Pass a namespace to timeit

2014-08-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Would still be nice to have something like this. The timeit module API is still crippled, especially now that "from __main__ import *" doesn't work in a function anymore. -- stage: patch review -> needs patch versions: +Python 3.5 -Python 3.3

[issue2527] Pass a namespace to timeit

2011-11-19 Thread Ezio Melotti
Changes by Ezio Melotti : -- versions: +Python 3.3 -Python 3.2 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue2527] Pass a namespace to timeit

2010-08-26 Thread Mark Lawrence
Changes by Mark Lawrence : -- stage: -> patch review versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker ___ ___ Python-b

[issue2527] Pass a namespace to timeit

2009-04-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: See related discussion in issue 5441 and issue 1397474. -- assignee: rhettinger -> ___ Python tracker ___ __

[issue2527] Pass a namespace to timeit

2009-04-03 Thread Stefan van der Walt
Changes by Stefan van der Walt : -- nosy: +stefanv ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue2527] Pass a namespace to timeit

2009-02-06 Thread Georg Brandl
Georg Brandl added the comment: I'm sorry, this should have been another issue. Reassigning to you. -- assignee: pitrou -> rhettinger ___ Python tracker ___ _

[issue2527] Pass a namespace to timeit

2009-02-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Georg, why did you reassign this? ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue2527] Pass a namespace to timeit

2009-02-05 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: rhettinger -> pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue2527] Pass a namespace to timeit

2009-02-04 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- priority: -> normal versions: +Python 2.7, Python 3.1 -Python 2.6 ___ Python tracker ___ ___ Python-

[issue2527] Pass a namespace to timeit

2009-01-26 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue2527] Pass a namespace to timeit

2009-01-24 Thread David W. Lambert
David W. Lambert added the comment: This note is simply a reminder that Antoine's 'from __main__ import *' solution fails in python3. Also, resolution of this issue probably could incorporate Issue1397474. >>> import timeit >>> timeit.timeit('None','from __main__ import *') Traceback (most

[issue2527] Pass a namespace to timeit

2009-01-23 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +stevenjd ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue2527] Pass a namespace to timeit

2008-04-02 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: On Wed, Apr 2, 2008 at 2:42 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Alexander, I'm fine with a more specific argument name. ns was what > the Timer already used internally. > Maybe it should be "locals" after all. It does not l

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Peter Otten
Peter Otten <[EMAIL PROTECTED]> added the comment: Alexander, I'm fine with a more specific argument name. ns was what the Timer already used internally. Antoine, from __main__ import name1, ..., nameN works fine on the command line, but inside a function you'd have to declare the names you w

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Generally, when I use timeit from the interpreter prompt, I use "from __main__ import *" as the setup code string. Then I can use all currently defined global symbols directly :) -- nosy: +pitrou __ Tr

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: On the second thought, I actually wanted Timer to mimic eval without realizing that eval uses positional rather than keywords arguments. 'locals' is obviously a bad choice for the keyword parameter because it masks locals() builtin. Ma

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: A more general approach would be to add both 'locals' and 'globals' to be used by exec. At least, I would change 'ns' to 'locals'. -- nosy: +belopolsky __ Tracker <[EMAIL PROTECTED]>

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- nosy: +georg.brandl __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Un

[issue2527] Pass a namespace to timeit

2008-04-01 Thread Peter Otten
New submission from Peter Otten <[EMAIL PROTECTED]>: I'd like to suggest a different approach than the one taken in rev. 54348 to improve timeit's scripting interface: allow passing it a namespace. Reasons: - It has smaller overhead for functions that take an argument: >>> def f(a): pass ... #