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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
> 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:
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:
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
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:
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
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:
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:
> 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:
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:
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:
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:
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:
> 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:
The first variant seems best to me.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue45104>
___
___
Python-bug
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:
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:
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:
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:
_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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
> 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:
> 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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
> "It's still one of the most common beginner mistakes"
Do you have any data to back this up? I really think it's overblown.
On the other hand, if it really _is_ so, how about changing the language? It
wouldn't be the first thing t
Vedran Čačić added the comment:
Aren't we overthinking this? Python 2 is a dead language. It has reached end of
life more than a year ago (and was scheduled to do so in 2015). Why are we
still trying to accomodate something that stopped being relevant a long time
ago?
--
nosy:
Vedran Čačić added the comment:
While it might be useful, I don't think it is what you want. For example, you
wouldn't say it contains 'r/sh', right? I think it should only refer to full
names of path parts.
--
nosy: +veky
__
Vedran Čačić added the comment:
It is just a matter of a different (though not very different) language. As
such, it is a duplicate of https://bugs.python.org/issue24990.
--
nosy: +veky
___
Python tracker
<https://bugs.python.org/issue43
Vedran Čačić added the comment:
@Raymond: why can't ABCs have _default_ implementation of | and |=, in terms of
other supported methods (such as update)? It seems to me this would be the best
of both worlds.
--
nosy: +veky
___
Python tr
Vedran Čačić added the comment:
Recursion limit is probably set too high, but nonetheless, the program is
nonsensical, the line 39 especially.
The reason for difference in behavior is that RecursionError is caught by blank
except in the earlier Pythons, while it crashes the stack in later
Vedran Čačić added the comment:
Terry: of course, if a method is not overridden, there's no need to call
super()'s method, since the only thing it would do is call the same thing that
would be called without overriding.
But of course, if Exception's __init__ does anyth
Vedran Čačić added the comment:
... as it probably should: look at https://bugs.python.org/msg349303
Yes, filtering comprehensions are a frequently used niche, and too long in the
"official" parlance. I seem to recall that
[x in mylist if x is not None]
(instead of triple
Vedran Čačić added the comment:
Yes, the ability to write randrange(1e9) is sometimes nice. And the fact that
it might give the number outside the intended range with probability 1e-17 is
not really an important argument (people have bad intuitions about very small
probabilities). But if we
Vedran Čačić added the comment:
Maybe you would use 5, but I would use 7 and get the same result. If the docs
say "X.rindex(Y) == i means i is the highest index where Y is found in X", and
"Y is found in X at i" is interpreted as "X[i:i+len(Y)] == Y" (as Serhiy
Vedran Čačić added the comment:
inf and -inf are really two different values (in the scope of the standard).
Same as 5. and -5., or even 0. and -0. They behave differently in some exactly
specified operations, and it is useful.
Are there any exactly specified operations whose specifications
Vedran Čačić added the comment:
> In the OP, the error is caused by `open` being unavailable, which is a
> builtin. According to what Serhiy says, this error would be after step 6
I think you read the post above incorrectly. The phase 3 is the one where open
is removed, since it
Vedran Čačić added the comment:
If I understand correctly, those are _private methods_ (names start with
underscore). In such cases, asserts can be completely fine, since the library
writer controls the situations where the method is called. If it is never
called with _UNKNOWN argument
Vedran Čačić added the comment:
Flag values are _not_ a set of enabled bits.
At least, it is a weird kind of set where a is the same as {a}. That's why I
mentioned mereology... there is no reasonable "membership", just "inclusion". I
understand that str is not a perf
Vedran Čačić added the comment:
Again, I disagree. `str` used to work like this in Py2.0 (or somewhere around
then), only 'x' was in 'xyz', not 'xy'. Then Guido came to his senses. :-)
This is not set theory, this is mereology. You don't differentiate betw
Vedran Čačić added the comment:
Of course, if it returns True only on _some_ bits combinations it doesn't make
sense. I thought every element of a Boolean span would be _in_ the Foo.
But about "zero bit", I still think it's perfectly ana
Vedran Čačić added the comment:
Just a comment, (1) is analogous to str. iter('abc') gives only 'a', 'b' and
'c', while contains accepts '', 'ab', 'bc', and 'abc' too. At least in my mind,
it's a prett
Vedran Čačić added the comment:
Of course, that's why I wrote "my" in quotes above. It's not my solution, it's
the idea that many people independently had. Because it is _the_ solution, of
course. :-]
I'd just like to point out in the above thread (first l
Vedran Čačić added the comment:
Sorry, but
1) Stability policy is great when we hold on to it. If we add new spellings of
assert every few years, what kind of stability it is? "My" solution is of the
same type: just add one more thing to the API. But that solution is better,
bec
Vedran Čačić added the comment:
> - do you think the change has merit?
Absolutely.
> - why /shouldn't/ we make the change?
Well, standard backward compatibility stuff. :-)
--
___
Python tracker
<https://bugs.python.
Vedran Čačić added the comment:
It would be a valid argument if the API _worked_. Obviously, it doesn't. Every
few years, the same story repeats. "We've found even more missspellings of
assert, we need to add them too. They cause real bugs in our tests." I have a
strong f
Vedran Čačić added the comment:
How about we actually _solve_ the problem, instead of masking it with layer
upon layer of obfuscation?
Python has standalone functions. assert_called (and company) should just be
functions, they shouldn't be methods, and the problem is solved elegantly
Vedran Čačić added the comment:
I think it would be simpler to just remove the empty name `x`.
"If you have an object, you can ...".
--
nosy: +veky
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
Noone said it is a requirement, I just said it would be nice to have it
factored out as a decorator or something instead of having to write __repr__
over and over again.
--
___
Python tracker
<ht
Vedran Čačić added the comment:
If it's considered to be not too backwards-incompatible, I think it would be
nice to have str different from repr. That way we can finetune what exactly we
need. But we can already do almost exactly that with *int* instead of *str*, so
it's not too
Vedran Čačić added the comment:
The fact that you've forgotten about it is exactly why sum tries to educate you
(despite Python being "the language of consenting adults" in most other
aspects). The problem (why it doesn't do a good job in that aspect) is that
people usual
Vedran Čačić added the comment:
Well, of course, but that's possible even now, and people still reach for
`round`. I guess the problem is that it's too easily accessible. :-)
--
___
Python tracker
<https://bugs.python.o
Vedran Čačić added the comment:
> Personally, I think I'd rather have easier ways to create Decimal objects
Wouldn't everybody? :-P But that's been proposed at least 4 times already and
never got anywhere. My proposal is at least original, has a precedent at the
abov
Vedran Čačić added the comment:
> I'd rather add whatever bells and whistles we need (if any) to make it easier
> for users who care about this to use Decimal.
This made me think. (I have tons of these ideas, but usually am afraid of
voicing them unless encouraged by comments s
Vedran Čačić added the comment:
> use more digits to manage rounding in decimal base, not only one but more (i
> should think better and experiment on how many)
You don't have to. It's infinitely many. :-P Think, how many decimal digits
would you need to accurately round numb
Vedran Čačić added the comment:
I think you don't know what paraphrasing means. Or maybe I don't know it, but
in any case, I'm well aware what Von Neumann said, and how it is usually
misunderstood in today's society. "Living in the state of sin" is simply an
Vedran Čačić added the comment:
IDLE has Go to File/Line menu too. I think it would also help there. (Terry,
can you confirm?) Not to mention that it would be one thing less to explain to
beginners when using pdb.
--
nosy: +veky
___
Python tracker
Vedran Čačić added the comment:
Yes, and these functions are completely fine for your personal library, if you
need such things. But they really have no place in math module, since (1) they
aren't always correct, (2) it's incredibly difficult to characterize exactly
when they a
Vedran Čačić added the comment:
Yes, we can do better than ms (whatever that means). And we do exactly that in
the `decimal` module. Floats are not the right target for your algorithms,
because they don't have decimal digits. It's as if you're trying to round words
in Englis
Vedran Čačić added the comment:
On the contrary, I think it would be much more clearer if it focused on the one
that was evaluated in the context. So, _inner_ listcomp is... (instead of
"nested listcomp is..."). "Main part of outer" is just beating around the bush.
Vedran Čačić added the comment:
ROUND_HALF_UP is not chosen because it's popular, but because it's the best way
to compensate for errors in representing decimal numbers by binary numbers.
Thinking that floats are decimal numbers is going to bite you anyway sooner or
later. For exam
Vedran Čačić added the comment:
It refers to the sentence
"""The result will be a new list resulting from evaluating the expression in
the context of the for and if clauses which follow it. """
The expression at the start of listcomp is the one that's e
Vedran Čačić added the comment:
This is not nested listcomp. Nested listcomp is a listcomp inside a listcomp.
What you wrote is one listcomp, with two for-clauses. It does "desugar" into a
nested loop, but that doesn't make it a nested listcomp.
---
Vedran Čačić added the comment:
If we want to proceed with this, much better way would be to add a rounding
mode optional argument to `round` builtin.
But really, anyone trying to precisely round a decimal representation of a
binary floating point number is, to paraphrase von Neumann, living
1 - 100 of 336 matches
Mail list logo