[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Vedran Čačić
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 entity from whichever directo

[issue27198] Adding an assertClose() method to unittest.TestCase

2022-03-19 Thread Vedran Čačić
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

[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-19 Thread Vedran Čačić
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 1+1 are the onl

[issue47054] "SyntaxError: non-default argument follows default argument" should be "parameter"

2022-03-17 Thread Vedran Čačić
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 parameter

[issue47007] [doc] str docs are inconsistent with special method lookup

2022-03-14 Thread Vedran Čačić
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

[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Vedran Čačić
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 should m

[issue46908] Debugger jumps to a wrong instruction in for loop

2022-03-03 Thread Vedran Čač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

[issue46757] dataclasses should define an empty __post_init__

2022-02-18 Thread Vedran Čačić
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

[issue46621] Should map(function, iterable, ...) replace StopIteration with RuntimeError?

2022-02-03 Thread Vedran Čač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

[issue46612] Unclear behavior of += operator

2022-02-02 Thread Vedran Čačić
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 result

[issue46574] itertools.count should work with non-number types

2022-01-29 Thread Vedran Čačić
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

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-08 Thread Vedran Čačić
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

[issue46033] Duplicated sentence in for statement documentation

2022-01-03 Thread Vedran Čačić
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

[issue46219] except* assumes that an exception group is truthy

2022-01-02 Thread Vedran Čačić
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 influence

[issue46033] Duplicated sentence in for statement documentation

2021-12-10 Thread Vedran Čačić
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

[issue26120] pydoc: move __future__ imports out of the DATA block

2021-12-07 Thread Vedran Čačić
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

[issue45988] inspect.signature fails on a @staticmethod

2021-12-05 Thread Vedran Čačić
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

[issue44166] Make IndexError messages for list more informative

2021-12-05 Thread Vedran Čačić
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.pyth

[issue45971] calendar module issue

2021-12-02 Thread Vedran Čačić
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

[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Vedran Čačić
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. But my

[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Vedran Čačić
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' Is this guaranteed by the docu

[issue45393] help() on operator precedence has confusing entries "await" "x" and "not" "x"

2021-10-06 Thread Vedran Čačić
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

[issue41226] Supporting `strides` in `memoryview.cast`

2021-09-30 Thread Vedran Čačić
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.org/issue41

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-27 Thread Vedran Čačić
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 that

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-24 Thread Vedran Čačić
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 want all o

[issue35712] Make NotImplemented unusable in boolean context

2021-09-20 Thread Vedran Čačić
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

[issue45155] Add default arguments for int.to_bytes()

2021-09-13 Thread Vedran Čačić
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/issue45

[issue45155] Add default arguments for int.to_bytes()

2021-09-13 Thread Vedran Čačić
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

[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Vedran Čačić
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 interest me

[issue45155] Add default arguments for int.to_bytes()

2021-09-09 Thread Vedran Čačić
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 network con

[issue45104] Error in __new__ docs

2021-09-06 Thread Vedran Čačić
Vedran Čačić added the comment: The first variant seems best to me. -- nosy: +veky ___ Python tracker <https://bugs.python.org/issue45104> ___ ___ Python-bug

[issue45048] subprocess.run(capture_output=Bool) does the opposite of expected

2021-08-29 Thread Vedran Čačić
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

[issue45043] Typo (change 'two' to 'three')

2021-08-29 Thread Vedran Čačić
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

[issue45009] Get last modified date of Folders and Files using pathlib module

2021-08-26 Thread Vedran Čačić
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

[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Vedran Čačić
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

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
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 menti

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
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, you shouldn't

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
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 instead of auto(

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
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 would

[issue44940] Suggest the use of non-capturing groups in re.findall() and re.finditer() docs

2021-08-20 Thread Vedran Čačić
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 you

[issue44940] Suggest the use of non-capturing groups in re.findall() and re.finditer() docs

2021-08-20 Thread Vedran Čačić
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, obviously it's needed

[issue44940] Hint the use of non-capturing group in re.findall() documentation

2021-08-19 Thread Vedran Čačić
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

[issue44940] Hint the use of non-capturing group in re.findall() documentation

2021-08-19 Thread Vedran Čačić
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? r

[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Vedran Čačić
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, using

[issue44663] Possible bug in datetime utc

2021-07-17 Thread Vedran Čačić
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

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-16 Thread Vedran Čačić
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': 'exit' is a perfectly valid identifier (and peop

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-12 Thread Vedran Čačić
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 expect t

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-12 Thread Vedran Čačić
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

[issue44607] Teleport method for turtle class

2021-07-12 Thread Vedran Čačić
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

[issue44595] round() gives wrong result

2021-07-09 Thread Vedran Čačić
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

[issue44452] Allow paths to be joined without worrying about a leading slash

2021-06-26 Thread Vedran Čačić
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. You mean, so

[issue44346] Fraction constructor may accept spaces around '/'

2021-06-09 Thread Vedran Čačić
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. how about 3_j?). I think that once we

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-29 Thread Vedran Čačić
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://bugs.python.org/issue44

[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.11

2021-05-21 Thread Vedran Čačić
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). -- nosy: +veky

[issue44115] Improve conversions for fractions

2021-05-12 Thread Vedran Čačić
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/issue44

[issue43701] Add this optionality

2021-04-03 Thread Vedran Čačić
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

[issue43581] array assignment error

2021-03-21 Thread Vedran Čačić
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

[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Vedran Čačić
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 type

[issue43535] Make str.join auto-convert inputs to strings.

2021-03-19 Thread Vedran Čačić
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 from the fact that + has

[issue43535] Make str.join auto-convert inputs to strings.

2021-03-18 Thread Vedran Čačić
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 thing you

[issue43535] Make str.join auto-convert inputs to strings.

2021-03-17 Thread Vedran Čačić
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. But it's

[issue34013] Inconsistent SyntaxError for print

2021-02-19 Thread Vedran Čačić
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 that was ch

[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Vedran Čačić
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: +veky

[issue43213] Shortcut for checking if PurePath object contains str

2021-02-13 Thread Vedran Čačić
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 ___ Python tracker

[issue43205] Python Turtle Colour

2021-02-12 Thread Vedran Čačić
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

[issue43085] Loosening | and |= operator type checking restriction

2021-02-01 Thread Vedran Čačić
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 tracker

[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Vedran Čačić
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

[issue15034] Document best practices for exceptions

2020-11-10 Thread Vedran Čačić
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 anything, then super

[issue35712] Make NotImplemented unusable in boolean context

2020-11-09 Thread Vedran Čačić
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

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Vedran Čačić
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

[issue31504] Documentation for return value for string.rindex is missing when search string is empty

2020-10-31 Thread Vedran Čačić
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(

[issue42210] float.hex discards sign from -nan

2020-10-31 Thread Vedran Čačić
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

[issue26789] logging: Trying to log during Python finalization with NameError: name 'open' is not defined

2020-10-30 Thread Vedran Čačić
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, sinc

[issue42060] Usage of assert in http/client.py

2020-10-18 Thread Vedran Čačić
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

[issue38250] enum.Flag should be more set-like

2020-10-14 Thread Vedran Čačić
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 perfe

[issue38250] enum.Flag should be more set-like

2020-10-13 Thread Vedran Čačić
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 between a digit and a one-digit number

[issue38250] enum.Flag should be more set-like

2020-10-11 Thread Vedran Čačić
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 analogous to

[issue38250] enum.Flag should be more set-like

2020-10-11 Thread Vedran Čačić
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 pretty strong analogy. -- ___ Python tracker

[issue41877] Check against misspellings of assert etc. in mock

2020-10-08 Thread Vedran Čačić
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 link you provided), h

[issue41877] Check against misspellings of assert etc. in mock

2020-10-08 Thread Vedran Čačić
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

[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-10-08 Thread Vedran Čačić
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.org/i

[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić
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 feeling it

[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić
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

[issue35765] Document references object x but doesn't show it in the example

2020-09-26 Thread Vedran Čačić
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

[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-09-14 Thread Vedran Čačić
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

[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-09-14 Thread Vedran Čačić
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 compelling

[issue41740] Improve error message for string concatenation via `sum`

2020-09-07 Thread Vedran Čačić
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 usually expect

[issue41598] Adding support for rounding modes to builtin round

2020-08-26 Thread Vedran Čačić
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.org/issue41

[issue41598] Adding support for rounding modes to builtin round

2020-08-26 Thread Vedran Čačić
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 above link (stri

[issue41598] Adding support for rounding modes to builtin round

2020-08-25 Thread Vedran Čačić
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 co

[issue41598] rnd() + rndup() in math

2020-08-22 Thread Vedran Čačić
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 numbers to a c

[issue41598] rnd() + rndup() in math

2020-08-22 Thread Vedran Čačić
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 emotionally powerfu

[issue41607] pdb - Clickable path to breakpoints

2020-08-21 Thread Vedran Čačić
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

[issue41598] rnd() + rndup() in math

2020-08-21 Thread Vedran Čačić
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 are, and (3

[issue41598] rnd() + rndup() in math

2020-08-20 Thread Vedran Čačić
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 English language. :-D

[issue41591] Comprehensions documentation

2020-08-20 Thread Vedran Čačić
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 bu

[issue41598] rnd() + rndup() in math

2020-08-20 Thread Vedran Čačić
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 example, would

[issue41591] Comprehensions documentation

2020-08-20 Thread Vedran Čačić
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 evalua

[issue41591] Comprehensions documentation

2020-08-20 Thread Vedran Čačić
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. -- n

[issue41598] rnd() + rndup() in math

2020-08-20 Thread Vedran Čačić
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   2   3   4   >