Change by Paul Pinterits :
--
nosy: -Paul Pinterits
___
Python tracker
<https://bugs.python.org/issue29964>
___
___
Python-bugs-list mailing list
Unsubscribe:
Paul Pinterits added the comment:
You're telling me that some people out there rely on their custom __init__
*not* being called? O.o
--
___
Python tracker
<https://bugs.python.org/is
Paul Pinterits added the comment:
Admittedly, with the way dataclasses accept their __init__ arguments, figuring
out which arguments to consume and which to pass on isn't a trivial task.
If a dataclass Bar inherits from a dataclass Foo, then Bar.__init__ is (for all
intents and pur
Paul Pinterits added the comment:
No, I'm saying Bar should initialize the 'bar' attribute, and then call
Foo.__init__ to let it initialize the 'foo' attribute.
--
___
Python tracker
<https:
Paul Pinterits added the comment:
> dataclasses doesn't know the signature of the base class's __init__, so it
> can't know how to call it.
The dataclass doesn't need to know what arguments the parent __init__ accepts.
It should consume the arguments it needs
New submission from Paul Pinterits :
It's documented behavior that @dataclass won't generate an __init__ method if
the class already defines one. It's also documented that a dataclass may
inherit from another dataclass.
But what happens if you inherit from a dataclass th
Paul Pinterits added the comment:
As an afterthought, I'd like to suggest an alternative solution: If changing
the `iterdir` behavior is not possible or not desirable for some reason, please
add a `Path.listdir` method that returns a list instead of an iterator. Lazy
file system opera
New submission from Paul Pinterits :
The fact that `Path.iterdir()` only throws exceptions once you start iterating
over it makes it very difficult to write correct code.
Let's look at an example: We'll iterate over all children of a directory and
print their file size.
If we tr
New submission from Paul Pinterits :
In a conversation with Ethan Furman (the author of the enum module) I've been
informed that Enum automatically checks whether the _missing_ method has
returned an instance of the correct class, and raises a TypeError if not.
(Link:
New submission from Paul Pinterits :
The documentation of the typing module explains how to instantiate generic
types, but there is no information about how to extract the type arguments from
a generic type.
Example:
>>> list_of_ints = typing.List[int]
>>>
>>&
Paul Pinterits added the comment:
If we take this class:
class Obj:
@property
def d(self):
print('called')
And we access Obj.d:
_ = Obj.d
According to the docs, the following should happen:
# obj.d looks up d in the dictionary of obj
d = Obj.__dict__['d
Paul Pinterits added the comment:
I'm aware that descriptors have to exist on the class in order to work. The
point is that the documentation states "If d defines the method __get__(), then
d.__get__(obj) is invoked" (where d is obj.d), which is
New submission from Paul Pinterits :
The [descriptor
howto](https://docs.python.org/3/howto/descriptor.html#invoking-descriptors)
states:
"For example, obj.d looks up d in the dictionary of obj. If d defines the
method __get__(), then d.__get__(obj) is invoked [...]"
This is not
New submission from Paul Pinterits:
The file paths displayed in exception tracebacks have their symlinks resolved.
I would prefer if the "original" path could be displayed instead, because
resolved symlinks result in unexpected paths in the traceback and can be quite
confusing.
Paul Pinterits added the comment:
No no, the docs are correct. This was definitely my mistake. I'm just trying to
say that it's rather confusing how there's only partial support for time zones.
When I saw that there is support for parsing the time zone offset, I assumed
tha
Paul Pinterits added the comment:
I see. You're right, it does make a difference.
However, this behaviour is quite unexpected. Perhaps I just didn't read the
docs carefully enough, but it wasn't clear to me that the time module had such
half-baked support for time zones.
An un
New submission from Paul Pinterits:
%z is listed as a supported directive in the python 3 documentation
(https://docs.python.org/3.5/library/time.html#time.strftime), but it doesn't
actually do anything:
>>> from time import strptime
>>> strptime('+',
17 matches
Mail list logo