1,129 matching pages, found in 378 ms
Ask StyxWritten on your GPU machine; takes a few seconds the first time.
-
discuss.python.orghttps://discuss.python.org › t › class-variables › 18214Class variables - Python Help - Discussions on Python.org
More about discuss.python.org
ForumAug 14, 2022. … it goes on to the class, and the superclasses. So looking up instance.attr will also return ‘from the class’. But when we assign to the instance attribute: instance.attr = 'from the instance' now …
-
discuss.python.orghttps://discuss.python.org › t › best-way-to-sort-a-list-into-a… › 24158Best way to sort a list into a dict based off of an attr on list elements - Python Help - Discussions on Python.org
More about discuss.python.org
ForumFeb 23, 2023. … NoneType'>: [None], <class 'tuple'>: [()], <class 'type'>: [<class 'type'>], <class 'str'>: ['foo']} I think Chris’s answer looks better: from collections import defaultdict result = defaultdict(list) for x in y: result[pred(x)].append …
-
discuss.python.orghttps://discuss.python.org › t › accessing-attributes-of-a-class › 13873Accessing attributes of a class - Python Help - Discussions on Python.org
More about discuss.python.org
ForumFeb 22, 2022. … if dir() on a class reported the methods and properties that its metaclass defines for the class object in addition to the methods and properties that the class defines for its instances …
-
discuss.python.orghttps://discuss.python.org › t › best-practice-to-do-the-same-t… › 24267Best practice to do the same tests in pytest with different classes - Python Help - Discussions on Python.org
More about discuss.python.org
ForumFeb 26, 2023. … many tests for a class with a C extension. I redo the same tests for: the c implementation the pure py implementation the subclass of the c implementation the subclass of the …
-
discuss.python.orghttps://discuss.python.org › t › docstrings-threated-differentl… › 7988Docstrings threated differently for static method and class method - Python Help - Discussions on Python.org
More about discuss.python.org
ForumMar 30, 2021. … help(Foo) I get the docstring of the Callable class for the class method but not the static method? Help on class Foo in module foo: class Foo(builtins.object) | Class methods defined …
-
discuss.python.orghttps://discuss.python.org › t › dataclass-single-reference-to-… › 21205Dataclass single reference to created field - Python Help - Discussions on Python.org
More about discuss.python.org
ForumNov 18, 2022. … instance of FirstClass shares the same instance of SecondClass The workaround I found was to create a __post_init__() that creates the instance instead @dataclass class FirstClass: # second_class: SecondClass = SecondClass() second …
-
discuss.python.orghttps://discuss.python.org › t › deferred-annotations-and-gener… › 72216Deferred annotations and generic base classes - Python Help - Discussions on Python.org
More about discuss.python.org
ForumNov 24, 2024. … to pay for using the subscript syntax? The following should definitely be evaluated directly and not deferred, and I suppose the interpreter cannot know the difference? class Bar: ... classes = {"bar": Bar} var …
-
discuss.python.orghttps://discuss.python.org › t › class-composition-between-two-… › 37531Class Composition Between Two Classes - Python Help - Discussions on Python.org
More about discuss.python.org
ForumOct 31, 2023. … Issue 1 I referenced the tk.Tk class as the ‘master’ class because the code snippet is based on this module. Additionally, in my test snippet: Login - Base class (inheriting from the tk.Tk …
-
discuss.python.orghttps://discuss.python.org › t › add-syntax-for-annotating-a-fu… › 105799Add syntax for annotating a function/class - Ideas - Discussions on Python.org
More about discuss.python.org
ForumJan 19, 2026. … you're skipping, start from the paragraph above me from typing import Sealed class Node :: Sealed[Leaf, Branch]: ... class Leaf(Node): ... class Branch(Node): ... It’s an actual annotation on the class, not a …
-
discuss.python.orghttps://discuss.python.org › t › 3-12-slot-classes-wishlist › 207423.12 slot classes wishlist - Ideas - Discussions on Python.org
More about discuss.python.org
Nov 4, 2022. … Add slotness to a class after the fact. Right now, when creating a slot class, we need to recreate the class from scratch to add slots to it. We’ve tried to make …
Search for “The Class site:discuss.python.org” on Google, or add !ddg, !w and other shortcuts to any search.