[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: (sorry, to sort the attributes.) -- ___ Python tracker <https://bugs.python.org/issue34160> ___ ___ Python-bugs-list mailin

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: Hi, this broke my tests, just as earlier comments predicted. Can we get an optional argument to sort the keys? The json module lets us sort keys even though it's irrelevant to JSON. Being able to sort attributes would be a very useful addition t

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: To provide a little more context: coverage.py has tests that the XML reports it generates are correct. It does this by comparing the result to saved XML files. On Python versions up to 3.7, the file compares correctly. It has sorted attributes generated

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: Diego, they are my tests in the coverage.py test suite. I'm checking that my XML generating code is producing the right XML. -- ___ Python tracker <https://bugs.python.org/is

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: This is exactly the situation Stefan was talking about: "However, I still think that Serhiy is right: this change would break code, and in particular test code that compares XML output. Having to deal with two different "correct" serialis

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: I can see that there are ways that I can change my tests. I see that there are third-party libraries that can help me with this. But changing the behavior of the standard library, without a way to retain the old behavior, and asking people to adapt by

[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: Words like flawed from the outset, fundamentally flawed, fragile, and ill-conceived are being thrown around, which does not help the discussion. Can we focus on the question of whether it's reasonable to add sorted attributes as an option? This

[issue34160] ElementTree not preserving attribute order

2018-11-16 Thread Ned Batchelder
Ned Batchelder added the comment: Stefan, just to clarify: it isn't that I don't feel like re-serializing my gold files with the latest version. I run my test suite on 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, PyPy2, and PyPy3. Today, one gold file suffices for all those versions. Without

[issue34160] ElementTree not preserving attribute order

2018-11-16 Thread Ned Batchelder
Ned Batchelder added the comment: It seemed like we were close to a consensus about adding back the option to sort the attributes, or did I misunderstand? -- ___ Python tracker <https://bugs.python.org/issue34

[issue18111] Add a default argument to min & max

2013-06-03 Thread Ned Batchelder
Ned Batchelder added the comment: I find the workarounds mentioned here to be baroque and confusing. The concept of a default value to return in the case of an empty iterator is straightforward. I'm +1 on adding this as well. -- nosy: +n

[issue18245] In itertools.groupby() make data plural

2013-06-17 Thread Ned Batchelder
Ned Batchelder added the comment: Please don't make this change. "Data" is used as a singular collective noun, especially in software contexts. "Data" as a plural noun sounds archaic, or at best, scientific. -- nosy: +nedbat _

[issue14803] Add -C option to run code at Python startup

2012-05-14 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue14803> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14803] Add -C option to run code at Python startup

2012-05-14 Thread Ned Batchelder
Ned Batchelder added the comment: The difficulty that coverage faces is not measuring python programs started from the command line like this, you can use "coverage run myprog.py" or "python -m coverage run myprog.py". The difficulty is when there are subprocesses run

[issue15256] Typo in error message

2012-07-05 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue15256> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-29 Thread Ned Batchelder
Ned Batchelder added the comment: > I'm -0.5 myself, though, for the reason that it complicates the startup > process a little bit more, without looking very compelling. It smells > disturbingly like LD_PRELOAD to me. Antoine, do you have a suggestion for how to solve the cover

[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-29 Thread Ned Batchelder
Ned Batchelder added the comment: Chris: The real problem is that it isn't the "test suite" that spawns the processes, the tests invoke product code, and the product code spawns Python. So modifying the Python-spawning really means modifying the product code to do something

[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-29 Thread Ned Batchelder
Ned Batchelder added the comment: Chris, I'm not sure how to answer your questions. The more powerful and flexible, the better. There is no "must" here. I'm looking for a way to avoid the hacks coverage.py has used in the past to measure coverage in subprocesses. A l

[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-31 Thread Ned Batchelder
Ned Batchelder added the comment: I agree with Antoine: I don't see why this should be a feature of virtualenvs. It's easy to use environment variables in a tightly-controlled way. We don't worry that any of the other environment variables that affect Python execution will

[issue15541] logging.exception doesn't accept 'extra'

2012-08-02 Thread Ned Batchelder
New submission from Ned Batchelder: The logging.exception method differs from .debug(), .info(), .warning(), .error() and .critical() in that it does not accept an `extra` keyword argument. There seems to be no reason for this. The docs are misleading about this. They say, "The argument

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
New submission from Ned Batchelder: When tokenizing with tokenize.generate_tokens, if the code ends with whitespace (no newline), the tokenizer produces an ERRORTOKEN for each space. Additionally, the regex that fails to find tokens in those spaces is linear in the number of spaces, so the

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
Ned Batchelder added the comment: Here's a patch for 3.3. I would like to also fix 2.7... -- keywords: +patch Added file: http://bugs.python.org/file27459/bug16152.patch ___ Python tracker <http://bugs.python.org/is

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
Changes by Ned Batchelder : Removed file: http://bugs.python.org/file27459/bug16152.patch ___ Python tracker <http://bugs.python.org/issue16152> ___ ___ Python-bugs-list m

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
Changes by Ned Batchelder : Added file: http://bugs.python.org/file27466/bug16152_v33.patch ___ Python tracker <http://bugs.python.org/issue16152> ___ ___ Python-bug

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
Changes by Ned Batchelder : Added file: http://bugs.python.org/file27467/bug16152_v27.patch ___ Python tracker <http://bugs.python.org/issue16152> ___ ___ Python-bug

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-06 Thread Ned Batchelder
Ned Batchelder added the comment: Updated with new (better) patch, for v2.7 and v3.3. They are the same except for the test. -- ___ Python tracker <http://bugs.python.org/issue16

[issue16152] Trailing whitespace makes tokenize.generate_tokens pathological

2012-10-09 Thread Ned Batchelder
Ned Batchelder added the comment: Jesús, done! -- ___ Python tracker <http://bugs.python.org/issue16152> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21232] Use of '1' instead of 'True' as 'splitlines' argument in difflib documentation

2014-04-18 Thread Ned Batchelder
Ned Batchelder added the comment: Although the OP was incorrect about 1 being guaranteed to be True, it is still better documentation to use True rather than 1 for a boolean argument. -- nosy: +nedbat ___ Python tracker <http://bugs.python.

[issue2506] Add mechanism to disable optimizations

2014-05-19 Thread Ned Batchelder
Ned Batchelder added the comment: Raymond, thanks for keeping us honest! I am still hoping to convince people that this is a good idea. I think Guido's +1 (https://mail.python.org/pipermail/python-dev/2012-December/123099.html) should help in that regard. Part of your reason for to

[issue2506] Add mechanism to disable optimizations

2014-05-21 Thread Ned Batchelder
Ned Batchelder added the comment: Python-Ideas thread started: https://mail.python.org/pipermail/python-ideas/2014-May/027893.html -- ___ Python tracker <http://bugs.python.org/issue2

[issue2506] Add mechanism to disable optimizations

2014-05-22 Thread Ned Batchelder
Ned Batchelder added the comment: I thought we were discussing this on Python-Ideas? -- ___ Python tracker <http://bugs.python.org/issue2506> ___ ___ Python-bug

[issue21625] help()'s more-mode is frustrating

2014-06-01 Thread Ned Batchelder
New submission from Ned Batchelder: >From the #python IRC channel: ``` [07:55:29] tonysar hello.new to programming and python, i use mac terminal but problem i have is , when i use help function of python to look up something , i lose my prompt and i have no idea how to go back , wha

[issue21625] help()'s more-mode is frustrating

2014-06-01 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks, this is a very complete explanation of the machinery behind the scenes. I think we would do beginners a service if we made the behavior a bit less obscure. Are there ways that we could (for example) have the prompt say "END (q to quit)"

[issue21625] help()'s more-mode is frustrating

2014-06-02 Thread Ned Batchelder
Ned Batchelder added the comment: Serhiy, thanks for the configuration tip. But you seem to be missing my point, which is that beginners need the default to be a little more friendly. I don't want to make it bad for experienced users, of course. I doubt Unix users will be confus

[issue16404] Uses of PyLong_FromLong that don't check for errors

2012-11-04 Thread Ned Batchelder
New submission from Ned Batchelder: Examining the CPython sources, there are a number of places where PyLong_FromLong is used without checking its return value. In places where it is done correctly, PyErr_Occurred is often used to avoid having to check every call. Here are places where it

[issue6359] pyexpat.c calls trace function incorrectly for exceptions

2012-11-09 Thread Ned Batchelder
Ned Batchelder added the comment: I have no idea why pyexpat.c invokes the trace function in the first place. Unless someone can explain why it does that when no other C extension does, my inclination would be to make it stop calling the trace function at all, not to fix how it calls it

[issue7083] locals() behaviour differs when tracing is in effect

2012-11-13 Thread Ned Batchelder
Ned Batchelder added the comment: ITSM this could use more clarification. It is subtle and baffling. I'm struggling to come up with sentences to make it clearer, though. -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/i

[issue7083] locals() behaviour differs when tracing is in effect

2012-11-14 Thread Ned Batchelder
Ned Batchelder added the comment: I wrote about this here: http://nedbatchelder.com/blog/201211/tricky_locals.html A reader suggested this addition to the docs, which I like: "Multiple invocations within the scope update and return the same dictionary instance. When a trace function

[issue16571] Iterating over inconsistently-indented code block causes execution of code only on last iteration of loop

2012-11-28 Thread Ned Batchelder
Ned Batchelder added the comment: @Brian: Your code doesn't run in Python 2.7 as you've shown it, it produces an IndentationError. If your code is actually different, and does run, try running it with the -tt flag on Python, which will warn about inconsistent indentation. -

[issue14373] C implementation of functools.lru_cache

2012-12-20 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: -nedbat ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16822] execv (et al.) should invoke atexit handlers before executing new code

2012-12-30 Thread Ned Batchelder
New submission from Ned Batchelder: If I register an atexit handler, and then call os.execv, the handler is not invoked before my process changes over to the new program. Shouldn't it be? My program is ending, so my atexit handlers should be invoked. This is based on this coverage.p

[issue16653] reference kept in f_locals prevents the tracing/profiling of a destructor

2012-12-31 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue16653> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17009] "Thread Programming With Python" should be removed

2013-01-21 Thread Ned Batchelder
New submission from Ned Batchelder: Sorry if this is the wrong bug tracker for this issue. Someone just asked in #python what they should do about the fact that Python has no threads on the Mac. When asked why they thought that, they pointed to this: http://www.python.org/doc/essays

[issue19184] dis module has incorrect docs for RAISE_VARARGS

2013-10-06 Thread Ned Batchelder
New submission from Ned Batchelder: The order of values on the stack is backwards for RAISE_VARARGS. The docs say: "Raises an exception. argc indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as

[issue19611] inspect.getcallargs doesn't properly interpret set comprehension code objects.

2013-11-15 Thread Ned Batchelder
New submission from Ned Batchelder: In 2.7, set comprehensions are compiled to code objects expecting an argument named ".0". This convention is also used for the unnamed arguments needed by tuple arguments. inspect.getcallargs understands the tuple argument case, but n

[issue19611] inspect.getcallargs doesn't properly interpret set comprehension code objects.

2013-11-15 Thread Ned Batchelder
Ned Batchelder added the comment: BTW: I don't hold any illusions that this bug is important enough to fix, but I would be interested in hearing ideas about how I could work around it... -- ___ Python tracker <http://bugs.python.org/is

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Ned Batchelder
Ned Batchelder added the comment: There are other forms of numbers allowed by Python that are not allowed by JSON: "001.1" Oddly, with all of the strictness in JSON, the exponent-marker "e" can be upper- or lower-case: 1e1 and 1E1 are both valid JSON.

[issue16669] Docstrings for namedtuple

2013-12-08 Thread Ned Batchelder
Ned Batchelder added the comment: I'll add my voice to those asking for a way to put docstrings on namedtuples. As it is, namedtuples get automatic docstrings that seem to me to be almost worse than none. Sphinx produces this: ``` class Key Key(scope, user_id, block_sco

[issue19931] namedtuple docstrings are verbose for no added benefit

2013-12-08 Thread Ned Batchelder
New submission from Ned Batchelder: When I make a namedtuple, I get automatic docstrings that use a lot of words to say very little. Sphinx autodoc produces this: ``` class Key Key(scope, user_id, block_scope_id, field_name) __getnewargs__() Return self as a plain tuple

[issue22022] test_pathlib: shutil.rmtree() sporadic failures on Windows

2014-07-21 Thread Ned Batchelder
Ned Batchelder added the comment: FWIW, every use of rmtree I have on Windows occasionally fails this way, parallelism seems not to be a factor. -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue22

[issue19950] Document that unittest.TestCase.__init__ is called once per test

2013-12-10 Thread Ned Batchelder
Ned Batchelder added the comment: This sentence seems to cover it: "Each instance of the TestCase will only be used to run a single test method, so a new fixture is created for each test." from http://docs.python.org/2/library/unittest.html The word "fixture" here is b

[issue6954] DISTUTILS_DEBUG causes stack trace, really simple fix

2009-09-20 Thread Ned Batchelder
New submission from Ned Batchelder : If you set the environment variable DISTUTILS_DEBUG=1, distutils will run with DEBUG, which will trace internal activity. But one of the traces is incorrect, and leads to this stack trace: Traceback (most recent call last): File "setup.py", li

[issue6954] DISTUTILS_DEBUG causes stack trace, really simple fix

2009-09-20 Thread Ned Batchelder
Ned Batchelder added the comment: Another one: Traceback (most recent call last): File "setup.py", line 72, in **addl_args File "c:\python31\lib\distutils\core.py", line 149, in setup dist.run_commands() File "c:\python31\lib\distutils\dist.py&qu

[issue6359] pyexpat.c calls trace function incorrectly for exceptions

2009-06-28 Thread Ned Batchelder
New submission from Ned Batchelder : Pyexpat.c calls the tracing function explicitly (not sure why). When it intercepts an exception, it calls the function with PyTrace_EXCEPTION, but then leaves the scope without calling PyTrace_RETURN. This is incorrect. There should always be a

[issue231540] threads and profiler don't work together

2010-07-23 Thread Ned Batchelder
Ned Batchelder added the comment: Isn't this problem solved by the threading.settrace and threading.setprofile functions? -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/iss

[issue9332] Document requirements for os.symlink usage on Windows

2010-08-01 Thread Ned Batchelder
Ned Batchelder added the comment: This breaks virtualenv3 on Python 3.2, which simply test for the existence of os.symlink, which then fails for lack of privileges. Perhaps an os.can_symlink() method, returning a boolean? It can request privileges if you like, but provides a simple test

[issue29048] Coverage influence tests, make some of them fail

2016-12-24 Thread Ned Batchelder
Ned Batchelder added the comment: I doubt very very much that coverage.py is stealing stderr. Many many test suites would have this problem if that were true. More likely is that somehow __del__ is not being invoked when you need it to be. I tried running the tests under coverage also, and

[issue29048] Coverage influence tests, make some of them fail

2016-12-24 Thread Ned Batchelder
Ned Batchelder added the comment: Are you sure the code that tried to print to stderr was even run? It's in a __del__ method, which is notorious for being affected by surprising things. -- ___ Python tracker <http://bugs.python.org/is

[issue29048] Coverage influence tests, make some of them fail

2016-12-24 Thread Ned Batchelder
Ned Batchelder added the comment: Can you show the output of "coverage debug sys"? -- ___ Python tracker <http://bugs.python.org/issue29048> ___ ___

[issue29048] Coverage influence tests, make some of them fail

2016-12-24 Thread Ned Batchelder
Ned Batchelder added the comment: I don't believe this is coverage.py's fault, so I don't have an answer to your question. There is no revision of coverage.py that *does* swallow stderr. Also, as you can see from the test output, it isn't swallowed, it's not being

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
New submission from Ned Batchelder: Creating two Random() instances in quick succession produces the same sequence, but only on Windows on Python 3.6. On 3.5 or earlier, or on Mac/Linux, the randomization is good. Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
Changes by Ned Batchelder : -- versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue29085> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
Ned Batchelder added the comment: Adding a time.sleep(0.001) (or maybe even just 0) between the calls prevents the problem. -- ___ Python tracker <http://bugs.python.org/issue29

[issue17894] Edits to descriptor howto

2017-02-27 Thread Ned Batchelder
Ned Batchelder added the comment: I'm still interested in moving this forward. I can make a GitHub pull request if that would help. -- ___ Python tracker <http://bugs.python.org/is

[issue27825] Make the documentation for statistics' data argument clearer.

2016-08-21 Thread Ned Batchelder
New submission from Ned Batchelder: The docs for statistics.mean say, "Return the sample arithmetic mean of data, a sequence or iterator of real-valued numbers." Most of the functions in statistics have a `data` argument, but this function is the only one that says, "a seque

[issue17351] Fixed python3 descriptor documentation example + removal of explicit "object" inheritance in docs

2013-03-09 Thread Ned Batchelder
Ned Batchelder added the comment: Why is it important to remove subclassing object? Isn't it still good form to mention object as a base class. -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/is

[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue17546> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11205] Evaluation order of dictionary display is different from reference manual.

2013-03-28 Thread Ned Batchelder
Ned Batchelder added the comment: Since this is documented in the Python Language Reference, it doesn't make much sense to have it describe one way for 3.3 and another for 3.4, does it? By definition, doesn't that make this an implementation dependency? We should update the docs t

[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-28 Thread Ned Batchelder
Ned Batchelder added the comment: Changing the type of the locals() return isn't the right way to solve this problem. Better docs is the way to do it. If someone is calling locals(), they should read the docs. Examining the type of values is discouraged in Python, we shouldn

[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-30 Thread Ned Batchelder
Ned Batchelder added the comment: I would say it something like this: "The dictionary returned by locals() is an accurate snapshot of the local namespace at the time it is called. After the call returns, changes to one may or may not be reflected in the other. The dictionary may c

[issue17713] test_logging fails in test_compute_rollover_weekly_attime

2013-04-13 Thread Ned Batchelder
New submission from Ned Batchelder: I just pulled down the tip of CPython, built it, and ran the tests, and got this failure: ``` == FAIL: test_compute_rollover_weekly_attime (test.test_logging.TimedRotatingFileHandlerTest

[issue17718] boolop constant checking for if/while

2013-04-13 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue17718> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17799] settrace docs are wrong about "c_call" events

2013-04-19 Thread Ned Batchelder
New submission from Ned Batchelder: Looking into this Stack Overflow question: http://stackoverflow.com/questions/16115027/pythons-sys-settrace-wont-create-c-call-events Reading the code in c_eval.c and friends, it looks like "c_call" events are never passed to the trace functio

[issue6359] pyexpat.c calls trace function incorrectly for exceptions

2013-04-20 Thread Ned Batchelder
Ned Batchelder added the comment: Attached a patch which simply removes the code that invokes the trace function. -- keywords: +patch Added file: http://bugs.python.org/file29951/6539.patch ___ Python tracker <http://bugs.python.org/issue6

[issue17894] Edits to descriptor howto

2013-05-02 Thread Ned Batchelder
New submission from Ned Batchelder: I find the explanations in the Descriptor howto to be difficult to understand. I took a stab at changing the first few sections to introduce the concepts in an easier-to-grasp style. Issue 12077 also covers a little bit of this. -- assignee: docs

[issue17898] gettext bug while parsing plural-forms metadata

2013-05-03 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue17898> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12077] Harmonizing descriptor protocol documentation

2013-05-03 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue12077> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17894] Edits to descriptor howto

