[issue35595] Add sys flag to always show full paths in stack traces (instead of relative paths)

2018-12-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 2.7 is (almost) end of life and well beyond feature-freeze, so this can only go into 3.8 or better. Since the paths logged are relative to the current working directory, perhaps you could just have your script log the working directory

[issue35575] Improved range syntax

2018-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: These proposals probably should be discussed on Python-Ideas first. You should also familiarize yourself with previous proposals to enhance range, such as https://mail.python.org/pipermail/python-ideas/2018-November/054510.html and the bug report #35200

[issue35574] Coconut support

2018-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: One more thing: if you intend to proceed with this, either as individual enhancements or a PEP, you should discuss them on the Python-Ideas mailing list first, to see how much or little community support the proposals have. Until then, I'm closing

[issue35574] Coconut support

2018-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: Do you have agreement from the maintainer(s) of Coconut that they are willing to put Coconut into the Python language and/or std library? Given that Coconut is effectively a radically different language from Python (a superset of Python

[issue35576] function splitextTest does not return expected value

2018-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please provide a proper reproducible bug report. Don't make us GUESS what function you are referring to. I don't know any "splitextTest" function that you describe in the bug report title. Do you mean os.path.splitext? Then you sho

[issue35573] is_HDN is returns false positive and false negative value for two test cases respectively

2018-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: What is the module "cookiejar" you are importing? Is that a third-party module? It doesn't seem to be in the standard library. There is a module `http.cookiejar` but it doesn't seem to have an `is_HDN` function. If this is a third-party libra

[issue35549] Add partial_match: bool = False argument to unicodedata.lookup

2018-12-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's my implementation: from unicodedata import name from unicodedata import lookup as _lookup from fnmatch import translate from re import compile, I _NAMES = None def getnames(): global _NAMES if _NAMES is None: _NAMES = [] for i

[issue35549] Add partial_match: bool = False argument to unicodedata.lookup

2018-12-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I love the idea, but dislike the proposed interface. As a general rule of thumb, Guido dislikes "constant bool parameters", where you pass a literal True or False to a parameter to a function to change its behaviour. Obviously this is not a

[issue35544] unicode.encode docstring says return value can be unicode

2018-12-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I'll keep on finding "-> string or unicode" misleading. How is it misleading when its true? -- ___ Python tracker <https://bugs.py

[issue35544] unicode.encode docstring says return value can be unicode

2018-12-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: Encoding and decoding, in the most general sense, can include unicode -> unicode and bytestring -> bytestring. I can't see any standard unicode->unicode encodings in Python 2.7 https://docs.python.org/2/library/codecs.html but we can create

[issue35530] Counter-intuitive logging API

2018-12-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Dec 19, 2018 at 10:37:22AM +, Mark Dickinson wrote: > > Mark Dickinson added the comment: > > The call to `logging.error` is *not* irrelevant here. It's causing an > implicit, and surprising (albeit documented), call to > `l

[issue35530] Counter-intuitive logging API

2018-12-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: > That's true. Maybe and warning or Exception can be raise? Why would we raise a warning or exception for expected behaviour? logging.error() and some_instance.error() don't necessarily produce the same output. What would the exception say? FatalEr

[issue35530] Counter-intuitive logging API

2018-12-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: The call to logging.error() is irrelevant, since there's no expectation that the module-level function will necessarily output the same as a method of a specific instance logger.error(). I agree that is it quite curious that the first call to logger.error

[issue35522] os.stat().st_ctime and time.time() mismatch

2018-12-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: In the future, please describe your problem here, on the bug tracker, not just by linking to Stackoverflow. You asked: "Why is the file creation time [less than] the time measured before it is created?" (You actually say "greater than&qu

[issue35496] left-to-right violation in match order

2018-12-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > See attached script, which is self-explanatory. I'm glad one of us thinks so, because I find it clear as mud. I spent *way* longer on this than I should have, but I simplified your sample code to the best of my ability. (See attached.) As far as I

[issue35449] documenting objects

2018-12-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: I asked: > > Are you suggesting we need new syntax to automatically assign docstrings > > to instances? Stefan replied: > No, I'm not suggesting that. And then immediately went on to suggest new syntax for automatically binding a st

[issue35449] documenting objects

2018-12-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Is there any discussion concerning what syntax might be used for > docstrings associated with objects ? I don't know about PyDoc in general, but I would expect help(obj) to just use obj.__doc__ which will return the instance docstring if it

[issue35449] documenting objects

2018-12-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Minor note on terminology: classes and functions are themselves objects. I think that help() (or in particular PyDoc in general) should support any instance with a __doc__ attribute. Its failure to do so is causing pain, see #12154. -- nosy

[issue35443] Add Tail Call Optimization

2018-12-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I see nothing wrong with adding Tail Call Optimization to Python. That's nice. Is that supposed to be an argument that convinces us? You are hardly the first person ever to suggest TCO for Python: https://duckduckgo.com/?q=tail+call+optimization+s

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Any ideas? Or I will create a PR in a week without 'CPython implementation > detail' I don't think we want to give any stability guarantees for this. Perhaps we should explicitly state that this is not guaranteed behaviour and may change in the

[issue35431] Add a function for computing binomial coefficients to the math module

2018-12-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Brett, what was the purpose of the title change? > title: The math module should provide a function for computing > binomial coefficients -> Add a function for computing binomial > coefficients to the

[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Dec 07, 2018 at 01:37:36PM +, Mark Dickinson wrote: > I'd personally prefer that floats not be accepted; Agreed. We can always add support for floats later, but its hard to remove it if it turns out to be problematic. We ought to require n

[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: > > Mathematically, `binomial(n, k)` for `k > n` is defined as 0. > > It's not so clear cut. You can find different definitions out there. > Knuth et. al., for example, in the book "Concrete Mathematics", extend > the de

[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Dec 07, 2018 at 12:04:44AM +, Raymond Hettinger wrote: > Also, I'm not sure what the predominant choice for variable names > should be, "n things taken r at a time" or "n things taken k at time". > > Also

[issue35435] Documentation of 3.3 is available

2018-12-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Documentation is available for all versions going back to Python 1.4. https://docs.python.org/release/1.4/ As it should be: I'm surely not the only person who has need to check old versions of the documentation from time to time. Not everyone is using

[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: You import reduce but never use it :-) +1 for this, I certainly miss it too. -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue35

[issue35407] Datetime function with selenium

2018-12-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is for reporting bugs in the Python interpreter and standard library, not for asking for help with bugs in your own code. The code you show contains a syntax error (some of the indentation is wrong) and at least one undefined variable, &quo

[issue35403] support application/wasm in mimetypes and http.server

2018-12-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 3.7 is in feature-freeze, so any new features like this will have to be 3.8 only. -- nosy: +steven.daprano versions: -Python 3.7 ___ Python tracker <https://bugs.python.org/issue35

[issue35397] Undeprecate and document urllib.parse.unwrap

2018-12-03 Thread Steven D'Aprano
New submission from Steven D'Aprano : The urllib.parse module contains an undocumented function unwrap: unwrap('') --> 'type://host/path' This is useful. I've been re-inventing this function in many of my scripts, because I didn't know it existed (not documented!) and only stumb

[issue35377] urlparse doesn't validate the scheme

2018-12-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm changing the name to better describe the problem, and suggest a better solution. The urlparse.urlsplit and .urlunsplit functions currently don't validate the scheme argument, if given. According to the RFC: Scheme names consist of a sequence

[issue35377] urlsplit scheme argument broken

2018-12-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: You haven't given a convincing reason that there is a problem that needs fixing, or if there is, that your patch is the right way to fix it. You have already pointed out that there is at least one scheme where :/// is part of a valid URL: "file:///&qu

[issue35382] Something wrong with pymysql

2018-12-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Also, for future reference, please spend the time to make a good bug report, showing the minimum code needed to reproduce the error, and the full error, not just a summary. Please read this before your next bug report: http://sscce.org/ Thank you

[issue35377] urlsplit scheme argument broken

2018-12-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think this is broken, but I do think it could be documented better. You have to read the documentation for `urlparse` to see this: [Quote] Following the syntax specifications in RFC 1808, urlparse recognizes a netloc only if it is properly

[issue34850] Emit a syntax warning for "is" with a literal

2018-11-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looks like we have a stand-off between core devs, and no BDFL to make a ruling. There is support for the feature from at least Barry and Raymond (although I think Guido was cool on the idea, maybe?). Gregory, do you feel strongly enough about

[issue35340] global symbol "freegrammar" should be made static ore renamed

2018-11-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: What "freegrammar" symbol are you referring to? Why should it be made static or renamed? 2.7 is something like a decade old now, why do you describe this as a new symbol? -- nosy: +steven.daprano

[issue35339] Populating instances of class automatically

2018-11-28 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue35200] Make the half-open range behaviour easier to teach

2018-11-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Raymond: > I'm in agreement with the comments that the proposed __str__ revision is > confusing. In what way is it "confusing"? I'm especially perplexed that Julien apparently thinks it is confusing when emitted by str(), but educational

[issue35200] Make the half-open range behaviour easier to teach

2018-11-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Nov 18, 2018 at 10:27:11PM +, Julien Palard wrote: > > Julien Palard added the comment: > > If I understand correctly, you'd like str(range(10)) to return " [1, 2, ..., 8, 9]>"? Exactly the same as you suggested for

[issue35274] Running print("\x98") then freeze in Interpreter

2018-11-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm afraid I can't reproduce that in Python 3.5.2 or 3.6.4. Can you try this? from time import time print(time(), '\x98', time()); print(time()) and copy and paste the results. What terminal/console are you using? If you change to a different console

[issue35200] Make the half-open range behaviour easier to teach

2018-11-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Nov 18, 2018 at 09:43:02PM +, Julien Palard wrote: > My first though went to giving something really simple like: > > >>> print(range(10)) > 1, 2, ..., 8, 9 -1 Surely that would be your *second* thought, since you alr

[issue35256] The Console of Python 3.7.0.

2018-11-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't understand what you think is the bug. You keep repeatedly appending 'z' to the same list. Why are you surprised that it appends 'z' more than once? If you don't want to append it twice, don't call the function twice. Every time you call

[issue35245] list comprehension for flattened or nested list differ too much

2018-11-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: > l2 = [str(leaf) for leaf in tree for tree in forest] Expanded to nested loops, that becomes: l2 = [] for leaf in tree: for tree in forest: l2.append(str(leaf)) which of course gives a NameError, because you are trying to iterate over a t

[issue35224] PEP 572: Assignment Expressions

2018-11-13 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35221] Enhance venv activate commands readability

2018-11-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://docs.python.org/3/library/venv.html > my students are often confused by it, sometimes they copy the angle brackets, > sometime even the prompt. Learning to recognise placeholders and the prompt is an essential part of learning to code, and a

[issue35200] Range repr could be better

2018-11-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I've never seen any student try `str(range(10))` in the repl I never suggested that students would try calling str() directly. That would be silly. They would use print(), as I'm sure many of them are already doing. After 20+ years of using Python

[issue35200] Range repr could be better

2018-11-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: With the proposed design, any two empty range objects have the same repr: repr(range(0)) == repr(range(2, 2)) == repr(range(1, 5, -1)) etc. Between this loss of information, and the loss of round-tripping through eval, I'm against this proposal. But I'd

[issue35200] Range repr could be better

2018-11-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Not everyone knows the '...' convention. At least according to Google's predictive search, if I type "what does three dots" I get common searches such as "what does three dots mean at the end of a sentence" and similar. How does you

[issue35176] for loop range bug

2018-11-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, this is standard behaviour, working as designed. 'a' is not a copy of the list 'x', 'a' is another name for the same list as 'x'. Any in-place modifications you make to 'a' happens to the object itself, the list, which is visible

[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: How weird... after restarting the interpreter, I can't reproduce that TypeError. I get the AssertionError Serhiy showed. -- ___ Python tracker <https://bugs.python.org/issue35

[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: You say it doesn't work as expected, but you don't say what you expect or why. (Don't make me guess what you mean -- explicit is better than implicit.) When I try your subclass in 3.6, I get an unexpected TypeError: py> class Dict(dict): ... def k

[issue35165] Possible wrong method name in attribute references doc

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://docs.python.org/3/reference/expressions.html#attribute-references __getattr__ is the correct method to override in most (but not all) cases. I don't think we should encourage people to override __getattribute__ as the first resort

[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug in Python, it is an invalid (broken) regular expression. There is nothing that the interpreter or the regular expression engine can do, because you are telling it to do something that makes no sense. What do you expect findall to find

[issue35124] Add style guide for unit tests

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think this is being excessively prescriptive and solving a problem that isn't a problem. But perhaps if you start by proposing a concrete style guide, I can judge better. -- nosy: +steven.daprano ___ Python

[issue35123] Add style guide for sentinel usage

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I was not aware that there currently were arguments about the use of sentinels in future code. I feel that you are being excessively prescriptive here: "we should nip it in the bud" is good advice for gardening, but for programming it just result

[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: There is no need to split the relevant code into a third-party website, especially when it is so small and can be included in-line here. Python 2.7: py> import distutils.version py> distutils.version.LooseVersion('7') > distutils.version.LooseVe

[issue35098] Deleting __new__ does not restore previous behavior

2018-10-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Its quite valid to assign to __new__ to replace the behavior of how an > instance is created. Of course it is, and I never argued otherwise. > Finally as for `Color.__x__` assignment, this has nothing to do with > `__slots__` as it

[issue35098] Deleting __new__ does not restore previous behavior

2018-10-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think the real WTF here is that you can write to arbitrary dunder attributes even if they aren't listed in __slots__. py> Color.__NOBODY_expects_the_Spanish_Inquisition__ = "What?" py> Color.__NOBODY_expects_the_Spanish_Inquisition__

[issue35085] FileNotFoundError: [Errno 2] No such file or directory:

2018-10-28 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue35085] FileNotFoundError: [Errno 2] No such file or directory:

2018-10-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: What do you mean, a crash report? You get a traceback telling you the problem: the file is missing. What behaviour did you expect if you try to decode a non-existent file? Perhaps you meant to write: python3 -m base64 -t "12s345a2" I d

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yes, that's exactly right. That's how local variables work in Python: x = 999 # global x def demo(): if False: x = 1 x # local x has no value does the same thing. This is standard, documented behaviour, regardless of which kind of assignment

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Stéphane, I'm curious why you asked for a pastebin when James already provided the code right here in the tracker? (Your email even included a copy of that code.) Why split the information into another website

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is expected behaviour: import is a form of assignment. "import logging", like "logging = 1", tells the compiler to treat logging as a local variable (unless you declare logging as global). As the exception says, you are trying t

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: > And you are free to use whatever sorting algorithms in its implementation for > this kind of task. That's very kind of you *wink* At this point, I don't think there's much more point to discussing this further until Tim Peters weighs in and lets u

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: The ``sorted`` docs links to the Sorting HOWTO, the ``list.sort`` docs should do the same. https://docs.python.org/3/library/functions.html#sorted https://docs.python.org/3/library/stdtypes.html#list.sort

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since sort is guaranteed to be stable, can't you sort in two runs? py> values = ['bc', 'da', 'ba', 'abx', 'ac', 'ce', 'dc', 'ca', 'aby'] py> values.sort(key=itemgetter(1), reverse=True) py> values.sort(key=itemgetter(0)) py> values ['ac', 'abx'

[issue34991] variable type list [] referential integrity data loss

2018-10-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't know what you mean by "referential integrity data loss". I have absolutely no idea how to interpret the wall of output you have provided. If there is a bug here, how do you know it is a language bug rather than a bug in your own co

[issue34948] Document __warningregister__

2018-10-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 10, 2018 at 05:11:01AM +, Serhiy Storchaka wrote: > I don't think that it is necessary to state its format. It is an > opaque dictionary, and its format is an implementation detail. There is at least one use-case for wanting to mani

[issue34948] Document __warningregister__

2018-10-09 Thread Steven D'Aprano
New submission from Steven D'Aprano : The warnings module makes use of a per-module global ``__warningregister__`` which is briefly mentioned in the docs but not documented. https://docs.python.org/3/library/warnings.html#warnings.warn_explicit Given that it is part of the warn_explicit API

[issue34928] string method .upper() converts 'ß' to 'SS' instead of 'ẞ'

2018-10-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: We match the Unicode specification, not arbitrary language rules. (Austrian and Swiss German are, I believe, phasing out ß altogether, and haven't added an uppercase variant.) Until the Unicode consortium change their case conversion rules, it is still

[issue28716] Fractions instantiation revisited

2018-10-07 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue28716> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33084] Computing median, median_high an median_low in statistics library

2018-10-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I want to revisit this for 3.8. I agree that the current implementation-dependent behaviour when there are NANs in the data is troublesome. But I don't think that there is a single right answer. I also agree with Mark that if we change median, we ought

[issue22232] str.splitlines splitting on non-\r\n characters

2018-10-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't like the idea of adding a second bool parameter to splitlines. Guido has a rough rule of thumb (which I agree with) of "no constant bool parameters". If people will typically call a function with some sort of "mode" paramete

[issue34907] calculation not working properly

2018-10-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: For future reference, please don't post unnecessary screen shots and images. Code is text, please copy and paste it as text, not as pixels. Images make it difficult or impossible for the blind and visually impaired to contribute. -- nosy

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: > And, I think a broader discussion on python-dev might be useful, too, in > order to get more opinions. Done: https://mail.python.org/pipermail/python-dev/2018-October/155410.html Changing the status to Pending until we have more clarity on w

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 03, 2018 at 01:56:00PM +, Eric V. Smith wrote: > I think this is a bug that should be fixed. Supporting this position, shadowing other exceptions doesn't change the exception generated by the interpreter: py> TypeError = None

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 03, 2018 at 09:49:06AM +, thautwarm wrote: > Steven, this problem is quite interesting because it just allows users > to cause fatal errors without any invalid operations. How is that different from every other case of shadowing a b

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: If I have understood you correctly, you are asking whether it is expected behaviour for assert to use the global AssertionError instead of the built-in AssertionError. I don't see why it shouldn't. In any case, that behaviour goes back to Python 1.5

[issue34850] Emit a syntax warning for "is" with a literal

2018-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please move the "chaos" discussion to #34867 -- ___ Python tracker <https://bugs.python.org/issue34850> ___ ___

[issue34867] Add mode to disable small integer and interned string caches

2018-10-01 Thread Steven D'Aprano
New submission from Steven D'Aprano : Split off from #34850 by Guido's request. To help catch incorrect use of `is` when `==` is intended, perhaps we should add an interpreter mode that disables the caches for small ints and interned strings. Nathaniel called it "chaos mode" b

[issue34850] Emit a syntax warning for "is" with a literal

2018-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Sep 30, 2018 at 10:24:41PM +, Nathaniel Smith wrote: > Would it make sense to implement a "chaos" mode (that e.g. testing > tools could enable unconditionally), that disables the small integer > and small string caches?

[issue34850] Emit a syntax warning for "is" with a literal

2018-09-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: I like this solution of a syntax warning for `is ` and I agree that `== None` should not be a warning. (And for what its worth, I strongly disagree with making `is` a hybrid sometimes-check-identity-sometimes-check-equality operator.) -- nosy

[issue34835] Multiprocessing module update fails with pip3

2018-09-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: ``pip3 search multiprocessing`` says: multiprocessing (2.6.2.1)- Backport of the multiprocessing package to Python 2.4 and 2.5 so you are trying to install a Python 2.4/2.5 package into Python 3.7, which naturally cannot work. In Python 2.6

[issue34763] Python lacks 0x4E17

2018-09-27 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue34763> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34709] Suggestion: make getuser.getpass() also look at SUDO_USER environment variable

2018-09-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Versions 3.7 and below are all in feature-freeze, so this change could only apply to 3.8 and above. I don't know if this feature is desirable or not. If it is (sometimes?) desirable, my guess is that it would be undesirable to use SUDO_USER *unless

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Well, the thing is that i pass two (apparent) identical values into the same > function, Even if they have the same *numeric* value, they aren't the same kind of value, and they aren't the same function. One is and the other is . When you

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, sorry, I mistyped. I said: So there's a problem. You're trying to raise a negative number to a positive value I meant to say a *fractional* value. Sorry for the confusion. -- ___ Python tracker

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your code gives runtime warnings of invalid values. You should fix that. If your values are invalid, there's probably a bug in your code. RuntimeWarning: invalid value encountered in double_scalars Your code is also very complex. You ought to simplify

[issue34644] Bug in reverse method

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug or a syntax error, and the behaviour goes back to at least Python 1.5 if not older. List.reverse returns a reference to the method object itself. List.reverse() *calls* the method. This is standard behaviour in Python, all methods

[issue34596] [unittest] raise error if @skip is used with an argument that looks like a test method

2018-09-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: For what its worth, I'm +1 with Serhiy that we raise an exception on a non-string argument, including the case where the caller forgets to provide a reason at all. I don't think that @skip with no reason was ever intended to work (it certainly wasn't

[issue34605] Avoid master/slave terminology

2018-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I strongly disagree with this as a general principle. "Master/slave" is a powerful, obvious metaphor which works well and is not the same as parent/child, server/client or employer/worker. In fact, in the BDSM subcultures, "master/slave"

[issue34596] [unittest] raise error if @skip is used with an argument that looks like a test method

2018-09-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Is there a use-case for reason to be anything but a string? -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue34

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-09-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks for confirming the seg fault. I've changed this to a crasher. Should we change the exception to RuntimeError? -- components: +Library (Lib) -Extension Modules type: behavior -> crash ___ Python trac

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-09-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've tried running this code in Python 3.6: from _struct import Struct for i in range(10): L = [Struct.__new__(Struct) for j in range(1000)] for s in L: try: x = s.pack_into(bytearray()) except SystemError

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: _struct is a private implementation detail. You shouldn't use it. You shouldn't care where the implementation "really is" in your Python code, because it could move without warning. There are no backwards-compatibility guarantees for private mo

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: This exception goes back to at least Python 2.6 (if not older) but I'm not convinced it is a bug. Calling __new__ alone is not guaranteed to initialise a new instance completely. The public API for creating an instance is to call the class object: s

[issue34483] eval() raises NameError: name '...' is not defined

2018-08-23 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue34483> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34437] print statement using \x results in improper and extra bytes

2018-08-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: You wrote: > There are 6 bytes not 4 and where did the c3, bd, and c2 come from? In Python 2, strings are byte strings, in Python 3, strings by default are Unicode text strings. You are seeing the UTF-8 representation of the text string. py> &qu

[issue34358] round() combined with product outputs ugly result

2018-08-08 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue34346] dir() hangs interpreter

2018-08-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think the description you give is very accurate. The description in the file splat.py says: "Hangs/core dumps Python2 when instantiated" (which is it? hang or core dump?) but I can't replicate that. Instantiating A() is fine for m

[issue34039] Loop limited to 1000

2018-07-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry, this is for reporting bugs in the Python interpreter and standard library, not your own code. If you have a bug in your pyinator project, you should report it to yourself, not us :-) If you think my analysis of the problem below is wrong

<    4   5   6   7   8   9   10   11   12   13   >