Steven D'Aprano added the comment:
I'm sorry, I don't understand what you think is the bug here. It looks like you
are passing a corrupted file which has a PNG extension but is not actually a
PNG file (it contains PHP code). What do you expect should happen?
--
nosy:
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue26214>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
Looks good to me.
I've run some quick timing tests, and for very small lists, there's no
significant difference, but for larger lists I'm getting up to a 50% speedup.
Nicely done, thank you.
--
__
Steven D'Aprano added the comment:
I don't see any conclusive evidence that this is a bug in the Python
interpreter, so I'm going to close the issue.
Hana, if you are still having this problem, please join the main python mailing
list https://mail.python.org/mailman/listinfo
New submission from Steven D'Aprano:
There are a few operations such as summing or unpacking infinite iterators
where the interpreter can become unresponsive and ignore Ctrl-C
KeyboardInterrupt. Guido suggests that such places should occasionally check
for signals:
https://mail.pytho
Steven D'Aprano added the comment:
This is the standard behaviour of closures in Python. It's annoying, and often
not what you expect, but it's not a bug.
Effectively, your dict or list contains five functions, each of which refer to
the same variable "t". By the tim
Steven D'Aprano added the comment:
Perhaps you could suggest a specific change to the docstrings for str.encode
and unicode.decode?
(BTW, I presume you are aware that the equivalent of (bytes)str.encode and
unicode.decode are gone in Python 3?)
--
nosy: +steven.da
Steven D'Aprano added the comment:
This was raised and rejected here:
http://bugs.python.org/issue24668
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/is
Steven D'Aprano added the comment:
This is not a bug, but behaving correctly. You have:
py> A = np.random.random((10,1))
py> np.all(A)
True
py> np.all(A) < 1 # is True less than 1?
False
which is correct: True is *not* less than 1. But True *is* less than 2:
py> True <
New submission from Steven D'Aprano:
Add either a FAQ or a new page under "Meta Information" in the documentation
for how to formally cite Python in scientific papers or other academic
situations.
See thread on Python-Ideas here for justification and further dis
Steven Basart added the comment:
Reopen this idea but removing the generator from weighted choice.
--
nosy: +progressive-o
Added file: http://bugs.python.org/file42322/weighted_choice_v3.diff
___
Python tracker
<http://bugs.python.org/issue18
Steven Basart added the comment:
The entire function of weighted choice. I removed the generator and replaced it
by adding an optional argument to specify an amount by which you want to call
this function.
--
Added file: http://bugs.python.org/file42323/weighted_choice_v3.patch
Steven Basart added the comment:
Hello rhettinger. I filled out the form thanks for letting me know about it.
Is there anything else I have to do?
Hey serhiy.storchaka
There were several things "wrong" with the previous implementation in my
opinion.
1st they tried to add too mu
Steven Basart added the comment:
Hey serhiy.storchaka
I can edit the code to output just one value if called with simply a list and
then return a list of values if called with the optional amount parameter. My
code also needs to check that amount >= 1.
My code was mostly just to rest
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue26694>
___
___
Python-bugs-list mailing list
Unsubscr
Steven Basart added the comment:
Okay so I added a few lines of code. One to make it return a single number if
amount == 1 and the other to check that the amount > 1.
The main difference I've noticed between this implementation and previous
versions compared to say R is that i
Changes by Steven Basart :
Removed file: http://bugs.python.org/file42385/weighted_choice_v4.patch
___
Python tracker
<http://bugs.python.org/issue18844>
___
___
Pytho
Steven Basart added the comment:
I reuploaded the file. The spacing on the if amount < 1 was off. Hopefully
its fixed now.
--
Added file: http://bugs.python.org/file42386/weighted_choice_v4.patch
___
Python tracker
<http://bugs.pyth
Steven Basart added the comment:
Re-implemented with suggested improvements taken into account. Thanks
@mark.dickinson and @pitrou for the suggestions.
I also removed the redundant "fast path" portion for this code since it doesn't
deal with generators anyways.
Let me
Changes by Steven Basart :
Removed file: http://bugs.python.org/file42392/weighted_choice_v5.patch
___
Python tracker
<http://bugs.python.org/issue18844>
___
___
Pytho
Steven Basart added the comment:
Left in a line of code that was supposed to be removed. Fixed.
--
Added file: http://bugs.python.org/file42393/weighted_choice_v5.patch
___
Python tracker
<http://bugs.python.org/issue18
New submission from Steven Reed:
Example repro:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x=map(bool,[1,0,0,1,1,0])
&
New submission from Steven Adams:
I've ran into a strange issue after trying to port a project to support py 3.x
The app uses a double os.fork to run in the background. On py 3.4+ it seems
that when you have an import uuid statement it causes threading.threads to
always return fal
Steven Adams added the comment:
I forgot to mention if i remove import uuid all works as expected.
--
___
Python tracker
<http://bugs.python.org/issue26
Steven Adams added the comment:
Shouldn't that mean it also breaks on py3.3?
As a workaround i just import uuid later within the thread method.
--
___
Python tracker
<http://bugs.python.org/is
Steven Adams added the comment:
My workaround didn't work either.. We are a number of third party libs
including flask. As soon as i import flask the issues remains.. Maybe something
with flask is importing ctypes?
Something aint
Steven Adams added the comment:
Ok but the question still remains, why does it only happen on py3.4+??
--
___
Python tracker
<http://bugs.python.org/issue26
Steven Adams added the comment:
anyone got any other thoughts on this??
--
___
Python tracker
<http://bugs.python.org/issue26793>
___
___
Python-bugs-list mailin
Steven D'Aprano added the comment:
I'm afraid I can't quite see what the problem is. If you're passing your own
globs argument, can't you deepcopy it yourself?
Could you show a minimal, short example demonstrating the issue please?
--
nosy: +steven.dapr
Steven D'Aprano added the comment:
On Fri, Apr 29, 2016 at 10:09:46AM +, DqASe wrote:
> Added file: http://bugs.python.org/file42649/x.py
Ah, I see! That makes sense now. Thanks.
Why don't you just set the initial state of the lists in the doctests?
That makes much better
Steven D'Aprano added the comment:
Xiang Zhang is correct: the original is technically correct. If you read it
like this:
"All of Python’s immutable built-in objects are hashable, while no mutable
containers (such as lists or dictionaries) are [hashable]."
it should be clear.
Steven D'Aprano added the comment:
On snap! Nicely found! This seems to have something to do with the way
generator expressions are run inside their own scope.
In Python 2.7, a list comprehension in a class sees the locals correctly:
py> class K:
... a = 2; x = [a+i for i in
New submission from Steven D'Aprano:
The FAQs include a discussion of the rejected Pascal "with" statement
(different from the Python `with`). From time to time people propose variants
of it, such as using a leading dot to make it unambiguous.
Guido has just firmly rejected
Changes by Steven D'Aprano :
--
stage: patch review -> commit review
___
Python tracker
<http://bugs.python.org/issue26002>
___
___
Python-bugs-lis
Steven D'Aprano added the comment:
On Sun, May 08, 2016 at 04:24:59AM +, Joshua Morton wrote:
> Following the comments in python ideas [1] [...]
>
> [1] https://mail.python.org/pipermail/python-ideas/2016-April/039469.html
Am I missing something? I don't see an
Steven D'Aprano added the comment:
Thanks Ian! I can't believe I looked at that function earlier today and
couldn't see that!
--
nosy: +steven.daprano
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bu
New submission from Steven D'Aprano:
(This is already done, but I should have added a ticket before committing the
new module.)
See PEP-0506.
--
assignee: steven.daprano
components: Library (Lib)
messages: 265288
nosy: steven.daprano
priority: normal
severity: normal
status:
Changes by Steven D'Aprano :
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue26996>
___
__
Steven D'Aprano added the comment:
This issue seems to have lost momentum, I'd like to revive it by proposing a
slightly different interface for the autorange function.
Attached is a proof-of-concept patch. I've moved the code which determines the
number of loops out of the mai
Steven D'Aprano added the comment:
> I would suggest making the 0.2 tunable as an optional argument.
Sounds like a good idea to me.
> I also notice the repeat functionality isn't included in the patch, is there
> a reason?
I don't understand which repeat functiona
Steven D'Aprano added the comment:
On Thu, May 12, 2016 at 04:49:59AM +, Nick Coghlan wrote:
> The embedded side-effects were my main concern with Scott's original
> patch, so Steven's callback-based approach strikes me as a definite
> improvement. However, the aw
Steven D'Aprano added the comment:
To explain in more detail: ``type('s').startswith`` is the same as
``str.startswith``, which is an unbound method in Python 2 and a regular
function in Python 3. Either way, it expects *two* arguments: a string which
becomes "self&q
Steven D'Aprano added the comment:
I don't understand. The documentation clearly states:
"Python searches a standard list of directories to find one which the calling
user can create files in." How do you expect to be able to write files to a
directory that doesn'
Steven Barker added the comment:
The problem being discussed here just came up on Stack Overflow today:
http://stackoverflow.com/questions/37288135/inspect-module-for-python/
The cause of the incorrect error message is pretty clear. The relevant code
from `inspect.getfile` should do something
Steven D'Aprano added the comment:
Ben, I'm sorry to see you have spent such a long time writing up reasons for
changing this behaviour. I fear this is a total waste of your time, and ours to
read it. Python 2.7 is under feature freeze, and changing the behaviour of
str.
New submission from Steven Barker:
The C implementation of `_random.Random.getrandbits` is unnecessarily limited
in the number of bits it can produce on 64-bit Windows systems. I learned about
this issue in discussion of my answer to this stack overflow question:
http://stackoverflow.com
Steven D'Aprano added the comment:
It looks like your Python 3 is somehow using your Python 2 site directory. What
does your PYTHONPATH contain?
Try running this:
python3 -E -S -c "import sys; print(sys.path)"
and see what it says.
--
nosy: +steven.daprano
type: cr
Steven D'Aprano added the comment:
In Python 3.x, 'a' is just as much a Unicode string as 'ä'. I agree that
binascii.a2b_hex should raise ValueError for argument 'ä', or ';' for that
matter, as they are invalid values. There's an inconsistenc
Steven D'Aprano added the comment:
The error message isn't wrong, just hard to understand. In your example, when
it says "need more than 4 values to unpack" it means that it got four values on
the right hand side, and needs five (which is more than four) to match what is
Steven D'Aprano added the comment:
This is not a bug. "while" is a keyword, it is part of Python's syntax, and you
are not permitted to use keywords as variable names. This is not an accident,
but a deliberate decision.
--
nosy: +steven.daprano
resolution: ->
Steven D'Aprano added the comment:
This bug report seems to be completely based on a false premise. In the very
first message of this issue, Ionel says:
"it return True even if __call__ is actually an descriptor that raise
AttributeError (clearly not callable at all)."
but th
Steven D'Aprano added the comment:
Antoine asked:
> If someone has actual code that suffers from this, it would be good to know
> about it.
You might have missed Łukasz' earlier comment: "In this particular case,
there's internal usage at Twitter that unearthed
Steven D'Aprano added the comment:
This would be risky, as byte-code only libraries do exist.
I think that deleting orphaned .pyc files from inside the __pycache__ directory
is safe, but deleting orphaned .pyc files outside of that risks deleting
legitimate byte-code libraries which a
Steven D'Aprano added the comment:
Maybe I've misunderstood RDM's comment, but if sys.exit(code) starts
automatically printing the return code, that's going to break a lot of scripts.
--
nosy: +steven.daprano
___
P
Steven D'Aprano added the comment:
The patch seems simple and straightforward enough. It just needs some tests,
and a Round Tuit.
--
assignee: -> steven.daprano
___
Python tracker
<http://bugs.python.org
Changes by Steven D'Aprano :
--
stage: -> test needed
___
Python tracker
<http://bugs.python.org/issue24068>
___
___
Python-bugs-list mailing list
Unsub
Steven D'Aprano added the comment:
This is not a bug, since %b is not supported in Python 2, only in Python 3:
https://docs.python.org/2/library/stdtypes.html#string-formatting-operations
No new features will be added to 2.7, so if you need %b you can use Python 3,
or in Python 2.7 yo
New submission from Steven D'Aprano:
The example code for http.client shows www.python.org/parrot.spam return a 404:
https://docs.python.org/3/library/http.client.html#examples
>>> # Example of an invalid request
>>> conn.request("GET", "/parrot.spam"
Steven D'Aprano added the comment:
For what it's worth, there are at least two localised versions of Python:
Teuton and ChinesePython. As far as I know, ChinesePython is still in active
development. Both translate the keywords and builtins, to German and Chinese
respectively. I do
Steven D'Aprano added the comment:
I don't think this is a bug. I think it is just a case that you have to be
careful when calling functions, you actually do call the function. And that it
returns what you think it does.
I think the critical point is this:
"It turned our t
Steven D'Aprano added the comment:
This has been discussed on Python-Ideas some time ago, possibly more than once.
See here for one such (short) discussion:
https://mail.python.org/pipermail/python-ideas/2013-April/020148.html
I think that move-to-trash functionality is quite useful, I n
New submission from Steven D'Aprano:
hashlib digests should have a nicer interface to allow conversion to ints.
Currently we write int(x.hexdigest(), 16) which is less than obvious and easy
to get wrong. It would be nice to be able to just say int(x) (that's my strong
preference) o
Steven D'Aprano added the comment:
This behaviour is expected. The factorial function calls itself, it doesn't
call "f", but it is "f" which has the cache. So the call to f() goes through
the cache, misses, and then calls factorial(), which has no cache.
In ef
Steven D'Aprano added the comment:
In case it isn't obvious, my example is meant to be pseudo-code, not the exact
implementation used.
--
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
Can confirm the expected behaviour (printing True) in Python 2.4 through 2.7,
3.3, Jython 2.5, and even venerable old Python 1.5 (where it prints 1).
But *not* IronPython 2.6, where it prints False.
In 3.6, the difference seems to be here:
New submission from Steven D'Aprano:
An occasionally requested feature is for a shuffled() function, related to the
in-place random.shuffle() as sorted() is to list.sort().
See the latest example:
https://mail.python.org/pipermail/python-ideas/2016-September/042096.html
--
mes
New submission from Steven D'Aprano:
Currently, math.isnan(n) and math.isinf(n) for n an int may raise OverflowError
if n is too big to convert to a float, e.g.:
py> math.isnan(10**1)
Traceback (most recent call last):
File "", line 1, in
OverflowError: int too large t
Steven D'Aprano added the comment:
As a convenience for whom? Certainly not the poor user, who thinks that
math.isnan(x) should return False if the number x is not a NAN. Since
neither 10**1 nor 10**10 are NANs, why should one return correctly
and the other raise a completely spu
Steven D'Aprano added the comment:
On Tue, Sep 06, 2016 at 05:59:08PM +, Mark Dickinson wrote:
> Why do you single out `int` for special treatment,
Mostly as a demonstration for what could be done, not necessarily as
what should be done. Secondly as a potential optimization. Why g
Steven D'Aprano added the comment:
That is because of floating point rounding.
When you calculate a/23, the result is the approximate float
2.659090889061502e+18 instead of the exact integer result 2659090889061502012.
Converting to an int gives you a result which is too small:
py>
Steven D'Aprano added the comment:
As discussed with Ned by email, I'm currently unable to build 3.6 and won't
have time to work on this before b1. As discussed on #27761 my tests here are
too strict and should be loosened, e.g. from assertEqual to assertAlmostEqual.
Ned wrot
Steven D'Aprano added the comment:
As discussed with Ned via email, this issue shouldn't affect the public
geometric_function and the failing tests (currently skipped) are too strict.
The existing tests demand an unrealistic precision which should be loosened,
e.g. from asse
New submission from Steven D'Aprano:
On Centos 5.11, building fails with:
Python/dtrace_stubs.o: In function `PyDTrace_LINE':
/home/steve/python/python-dev/cpython/Include/pydtrace.h:28: multiple
definition of `PyDTrace_LINE'
Python/ceval.o:/home/steve/python/python-dev/
Steven D'Aprano added the comment:
Ned, I know my system is old so I understand if 3.6 no longer supports
gcc 4.1. Tell me what minimum version I should use (4.8?) and I'll find
a way to upgrade or use another system.
Shouldn't the build system explicitly report that the compi
New submission from Steven D'Aprano:
>>> statistics.geometric_mean([0.7 for _ in range(5000)])
Traceback (most recent call last):
File "/Users/mdickinson/Python/cpython-git/Lib/statistics.py", line 362, in
float_nroot
isinfinity = math.isinf(x)
OverflowError: int
Steven D'Aprano added the comment:
On Mon, Sep 12, 2016 at 03:35:14PM +, Mark Dickinson wrote:
> statistics.geometric_mean(0.7 for _ in range(5000))
I've raised a new ticket #28111
--
___
Python tracker
<http://bugs.pytho
Steven D'Aprano added the comment:
> Surely this isn't intended behavior (?)
It is indeed. That's standard behaviour for GNU getopt, which the Python module
is modelled after:
[steve@ando ~]$ getopt --version
getopt (enhanced) 1.1.4
[steve@ando ~]$ getopt --versi
getop
Steven D'Aprano added the comment:
> How is silently failing to resolve input errors okay ?
You haven't demonstrated that it fails to resolve input errors. You have
demonstrated a *feature*, not a bug: getopt will accept prefixes if they
unambiguously match ONE long option only.
Steven D'Aprano added the comment:
> argparse here I come!
https://docs.python.org/2/library/argparse.html#argument-abbreviations-prefix-matching
Prefix matching is a standard feature of all command line option parsers
that I
New submission from Steven D'Aprano:
It is moderately common to want to join a sequence of substrings with a
delimiter rather than a separator, e.g. when joining a sequence of lines into a
single string, you usually want a trailing newline as well as newlines between
the lines. E.g.:
Steven D'Aprano added the comment:
> lines = ''.join(substring + '\n' for substring in substrings)
Huh. There were three of us looking at this at work yesterday, and none
of us thought of that.
--
___
Python trac
Steven D'Aprano added the comment:
> * Display the average, rather than the minimum, of the timings *and*
> display the standard deviation. It should help a little bit to get
> more reproductible results.
I'm still not convinced that the average is the right statistic to
Steven D'Aprano added the comment:
> I'd suggest to display all values and base the findings on
> all available values, rather than just one:
> min, max, avg, median, stddev.
If we're going to go down that path, I suggest using something like:
https://en.wikipedia.org/
Steven D'Aprano added the comment:
> Looking again at the comments for the other respondents, I think this
> should just be closed. It doesn't make sense to disturb a long
> standing API or the break the join/split symmetry.
For what it's worth, in hindsight I agree.
Steven D'Aprano added the comment:
Unfortunately I'm in a pickle at the moment, I cannot build 3.6 on any
of the machines I have available (three), and no time to upgrade them to
something that will build 3.6. But I can provide some tests, if
somebody is willing to review and check
Steven D'Aprano added the comment:
Looks good for me.
Thanks for catching this: I knew it was a bug, but then I ran into the issue
that I could no longer build 3.6 before I could fix it, and between that and
various issues in the real world I never got back to
Steven D'Aprano added the comment:
> The newly-added statistics.geometric_mean function appears to have no
> tests at all
That's weird and unfortunate. I certainly wrote tests, and I have a
backup of them. I have no idea what happened.
Attached is a patch that adds the tests,
Steven D'Aprano added the comment:
> Steve, I really think we should postpone to 3.7. [...]
If these fixes have to be in by the next beta (10th Oct), I fear that
you are right. I can build up to changeset 103135:8b74e5528f35, but not
beyond. I will be able to rectify that, but reali
Steven D'Aprano added the comment:
I'm sorry to say that due to technical difficulties, geometric mean is not
going to be in a fit state for beta 2 of 3.6, and so is going to be removed and
delayed until 3.7.
--
priority: release blocker ->
versions: +Python 3.
Changes by Steven D'Aprano :
--
versions: -Python 3.6
___
Python tracker
<http://bugs.python.org/issue28351>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: -Python 3.6
___
Python tracker
<http://bugs.python.org/issue28328>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: -Python 3.6
___
Python tracker
<http://bugs.python.org/issue28327>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: -Python 3.6
___
Python tracker
<http://bugs.python.org/issue28111>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: +Python 3.7 -Python 3.6
___
Python tracker
<http://bugs.python.org/issue27761>
___
___
Python-bugs-list m
New submission from Steven D'Aprano:
Did you take a picture of the screen with your iPhone? Why didn't you take a
screenshot? Or better still, since this is a text-based medium not a graphics
error, copy and paste the text involved? That's easier for people to work with,
incl
Steven D'Aprano added the comment:
See #28366
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue28365>
___
___
Python-bugs-list m
Changes by Steven D'Aprano :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/is
Changes by Steven D'Aprano :
--
nosy: +terry.reedy
___
Python tracker
<http://bugs.python.org/issue28365>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
This was discussed on Python-Ideas back in July:
https://mail.python.org/pipermail/python-ideas/2016-July/041153.html
I don't recall any opposition, although Nick suggested that possibly a better
idea was to resurrect the `apply` built-in into
Steven D'Aprano added the comment:
There seems to be consensus that this should be treated as a bug fix, not a new
feature. Could this still make it into 3.6 even though it missed the first beta?
--
nosy: +steven.daprano
___
Python tracker
1801 - 1900 of 1942 matches
Mail list logo