Recently I fell into the trap of creating a circular import and yet again it
took time to figure out what was wrong.
I'm wondering why the python import code does not detect this error and raise
an exception.
I took a look at the code and got as far as figuring out that I would need to
add the
But circular imports are sometimes needed in modules.
For example when you have two classes in two different modules that
reference each other in their methods (and because you can't pre-declare
classes like in C++).
2017-06-13 20:30 GMT+02:00 Barry Scott :
> Recently I fell into the trap of crea
I have been trying to get dir(c_ext_obj) to work for PyCXX as the method used
with
python2 was removed in python3, namely use the list of names returned from
the __members__ attribute.
I have failed to find a simple replacement for the python3 API.
It seems that I have implement __dir__.
But to
AFAIK the socket module returns plain tuples in Python3:
https://docs.python.org/3/library/socket.html
Why not use named tuples?
Regards,
Thomas Güttler
--
I am looking for feedback for my personal programming guidelines:
https://github.com/guettli/programming-guidelines
__
> On 13 Jun 2017, at 20:13, Antoine Rozo wrote:
>
> But circular imports are sometimes needed in modules.
> For example when you have two classes in two different modules that reference
> each other in their methods (and because you can't pre-declare classes like
> in C++).
Really? It has al
On Wed, Jun 14, 2017 at 6:35 AM, Barry wrote:
> On 13 Jun 2017, at 20:13, Antoine Rozo wrote:
>
> But circular imports are sometimes needed in modules.
> For example when you have two classes in two different modules that
> reference each other in their methods (and because you can't pre-declare
On 6/13/2017 2:42 PM, Barry Scott wrote:
I have been trying to get dir(c_ext_obj) to work for PyCXX as the method used
with
python2 was removed in python3, namely use the list of names returned from
the __members__ attribute.
__members__ was deprecated about 15 years ago and gone from the stdl
I didn't interpret the initial email as wanting an error on *all* circular
imports. Merely those which are unresolvable. I've definitely helped people
diagnose circular imports and wished there was an error that called that
out programmatically, even if it's just a string admonition to check for
ci
On Wed, Jun 14, 2017 at 8:10 AM, Mahmoud Hashemi wrote:
> I didn't interpret the initial email as wanting an error on *all* circular
> imports. Merely those which are unresolvable. I've definitely helped people
> diagnose circular imports and wished there was an error that called that out
> progra
I've also been thinking about this lately. I can remember being confused
the first time I saw "ImportError: cannot import name X". As there are
multiple things that can cause this error, it took me a while to find a
stackoverflow post that suggested that this might be due to circular
imports. After
On Wed, Jun 14, 2017 at 8:09 AM, Terry Reedy wrote:
> Perhaps you are looking for __dir__, called by dir().
>
> " dir([object])
>
> Without arguments, return the list of names in the current local scope.
> With an argument, attempt to return a list of valid attributes for that
> object.
>
>
Oh I know the traceback, I've had many brought to my desk by a confused
junior dev, looking a lot like yours truly a few years back. :)
My only problem with it is that it makes people look at "a.py". And if you
look at "a.py", you'll see there's a "q" there. While most of us on this
list will chec
On 14 June 2017 at 08:49, Mahmoud Hashemi wrote:
> Oh I know the traceback, I've had many brought to my desk by a confused
> junior dev, looking a lot like yours truly a few years back. :)
Something worth noting is that as of 3.7, all circular imports that
actually *are* resolvable at runtime wil
That would be amazing! If there's anything I can do to help make that
happen, please let me know. It'll almost certainly save that much time for
me alone down the line, anyway :)
On Tue, Jun 13, 2017 at 7:41 PM, Nick Coghlan wrote:
> On 14 June 2017 at 08:49, Mahmoud Hashemi wrote:
> > Oh I kno
On 14 June 2017 at 13:02, Mahmoud Hashemi wrote:
> That would be amazing! If there's anything I can do to help make that
> happen, please let me know. It'll almost certainly save that much time for
> me alone down the line, anyway :)
The `IMPORT_FROM` opcode's error handling would probably be the
15 matches
Mail list logo