[Python-Dev] Re: Azure Pipelines PR: Spurious failure of 3.8 branch

2020-02-03 Thread Chris Withers
This seems the best thread to follow up on, just had a spurious failure backporting a patch to 3.8 from master: https://dev.azure.com/Python/cpython/_build/results?buildId=57386=logs=c83831cd-3752-5cc7-2f01-8276919eb334=5a421c4a-0933-53d5-26b9-04b36ad165eb

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 17:09, Stephen J. Turnbull wrote: Executive summary: "There should be a tool" (sorry, I'm not volunteering any time soon) that could be added to $VCS diff (say, "git coverage-diff" or "git diff --coverage"). That sounds like a very hard problem to solve... > If people are

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 14:52, Karthikeyan wrote: We try to support several different ways of running tests. This allows to catch some environment depended flaws in tests and serves as a kind of the test of unittest itself. Not all test files are made discoverable yet, but we move in

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 14:22, Paul Moore wrote: If people are actually using these blocks, then so be it, but it feels like the people who want them to stick around are saying they're using them just on the off chance they might use them, which feels like a poor reason to keep a bunch of dead code

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
Sorry, accidentally include a comment for this in a reply to Paul: On 01/05/2019 13:39, Serhiy Storchaka wrote: We try to support several different ways of running tests. This allows to catch some environment depended flaws in tests and serves as a kind of the test of unittest itself. Not all

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 13:37, Paul Moore wrote: I agree - removing this just to make the coverage figures look pretty seems like the wrong motivation. Configuring coverage to understand that you want to exclude these lines from the checking would be fine, as would accepting that a coverage of slightly

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 13:21, Victor Stinner wrote: Le mer. 1 mai 2019 à 03:12, Chris Withers a écrit : Right, but that's not the documented way of running individual suites in the devguide. Maybe, but I'm using that sometimes and it's useful for some specific issues. Is it possible to run

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 07:46, Serhiy Storchaka wrote: 01.05.19 00:24, Chris Withers пише: I have a crazy idea of getting unittest.mock up to 100% code coverage. I noticed at the bottom of all of the test files in testmock/, there's a: if __name__ == '__main__': unittest.main() ...block. How

Re: [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-05-01 Thread Chris Withers
On 01/05/2019 06:12, Terry Reedy wrote: Such blocks should be excluded from coverage by the default .coveragerc file.  Mine came with exclude_lines =     # Don't complain if non-runnable code isn't run:     if 0:     if __name__ == .__main__.:     if DEBUG: Which .coveragerc are you

[Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

2019-04-30 Thread Chris Withers
Hi All, I have a crazy idea of getting unittest.mock up to 100% code coverage. I noticed at the bottom of all of the test files in testmock/, there's a: if __name__ == '__main__':     unittest.main() ...block. How would people feel about these going away? I don't *think* they're needed now

[Python-Dev] drop jython support in mock backport?

2019-04-30 Thread Chris Withers
[resending to python-dev in case there are Jython users here...] Hi All, If you need Jython support in the mock backport, please shout now: https://github.com/testing-cabal/mock/issues/453 cheers, Chris ___ Python-Dev mailing list

Re: [Python-Dev] git history conundrum

2019-04-28 Thread Chris Withers
On 28/04/2019 22:21, Robert Collins wrote: Thank you! Thank me when we get there ;-) Currently in Dec 2018 with a wonderful Py2 failure: == ERROR: test_autospec_getattr_partial_function

Re: [Python-Dev] git history conundrum

2019-04-28 Thread Chris Withers
On 28/04/2019 03:51, Martin Panter wrote: On Sat, 27 Apr 2019 at 19:07, Chris Withers wrote: Right, so I've merged up to 15f44ab043, what comes next? $ git log --oneline --no-merges 15f44ab043.. -- Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail -n 3 This Git command line means

Re: [Python-Dev] git history conundrum

2019-04-28 Thread Chris Withers
On 28/04/2019 03:51, Martin Panter wrote: On Sat, 27 Apr 2019 at 19:07, Chris Withers wrote: Right, so I've merged up to 15f44ab043, what comes next? $ git log --oneline --no-merges 15f44ab043.. -- Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail -n 3 This Git command line means list

[Python-Dev] git history conundrum

2019-04-27 Thread Chris Withers
Hi All, I'm in the process of bringing the mock backport up to date, but this has got me stumped: $ git log --oneline  --no-merges 5943ea76d529f9ea18c73a61e10c6f53bdcc864f.. -- Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail 362f058a89 Issue #28735: Fixed the comparison of

[Python-Dev] any way to subscribe to bugs and PRs on a particular topic?

2018-12-04 Thread Chris Withers
Hello, I'd like to see if I can help with unittest.mock, but don't have a huge amount of bandwidth and can't even parse let alone process the whole firehose of bpo and GH PRs. Is there  any way I can get bugs.python.org and github PRs to only tell me about things, preferably by email, that

Re: [Python-Dev] getting merge rights back on github

2018-12-03 Thread Chris Withers
1177: Skip deleted attributes while calling reset_mock (GH-9302) Victor Le dim. 2 déc. 2018 à 15:45, Chris Withers a écrit : Hi All, It's been quite a long time since I last used my python commit rights, and it appears they've evaporated in the move to GitHub. I'd like to get back into h

[Python-Dev] getting merge rights back on github

2018-12-02 Thread Chris Withers
Hi All, It's been quite a long time since I last used my python commit rights, and it appears they've evaporated in the move to GitHub. I'd like to get back into helping out, particularly with unittest.mock where I've recently started helping out as a maintainer over on

[Python-Dev] getting merge rights back on github

2018-12-02 Thread Chris Withers
Hi All, It's been quite a long time since I last used my python commit rights, and it appears they've evaporated in the move to GitHub. I'd like to get back into helping out, particularly with unittest.mock where I've recently started helping out as a maintainer over on

[Python-Dev] dynamic linking, libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and Mac OS X

2015-12-24 Thread Chris Withers
Hi All, I hit this every time I install packages on Mac OS X that use libssl, it looks like extensions are built linking to .dylib's that are not resolveable when the library is actually used: >>> from OpenSSL import SSL Traceback (most recent call last): File "", line 1, in File

[Python-Dev] dynamic linking, libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and Mac OS X

2015-12-24 Thread Chris Withers
Hi All, I hit this every time I install packages on Mac OS X that use libssl, it looks like extensions are built linking to .dylib's that are not resolveable when the library is actually used: from OpenSSL import SSL Traceback (most recent call last): File "", line 1, in File

Re: [Python-Dev] dynamic linking, libssl.1.0.0.dylib, libcrypto.1.0.0.dylib and Mac OS X

2015-12-24 Thread Chris Withers
On 24/12/2015 14:36, Cory Benfield wrote: On 24 Dec 2015, at 11:17, Chris Withers <ch...@simplistix.co.uk> wrote: Here's a couple of examples of this problem in the wild: https://github.com/alekstorm/backports.ssl/issues/9 http://stackoverflow.com/questions/32978365/how-do-i-run-ps

Re: [Python-Dev] under what circumstances can python still exhibit "high water mark" memory usage?

2015-10-14 Thread Chris Withers
On 14/10/2015 16:04, Stefan Ring wrote: On Wed, Oct 14, 2015 at 3:11 PM, Chris Withers <ch...@simplistix.co.uk> wrote: I'm having trouble with some python processes that are using 3GB+ of memory but when I inspect them with either heapy or meliae, injected via pyrasite, those tools only

[Python-Dev] under what circumstances can python still exhibit "high water mark" memory usage?

2015-10-14 Thread Chris Withers
Hi All, I'm having trouble with some python processes that are using 3GB+ of memory but when I inspect them with either heapy or meliae, injected via pyrasite, those tools only report total memory usage to be 119Mb. This feels like the old "python high water mark" problem, but I thought

Re: [Python-Dev] under what circumstances can python still exhibit "high water mark" memory usage?

2015-10-14 Thread Chris Withers
On 14/10/2015 16:13, Victor Stinner wrote: Hi, You may also try tracemalloc to get stats of the Python memory usage ;-) The Python memory allocator was optimized in Python 3.3: it now uses mmap() when available (on UNIX), it helps to reduce the fragmentation of the heap memory. Since Python

Re: [Python-Dev] documentation / implementation question for subprocess.check_output

2015-07-17 Thread Chris Withers
On 16/07/2015 16:27, Nick Coghlan wrote: On 16 July 2015 at 20:35, Guido van Rossum gu...@python.org wrote: In which version? I don't see that phrase in the 3.5 docs. The equivalent note in 3.x is Do not use stdout=PIPE or stderr=PIPE with this function. The child process will block if it

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 20:09, Paul Moore wrote: On 20 April 2015 at 19:41, Barry Warsaw ba...@python.org wrote: tldr; type hints in python source are scary. Would reserving them for stub files be better? I think so. I think PEP 8 should require stub files for stdlib modules and strongly encourage them

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 19:30, Harry Percival wrote: Hi all, tldr; type hints in python source are scary. Would reserving them for stub files be better? I was trying to find Jack's original post as I think his summary is excellent and aligns well with where I think I'm coming from on this:

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 19:30, Harry Percival wrote: Hi all, tldr; type hints in python source are scary. Would reserving them for stub files be better? I think Jack's summary of this is excellent and aligns well with where I think I'm coming from on this:

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 20:09, Paul Moore wrote: On 20 April 2015 at 19:41, Barry Warsaw ba...@python.org wrote: tldr; type hints in python source are scary. Would reserving them for stub files be better? I think so. I think PEP 8 should require stub files for stdlib modules and strongly encourage them

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 21/04/2015 12:23, Gustavo Carneiro wrote: Well, (i) can be done with good documentation (docstrings etc.). Documentation is not checked. It often loses sync with the actual code. Docs say one thing, code does another. That certainly something that could be fixed by formalising

Re: [Python-Dev] PEP 468 (Ordered kwargs)

2015-01-28 Thread Chris Withers
On 28/01/2015 07:14, Gregory P. Smith wrote: It is a potentially bad idea if order is the default behavior of iteration, items(), keys() and values(). Ideally order should only be exposed when explicitly asked for to help prevent bugs and mitigate potential information leaks. I have to be

Re: [Python-Dev] Move selected documentation repos to PSF BitBucket account?

2014-11-24 Thread Chris Withers
On 24/11/2014 02:59, Barry Warsaw wrote: On Nov 23, 2014, at 08:55 AM, Guido van Rossum wrote: - Moving from Hg to Git is a fair amount of one-time work For anyone seriously interested in this, even experimentally, I would highly suggest looking at Eric Raymond's reposurgeon code. You can

[Python-Dev] namedtuple implementation grumble

2014-06-07 Thread Chris Withers
Hi All, I've been trying to add support for explicit comparison of namedtuples into testfixtures and hit a problem which lead me to read the source and be sad. Rather than the mixin and class assembly in the function I expected to find, I'm greeted by an exec of a string. Curious as to

Re: [Python-Dev] pep8 reasoning

2014-04-25 Thread Chris Withers
On 25/04/2014 03:00, Chris Angelico wrote: On Fri, Apr 25, 2014 at 11:40 AM, Allen Li cyberdup...@gmail.com wrote: 2) If you're starting a new project, follow PEP8 (or the standards for the language you're using) to preserve CONSISTENCY. Don't forget that PEP 8 is not the standard for the

