Re: Fwd: A typing question

2022-11-01 Thread Paulo da Silva
Às 21:08 de 31/10/22, Peter J. Holzer escreveu: On 2022-10-30 11:26:56 +0100, 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 :-) !

Re: Fwd: A typing question

2022-10-31 Thread Peter J. Holzer
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

Re: Fwd: A typing question

2022-10-31 Thread Peter J. Holzer
On 2022-10-30 11:26:56 +0100, 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 :-) ! > > > > > > from typing import List, Opti

Re: Fwd: A typing question

2022-10-31 Thread dn
On 01/11/2022 01.56, Stefan Ram wrote: dn writes: On 31/10/2022 11.44, Chris Angelico wrote: ... I'm curious to what extent sloppy English correlates with sloppy code. ... When it comes to CVs/resumés (see what I did there?), I must admit that the most egregious of errors in spelling or gra

Re: Fwd: A typing question

2022-10-30 Thread dn
On 31/10/2022 11.44, Chris Angelico wrote: On Mon, 31 Oct 2022 at 09:39, dn wrote: On 31/10/2022 06.06, Stefan Ram wrote: Paulo da Silva writes: Is there anything to do without loosing my script structure and usual practice? to lose (losing): to stop having something to loose (loo

Re: Fwd: A typing question

2022-10-30 Thread Chris Angelico
On Mon, 31 Oct 2022 at 09:39, dn wrote: > > On 31/10/2022 06.06, Stefan Ram wrote: > > Paulo da Silva writes: > >> Is there anything to do without loosing my script structure and usual > >> practice? > > > >to lose (losing): to stop having something > >to loose (loosing): to let or make l

Re: Fwd: A typing question

2022-10-30 Thread dn
On 31/10/2022 06.06, Stefan Ram wrote: Paulo da Silva writes: Is there anything to do without loosing my script structure and usual practice? to lose (losing): to stop having something to loose (loosing): to let or make loose (see next line) loose (adj.): not firmly attached/tied/fas

Re: Fwd: A typing question

2022-10-30 Thread dn
On 30/10/2022 17.48, Paulo da Silva wrote: Às 02:32 de 30/10/22, dn escreveu: On 30/10/2022 11.59, Paulo da Silva wrote: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes. This is the problem for

Re: Fwd: A typing question

2022-10-30 Thread Paulo da Silva
Às 17:06 de 30/10/22, Stefan Ram escreveu: Paulo da Silva writes: Is there anything to do without loosing my script structure and usual practice? to lose (losing): to stop having something to loose (loosing): to let or make loose (see next line) loose (adj.): not firmly attached/tied

Re: Fwd: A typing question

2022-10-30 Thread Paulo da Silva
Às 22:34 de 29/10/22, dn escreveu: Out of interest, tested snippet in PyCharm, cf native-mypy. It flags the original:     GLOBALS.foos: Optional[Foos]=Foos() but not the fall-back:     GLOBALS.foos=Foos() Must admit, the first query coming to mind was: why is the typing taking place at i

Re: Fwd: A typing question

2022-10-30 Thread Paulo da Silva
Às 10:26 de 30/10/22, Peter J. Holzer escreveu: On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: Às 22:34 de 29/10/22, dn escreveu: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes.

Re: A typing question

2022-10-30 Thread Paulo da Silva
Às 01:14 de 30/10/22, Thomas Passin escreveu: On 10/29/2022 1:45 PM, Paulo da Silva wrote: Hi! Consider this simple script ... ___ from typing import List, Optional class GLOBALS: foos=None class Foo: def __init__(self): pass class Foos: Foos: List[F

Re: Fwd: A typing question

2022-10-30 Thread Paulo da Silva
Às 02:32 de 30/10/22, dn escreveu: On 30/10/2022 11.59, Paulo da Silva wrote: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes. This is the problem for me. So far, without typing, I used to have

Re: Fwd: A typing question

2022-10-30 Thread Peter Otten
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 initi

Re: Fwd: A typing question

2022-10-30 Thread Peter J. Holzer
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 :-) ! > > > > > > __

Re: Fwd: A typing question

2022-10-30 Thread Thomas Passin
On 10/30/2022 6:26 AM, Peter J. Holzer wrote: On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: Às 22:34 de 29/10/22, dn escreveu: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes.

Re: Fwd: A typing question

2022-10-30 Thread Peter J. Holzer
On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: > Às 22:34 de 29/10/22, dn escreveu: > > Solution (below) will not work if the mention of Foos in GLOBALS is a > > forward-reference. > > Either move GLOBALS to suit, or surround "Foos" with quotes. ^^^

Re: A typing question

2022-10-30 Thread Peter J. Holzer
On 2022-10-29 20:14:12 -0400, Thomas Passin wrote: > I don't understand > > class Foos: > Foos: List[Foo]=[] > > If "Foos" is supposed to be a class attribute, then it cannot have the same > name as the class. Why not? They are in different namespaces. #v+ #!/usr/bin/python3 class Foos:

Re: Fwd: A typing question

2022-10-29 Thread dn
On 30/10/2022 11.59, Paulo da Silva wrote: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes. This is the problem for me. So far, without typing, I used to have some config and globals classes, mo

Re: A typing question

2022-10-29 Thread Thomas Passin
On 10/29/2022 1:45 PM, Paulo da Silva wrote: Hi! Consider this simple script ... ___ from typing import List, Optional class GLOBALS:     foos=None class Foo:     def __init__(self):     pass class Foos:     Foos: List[Foo]=[]     # SOME GLOBALS ARE USED HERE in a r

Re: Fwd: A typing question

2022-10-29 Thread Paulo da Silva
Às 22:34 de 29/10/22, dn escreveu: Out of interest, tested snippet in PyCharm, cf native-mypy. It flags the original:     GLOBALS.foos: Optional[Foos]=Foos() but not the fall-back:     GLOBALS.foos=Foos() Must admit, the first query coming to mind was: why is the typing taking place at i

Re: Fwd: A typing question

2022-10-29 Thread dn
Out of interest, tested snippet in PyCharm, cf native-mypy. It flags the original: GLOBALS.foos: Optional[Foos]=Foos() but not the fall-back: GLOBALS.foos=Foos() Must admit, the first query coming to mind was: why is the typing taking place at initialisation-time, rather than within

Fwd: A typing question

2022-10-29 Thread Sam Ezeh
Do you want the following? ``` from typing import List, Optional class GLOBALS: foos: Optional[Foos] = None class Foo: def __init__(self): pass class Foos: Foos: List[Foo] = [] def __init__(self): pass GLOBALS.foos = Foos() ``` Kind regards, Sam Ezeh On S

A typing question

2022-10-29 Thread Paulo da Silva
Hi! Consider this simple script ... ___ from typing import List, Optional class GLOBALS: foos=None class Foo: def __init__(self): pass class Foos: Foos: List[Foo]=[] # SOME GLOBALS ARE USED HERE in a real script def __init__(self): pass G