About 10,200,000 results
Open links in new tab
  1. oop - What is an Object in Python? - Stack Overflow

    May 26, 2019 · In the context of Python and all other Object Oriented Programming (OOP) languages, objects have two main characteristics: state and behavior. You can think of a …

  2. How do I look inside a Python object? - Stack Overflow

    Jun 17, 2009 · To the person I talked with, Python is well within what he'd call object oriented, Javascript is not at all. I was advised to not use vars() or __dict__ , just use the actual API of …

  3. python - Find object in list that has attribute equal to some value ...

    I know that generally in python list comprehensions are preferred or at least that is what I read, but I don't see the issue to be honest. Of course Python is not an FP language, but Map / …

  4. python - How do I pass a variable by reference? - Stack Overflow

    Jun 12, 2009 · Python: Python is “pass-by-object-reference”, of which it is often said: “Object references are passed by value.” . Both the caller and the function refer to the same object, …

  5. python - Saving an Object (Data persistence) - Stack Overflow

    Dec 25, 2010 · Versions > 0 are binary and the highest one available depends on what version of Python is being used. The default also depends on Python version. In Python 2 the default …

  6. How can I create a copy of an object in Python? - Stack Overflow

    Jan 25, 2011 · According to my tests with Python 3, for immutable objects, like tuples or strings, it returns the same object (because there is no need to make a shallow copy of an immutable …

  7. Python dictionary from an object's fields - Stack Overflow

    Sep 15, 2008 · Note that best practice in Python 2.7 is to use new-style classes (not needed with Python 3), i.e. class Foo(object): ... Also, there's a difference between an 'object' and a 'class'. …

  8. python - List attributes of an object - Stack Overflow

    dir() is exactly what I was looking for when I Googled 'Python object list attributes' -- A way to inspect an instance of an unfamiliar object and find out what it's like. – JDenman6 Commented …

  9. python - Serializing class instance to JSON - Stack Overflow

    (Works on Python 2.7 and Python 3.x) Note: In this case you need instance variables and not class variables, as the example in the question tries to do. (I am assuming the asker meant …

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

    May 13, 2010 · class Object(object): pass obj = Object() obj.somefield = "somevalue" But consider giving the Object class a more meaningful name, depending on what data it holds. Another …

Refresh