Re: [Python-Dev] pep8 reasoning

2014-04-25 Thread Chris Withers
On 25/04/2014 04:03, Barry Warsaw wrote: On Apr 25, 2014, at 12:00 PM, Chris Angelico wrote: Don't forget that PEP 8 is not the standard for the Python language, only the Python stdlib. Particularly, there's no strong reason to follow some of its lesser advices (eg spaces rather than tabs, the

[Python-Dev] pep8 reasoning

2014-04-24 Thread Chris Withers
Hi All, Apologies if this is considered off topic, but I'm keen to get the language designers point of view and short of emailing Barry, Guido and Nick directly, this seemed like the best place. I'm having a tough time persuading some people of the benefits of pep8, particularly when it

[Python-Dev] pep8 reasoning

2014-04-24 Thread Chris Withers
Hi All, Apologies if this is considered off topic, but I'm keen to get the language designers point of view and short of emailing Barry, Guido and Nick directly, this seemed like the best place. I'm having a tough time persuading some people of the benefits of pep8, particularly when it

Re: [Python-Dev] getattr vs hashattr

2014-03-17 Thread Chris Withers
On 03/12/2014 04:49 PM, Chris Angelico wrote: You can use hasattr() in place of AttributeError Is that true now? It used to be that hasattr swallowed all exceptions rather than just AttributeError making is a very dangerous weapon for anything (such as an orm or odb) that might do something

[Python-Dev] python 3 niggle: None 1 raises TypeError

2014-02-14 Thread Chris Withers
Hi All, Sending this to python-dev as I'm wondering if this was considered when the choice to have objects of different types raise a TypeError when ordered... So, the concrete I case I have is implementing stable ordering for the python Range objects that psycopg2 uses. These have 3

Re: [Python-Dev] windows file closing race condition?

2013-09-06 Thread Chris Withers
On 06/09/2013 07:10, Antoine Pitrou wrote: This happens very infrequently, the OS is Windows 7 and the filesystem is NTFS, if that helps... It should help indeed: http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx The box in questions runs no AV software or indexing

Re: [Python-Dev] windows file closing race condition?

2013-09-06 Thread Chris Withers
On 06/09/2013 08:14, Nick Coghlan wrote: This feels a lot like an issue we were seeing on the Windows buildbots, which we ended up working around in the test support library: http://bugs.python.org/issue15496 Wow :'( That would be some awfully ugly code to upgrade from hack in the test

[Python-Dev] windows file closing race condition?

2013-09-05 Thread Chris Withers
Hi All, Continuous testing is a wonderful thing when it comes to finding weird edge case problems, like this one:

Re: [Python-Dev] Official github mirror for CPython?

2013-07-28 Thread Chris Withers
On 25/07/2013 16:30, Brett Cannon wrote: Based on the list of people who are members of github.com/python http://github.com/python it's as official as it's going to get (depends on who of that group owns it). But assuming whomever owns it is okay with hosting a mirror, what exactly is going to

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-07 Thread Chris Withers
On 05/07/2013 11:26, Martin v. Löwis wrote: ... A.__getattribute__(A,'s') staticmethod object at 0x100937828 A.__getattribute__(A,'c') classmethod object at 0x100937860 A.__getattribute__(A,'r') function A.r at 0x100938378 Okay, but with this line: found = found.__getattribute__(found,

[Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Chris Withers
Hi All, In Python 2, I can figure out whether I have a method or a function, and, more importantly, for an unbound method, I can figure out what class the method belongs to: class MyClass(object): ... def method(self): pass ... MyClass.method unbound method MyClass.method

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Chris Withers
On 04/07/2013 12:59, Christian Heimes wrote: Am 04.07.2013 13:21, schrieb Chris Withers: There doesn't appear to be any way in Python 3 to do this, which is a little surprising and frustrating... What am I missing here? I removed unbound methods almost six years ago: http://hg.python.org

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Chris Withers
.meth()) cheers, Chris On 04/07/2013 17:25, Guido van Rossum wrote: Chris, what do you want to do with the knowledge you are seeking? --Guido van Rossum (sent from Android phone) On Jul 4, 2013 4:28 AM, Chris Withers ch...@simplistix.co.uk mailto:ch...@simplistix.co.uk wrote: Hi All

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Chris Withers
don't know that Victor's suggestion will actually work in all the cases that MyClass.a_method.im_class does :-S Chris On Thu, Jul 4, 2013 at 9:42 AM, Chris Withers ch...@simplistix.co.uk Hi Guido, I've bumped into this a couple of times. First time was when I wanted to know whether

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Chris Withers
On 04/07/2013 20:50, Benjamin Peterson wrote: 2013/7/4 Eric Snow ericsnowcurren...@gmail.com: You could always monkeypatch builtins.__build_class__ to add an attribute to every unbound method pointing to the class. I would not reccomend that. __build_class__ is very internal and it's

Re: [Python-Dev] BDFL delegation for PEP 426 (PyPI metadata 1.3)

2013-02-22 Thread Chris Withers
On 03/02/2013 13:27, Tres Seaver wrote: As for setuptools (as opposed to distribute), I don't think we should care anymore. Yes, you need to care. It is *still* true today that distribute and setuptools remain largely interchangeable, which is the only thing that makes distribute viable, in

[Python-Dev] build from source on mac uses clang, python.org binary uses gcc

2013-02-14 Thread Chris Withers
Hi All, I've run into some issues installing lxml for python 3.3 on my mac: One of the stumbling blocks I've hit is that I built python 3.3 from source (./configure make make altinstall), and it used clang: buzzkill:virtualenvs chris$ /src/Python-3.3.0/python.exe Python 3.3.0 (default,

Re: [Python-Dev] build from source on mac uses clang, python.org binary uses gcc (missing links)

2013-02-14 Thread Chris Withers
On 14/02/2013 09:18, Chris Withers wrote: Hi All, I've run into some issues installing lxml for python 3.3 on my mac: (forgot the links) https://mailman-mail5.webfaction.com/pipermail/lxml/2013-February/006730.html https://mailman-mail5.webfaction.com/pipermail/lxml/2013-February/006731.html

Re: [Python-Dev] build from source on mac uses clang, python.org binary uses gcc

2013-02-14 Thread Chris Withers
On 14/02/2013 12:15, Ronald Oussoren wrote: buzzkill:virtualenvs chris$ /src/Python-3.3.0/python.exe Python 3.3.0 (default, Jan 23 2013, 09:56:03) [GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin Type help, copyright, credits or license for more information.

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-13 Thread Chris Withers
On 12/02/2013 21:03, Maciej Fijalkowski wrote: We recently encountered a performance issue in stdlib for pypy. It turned out that someone commited a performance fix that uses += for strings instead of .join() that was there before. That's... interesting. I fixed a performance bug in httplib

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-13 Thread Chris Withers
On 13/02/2013 11:53, Steven D'Aprano wrote: I fixed a performance bug in httplib some years ago by doing the exact opposite; += - ''.join(). In that case, it changed downloading a file from 20 minutes to 3 seconds. That was likely on Python 2.5. I remember it well.

[Python-Dev] what is a dict_keys and where can I import it from?

2013-02-12 Thread Chris Withers
Hi all, So, dicts in Python 3 return something different from their keys and values methods: dict(x=1, y=2).keys() dict_keys(['y', 'x']) type(dict(x=1, y=2).keys()) class 'dict_keys' I have vague memories of these things being referred to as views or some such? Where can I learn more?

[Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Chris Withers
Hi All, I see in Python 3, some ImportErrors have grown a '_not_found' attribute. What's the significance of this attribute and where/how is it added? The only way I can seem to create this attribute is: ex = ImportError ex._not_found = True cheers, Chris -- Simplistix - Content

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Chris Withers
On 11/02/2013 10:54, Nick Coghlan wrote: On Mon, Feb 11, 2013 at 6:08 PM, Chris Withersch...@simplistix.co.uk wrote: Hi All, I see in Python 3, some ImportErrors have grown a '_not_found' attribute. What's the significance of this attribute and where/how is it added? The only way I can seem

[Python-Dev] checking what atexit handlers are registered in Python 3

2013-02-10 Thread Chris Withers
Hi All, I'm finally getting around to porting some of the packages I maintain over to Python 3. One rough edge I've hit: I see the atexit module has moved to be C-based and, as far as I can tell, no longer allows you to introspect what atexit functions have been registered. If I'm writing

[Python-Dev] help with knowledge on how to find which release a fix will land in

2013-02-08 Thread Chris Withers
Hi All, Where would I look to find out which release a fix for an issue (http://bugs.python.org/issue15822 if you're interested ;-)) will land in? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk

Re: [Python-Dev] help with knowledge on how to find which release a fix will land in

2013-02-08 Thread Chris Withers
On 08/02/2013 11:17, Antoine Pitrou wrote: Le Fri, 08 Feb 2013 10:58:36 +, Chris Withersch...@simplistix.co.uk a écrit : Hi All, Where would I look to find out which release a fix for an issue (http://bugs.python.org/issue15822 if you're interested ;-)) will land in? Just read that

[Python-Dev] why do we allow this syntax?

2013-02-08 Thread Chris Withers
Hi All, Just had a bit of an embarrassing incident in some code where I did: sometotal =+ somevalue I'm curious why this syntax is allowed? I'm sure there are good reasons, but thought I'd ask... Chris -- Simplistix - Content Management, Batch Processing Python Consulting -

Re: [Python-Dev] why do we allow this syntax?

2013-02-08 Thread Chris Withers
On 08/02/2013 16:17, Oscar Benjamin wrote: Decimal.__pos__ uses it to return a Decimal instance that has the default precision of the current Decimal context: from decimal import Decimal d = Decimal('0.33') d

Re: [Python-Dev] slightly misleading Popen.poll() docs

2013-01-22 Thread Chris Withers
On 05/12/2012 17:15, Steven D'Aprano wrote: Check if child process has terminated. Returns None while the child is still running, any non-None value means that the child has terminated. In either case, the return value is also available from the instance's returncode attribute. Do you want

[Python-Dev] slightly misleading Popen.poll() docs

2012-12-05 Thread Chris Withers
Hi All, Would anyone object to me making a change to the docs for 2.6, 2.7 and 3.x to clarify the following: http://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll A couple of my colleagues have ended up writing code like this: proc = Popen(['some', 'thing']) code =

Re: [Python-Dev] slightly misleading Popen.poll() docs

2012-12-05 Thread Chris Withers
On 05/12/2012 16:34, Antoine Pitrou wrote: http://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll The doc looks clear to me. poll() returns the returncode attribute which is described thusly: A None value indicates that the process hasn’t terminated yet. Therefore, I don't

[Python-Dev] performance of {} versus dict()

2012-11-14 Thread Chris Withers
Hi All, A colleague pointed me at Doug's excellent article here: http://www.doughellmann.com/articles/misc/dict-performance/index.html ...which made me a little sad, I suspect I'm not the only one who finds: a_dict = dict( x = 1, y = 2, z = 3, ... ) ...easier to read

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Chris Withers
On 14/11/2012 09:58, Merlijn van Deen wrote: On 14 November 2012 10:12, Chris Withers ch...@simplistix.co.uk wrote: ...which made me a little sad Why did it make you sad? dict() takes 0.2µs, {} takes 0.04µs. In other words: you can run dict() _five million_ times per second, and {} twenty

Re: [Python-Dev] performance of {} versus dict(), de fmd(**kw): return kw trumps all ; -)

2012-11-14 Thread Chris Withers
On 14/11/2012 10:11, mar...@v.loewis.de wrote: Zitat von Chris Withers ch...@simplistix.co.uk: a_dict = dict( x = 1, y = 2, z = 3, ... ) What can we do to speed up the former case? It should be possible to special-case it. Rather than creating a new dictionary from

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Chris Withers
On 14/11/2012 21:40, Greg Ewing wrote: * If the compiler were allowed to recognise builtins, it could turn dict(a = 1, b = 2) into {'a':1, 'b':2} automatically. That would be my naive suggestion, I am prepared to be shot down in flames ;-) Would be even more awesome if it could end up with

Re: [Python-Dev] performance of {} versus dict(), de fmd(**kw): return kw trumps all ; -)

2012-11-14 Thread Chris Withers
On 14/11/2012 22:37, Chris Withers wrote: On 14/11/2012 10:11, mar...@v.loewis.de wrote: def xdict(**kwds): return kwds Hah, good call, this trumps both of the other options: $ python2.7 -m timeit -n 100 -r 5 -v {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7} raw times: 1.45 1.45 1.44

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Chris Withers
On 15/11/2012 06:32, Stefan Behnel wrote: Donald Stufft, 15.11.2012 00:00: $ pypy -m timeit 'dict()' 10 loops, best of 3: 0.000811 usec per loop $ pypy -m timeit '{}' 10 loops, best of 3: 0.000809 usec per loop $ pypy -m timeit 'def md(**kw): return kw; md()' 1 loops,

[Python-Dev] problems building python2.7

2012-11-09 Thread Chris Withers
Hi All, I wanted to run the unit tests before checking in the patch for http://bugs.python.org/issue16441, even though it's a trivial change, so I was trying to follow the instructions at: http://docs.python.org/devguide/ I'm on MacOS, so following the unix instructions did: ./configure

Re: [Python-Dev] problems building python2.7

2012-11-09 Thread Chris Withers
On 09/11/2012 10:52, Michael Foord wrote: However, I can't find the python it's built... It should be python.exe (yes really). Hah! Should http://docs.python.org/devguide/ be updated to reflect this or does this only affect Mac OS? (or should we correct the build so it doesn't spit out a

Re: [Python-Dev] problems building python2.7

2012-11-09 Thread Chris Withers
On 09/11/2012 11:54, Ronald Oussoren wrote: On 9 Nov, 2012, at 11:57, Chris Withersch...@simplistix.co.uk wrote: On 09/11/2012 10:52, Michael Foord wrote: However, I can't find the python it's built... It should be python.exe (yes really). Hah! Should http://docs.python.org/devguide/

Re: [Python-Dev] problems building python2.7

2012-11-09 Thread Chris Withers
On 09/11/2012 11:54, Hans Mulder wrote: I tried make test, and I got: test test_urllib failed -- Traceback (most recent call last): File /Users/hans/python/cpython/cpython-2.7/Lib/test/test_urllib.py, line 235, in test_missing_localfile fp.close() UnboundLocalError: local variable 'fp'

[Python-Dev] chained assignment weirdity

2012-11-06 Thread Chris Withers
Hi All, I bumped into this using Michael Foord's Mock library. It feels like a bug to me, but thought I'd ask here before logging one in the tracker in case people know that we won't be able to fix it: On 05/11/2012 13:43, Michael Foord wrote: class Foo(object): ... def __setattr__(s, k,

[Python-Dev] bug in tarfile module?

2012-08-23 Thread Chris Withers
Hi All, This feels like a bug, but just wanted to check here before filing a report if I've missed something: buzzkill$ python2.7 Enthought Python Distribution -- www.enthought.com Version: 7.2-2 (32-bit) Python 2.7.2 |EPD 7.2-2 (32-bit)| (default, Sep 7 2011, 09:16:50) [GCC 4.0.1 (Apple

[Python-Dev] Who's maintaining Sphinx nowadays?

2012-07-26 Thread Chris Withers
Hi All, Sorry if this is considered slightly off topic, but Sphinx is the tool we use for the Python core docs so: Who's looking after Sphinx nowadays? I've hit what I consider to be a bug: https://groups.google.com/group/sphinx-dev/browse_thread/thread/197fc26ba570913d?hl=en So I forked on

Re: [Python-Dev] Who's maintaining Sphinx nowadays?

2012-07-26 Thread Chris Withers
Hi Georg, On 26/07/2012 21:07, Georg Brandl wrote: If you're patient enough, I'll take care of your problem eventually. If not, and you're looking for a project to co-maintain, we can set something up :) I'm certainly interested in helping out where I can, Sphinx has been a fantastic

Re: [Python-Dev] Playing with a new theme for the docs

2012-03-21 Thread Chris Withers
On 21/03/2012 09:33, Jonathan Hartley wrote: On 21/03/2012 08:25, Dirkjan Ochtman wrote: On Wed, Mar 21, 2012 at 07:00, Georg Brandlg.bra...@gmx.net wrote: OK, that seems to be the main point people make... let me see if I can come up with a better compromise. Would it be possible to limit

Re: [Python-Dev] PyPy 1.8 released

2012-02-14 Thread Chris Withers
On 10/02/2012 09:44, Maciej Fijalkowski wrote: you can download the PyPy 1.8 release here: http://pypy.org/download.html Why no Windows 64-bit build :'( Is the 32-bit build safe to use on 64-bit Windows? Chris -- Simplistix - Content Management, Batch Processing Python Consulting

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-02-03 Thread Chris Withers
On 27/01/2012 15:09, Antoine Pitrou wrote: On Fri, 27 Jan 2012 15:21:33 +0200 Eli Benderskyeli...@gmail.com wrote: Following an earlier discussion on python-ideas [1], we would like to propose the following PEP for review. Discussion is welcome. The PEP can also be viewed in HTML form at

Re: [Python-Dev] A new dictionary implementation

2012-02-02 Thread Chris Withers
On 01/02/2012 17:50, Guido van Rossum wrote: Another question: a common pattern is to use (immutable) class variables as default values for instance variables, and only set the instance variables once they need to be different. Does such a class benefit from your improvement? A less common

Re: [Python-Dev] 2.7 now uses Sphinx 1.0

2012-01-20 Thread Chris Withers
On 14/01/2012 16:14, Sandro Tosi wrote: Hello, just a heads-up: documentation for 2.7 branch has been ported to use sphinx 1.0, so now the same syntax can be used for 2.x and 3.x patches, hopefully easying working on both python stacks. That's great news, does that now mean the objects

Re: [Python-Dev] PEP 380 (yield from) is now Final

2012-01-14 Thread Chris Withers
Finally, a reason to use Python 3 ;-) Chris On 13/01/2012 16:00, Guido van Rossum wrote: AWESOME!!! On Fri, Jan 13, 2012 at 4:14 AM, Nick Coghlan ncogh...@gmail.com mailto:ncogh...@gmail.com wrote: I marked PEP 380 as Final this evening, after pushing the tested and documented

[Python-Dev] Fwd: Anyone still using Python 2.5?

2011-12-21 Thread Chris Withers
What's the python-dev view on this? Original Message Subject: Anyone still using Python 2.5? Date: Wed, 21 Dec 2011 07:15:46 + From: Chris Withers ch...@simplistix.co.uk To: Python List python-l...@python.org, testing-in-pyt...@lists.idyll.org testing-in-pyt

Re: [Python-Dev] Inconsistent script/console behaviour

2011-10-01 Thread Chris Withers
On 24/09/2011 00:32, Guido van Rossum wrote: The interactive console is optimized for people entering code by typing, not by copying and pasting large gobs of text. If you think you can have it both, show us the code. Anatoly wants ipython's new qtconsole. This does the right thing because

Re: [Python-Dev] Packaging in Python 2 anyone ?

2011-09-16 Thread Chris Withers
On 15/09/2011 19:31, Michael Foord wrote: The current tools are a real pain for versioning anyway. If your pypi page even *links* to a page that offers an alpha or beta (in development version) for download then both pip and easy_install will fetch that, in preference to the most recent version

[Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Chris Withers
Hi All, Any chance the version of sphinx used to generate the docs on docs.python.org could be updated? I'd love to take advantage of the new format intersphinx mapping: http://sphinx.pocoo.org/ext/intersphinx.html#confval-intersphinx_mapping ...but since it looks like docs.python.org uses

Re: [Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Chris Withers
On 16/08/2011 16:05, Sandro Tosi wrote: Hello Chris, On Wed, Aug 17, 2011 at 00:58, Chris Withersch...@simplistix.co.uk wrote: Hi All, Any chance the version of sphinx used to generate the docs on docs.python.org could be updated? I think what's needed first is to run a pilot: take the

Re: [Python-Dev] email-6.0.0.a1

2011-08-02 Thread Chris Withers
On 19/07/2011 22:21, R. David Murray wrote: The basic additional API is that a 'source' attribute contains the text the generator read from the input source, and a 'value' attribute that contains the value with all the Content-Transfer-Encoding stuff undone so that you have a real unicode

[Python-Dev] how do you find out what version of Python a PEP landed in?

2011-05-17 Thread Chris Withers
Hi All, A friend of mine is coming over to Python and asked a question I thought would have a better answer than it appears to: How do I know which version of Python a PEP lands in? I was expecting there to be a note at the bottom of the PEP, 342 in this case, but that doesn't appear to be

Re: [Python-Dev] Finally fix installer to add Python to %PATH% on Windows

2011-02-06 Thread Chris Withers
On 06/02/2011 15:20, Brian Curtin wrote: There are still outstanding considerations in the various issues on the tracker, so it would be best to address them before requesting integration. Example: What should happen when there is another Python installation on the path? Same as happens with

Re: [Python-Dev] Finally fix installer to add Python to %PATH% on Windows

2011-02-06 Thread Chris Withers
On 06/02/2011 15:25, Brian Curtin wrote: So put the new path before the old path, or replace it? The current patch appends to the end. I believe the last path wins in Windows land, so that would be fine. Chris -- Simplistix - Content Management, Batch Processing Python Consulting

Re: [Python-Dev] Finally fix installer to add Python to %PATH% on Windows

2011-02-04 Thread Chris Withers
On 28/01/2011 19:21, Michael Foord wrote: I've helped quite a few python newbies on Windows who are also surprised / frustrated on learning that python on the command line doesn't work after installing python. Yes, I've always found it a surprising disappointment that I have to manually munge

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-13 Thread Chris Withers
On 07/12/2010 20:26, Vinay Sajip wrote: I would suggest that when unit testing, rather than adding StreamHandlers to log to stderr, that something like TestHandler and Matcher from this post: http://plumberjack.blogspot.com/2010/09/unit-testing-and-logging.html For Python 2, my testfixtures

Re: [Python-Dev] os.path.normcase rationale?

2010-10-08 Thread Chris Withers
On 05/10/2010 12:04, Steven D'Aprano wrote: On Tue, 5 Oct 2010 07:21:15 pm Chris Withers wrote: On 25/09/2010 04:25, Steven D'Aprano wrote: 1. Return the case of a filename in some canonical form which depends on the file system? 2. Return the case of a filename as it is actually stored

Re: [Python-Dev] Adding Wing 4 project to

2010-10-08 Thread Chris Withers
On 05/10/2010 13:00, Antoine Pitrou wrote: 3. stay with versioned project file names and rename 'python-wing.wpr' to 'python-wing3.wpr' (Option 3 could be done immediately of course.) Option 3 looks the most reasonable to me. I don't use Wing, but option 3 does seem most sensible.

  1   2   3   >