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:
Foos = [1, 2, 3]
f = Foos()
print(f.Foos)
#v-
This works and I see no reason why it shouldn't work.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list