2013-05-04 Thread Ned Batchelder
Ned Batchelder added the comment: I worked with Ezio to make a new patch with the full edits. I have other ideas for edits to the rest of the document, but we can discuss those if you like these... -- Added file: http://bugs.python.org/file30127/descriptor_howto_2.patch

[issue17894] Edits to descriptor howto

2013-05-04 Thread Ned Batchelder
Ned Batchelder added the comment: Raymond, I'm glad you're on top of this. I would have thought the howto should be the easy on-ramp, and deeper authoritative details should go in the reference section. -- ___ Python trac

[issue17914] add os.cpu_count()

2013-05-06 Thread Ned Batchelder
Ned Batchelder added the comment: If you can't determine the number of CPUs, return a clear "can't determine" value, such as 0 or -1. Returning 1 will hide information, and it's an easy default for the caller to apply if they want to.

[issue17914] add os.cpu_count()

2013-05-06 Thread Ned Batchelder
Ned Batchelder added the comment: Seriously, return zero, and I can use it as: cpu_count = os.cpu_count() or 1 Why throw away information? -- ___ Python tracker <http://bugs.python.org/issue17

[issue17914] add os.cpu_count()

2013-05-11 Thread Ned Batchelder
Ned Batchelder added the comment: A few small points: Use `num is None` instead of `num == None`. Use `isinstance(cpus, int)` rather than `type(cpus) is int`. And this I think will throw an exception in Python 3: `cpus >= 1 or cpus == None`, because you can't compare N

