Vedran Čačić added the comment:
How about adding the words "More precisely," at the beginning of the second
sentence?
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
A long time ago, Python documentation used true and false as adjectives (as
opposed to True and False, which are proper names for canonical true/false
objects). I think it was BDFL's preference back then.
In the meantime, I suppose through JS's
Vedran Čačić added the comment:
Yes, it's ok. The only slight problem is that is suggests that first item is
somehow special, but later it is explained that in fact it is not. :-) I would
say "_Each_ item ..." (instead of "First") and without the "this is repea
Vedran Čačić added the comment:
Let me just say that I use `raise SystemExit` all the time. Beats `from sys
import exit`, weird error messages about having to type parentheses, and surely
beats "oh, am I on Windows so Ctrl+Z, or on Linux so Ctrl+D". :-]
I also use `raise Keyboar
Vedran Čačić added the comment:
At one moment, I had a need for
itertools.count(datetime.date.today(), datetime.timedelta(days=1))
Of course, it was no problem to write it myself, but still, it would be
incredibly neat if it simply worked.
--
nosy: +veky
Vedran Čačić added the comment:
You've managed to write 3 messages already, without at any point mentioning
what _really_ happens when you += something.
a += b means (is closest to) a = type(a).__iadd__(a, b)
You focus all the time on __iadd__ call, disregarding that its resu
Vedran Čačić added the comment:
Just for the record, I consider PEP 479 one of (very rare) design bugs in
Python, and would like it reversed some day. (So anything that helps this
outcome, including -1 on this, is welcome.)
It subverts the natural property of exceptions (that they bubble
Vedran Čačić added the comment:
That "except AttributeError" approach is a powerful bug magnet, since it can
very easily mask real attribute errors stemming from misspelled attribute names
in the __post_init__ call itself. What you should _really_ do is
def __post_i
Vedran Čačić added the comment:
pdb on Py3.10.2 works fine with that code.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue46908>
___
___
Pytho
Vedran Čačić added the comment:
Confirmed. On Python 3.10.2,
>>>
re.findall(r"(((\w)+\w*\3){2}|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*",'alabama')
[]
yet https://regex101.com/r/uT8gag/1 (with "Python" selected) says it
Vedran Čačić added the comment:
You mean `type(object).__str__(object)` instead of `type(object).__str__()`,
obviously.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue47
Vedran Čačić added the comment:
The problem is more subtle. The thing is, "default parameter" doesn't make
sense in this context. Yes, a and b are parameter, but a is not "default
parameter" in any sensible way. It is _None_ which is the default argument for
param
Vedran Čačić added the comment:
I'm not satisfied with "and" formulation. For all practical purposes, math.nan
is the "same" object as float('nan'), they just represent two ways of referring
to it (or constructing it). To me it sounds a bit like "2 and
Vedran Čačić added the comment:
An important point nobody made, as far as I can see:
* the main usability improvement justifying math.isclose is that you don't know
the order of magnitude of your correct value--it could be anything (even
infinite), and the manner of comparison depends
Vedran Čačić added the comment:
> First, I hope we all agree:
> 'C:\Windows\..\Program Files' and '/usr/../bin' == relative path
I don't agree. To me, absolute means regardless of a reference point. So,
absolute path would be a path that refers to the same entit
Vedran Čačić added the comment:
Well, it is the _intended_ use of NotImplemented. Of course you can use it
whenever you want, just as you can use Ellipsis whenever you want. But I don't
think docs should encourage that.
--
nosy: +veky
___
P
Vedran Čačić added the comment:
Sorry, I think you still don't understand.
The emulation of double dispatch by single dispatch, with all complications it
brings, is the only reason NotImplemented exists. If Python didn't have binary
operators (or inheritance), I'm quite sure i
Vedran Čačić added the comment:
Of course, languages evolve. Annotations were introduced just for function
arguments, now we use them almost everywhere. Generators were simply loop
managers, now they've blown up to complete asynchronous programming beasts.
Ellipsis was introduced for e
Vedran Čačić added the comment:
Of course, if there are independent use cases already in the codebase, then my
opinion is changed.
--
___
Python tracker
<https://bugs.python.org/issue37
Vedran Čačić added the comment:
I just want to express my delight, Terry, about your desire to solve the root
of the problem instead of just fixing a particular instance. (This is not the
first time I witnessed that.) It's a big part of the reason why I love Python
so much.
--
Vedran Čačić added the comment:
I don't think anything _bad_ can happen with that optimization, if it's already
written. And people (me included) do like to write shorter expressions instead
of longer ones.
--
nosy: +veky
___
Pyth
Vedran Čačić added the comment:
I also use it all the time. Most recently in some numerical calculation for
successive differences. My main problem is that I'm too often tempted to just
zip l with l[1:], thereby restricting the code to sequences, when it would work
perfectly well fo
Vedran Čačić added the comment:
> Many docs are ... vague about types.
... and I consider that a feature. At least if you do that, make an explicit
decision not to introduce TypeErrors for "disagreeing with the documented
signature".
For example, I'd be ok with sum b
Vedran Čačić added the comment:
I don't see what the "fix" should be. Python doesn't have value semantics.
Functions are called with objects, not with their values.
Imagine a was global variable, and then you say:
a = mutable_object()
f(a)
a.mutate()
f.
Vedran Čačić added the comment:
In that case, I'm pretty sure you'd never be able to document almost _any_
function signature. Python is simply not a statically typed language, and we
love it because of that.
Ok, go to the list of builtins, and start alphabetically. First is abs.
Vedran Čačić added the comment:
Well, yes, if you're going to invent a special typeclass for every protocol,
then you can document any signature. But what purpose does it serve? Abs to me
seems like a hack, not something we really wanted to capture with the type
system.
Do you find (x
Vedran Čačić added the comment:
Your arguments in my view boil down to "Haskell is a nice language" and "Static
typing is useful". It still doesn't change my argument that Python is
genetically neither of these. And we will cripple it greatly if we try to push
it
Vedran Čačić added the comment:
https://www.python.org/dev/peps/pep-0484/#non-goals
I really have nothing more to say.
--
___
Python tracker
<https://bugs.python.org/issue38
Vedran Čačić added the comment:
> when `b` has same values of `a` before it is mutated.
There might be no such object. Or it might exist, but you still wouldn't want
it.
Consider the case when a is a coroutine that has just started (a=coro()). You
call f with a, and then advance
Vedran Čačić added the comment:
Is this actually needed? I can't remember ever needing more than 4 (in a
pattern). I find it very hard to believe someone might actually have such a
regex with more than a hundred backreferences. Probably it's just a misguided
attempt to pars
Vedran Čačić added the comment:
I have no problem with long regexes. But those are not only long, those must be
_deeply nested_ regexes, where simply 100 is an arbitrary limit. I'm quite sure
if you really need depth 100, you must also need a dynamic depth of nesting,
which you cannot r
Vedran Čačić added the comment:
The documentation clearly says:
> This special sequence can only be used to match one of the first 99 groups.
> If the first digit of number is 0, or number is 3 octal digits long, it will
> not be interpreted as a group match, but as the character w
Vedran Čačić added the comment:
Not very useful, surely (now that we have hex escapes).
[I'd still retain \0 as a special case, since it really is useful.] But a lot
more useful than a hundred backreferences.
And I'm as a matter of principle opposed to changing something that'
Vedran Čačić added the comment:
However, this is an instance of a general problem: whenever we want to strongly
type (via dunders) protocols that specialcase builtin types, we will have to
choose between three options:
* special case them also in typing engine, complicating the typing engine
Vedran Čačić added the comment:
The width doesn't mean "the number of bits", it means "the width of the field".
In every other case too:
* when we format negative numbers, width includes the minus sign
* when we format decimal numbers, width includes decimal point (o
Vedran Čačić added the comment:
It seems that you're confusing two things that really don't have much in common.
* (field) width is a _number_, saying how many characters (at least) should the
formatted output take.
* padding is a bool (or maybe a char), saying what should be put
Vedran Čačić added the comment:
I can't find it now, but I seem to remember me having this same proposal
(except the part for bytes) quite a few years ago, and you being the most vocal
opponent. What changed? Of course, I'm still for it.
(Your second list has fourth item extra
Vedran Čačić added the comment:
Does strong typing mean you should write
if bool(condition): ...
or
for element in iter(sequence): ...
or (more similar to this)
my_set.symmetric_difference_update(set(some_iterable))
?
As Eric has said, if there's only one possible thin
Vedran Čačić added the comment:
Matthew: can you then answer the same question I asked Serhiy?
The example usually given when advocating strong typing is whether 2 + '3'
should be '23' or 5. Our uneasiness with it doesn't stem from coercions between
int and str, but
Vedran Čačić added the comment:
Yes, I know what strong typing means, and can you please read again what I've
written? It was exactly about "In the face of ambiguity, refuse the temptation
to guess.", because binary operators are inherently ambiguous when given
differently
Vedran Čačić added the comment:
All three words in the title are wrong. :-D
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue43581>
___
___
Pytho
Vedran Čačić added the comment:
Well, just reverse the order of -= in second statement. If you write =-, it
will magically work. ;-)
But in the general case, sometimes introducing temporary variables is the
simplest solution.
The alternative would be to implement pointwise -= for tuples
Vedran Čačić added the comment:
Absolutely. I think that's a big part of the reason that as_integer_ratio is
there.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/is
Vedran Čačić added the comment:
May I ask, is this going forward? I installed 3.11-dev, it's not there (though
__future__ claims it should be). I understand if it isn't done yet, just want
to know if there's risk it will be postponed again (or even given up).
---
Vedran Čačić added the comment:
How about '1_/_2'? I think making / more separated adds value... though of
course, someone will ask about '1 / 2' next. :-)
--
nosy: +veky
___
Python tracker
<https://bug
Vedran Čačić added the comment:
Of course, I'm for it. But we have to be consistent... I was surprised to
realize `complex` doesn't accept '2 + 3j' (even though it accepts '(2+3j)', and
even '\n2+3j\t'). There are a lot of slippery slopes here (e.g
Vedran Čačić added the comment:
It doesn't make sense to "concatenate" one absolute path to another. / has a
simple explanation: if you start at /foo, and then do cd bar, you'll end up in
/foo/bar. But if you start at /foo, and then do cd /bar, you'll end up in /bar
Vedran Čačić added the comment:
Have you seen the Note at
https://docs.python.org/3/library/functions.html?highlight=Note#round?
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue44
Vedran Čačić added the comment:
In my view, turtle is a great tool for exploring _polar_ coordinates. If you
set emphasis to rectangular coordinates, there are many tools that are much
better.
Second, your function might be ok for you, but it is really not suitable for
standard library
Vedran Čačić added the comment:
Of course, the "license" mention should be changed in the same way (in the same
message).
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
> based on feedback it seems that almost everyone expects "exit" to exit
I don't, and I don't remember being asked.
Let me be clear: if exit were a Python keyword, then maybe I would expect that.
Or at least, I could convince myself to e
Vedran Čačić added the comment:
> In the other hand, special-casing 'quit\n' and 'exit\n' could be seen as
> analogous to special-casing '^Z\n'
Terry, there is a big difference between special-casing 'exit\n' and
special-casing '^Z\n'
Vedran Čačić added the comment:
Would it be possible to change .utcnow to now return a datetime annotated with
UTC "timezone"? After all, now we have timezone-aware datetimes and the
convention that naive means local, this behavior might even be considered a bug.
--
n
Vedran Čačić added the comment:
Your implementation has many problems. First, almost all your complexity claims
are wrong, probably because you copied them from Java, which uses balanced
trees instead of Python's hash tables.
(Also, the method names seem to be copied from Java,
Vedran Čačić added the comment:
It currently says:
...matches are returned in the order found. If one or more groups are present
in the pattern, return a list of groups...
I'm not quite sure how it could be clearer. Maybe "Alternatively" at the start
of the second sentence?
Vedran Čačić added the comment:
Ah, now I see. When some_match.group(0) is called, the whole match is returned.
So match can be considered kinda group (quasigroup?:). I see how it can be
confusing: python usually starts indexing at 0, and someone might think that a
.group(0) would be
Vedran Čačić added the comment:
Have you seen the patch? In the patched docs, non-capturing grouping is
explicitly mentioned. (Though I myself wouldn't include even that, as it's
superfluous with what's said before, obviou
Vedran Čačić added the comment:
Also, maybe you should read the following sentence (also in the docs):
> If one wants more information about all matches of a pattern than the matched
> text, finditer() is useful as it provides match objects instead of strings.
It seems that's what
Vedran Čačić added the comment:
For IntEnum, maybe. But for Enum, the whole point of auto() is that the values
don't really matter. The rationale was that with IntEnum, truth testing (which
is often used in Python to realize Optional) would distinguish None, and then
all true Enums
Vedran Čačić added the comment:
I think you should be even more explicit. If values matter, they _should_ be
seen in code. (All of them, not just the first one.) auto() just means "this
value doesn't really matter". And it's not really hard to write concrete values
instea
Vedran Čačić added the comment:
Honestly, I think it's backwards. Either they _do_ matter because of some
external factor (you mention network interoperability, though I'd like you to
clarify... what exactly did you send over the network?), or they don't matter
(if done right
Vedran Čačić added the comment:
_But why should it matter that starting value is the same_ unless you actually
use IntEnums for indexing?
About your code: what do you _actually_ mean by "equivalent"? I hope you don't
think that the memory representation is the same. You keep
Vedran Čačić added the comment:
And CEnum is probably the best name for it. "Int" part is pretty much implied
in "C" part.
--
___
Python tracker
<https://bug
Vedran Čačić added the comment:
It probably has nothing to do with your bug, but your title is wrong. You are
_not_ getting mtime using pathlib (but using os.path instead). That is done
like using this approach:
https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat
Just to
Vedran Čačić added the comment:
Matt obviously meant the day of week, but in docs day is meant as day of month.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue45
Vedran Čačić added the comment:
I think it is exactly what "capture" means: "not allow it to escape" (to the
console). Maybe you should read the documentation?
--
nosy: +veky
___
Python tracker
<https://bug
Vedran Čačić added the comment:
The first variant seems best to me.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue45104>
___
___
Python-bug
Vedran Čačić added the comment:
> choose one for the default so that default encoding/decoding will work cross
> platform. I think "little" is the most common (intel and arm).
Raymond, please don't do this. We already have a "sensible default" in a
networ
Vedran Čačić added the comment:
My sensibilities are irrelevant here. I'm just saying we already have a
standard byte order for data in transit, and it was introduced long before this
thing called internet (it was with capital I back then:) started to intere
Vedran Čačić added the comment:
The poll is invalid, since the option that most people want is deliberately not
offered.
--
___
Python tracker
<https://bugs.python.org/issue45
Vedran Čačić added the comment:
I'd say yes. Of course, one way to ascertain that would be to conduct a valid
pool. ;-)
--
___
Python tracker
<https://bugs.python.org/is
Vedran Čačić added the comment:
Please see the message https://bugs.python.org/issue35712#msg349303. Filtering
with those dunder sesqui-dispatch methods really is a bug magnet.
--
___
Python tracker
<https://bugs.python.org/issue35
Vedran Čačić added the comment:
> why it would be beneficial to have custom handling like this for exit is that
> exit is a site-builtin, not a builtin.
In my view, that's exactly why it _shouldn't_ have a special treatment. After
all, site can add many more builtins. Do you
Vedran Čačić added the comment:
Just wanted to say that
"raise SystemExit" is shorter than
"import sys; sys.exit()", has no special characters (just letters and space)
and is really much quicker to write. Yes, it doesn't work if someone rebound
SystemExit, but if
Vedran Čačić added the comment:
I surely don't understand what the third argument means. What's (1, 2) there,
and what stride does it produce?
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
I guess those old versions were removed because they are "frozen", that is, not
receiving doc fixes anymore.
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
New submission from Vedran Čačić :
I'm sure this is exactly how it should work, I just want to know if you think
it is documented properly, so I can rely on it. In my opinion the docs should
be more precise.
>>> ''.join(dict.fromkeys('axbxc'))
'axbc
Vedran Čačić added the comment:
Absolutely, but that's not my problem. I take your sentence to mean that when I
do something with a _dict_ argument, it should try to preserve its insertion
order as much as possible (given the semantics of the concrete method in
question). I agree.
B
Vedran Čačić added the comment:
https://docs.python.org/3/library/calendar.html#module-calendar
The functions and classes defined in this module use an idealized calendar, the
current Gregorian calendar extended indefinitely in both directions.
https://en.wikipedia.org/wiki
Vedran Čačić added the comment:
> fix typically isn't replacing s[i] with s[i - 5]
... especially since that will still raise IndexError (in case when i==15 and
len(s)==10). ;-P
--
nosy: +veky
___
Python tracker
<https://bugs
Vedran Čačić added the comment:
Of course, signature should be imported from inspect, not from typing. In that
case, the example works on Python 3.10 and 3.11.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue45
Vedran Čačić added the comment:
I thought that _Feature starts with an underscore precisely to evade such
listings. Do other "private" module data also get listed?
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
Very nice. I aplaud your return to the original Python terminology, of true and
false as adjectives, and True and False as names for specific objects. Perlisms
such as `truthy` or `that evaluates as True` simply make my head spin.
I wrote one comment
Vedran Čačić added the comment:
Yes, this is impossible using only "universal Python" (independent of
implementation). Though, of course, it's possible in CPython if you analyze the
source code (or AST) and count the targets on the left side.
---
Vedran Čačić added the comment:
Have you read https://github.com/ericvsmith/dataclasses/issues/3?
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue38
Vedran Čačić added the comment:
It seems to me that what you're missing is that "class declarations" are still
perfectly normal executable statements (in most other superficially similar
programming languages, they are not). So, when you say
class A:
b = []
it is actua
Vedran Čačić added the comment:
Why exactly is [2,3] expected? In the first example, the inner list has two
functions that are _exactly the same_. Each of them takes a, grabs i from outer
scope, and returns a[i]. (And of course, at the moment of evaluation of these
functions, i is 1.)
Do
Vedran Čačić added the comment:
Yes, I never really understood what problem people have with it. If I manually
say
i = 0
f = lambda a: a[i]
i = 1
g = lambda a: a[i]
why does anyone expect functions f and g to be different? They have the same
argument, and do the same thing with it. The
Vedran Čačić added the comment:
I think the real issue here
> mypath = PurePosixPath(normpath(mypath))
is the PurePosixPath wrapper. It is nice that normpath _accepts_ pathlike
objects, but it should then not return a generic str. It should try to return
an object of the same type.
Vedran Čačić added the comment:
I think that "HOW TO"s are fundamentally different from the "regular"
documentation, in that they focus on explaining only the usual use cases and
valuing simple explanations over the correct ones. Of course this _can_ be
fixed, but I don&
Vedran Čačić added the comment:
I must say that the problem (with two classes divided into teams) seems to me
to be exactly one that can be solved with gcd, and lcm itself is mostly useless
for it.
--
nosy: +veky
___
Python tracker
<ht
Vedran Čačić added the comment:
I agree with Raymond that it's really seldom needed. However, I'd like to point
out that the "trivial" implementation might not be so trivial after all: as
Steven said, it mishandles (0,0) case. And even Tim fell into that trap, so it
can
Vedran Čačić added the comment:
is_prime that's always correct is probably not the right thing to go into math.
Besides, now we have isqrt, it's just
n>1 and n&1 and all(n%d for d in range(3,isqrt(n)+1,2))
-- yes, it's damn slow, but so is everything else you
Vedran Čačić added the comment:
And yeah, I managed to leave out 2. Speaking about "often implemented wrong"...
:-))
--
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
You mean, something like
while ((row = pysqlite_cursor_iternext(self))) {
PyList_Append(list, row);
Py_DECREF(row);
}
? It's interesting that now we have walrus in Python, we see the opportunities
for it in other languages
Vedran Čačić added the comment:
It seems you haven't read carefully what I've written. This way some compilers
might emit warnings. Please read
https://stackoverflow.com/questions/5476759/compiler-warning-suggest-parentheses-around-assignment-used-as-t
Vedran Čačić added the comment:
Tim: Considering that congruence is _defined_ as x=y(mod m) :<=> m|y-x, it's
really not so surprising. :-)
Steven: It seems that we completely agree about inclusion of
is_probabilistic_prime in stdlib. And we agree that it should be called i
Vedran Čačić added the comment:
> Of course the result is exactly 2. Which I have enough RAM to hold ;-)
You might think so, but if you write it as 2.00...0 with
>>> decimal.MAX_PREC
99
zeros, I think you're overestimating your RAM capacity. :-P
Now,
Vedran Čačić added the comment:
Yeah, I should have said "represent" instead of "write". :-)
--
___
Python tracker
<https://bugs.python.org/issue39576>
___
Vedran Čačić added the comment:
I can't help with the issue itself (though I must say that I philosophically
don't believe in "sailed off ships" -- in the limit, Python must be the best it
can be, though it can take decades to get there), but I can help you with the
erro
1 - 100 of 336 matches
Mail list logo