[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

[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

[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 repea

[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

[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

[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 resu

[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

[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

[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

[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

[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

[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 param

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

2022-03-18 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

[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

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

2022-03-31 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 entit

[issue37934] Docs: Clarify NotImplemented use cases

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

[issue37934] Docs: Clarify NotImplemented use cases

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

[issue37934] Docs: Clarify NotImplemented use cases

2019-09-02 Thread Vedran Čač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

[issue37934] Docs: Clarify NotImplemented use cases

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

[issue38077] IDLE leaking ARGV into globals() namespace

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

[issue36781] Optimize sum() for bools

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

[issue38200] Adding itertools.pairwise to the standard library?

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

[issue38333] add type signatures to library function docs

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

[issue38346] Wrong behavior when using `assert_called_with` with mutable object

2019-10-02 Thread Vedran Čačić
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.

[issue38333] add type signatures to library function docs

2019-10-02 Thread Vedran Čačić
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.

[issue38333] add type signatures to library function docs

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

[issue38333] add type signatures to library function docs

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

[issue38333] add type signatures to library function docs

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

[issue38346] Wrong behavior when using `assert_called_with` with mutable object

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

[issue38582] re: backreference number in replace string can't >= 100

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

[issue38582] re: backreference number in replace string can't >= 100

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

[issue38582] re: backreference number in replace string can't >= 100

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

[issue38582] re: backreference number in replace string can't >= 100

2019-10-25 Thread Vedran Čačić
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'

[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

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

[issue38657] String format for hexadecimal notation breaks padding with alternative form

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

[issue38657] String format for hexadecimal notation breaks padding with alternative form

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

[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

[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 thin

[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

[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

[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

[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

[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/is

[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). ---

[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://bug

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

2021-06-08 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

[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

[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

[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

[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

[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 e

[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'

[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

[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,

[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?

[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 be

[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, obviou

[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

[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

[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 instea

[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

[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

[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

[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 to

[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

[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

[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

[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 networ

[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 intere

[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-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/is

[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

[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

[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

[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.o

[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

[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&#x

[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. B

[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

[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

[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

[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

[issue38738] Fix formatting of True and False

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

[issue34716] MagicMock.__divmod__ should return a pair

2019-11-13 Thread Vedran Čačić
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. ---

[issue38758] @dataclass defaults

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

[issue38758] @dataclass defaults

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

[issue38933] unusual behaviour on list of dependable lambdas

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

[issue38933] unusual behaviour on list of dependable lambdas

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

[issue38924] pathlib paths .normalize()

2019-11-28 Thread Vedran Čačić
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.

[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Vedran Čačić
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&

[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

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

[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

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

[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

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

[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

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

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

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

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

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

[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

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

[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-06 Thread Vedran Čač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,

[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Vedran Čačić
Vedran Čačić added the comment: Yeah, I should have said "represent" instead of "write". :-) -- ___ Python tracker <https://bugs.python.org/issue39576> ___

[issue39601] brace escapes are not working in formatted string literal format specifications

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