[issue17914] add os.cpu_count()

2013-05-11 Thread Ned Batchelder
Ned Batchelder added the comment: @Yogesh: if cpus is None, then this will raise an exception in Python 3: `cpus >= 1 or cpus == None` Perhaps you don't have enough test cases yet. -- ___ Python tracker <http://bugs.python.org

[issue17914] add os.cpu_count()

2013-05-13 Thread Ned Batchelder
Ned Batchelder added the comment: Python's goal is not to emulate the suboptimal parts of other languages. We have dynamic typing, and so can return None from the same function that returns 1. And we have compact expressions like `cpu_count() or 1`, so we don't have to make u

[issue17982] Syntax Error in IDLE3 not in IDLE

2013-05-15 Thread Ned Batchelder
Ned Batchelder added the comment: Python 3 has no print statement, it has a print function, so you need: print("Hello, world!") -- nosy: +nedbat ___ Python tracker <http://bugs.python.o

[issue18031] The Python Tutorial says % string formatting will be removed

2013-05-22 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue18031> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22785] range docstring is less useful than in python 2

2014-11-02 Thread Ned Batchelder
New submission from Ned Batchelder: The Python 3.4 docstring for range is: {{{ | range(stop) -> range object | range(start, stop[, step]) -> range object | | Return a virtual sequence of numbers from start to stop by step. }}} In Python 2.7, it said: {{{ range(stop) ->

[issue20844] SyntaxError: encoding problem: iso-8859-1 on Windows

2014-12-27 Thread Ned Batchelder
Ned Batchelder added the comment: This bug just bit me. Changing "# coding: utf8" to "# coding: utf-8" works around it. -- nosy: +nedbat ___ Python tracker <http://bug

[issue20844] SyntaxError: encoding problem: iso-8859-1 on Windows

2014-12-27 Thread Ned Batchelder
Ned Batchelder added the comment: (oops: with Python 3.4.1 on Windows) -- ___ Python tracker <http://bugs.python.org/issue20844> ___ ___ Python-bugs-list mailin

[issue24452] Make webbrowser support Chrome on Mac OS/X

2015-06-14 Thread Ned Batchelder
New submission from Ned Batchelder: This doesn't work on Python 3.4 on a Mac with Yosemite and Chrome installed: import webbrowser webbrowser.get("chrome") This patch makes it work: ``` *** /usr/local/pythonz/pythons/CPython-3.4.1/lib/python3.4/webbrowser.py 2

[issue24632] Improve documentation about __main__.py

2015-07-14 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, the Stack Overflow answer: http://stackoverflow.com/a/4043007 -- ___ Python tracker <http://bugs.python.org/issue24

[issue25260] python -m test --coverage doesn't work on Windows

2015-09-28 Thread Ned Batchelder
Ned Batchelder added the comment: What version of coverage.py is this? -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue25260> ___ ___ Python-bug

[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ned Batchelder
New submission from Ned Batchelder: The MANIFEST.in file for coverage.py excludes directories line doc/_build. If I run "python setup.py --quiet develop", I get output like this: python3.5 setup.py --quiet develop no previously-included directories found matching 'doc

[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ned Batchelder
Ned Batchelder added the comment: You are right that "develop" is from setuptools. The same messages appear with "sdist": $ python setup.py --quiet sdist no previously-included directories found matching 'doc/_build' no previously-included directorie

[issue20438] inspect: Deprecate getfullargspec?

2015-10-25 Thread Ned Batchelder
Ned Batchelder added the comment: I'm confused: the discussion here is mostly about updating docs to note deprecation. Then at the very end, is an off-hand remark about removing getargspec. The docs for getargspec currently read, "This function will be removed in Python 3.6."

[issue20438] inspect: Deprecate getfullargspec?

2015-10-26 Thread Ned Batchelder
Ned Batchelder added the comment: This is the situation I am in: coverage.py uses getargspec in a very simple way in its tooling. I support 2.7 and 3.5, so I have to do this: try: getargspec = inspect.getfullargspec except AttributeError: getargspec

[issue25486] Resurrect inspect.getargspec() in 3.6

2015-10-26 Thread Ned Batchelder
Changes by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <http://bugs.python.org/issue25486> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23619] Python 3.5.0a2 installer fails on Windows

2015-12-25 Thread Ned Batchelder
Ned Batchelder added the comment: I tried to install 3.5.1 32-bit into a fresh virtualbox image from https://dev.windows.com/en-us/microsoft-edge/tools/vms/mac/ (IE 10 on Win 7), and got this same error message. Python will not run, it only shows

[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-25 Thread Ned Batchelder
New submission from Ned Batchelder: I tried to install 3.5.1 32-bit into a fresh virtualbox image from https://dev.windows.com/en-us/microsoft-edge/tools/vms/mac/ (IE 10 on Win 7), and got this error message. When I try to run Python with "py -3", it will not run, it

[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Ned Batchelder
Ned Batchelder added the comment: This was my second attempt, and there is no other installation running. -- ___ Python tracker <http://bugs.python.org/issue25

[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Ned Batchelder
Ned Batchelder added the comment: This is in a virtualbox. I have my host OS files mapped in the guest Windows OS to drive N:. When I try to install by running N:\Downloads\python-3.5.1.exe, it fails with the error shown above. When I copy the file to the C: drive, it succeeds

<    1   2   3   4   >