About 79,000 results
Open links in new tab
  1. Python, creating objects - Stack Overflow

    Feb 26, 2013 · Note that even though one of the principles in Python's philosophy is "there should be one—and preferably only one—obvious way to do it", there are still multiple ways to do this. …

  2. python - How to create a list of objects? - Stack Overflow

    We have class for students and we want make list of students that each item of list is kind of student. class student : def __init__(self,name,major): self.name=name self.major=major …

  3. oop - What is an Object in Python? - Stack Overflow

    May 26, 2019 · Objects are Python’s abstraction for data. All data in a Python program is represented by objects or by relations between objects. (In a sense, and in conformance to …

  4. Create an Array of objects in Python - Stack Overflow

    Feb 1, 2015 · I'm trying to make a list of objects in python. I'm doing this by making one object. You simply can't do this; your second statement contradicts your first statement. You must …

  5. python - How to dynamically build a JSON object? - Stack Overflow

    Jul 30, 2021 · Python objects are not that simply reflected into JSON, as JSON is quite a limited format with only a few data types. There are a lot of questions here on SO already that cover …

  6. python - Compare object instances for equality by their attributes ...

    In Python 2.7 at least, objects are compared by identity by default. That means for CPython in practical words they compare by they memory address. That's why cmp(o1, o2) returns 0 only …

  7. python - Define a list with type - Stack Overflow

    Jan 14, 2015 · Python is dynamically typed, and you just don't declare types for variables like you do in Java. The official tutorial is highly suggested reading at this stage. Share

  8. python - How to print instances of a class using print ... - Stack …

    Even though this is an older post, there is also a very convenient method introduced in dataclasses (as of Python 3.7). Besides other special functions such as __eq__ and __hash__ …

  9. python - How can I create an object and add attributes to it?

    May 13, 2010 · There is types.SimpleNamespace class in Python 3.3+: obj = someobject obj.a = SimpleNamespace() for p in params: setattr(obj.a, p, value) # obj.a.attr1 …

  10. python - "Enabling" comparison for classes - Stack Overflow

    It is on classes/objects, and it's a simple class on defining a circle, with the name class Circle(object). The exact text of the HW (I completed the first two parts of this hw and thus this …

Refresh