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 S
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
___
P
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/is
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
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
c
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 method
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 si
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.
--
___
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 othe
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 *u
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue34763>
___
___
Python-bugs-list mailing list
Unsubscr
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 Pytho
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.)
--
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?
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 mo
Steven D'Aprano added the comment:
Please move the "chaos" discussion to #34867
--
___
Python tracker
<https://bugs.python.org/issue34850>
___
___
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
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 shadowin
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 =
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
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.
-
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"
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, w
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue28716>
___
___
Python-bugs-list mailing list
Unsubscr
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, i
Steven Packard added the comment:
I don't think you can blindly change that value of that definition. It will
likely break the compilation of the module using Solaris Sun Studio while
fixing compilation with gcc. The attached patch should do the correct thing in
the presence of e
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_explici
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 wanti
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
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.so
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
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
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 try
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 anoth
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 kin
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 don&
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
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_Inquisiti
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 i
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.
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 r
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
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 fin
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
fi
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(
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.o
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' ha
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 simila
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 proposa
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
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,
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue35224>
___
___
Python-bugs-list mailing list
Unsubscr
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
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
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 yo
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 chan
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 sugg
New submission from Steven Johnson:
CDLL does not use the same paths as find_library and thus you can *find* a
library, but you can't necessarily use it.
In my case, I had SDL2 in /usr/local/lib. find_library correctly gets
the name, but does not return the path. CDLL apparently doe
Steven Johnson added the comment:
Should the docs then be changed for find_library to inform that "It is not
guaranteed that a found library can be opened" (at least for linux)?
Or would a feature request for full paths from find_library for linux be more
appropriate?
It seems hac
New submission from Steven D'Aprano:
I'm adding this so there is a record in the bug tracker for posterity. No
action is needed except to close it as a "Won't Fix".
As per this discussion here:
http://mail.python.org/pipermail/python-ideas/2013-June/021318.html
using
Changes by Steven D'Aprano :
--
resolution: -> rejected
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue18568>
___
___
Python-
New submission from Steven D'Aprano:
The documentation for string escapes suggests that \u escapes can be used
to generate characters in the Supplementary Multilingual Planes by using
surrogate pairs:
"Individual code units which form parts of a surrogate pair can be encoded
Steven D'Aprano added the comment:
On 29/07/13 22:27, R. David Murray wrote:
>>>> '\uD80C\uDC80' == '\U00013080'
> False
Are you running a wide build? In a narrow build, it returns True.
--
___
Python tra
Steven D'Aprano added the comment:
On 31/07/13 17:14, Larry Hastings wrote:
> IMO the optimal solution is that tab preceded by only whitespace indents, and
> tab preceded by any non-whitespace character attempts to complete. Can we
> goad readline into behaving this wa
New submission from Steven D'Aprano:
I proposed adding a statistics module to the standard library some time ago,
and received some encouragement:
http://mail.python.org/pipermail/python-ideas/2011-September/011524.html
Real life intervened, plus a bad case of over-engineering, but ove
New submission from Steven D'Aprano:
As per the discussion here:
http://mail.python.org/pipermail/python-ideas/2013-July/022419.html
\N{} escapes should support the Unicode code point notation U+ (where there
are four, five or six hex digits after the U+).
E.g. '\N{U+03
Steven D'Aprano added the comment:
A function like this often gets called to truncate lots of lines. Unfortunately
for many use-cases, the part truncated is the most significant part of the
line. E.g.:
Scanning file:
/home/fred/documents/datafil...
/home/fred/documents/datafil...
/home
Steven D'Aprano added the comment:
Bike-shedding here... why "(...)"? Is it common to use round brackets for this
purpose? In English-speaking countries, it is usual to use square brackets for
editorial comments, including ellipsis "[...]".
Either way, if you wanted
Steven D'Aprano added the comment:
On 03/08/13 13:02, Alexander Belopolsky wrote:
>
> Alexander Belopolsky added the comment:
>
> Is there a reason why there is no "review" link? Could it be because the
> file is uploaded as is rather than as a patch?
I cann
Steven D'Aprano added the comment:
On 04/08/13 05:31, Alexander Belopolsky wrote:
>
> Alexander Belopolsky added the comment:
>
> Here is the use-case that was presented to support adding additional
> operations on timedelta objects:
>
> """
> I'
Steven D'Aprano added the comment:
On 03/08/13 13:22, Alexander Belopolsky wrote:
>
> Alexander Belopolsky added the comment:
>
> The implementation of median and mode families of functions as classes is
> clever,
So long as it is not too clever.
> but I am not su
Steven D'Aprano added the comment:
On 06/08/13 03:08, Mark Dickinson wrote:
>
> I too find the use of a class that'll never be instantiated peculiar.
I'll accept "unusual", but not "peculiar". It's an obvious extension to classes
being first
Steven Velez added the comment:
This may be a small use case, but a use case none-the less. In my situation, I
am distributing a frozen python package and it runs under the users home
directory. If the user's name has international characters, this will fail.
I expect we will have si
Steven D'Aprano added the comment:
On 31/07/13 20:23, Antoine Pitrou added the comment:
>
> I suppose you should write a PEP for the module inclusion proposal
Done.
http://www.python.org/dev/peps/pep-0450/
I hope to have an updated reference implementation, plus unittests, up late
Steven D'Aprano added the comment:
On 09/08/13 21:49, Oscar Benjamin wrote:
> I think that the argument `m` to variance, pvariance, stdev and pstdev
> should be renamed to `mu` for pvariance/pstdev and `xbar` for
> variance/stdev. The doc-strings should carefully distinguish that
Steven D'Aprano added the comment:
On 12/08/13 19:21, Mark Dickinson wrote:
> About the implementation of sum: it's worth noting that the algorithm you're
> using for floats depends on correct rounding of addition and subtraction, and
> that that's not guaranteed.
Steven D'Aprano added the comment:
Attached is a patch containing the statistics reference implementation, after
considering feedback given here and on python-ideas, and tests.
--
keywords: +patch
Added file: http://bugs.python.org/file31286/statistics.
New submission from Steven D'Aprano:
I hope I'm doing the right thing by replying in-line. This is my first code
review, please let me know if I'm doing something wrong.
By the way, the email hasn't gone to the tracker again. Is that a bug in the
tracker? I've take
Steven D'Aprano added the comment:
To anyone waiting for me to respond to rietveld reviews, I'm trying, I really
am, but I keep getting a django traceback.
This seems to have been reported before, three months ago:
http://psf.upfronthosting.co.za/roundup/met
Steven D'Aprano added the comment:
Since I can't respond to the reviews, here's a revised patch. Summary of major
changes:
- median.* functions are now median_*
- mode now only returns a single value
- better integrate tests with Python regression suite
- cleanup test
Steven D'Aprano added the comment:
On 15/08/13 22:58, ezio.melo...@gmail.com wrote:
> http://bugs.python.org/review/18606/diff/8927/Lib/statistics.py#newcode277
> Lib/statistics.py:277: assert isinstance(x, float) and
> isinstance(partials, list)
> Is this a good idea?
I thin
Steven D'Aprano added the comment:
Merged two test suites into one, and PEP-ified the test names testSpam ->
test_spam.
--
Added file: http://bugs.python.org/file31366/test_statistics.patch
___
Python tracker
<http://bugs.python.org
Steven D'Aprano added the comment:
Patch file for the stats module alone, without the tests.
--
Added file: http://bugs.python.org/file31367/statistics.patch
___
Python tracker
<http://bugs.python.org/is
Steven D'Aprano added the comment:
On 19/08/13 23:15, Oscar Benjamin wrote:
> So with the current implementation I can do:
>
>>>> from decimal import Decimal as D, localcontext, Context, ROUND_DOWN
>>>> data = [D("0.1375"), D("0.2108"), D
Steven D'Aprano added the comment:
On 20/08/13 22:43, Mark Dickinson wrote:
> I agree with Oscar about sum for decimal.Decimal. The *ideal* sum for
> Decimal instances would return the correctly rounded result (i.e., the exact
> result, rounded to the current context just
Steven D'Aprano added the comment:
I have changed the algorithm for statistics.sum to use long integer summation
of numerator/denominator pairs.
This removes the concerns Mark raised about the float addition requiring
correct rounding. Unless I've missed something, this now
New submission from Steven D'Aprano:
math.isfinite currently raises ValueError when given a Decimal sNAN (signalling
NAN).
I've run into a situation where I'm calling isfinite() on a numeric value which
may be a Decimal sNAN, and it would be nice if it returned False.
On the
New submission from Steven D'Aprano:
On issue 15544 Mark Dickinson suggested adding methods to float to match
methods on Decimal, giving type-agnostic ways of testing real numbers that
don't rely on converting to float. I don't see any sign that Mark raised a
feature request
New submission from Steven Murdoch:
When an IMAP server is behind a proxy, the proxy's capabilities may differ from
that of the actual IMAP server. However, in Python imaplib, the client will
ignore any updates to available capabilities in the response to the LOGIN
command (see rf
Steven Winfield added the comment:
The tk sources (at least the 8.5.11 version I'm looking at now) have some X11
headers that can be used by the windows build in the "xlib" directory.
--
nosy: +steven.winfield
___
Python
Steven D'Aprano added the comment:
I think this suggested enhancement is unreasonable and of limited usefulness,
and even if it were useful, too specialised to bother with.
The obvious message is badly misleading. When I read this:
TypeError: 'tuple' object is not callable,
Steven Bethard added the comment:
This patch looks like the right fix to me. The tests look good too.
--
___
Python tracker
<http://bugs.python.org/issue13
Steven Bethard added the comment:
I think the real fix needs to search recursively though all subparsers. Here's
a first draft of a patch that does this. I believe your sample code works after
this patch.
I don't have the time to turn your bug report into proper test (and add a tes
Steven Bethard added the comment:
The patch supplied was in reverse, but the bug report was correct. You can't
pass "type=string" since there's no string callable, only a str callable.
The docstring is confusing because the quotes make it looks like we mean the
string
Steven Bethard added the comment:
I can't find anywhere in the documentation where type=bool, type=unicode or
type=long are disallowed. They shouldn't be disallowed. If you want to pass
type=bool, argparse should not stop you. And it currently doesn't:
>>> parser =
Steven Bethard added the comment:
I don't think this is going to change.
It's basically a consequence of having a unified handling of nargs='?',
nargs='*', nargs='+', etc. These will all consume as many arguments as they
can, and argparse doesn&
Steven Bethard added the comment:
Special casing the formatting of 'store_const' makes me nervous because
formatting is already complicated and it doesn't know anything about action
types.
But feel free to propose a patch!
In the meantime:
- propagate the default to all t
Steven Bethard added the comment:
So I generally agree that FileType is not what you want for anything but quick
scripts that can afford to either leave a file open or to close stdin and/or
stdout. However, quick scripts are an important use case for argparse, so I
don't think we shoul
Steven Bethard added the comment:
The patch looks good to me. I've updated it for trunk and to include Mike
Meyer's additional test. All argparse tests pass.
Anyone who's able to commit and backport, please do.
(I should be able to commit myself, but it's now been too
Steven Bethard added the comment:
Yes, the original patch looks fine to me. I applied and tested it, and it works
as expected.
Please go ahead and apply.
--
___
Python tracker
<http://bugs.python.org/issue12
1301 - 1400 of 1942 matches
Mail list logo