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
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
À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
On 2022-10-29 19:21, Bernard LEDRU wrote:
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first
count occurr
I believe you would do well to print a, before trying to transform it into
something else.
'\2' is chr(2).
'\a' is the bell character, and is unprintable.
'\_' is two characters though.
On Sat, Oct 29, 2022 at 2:12 PM Bernard LEDRU
wrote:
> Hello,
>
> https://docs.python.org/3/library/stdtypes.
Better to use raw strings whenever backslashes are involved.
On 10/29/2022 2:21 PM, Bernard LEDRU wrote:
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If
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
> On 29 Oct 2022, at 22:14, Bernard LEDRU wrote:
>
> Hello,
>
> https://docs.python.org/3/library/stdtypes.html#string-methods
>
> str.replace(old, new[, count])¶
> Return a copy of the string with all occurrences of substring old replaced by
> new. If the optional argument count is given,
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
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
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first
count occurrences are replaced.
Attention when the
On 10/28/22 21:31, DFS wrote:
> I found one person that said they did it but their syntax didn't work.
> But it doesn't throw an error either.
>
> model.setData(model.index(tblRow, col), font, Qt.FontRole)
I wouldn't expect that to work but it's understandable why it didn't
throw an error. setD
12 matches
Mail list logo