Fwd: A typing question

Peter J. Holzer hjp-python at hjp.at
Mon Oct 31 17:15:47 EDT 2022


On 2022-10-30 20:43:23 +0100, Peter Otten wrote:
> On 30/10/2022 14:37, Peter J. Holzer wrote:
> > On 2022-10-30 09:23:27 -0400, Thomas Passin wrote:
> > > On 10/30/2022 6:26 AM, Peter J. Holzer wrote:
> > > > On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote:
> > > > > The funny thing is that if I replace foos by Foos it works because it gets
> > > > > known by the initial initialization :-) !
[...]
> > 
> > Yes. I was referring to the code as written. Why does that work? I don't
> > think it should.
> 
> For me it makes sense. I think mypy should refrain from trying to figure
> out order of execution.

I was unclear, sorry. What I meant was "why does replacing foos by Foos
make the error disappear?" not "why do forward references work?". But
may have misunderstood what Paulo meant as I cannot reproduce his
results. So maybe the behaviour I don't understand (and would consider
buggy) doesn't actually exist.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20221031/f56137b8/attachment.sig>


More information about the Python-list mailing list