python-object Questions
7
Solved
I am absolutely new to Python (I came from Java) and I have the following doubts about class fields.
Considering code like this:
class Toy():
def __init__(self, color, age):
self.color = color
s...
Eme asked 14/12, 2019 at 16:29
3
Solved
I have written a simple example to illustrate what exactly I'm banging my head onto. Probably there is some very simple explanaition that I just miss.
import time
import multiprocessing as mp
impor...
Kaolin asked 7/9, 2021 at 11:15
3
Solved
Please consider the below code
class DataMember():
def __init__(self, **args):
self.default = {"required" : False , "type" : "string" , "length": -1}
self.default.update(args)
def __call__(sel...
Haro asked 26/8, 2018 at 10:7
1
Solved
Why can't you override a class name declaratively, e.g. to use a class name which is not a valid identifier?
>>> class Potato:
... __name__ = 'not Potato'
...
>>> Potato.__name_...
Dziggetai asked 11/4, 2018 at 17:31
1
Solved
I am trying to print a list of python objects that contain a list as a property and i am having some unexpected results:
here is my code:
class video(object):
name = ''
url = ''
class topic(o...
Interesting asked 19/7, 2016 at 3:3
2
Solved
When I try to override the magic method __eq__, and use super to access the base method found in object, I get an error. There's no way this is a bug, but it sure feels like one:
class A(object):
...
Hostage asked 23/5, 2016 at 1:11
1
© 2022 - 2024 — McMap. All rights reserved.