Python Forum
Return Object Created from Multiple Classes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return Object Created from Multiple Classes
#2
That's the default text representation of objects. You get that for any object you create unless you override the __repr__ method. However, the list actually has the addresses (or rather, pointers to those addresses). Typical user created classes (that is, sub-classes of object) are mutable. So they are passed around by reference, not value. So say you have lyst1 and lyst2, and the Movie object for The Outlaw Josie Wales is in both lists. If you change the one in lyst1, that will change the one in lyst2, since both lists just have references to the same object.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Return Object Created from Multiple Classes - by ichabod801 - Oct-18-2018, 01:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  This result object does not return rows. It has been closed automatically dawid294 6 1,079 Mar-30-2024, 03:08 AM
Last Post: NolaCuriel
  how to return a reference to an object? Skaperen 8 1,208 Jun-07-2023, 05:30 PM
Last Post: Skaperen
  super multiple parallel classes catlessness 2 1,337 Jun-07-2022, 02:35 PM
Last Post: deanhystad
  please help with classes and return values jamie_01 5 1,798 Jan-17-2022, 02:11 AM
Last Post: menator01
  Function - Return multiple values tester_V 10 4,466 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Object inheriting from two classes? Melendroach 3 2,171 May-11-2021, 06:37 PM
Last Post: deanhystad
  Object already contains values when created Stef 4 2,394 Aug-20-2020, 09:42 AM
Last Post: Stef
  isinstance() always return true for object type check Yoki91 2 2,570 Jul-22-2020, 06:52 PM
Last Post: Yoki91
  Return Multiple or one just JohnnyCoffee 14 5,308 May-01-2020, 11:26 AM
Last Post: JohnnyCoffee
  How to mock an object that is created during function call? Schlangenversteher 0 1,979 Jan-31-2020, 01:36 PM
Last Post: Schlangenversteher

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020