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 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 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
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,
New submission from Steven D'Aprano:
math.nan fails on some Decimal NANs. For example, while this works:
>>> import math
>>> from decimal import Decimal
>>> math.isnan(Decimal('nan'))
True
These both fail with ValueError:
math.isnan(Dec
Changes by Steven D'Aprano :
--
components: +Library (Lib)
type: -> behavior
___
Python tracker
<http://bugs.python.org/issue15544>
___
___
Python-bug
Steven D'Aprano added the comment:
Attached is a patch for decimal.py, and test_decimal.py. I cannot provide a
patch for the C decimal implementation, sorry.
Following Mark's suggestion, my patch keeps the sign but discards the payload
for quiet NANs, and raises ValueError for signa
Steven D'Aprano added the comment:
On 03/08/12 22:06, Mark Dickinson wrote:
>
>> Decimal('snan').is_nan() just returns true and I am under the impression
>> that IEEE 754 specifies the same.
>
> Sure, but IEEE 754 also specifies that math.sqrt() should
Steven D'Aprano added the comment:
On 05/08/12 03:45, Mark Dickinson wrote:
> It would make sense to add float.is_infinite and (possibly) float.is_finite
> methods at the same time.
If you don't add is_finite, you know someone is going to express surprise that
it wasn't
Changes by Steven D'Aprano :
--
nosy: +stevenjd
___
Python tracker
<http://bugs.python.org/issue16104>
___
___
Python-bugs-list mailing list
Unsubsc
Steven D'Aprano added the comment:
A question came up on Python-ideas about readline apparently missing a standard
function. See:
http://mail.python.org/pipermail/python-ideas/2012-October/016329.html
For debugging issues with readline, it would be be very useful to be able to
quer
Changes by Steven D'Aprano :
--
nosy: +stevenjd
___
Python tracker
<http://bugs.python.org/issue5845>
___
___
Python-bugs-list mailing list
Unsubsc
Steven D'Aprano added the comment:
I don't think the relevant information -- that re match and search return None
in the case of no match -- is that distant from the paragraph quoted. This fact
is already mentioned FOUR times in the page, in each of the re.match, re.search
fun
Steven D'Aprano added the comment:
If any of the docs are unclear, I would be very happy take suggestions to
improve them. But I'm not entirely sure that the docs are the right place to
show the equations. You should be able to look them up on Wikipedia or Wolfram
Mathworld if you
Steven D'Aprano added the comment:
Personally, I think that the second reason given in the footnote, that it makes
for confusing tests, is bogus, or at least it's a matter of opinion. I for one
don't think they are confusing, and would like to see mixed output/tracebacks
suppor
New submission from Steven D'Aprano:
If you know the population mean mu, you should calculate the sample variance by
passing mu as an explicit argument to statistics.pvariance. Unfortunately, it
doesn't work as designed:
py> data = [1, 2, 2, 2, 3, 4] # sample from a population w
Changes by Steven D'Aprano :
--
resolution: invalid ->
stage: -> needs patch
status: closed -> open
type: behavior -> enhancement
versions: +Python 3.5 -Python 2.7, Python 3.4
___
Python tracker
<http://bugs.p
Steven D'Aprano added the comment:
On Wed, Apr 09, 2014 at 08:20:42AM +, Wolfgang Maier wrote:
> I do not think this is a bug in the module, but rather incorrect usage.
[...]
No, it is legitimate usage. See, for example, "Numerical Recipes in
Pascal" by Press et al.
Steven D'Aprano added the comment:
Can't you just re-direct stdout or stderr? I'm sure that works even on Windows.
E.g.
py -${PY_QUALIFIER} -m compileall -q "$INSTDIR\pkgs" 2> null
Is there a reason you cannot do this? I think that adding functionality to
compilea
Changes by Steven D'Aprano :
--
nosy: -steven.daprano
___
Python tracker
<http://bugs.python.org/issue16104>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
3.1, 3.2, 3.3 and 3.4 are all in feature-freeze, so this is only an option for
3.5.
A very tentative +1 on this feature. But I fear it may need to be discussed on
python-ideas first.
--
nosy: +steven.daprano
type: -> enhancement
versions:
Steven D'Aprano added the comment:
Actually, no, it is a staticmethod. See Guido's tutorial from way back in
version 2.2:
[quote]
__new__ is a static method. When defining it, you don't need to (but may!) use
the phrase "__new__ = staticmethod(__new__)", because thi
Steven D'Aprano added the comment:
On Fri, May 16, 2014 at 07:50:16AM +, Ezio Melotti wrote:
> Do you want to propose a patch?
I'm really not sure that I agree with this request. I'm currently
sitting on the fence, undecided, about 60% against and 40% in favour of
expl
Steven D'Aprano added the comment:
On Wed, May 28, 2014 at 02:43:29PM +, Thomas Dybdahl Ahle wrote:
> I have written some proof of concept code here [1], I would appreciate
> you commenting on it, before I turn it into a patch, as I haven't
> contributed code to Pyt
Steven D'Aprano added the comment:
I've run some performance tests on six variations of the O(N) select algorithm,
based on Tim Peters' and Thomas Ahle's code, comparing them to the naive O(N
log N) "sort first" algorithm, and sorting is consistently faster up
Steven D'Aprano added the comment:
On Sat, Jun 07, 2014 at 01:02:52PM +, Julian Taylor wrote:
> but a selection algorithm is useful on its own for all of python and
> then a multiselect should be considered.
I like the idea of a select and/or multiselect for 3.5. As a
new
Steven D'Aprano added the comment:
I have been using something like this for many years now and it is very handy.
I have an early version of the code posted here:
http://code.activestate.com/recipes/577896
Over the next week or so, I'll prepare a patch.
Because it's a new feat
Steven D'Aprano added the comment:
On Mon, Jun 16, 2014 at 02:09:22AM +, Raymond Hettinger wrote:
> Perhaps a time-elapsed context manager would be a better fit in the
> contextlib module (which contains more general purpose macro-level
> tools usable for many different task
Steven D'Aprano added the comment:
On Sun, Oct 13, 2013 at 09:21:13AM +, Nick Coghlan wrote:
>
> Nick Coghlan added the comment:
>
> Are the ReST docs the only missing piece here?
As far as I know, the only blocker is that the ReST docs are missing.
Also Guido woul
Steven D'Aprano added the comment:
Oscar Benjamin has just made a proposal to me off-list that has *almost*
convinced me to make statistics.sum a private implementation detail, at
least for the 3.4 release. I won't go into detail about Oscar's
proposal, but it has caused me to
Steven D'Aprano added the comment:
Here is the updated version which I hope is not too late for alpha 4. Main
changes:
* sum is now private
* docstrings have been simplified and shrunk somewhat
* I have a draft .rst file, however I'm having trouble getting Sphinx working
on my sy
Steven D'Aprano added the comment:
Georg Brandl wrote:
> The rst file is missing from your patch.
Oops! Sorry about that. Fixed now.
> I already posted a patch with statistics.rst five days ago.
> I have no idea why you ignored it.
I'm sorry if I stepped on your toes,
Steven D'Aprano added the comment:
Duplicate of this: http://bugs.python.org/issue6017
--
nosy: +stevenjd
___
Python tracker
<http://bugs.python.org/is
Changes by Steven D'Aprano :
--
nosy: -stevenjd
___
Python tracker
<http://bugs.python.org/issue19332>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
On Sat, Nov 16, 2013 at 04:33:36PM +, Serhiy Storchaka wrote:
>
> Should we add these methods to other concrete Number subclasses (as Fraction
> and complex)?
Seems like a good idea to me. Is it worth making them part of the Number
ABC,
Steven D'Aprano added the comment:
> in many cases flat-out wrong
What advice is "flat-out wrong"? All the advice seems excellent to me:
* avoid "from spam import *" (with a very few exceptions)
* be cautious about "from spam import eggs"
* avoid bare
Steven D'Aprano added the comment:
Looks good, but I think it is better to have an "unroll" option rather than do
it automatically. I'm okay with the default being to unroll, but sometimes I
want to compare the speed between different versions of Python, and having
unroll
Steven D'Aprano added the comment:
On Wed, Jul 16, 2014 at 02:49:31PM +, Armin Rigo wrote:
> ...but I don't think PyPy should be by itself a good enough reason to
> reject this patch. It would be fine if timeit detects which
> interpreter it runs on, and only tries t
Steven D'Aprano added the comment:
On Thu, Jul 17, 2014 at 07:39:21PM +, Jim Jewett wrote:
> Note, however, that containers will normally implement item equality
> as "a is b or a==b"
We can't say "will normally", since we don't know about the inf
Steven D'Aprano added the comment:
> Many specialized reprs follow a pattern <... at {hexadecimal id}...>.
> But there are few deviations:
[...]
> Proposed patch makes these cases to conform with other reprs.
I oppose making this change. The exact format of this generic r
Steven D'Aprano added the comment:
I agree that the documentation could be improved, but it's not really *wrong*.
Consider a glob like "spam/[abc]/*.txt". What iglob does is conceptually closer
to:
(1) generate the list of files matching "spam/a/*.txt" and yield
Steven D'Aprano added the comment:
On Thu, Aug 14, 2014 at 04:47:41PM +, Mark Dickinson wrote:
> I'm not sure it's worth fixing this, but it seems worth recording:
>
> >>> -0.5 // float('inf')
> -1.0
>
> I was expecting a value of `
Steven D'Aprano added the comment:
Thank you for the extensive examples, but I'm afraid this is not a bug.
In your code, "result" is a local variable, which means it only exists inside
the fib() function. When you try inspecting "result", it fails because there
Changes by Steven D'Aprano :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue22202>
___
___
Python-bugs-list mailing list
Unsub
Steven D'Aprano added the comment:
> It should read:
> "administrative data structures that should be not shared
> even between copies"
No. If they should NOT be shared, then making a deep copy is the correct thing
to do. The problem with deepcopy is when you actual
Steven D'Aprano added the comment:
I'm afraid I don't understand the purpose of this feature request, or what the
behaviour is.
You show a simple example:
>>> s = 'abc;;def;hij'
>>> s.split(';', offset=1)
['abc', ';def
Steven D'Aprano added the comment:
I'm dubious about this issue. It suggests that the wording of the exceptions is
part of the API of the two modules.
If the idea is just to copy the best error messages from one module to the
other, then I guess there is no harm. But if the
Steven D'Aprano added the comment:
On Fri, Sep 19, 2014 at 08:41:57PM +, Mark Lawrence wrote:
> I do not believe that any changes should be made to the re module
> until such time as there is a fully approved PEP []
Why is this so controversial? We're not talking
Steven D'Aprano added the comment:
I would be a lot more cautious about changing the gcd function. As Mark says,
there is *not* a single well-defined meaning of the gcd for negative arguments.
Even Wolfram can't decide which to use: Mathworld gives one interpretation,
Mathematica th
Steven D'Aprano added the comment:
If we are considering adding a new gcd elsewhere (say, in the math module),
then it should accept any arbitrary number of arguments, not just two. (At
least one argument though.)
Also, Mathematica supports the GCD of rational numbers, not just int
Steven D'Aprano added the comment:
For future reference, we *strongly* recommend that instead of taking a screen
shot and posting it as an attachment, you copy and paste the text directly.
Don't retype it, any decent terminal application will allow you to select and
copy the text,
Steven D'Aprano added the comment:
I'm afraid that you are mistaken about Python's argument passing semantics.
Arguments are *always* passed using the same semantics, and *never* using
either pass-by-value or pass-by-reference.
These two pages may help you understand why Py
Steven D'Aprano added the comment:
On Mon, Sep 29, 2014 at 07:33:21PM +, Ram Rachum wrote:
> I suggest implementing `Counter.__lt__` which will be a partial order,
> similarly to `set.__lt__`.
Since Counter is described as a multiset, this sounds reasonable to me.
Steven D'Aprano added the comment:
As I explained on the thread (possibly my post crossed in the mail with Ryan's
patch) I don't believe this is a bug fix. MatchObject.group has only accepted
actual ints, not longs, since Python 1.5 (tested 1.5, 2.4-2.7). Nor is there
any
Steven D'Aprano added the comment:
Ethan said:
> If it is so specialized as to only be needed in complex combinatorial
> calculations, does it belong in the general-purpose part of the
> language?
It's a multi-set, a general purpose and fairly fundamental data type.
https
Steven D'Aprano added the comment:
On Sat, Oct 04, 2014 at 07:57:16AM +, Serhiy Storchaka wrote:
> There are some properties of set comparison:
>
> (a < b) == (a <= b and a != b)
> (a <= b) == (a < b or a == b)
> (a <= b and b <= a) == (a == b)
> (a
Steven D'Aprano added the comment:
On Sat, Oct 04, 2014 at 08:38:17AM +, Ram Rachum wrote:
>
> Ram Rachum added the comment:
>
> > There are some properties of set comparison:
> >
> > (a < b) == (a <= b and a != b)
>
> I don't think so, b
Steven D'Aprano added the comment:
On Sat, Oct 04, 2014 at 10:43:02AM +, Antoine Pitrou wrote:
> Just because something is discussed doesn't mean it needs a PEP.
I know that in general discussions do not need a PEP, but we seem to be
rushing awfully fast into writing code b
Changes by Steven D'Aprano :
--
assignee: -> stevenjd
nosy: +stevenjd
___
Python tracker
<http://bugs.python.org/issue20389>
___
___
Python-bugs-lis
Steven D'Aprano added the comment:
Off the top of my head, I can think of three APIs:
(1) separate functions, as Nick suggests:
mean vs weighted_mean, stdev vs weighted_stdev
(2) treat mappings as an implied (value, frequency) pairs
(3) take an additional argument to switch between unwei
Changes by Steven D'Aprano :
--
assignee: -> stevenjd
___
Python tracker
<http://bugs.python.org/issue20478>
___
___
Python-bugs-list mailing list
Unsub
Changes by Steven D'Aprano :
--
assignee: -> stevenjd
___
Python tracker
<http://bugs.python.org/issue20481>
___
___
Python-bugs-list mailing list
Unsub
1101 - 1200 of 1443 matches
Mail list logo