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 sh
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) this is
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 closi
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 #
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 dire
Steven D'Aprano added the comment:
For future reference, please don't give screen shots when reporting bugs. Code
is text, and we don't edit code with Photoshop.
Copy and paste the text, don't take a screen shot. Screen shots make it
impossible to run the code, and th
Steven D'Aprano added the comment:
> In the old days I'd just `hash(some_variable)` but of course now I cannot.
I'm sorry, I don't understand... why can't you?
py> text = "NOBODY expects the Spanish Inquisition!"
py> hash(text)
1245575277
The
Steven D'Aprano added the comment:
> Steven, my requirement calls for same hash on multiple machines.
> Python's hash (for strings) is keyed with a random value.
Ah, of course it does, I forgot about that.
The only problem with exposing siphash is that we are ex
Steven D'Aprano added the comment:
This is spam.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
Steven D'Aprano added the comment:
I think you may be misunderstanding what you are seeing.
The documentation for textwrap.wrap says:
By default, tabs in 'text' are expanded with string.expandtabs()
which converts tabs to one or more spaces, enough to align to some
multi
Steven D'Aprano added the comment:
Can you please provide a *simple* and *complete* demonstration, including the
*full* traceback? As given, we cannot run the supplied code and don't know what
the contents of the csv file are supposed to be.
See here for more detail: http://www
Steven D'Aprano added the comment:
This bug report is incoherent. This has nothing to do with alarms or regular
expressions, and I don't know what your code is supposed to do or what results
you are expecting. What's "a calci programe"?
You ask:
"Do we hav
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue35639>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
> That sort currently uses __lt__ only is, in my opinion, an implementation
> detail.
Its only an implementation detail until the language specification defines it
as a guarantee of the language. Then it becomes part of the sorting API.
Pe
Steven D'Aprano added the comment:
> should the function be expanded to calculate for negative
> n or is the function expected to work only in combination sense?
If this were my design, I would offer both but in separate functions:
def comb(n, k):
if n < 0: raise ValueEr
Steven D'Aprano added the comment:
> return (-1)**k * bincoeff(n+k+1, k)
Oops, that's meant to be n+k-1.
--
___
Python tracker
<https://bugs.pytho
Steven D'Aprano added the comment:
Not a bug. 0.1 is a binary floating point value, please read the FAQs:
https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate
1/10 = 0.1 in decimal cannot be represented *exactly* in binary floating point,
so whe
Steven D'Aprano added the comment:
There is no need to call int() on a literal int: 103 is already an int,
calling int() on it is just wasting time and making confusing code.
print (int(y1y2y3y4))
gives a NameError, since you don't have a variable "y1y2y3y4" de
Steven D'Aprano added the comment:
I'm not sure whether having NULLs terminate a struct format string is a feature
or a bug.
Given that nearly every other string in Python treat NULLs as ordinary
characters, I'm inclined to say this is a bug. Or at least an unnecessary
r
Steven D'Aprano added the comment:
> the canonical __ne__ delegation to __eq__ for any class should be implemented
> as something like
I disagree that your code snippet is the canonical way to write __ne__. I'd
write it like this:
def __ne__(self, other):
Steven D'Aprano added the comment:
This is not a bug, it is standard behaviour for all iterators, not just
generators.
For loops work by calling next() on the iterator object, if you call next() on
the same object inside the loop, that has the effect of advancing the for loop.
Yo
Steven D'Aprano added the comment:
I agree that for numeric data, it isn't worth changing the behaviour of median
to avoid the division in the case of two equal middle values.
Even if we did accept this feature request, it is not going to eliminate the
change in type in all cir
Steven D'Aprano added the comment:
You say:
> The PEP reads as if returning a value via StopIteration was meant to signal
> that the generator was finished and that StopIteration.value was the final
> value.
To me, the PEP is clear that `return expr` is equivalent to `raise
Steven D'Aprano added the comment:
> I understood the PEP to include `return expr` in the iteration values
> as per the first bullet of the proposal.
>
> > Any values that the iterator yields are passed directly to the caller.
>
> This bullet doesn't have a
Steven D'Aprano added the comment:
Python 2.7 has long passed feature freeze, and this would be new behaviour
appearing in a bug-fix release, which we don't normally do.
I'm going to close this as Rejected, but if you think you can make a good case
for why this enhancement
Steven D'Aprano added the comment:
I'm very interested in adding quartiles and general quantiles/fractiles, but
I'm not so sure that this select(data, index) function would be useful. Can you
explain how you would use this?
--
___
Steven D'Aprano added the comment:
On Fri, Jan 18, 2019 at 11:13:41PM +, Rémi Lapeyre wrote:
> Wouldn't be the 5-th percentile be select(data, round(len(data)/20)?
Oh if only it were that simple!
Using the method you suggest, the 50th percentile is not the same as the
medi
Steven D'Aprano added the comment:
The version message doesn't look "too complicated" to me. It looks no more
complicated as that which Python has always displayed, going back to Python 1.5
(the oldest version I still have access to).
Python 1.5.2 (#1, Aug 27 2012,
Steven D'Aprano added the comment:
I believe that Python's behaviour here is correct. You are supplying a netloc
which includes a username "www.google.com\" with no password. That might be
what you intend to do, or it might be malicious data. That depends on context,
and
Steven D'Aprano added the comment:
On Fri, Jan 18, 2019 at 12:31:51AM +, bryan.koch wrote:
> Thank you both for the clarifications. I agree these's no bug in
> `yield from` however is there a way to reference the return value when
> a generator with a return is inv
Steven D'Aprano added the comment:
> Is this proposal still relevant?
Yes.
As Raymond says, deciding on a good API is the hard part. Its relatively
simple to change a poor implementation for a better one, but backwards
compatibility means that changing the API is very difficult.
Steven D'Aprano added the comment:
> The “urllib.parse” module generally follows RFC 3986, which does not
> allow a literal backslash in the “userinfo” part:
And yet the parse() function seems to allow arbitrary unescaped
characters. This is from 3.8.0a0:
py> from urlli
Steven D'Aprano added the comment:
Rémi. I've read over your patch and have some comments:
(1) You call sorted() to produce a list, but then instead of retrieving the
item using ``data[i-1]`` you use ``itertools.islice``. That seems unnecessary
to me. Do you have a reason for usin
Steven D'Aprano added the comment:
> steven your generator example is exactly what I wanted to do; looks
> like I'm upgrading to Python 3.8 for the new assignment syntax.
Sorry to have mislead you, but I don't think it will do what I thought.
After giving it some more
Steven D'Aprano added the comment:
> I'm off to write an ugly `next()` wrapper then.
Wouldn't it be simpler to re-design the generators to yield the final
result instead of returning it? To process the final item differently
from the rest, you just need something like thi
Steven D'Aprano added the comment:
Here is some further information on weights in statistics in general,
and SAS and Stata specifically:
https://blogs.sas.com/content/iml/2017/10/02/weight-variables-in-statistics-sas.html
Quote:
use the FREQ statement to specify integer frequencie
Steven D'Aprano added the comment:
> We only print simplified message in official binary release, any
> Linux/private builds still using the current message. We know enough
> information about official binary release.
Who is "we" in this sentence?
Are you saying th
Steven D'Aprano added the comment:
This is a bug tracker for reporting bugs and enhancement requests, not a help
desk.
Do you have a *specific* feature request or a bug to report? If not, you should
ask this on a community forum such as Stackoverflow, Reddit's r/learnpython,
Steven D'Aprano added the comment:
> Since Undef is not defined, I should get an exception when calling
> get_type_hints
One of the motives of PEP-563 is to make it easier to use forward references.
I'm not sure, but it seems to me that given that, we should not get an
Steven D'Aprano added the comment:
Wait, I just noticed that PEP563 says:
"Note: if an annotation was a string literal already, it will still be wrapped
in a string."
https://www.python.org/dev/peps/pep-0563/#id5
In 3.8.0a I get this:
py> from __future__ import annotatio
Steven D'Aprano added the comment:
You are not looking at the class, you are looking at an instance:
py> exc = ZeroDivisionError('divide by zero')
py> type(exc).__name__
'ZeroDivisionError'
py> exc.__name__
Traceback (most recent call last):
F
Steven D'Aprano added the comment:
Sorry for the late reply, I missed Tim's comment when it first came
through.
> Please resist pointless feature creep. The original report was about
> comb(n, k) for integer n and k with 0 <= k <= n and that's all.
> Ever
Steven D'Aprano added the comment:
> This involved a few changes, which seem to reflect the consensus here:
> - raise ValueError if k>n ;
> - rename the function to math.combinations.
I see at least four people (myself, Raymond, Mark and Tim) giving comb
as first choice,
Steven D'Aprano added the comment:
> It should instead show the lines from the file as it was when the code was
> executed.
How is Python supposed to do that without making a copy of every module and
script it runs just in case it gets modified?
(That's not a rhetorical qu
Steven D'Aprano added the comment:
There may be something we can do to improve the error reporting and make
it less perplexing:
https://mail.python.org/pipermail/python-ideas/2019-January/055041.html
--
___
Python tracker
&
Steven D'Aprano added the comment:
> For information - all taken from docs and Lib/*.py
I'm sorry Jonathon, I don't see how they are relevant or interesting to
the topic in hand other than "they're used to print stack traces". Okay,
they're used
Steven D'Aprano added the comment:
> sin(1<<500) is correctly computed as 0.42925739234242827
py> math.sin(1<<500)
0.9996230490249484
Wolfram Alpha says it is
0.429257392342428277735329299112473759079115476327819897...
https://www.wolframalpha.com/input/?i=si
Steven Winfield added the comment:
(Just updating the issue to note that Python 3.7 is similarly affected)
--
nosy: +steven.winfield
versions: +Python 3.7
___
Python tracker
<https://bugs.python.org/issue34
Steven D'Aprano added the comment:
If the licencing issue is resolved, can we reconsider this for 3.8?
--
versions: +Python 3.8 -Python 3.6
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
In the PEP, I did say that I was making no attempt to compete with numpy
for speed, and that correctness was more important than speed.
That doesn't mean I don't care about speed. Nor do I necessarily care
about absolute precision when gi
Steven D'Aprano added the comment:
>def fmean(seq: Sequence[float]) -> float:
>return math.fsum(seq) / len(seq)
Is it intentional that this doesn't support iterators?
--
___
Python tracker
<https://bugs
Steven D'Aprano added the comment:
> On my current 3.8 build, this code given an approx 500x speed-up
On my system, I only get a 30x speed-up using your timeit code. Using
ints instead of random floats, I only get a 9x speed-up.
This just goes to show how sensitive these timing res
Steven D'Aprano added the comment:
That's not a crash. You are trying to install a package using pip, pip sees
that it is missing the METADATA file and reports a problem. That is working
correctly, not a crash.
There is no way for us to know how the metadata file got deleted.
Steven D'Aprano added the comment:
Oh, I seem to have accidentally reverted the change of title.
Sorry, that was definitely not intended and I don't know how it
happened. But now that it has, I'm not going to change it until we have
a dec
Steven D'Aprano added the comment:
I presume you aren't referring to this:
from types import MethodType
> There really isn't anything else to say about it
How about starting with why you want this and what you will do with it?
According to this post on Sta
Change by Steven Davidson :
--
nosy: +Steven Davidson
___
Python tracker
<https://bugs.python.org/issue23607>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Steven D'Aprano :
--
nosy: +steven.daprano
versions: +Python 3.8 -Python 2.7, Python 3.5
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
> Would you like me to submit a PR with docs and tests?
Yes please! I'm happy with the name fmean.
--
___
Python tracker
<https://bugs.pytho
Steven D'Aprano added the comment:
Thanks Raymond for the interesting use-case.
The original design of mode() was support only the basic form taught in
secondary schools, namely a single unique mode for categorical data or
discrete numerical data.
I think it is time to consider a r
Steven D'Aprano added the comment:
What's "BIF" mean? You use that term multiple times but I have never heard it
before.
I'm sorry, I don't understand your code (and don't have time to study it in
detail to decipher it). It would help if you factored out
Steven D'Aprano added the comment:
Which documentation are you referring to?
The docstring says:
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
which is clearly a space. The docs here:
https://docs.python.org/3/library/functions.html#print
s
Steven D'Aprano added the comment:
I'm not sure that __debug__ is a proper keyword. Unlike None, if you
monkey-patch builtins, you can modify it:
py> builtins.__dict__['__debug__'] = 'Surprise!'
py> __debug__
'Surprise!'
py> builtins.__dict
Steven D'Aprano added the comment:
Do I correctly understand the reported problem here?
set.add(0) correctly raises TypeError in each case, but:
(1) the exception message changes between versions;
(2) and also changes depending on whether or not sys.trace is active.
I don't
Steven D'Aprano added the comment:
Changing the title from referring to "decimal" to "float", since this has
nothing to do with the decimal module or Decimal type.
Like Raymond and Tim, I too cannot reproduce the claimed difference in
behaviour between Python 2.7 a
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue36027>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
I like this idea!
Should the "examples" method be re-named "samples"? That's the word used in the
docstring, and it matches the from_samples method.
--
___
Python tracker
<h
Steven D'Aprano added the comment:
PR looks good to me, thanks Raymond.
Just at the moment I'm having problems with my internet connection leading to
technical difficulties with Github. Hopefully I can resolve this soon.
--
___
Pyth
Steven D'Aprano added the comment:
Thanks Raymond.
Apologies for commenting here instead of at the PR.
While I've been fighting with more intermittedly broken than usual
internet access, Github has stopped supporting my browser. I can't
upgrade the browser without upgradin
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue29724>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
On my computer, running Python 3.5 and continuing to do other tasks while the
tests are running, I get a reproducible 5% speedup by using the "default
values" trick. Here's my code:
import operator
def dotproduct(vec1, vec2):
return
Steven D'Aprano added the comment:
Further to Barry's explanation, you see the same result with any values which
compare equal:
py> from decimal import Decimal as D
py> [1, 1.0, D(1), True, 1+0j].count(D(1))
5
This is standard behaviour for methods `count`, `remove`, and
Steven D'Aprano added the comment:
To be clear, I'm referring to the docs in the tutorial:
https://docs.python.org/3.7/tutorial/datastructures.html
and the docstrings as well as the library reference:
https://docs.python.org/3.7/library/stdtypes.html#sequence-types-list-tuple-
Changes by Steven D'Aprano :
--
nosy: +haypo, ncoghlan, steven.daprano
___
Python tracker
<http://bugs.python.org/issue29790>
___
___
Python-bugs-list m
Steven D'Aprano added the comment:
Your example works because random is a module:
py> from types import ModuleType
py> import random
py> type(random) is ModuleType
True
Since random is an instance of ModuleType, your class M is a subclass of
ModuleType, and assigning to rando
Steven D'Aprano added the comment:
I'm afraid I don't know what SUT means.
But 3 == 3.0 is the correct and expected behaviour. If you need to
check that two values are both the same type and the same value, you
have to validate the type and value separately.
Changing the beh
Steven D'Aprano added the comment:
It seems to me that the basic Counter class should be left as-is, and if there
are specialized methods used for statistics (such as normalize) it should go
into a subclass in the statistics module.
The statistics module already uses Counter internal
Steven D'Aprano added the comment:
Its not clear what you are asking for here. Do you think the current behaviour
is a bug? Are you asking for a new feature? What do you want?
When the decorator is called, "self" doesn't exist, so of course
@self.decorator *must* fail. W
Steven D'Aprano added the comment:
Why is the name flagged as a private implementation detail? I.e. a single
leading underscore. I'd be reluctant to rely on this in production code, given
how strong the _private convention is.
Suggest just `sys.raw_args` instead.
-
Steven D'Aprano added the comment:
Before writing a patch that may be rejected, can you explain in detail what
change you propose? Example(s) will be good.
For example:
py> from operator import attrgetter
py> f = attrgetter('keys')
py> f({})
I don't see a tup
Steven D'Aprano added the comment:
Duck typing is not something that "Python" does, it is a style of programming
done by Python programmers. You wouldn't expect isinstance() to try to "duck
type", and likewise the inspect module should be precise about what
Steven D'Aprano added the comment:
> list expression pass starred expression, the other hand
> tuple expression cannot pass starred expression.
You are misinterpreting what you are seeing.
( ) is not a tuple expression (except for the special case of empty brackets,
which makes an
New submission from Steven D'Aprano:
As discussed on the Python-Ideas mailing list, it is time to discourage the use
of operator.__dunder__ functions. Not to remove them or deprecate them, just
change the documentation to make it clear that the dunderless versions are
preferred.
Guido
Steven D'Aprano added the comment:
In the future please don't post binary files containing source code, especially
something as non-standard as 7z. That just makes it difficult for people to
review the code. Either paste your code snippet directly into the bug report,
or attach i
Steven D'Aprano added the comment:
The behaviour is as documented and is not a bug. When you have a three-argument
extended slice, the starting and stopping values depend on whether the stride
(step) is positive or negative. Although that's buried in a footnote to the
tab
Steven D'Aprano added the comment:
Perhaps the existing ``cache_clear`` method could take optional arguments?
def cache_clear(self, *args, **kw):
if not (args or kw):
# clear the entire cache
else:
# clear just the cache entry for *args, **kw
--
compo
Steven D'Aprano added the comment:
Is this unnecessary code churn?
That's not a rhetorical question. Fixing code that isn't broken is not always a
good idea.
``func()`` is not always identical to ``func()``, there are situations where there is a significant performance
differe
Steven D'Aprano added the comment:
Be careful with the documentation patch. Although unbound method as an object
type is gone, unbound method as a concept is not.
Conceptually, something like ``MyClass.spam`` is an unbound method: it is a
method of the MyClass type, but bound to no ins
New submission from Steven D'Aprano:
According to the documentation, random.shuffle() should accept a sequence. But
it also accepts dicts, in which case it does nothing, expensively:
py> x = dict.fromkeys(range(10**6))
py> random.shuffle(x)
py> str(x)[:55] + "...}"
Steven D'Aprano added the comment:
This is not a small change, and will need careful thought.
The problem is that in Python 3 (and in Python 2 for new-style classes), dunder
methods are only called by the interpreter if they are defined on the class
itself, not on the instance. That
Steven D'Aprano added the comment:
A further thought... looking at your example code, I believe that part of the
__getattr__ is redundant.
def __getattr__(self, item):
try:
return self.__getattribute__(item)
except AttributeError:
return s
Steven D'Aprano added the comment:
I think this should be closed. For backwards compatibility, the defaultdict
default_factory function must remain as it is. There is lots of code that uses
something like `int` or `list` as the factory, and if the missing key was to be
passed, the code
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue9584>
___
___
Python-bugs-list mailing list
Unsubscr
New submission from Steven D'Aprano:
There has been some discussion on Python-Ideas about adding
fnmatch.filter_false to complement filter, for when you want to ignore matching
files rather than non-matching ones.
https://mail.python.org/pipermail/python-ideas/2017-May/045694.html
I
Steven D'Aprano added the comment:
I'm happy for you to change the name to filterfalse.
--
___
Python tracker
<http://bugs.python.org/issue30413>
___
___
Steven D'Aprano added the comment:
Can you please explain why you need to change the --more-- text in the pager?
I haven't been able to find any way to change the "--more--" prompt in the
shell commands `less` and `more`, and remember that the pager will under some
circ
New submission from Steven Myint:
Since #29463, it is no longer obvious how to get the line number of a docstring
in the AST:
import ast
x = ast.parse('''\
def foo():
"""This is a docstring."""
''')
Steven Myint added the comment:
I think what you guys have brought up makes sense.
Now that you mention it, I see that pyflakes gives the wrong line number if an
escaped newline appears after the doctests. Though, it works fine if the
escaped newline appears before it.
https://github.com
Steven D'Aprano added the comment:
This is just module shadowing in action. If you have two or more modules, or
packages, in the module search path, the first one found will block access to
the others.
> this is a bad design in my opinion.
*shrug* It is what it is.
Often it is inco
Steven D'Aprano added the comment:
I don't really understand your example code. What result did you expect? The
output shown in Github seems correct to me:
optional arguments:
-h, --helpshow this help message and exit
--language1 XX
La
1001 - 1100 of 1942 matches
Mail list logo