Python Forum
Pass an object to a class, then make an object of it and pass again
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass an object to a class, then make an object of it and pass again
#6
(Nov-09-2020, 01:14 PM)buran Wrote: did you read my post?
(Nov-09-2020, 12:01 PM)buran Wrote:
fabric = Fabric(bode)
print(fabric.Body.bottom.feets)
fabric.Body.top.eyes = 2 # 2 eyes
print(fabric.Body.top.eyes)
I must comment on the inconsistencies in your class - e.g. Fabric.Body attribute, why Body and not body? Also normally the params in __init__ will be the same as the attribute you assign, i.e. why humans and not body?

Yes, I try to apply it now
fabric.Body.top.eyes = 2 # 2 eyes
so this line logic happens inside Fabric class(not like now - this line is outside class). I am trying to create a function as solution. So when data arrives to this Fabric class data gets modified.
Reply


Messages In This Thread
RE: Pass an object to a class, then make an object of it and pass again - by TomasAm - Nov-09-2020, 01:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class and Object HW for cars - Help with error handling for user inputs jakeshugart 2 585 May-09-2024, 05:00 PM
Last Post: jakeshugart
  Object Detection with ESP32 CAM. MateoG 0 750 Oct-11-2023, 01:44 PM
Last Post: MateoG
  fixing error TypeError: 'float' object is not subscriptable programmingirl 1 1,656 Jan-28-2023, 08:13 PM
Last Post: deanhystad
  how to pass named arguments arunan 1 4,074 Jan-18-2021, 01:30 PM
Last Post: buran
  Animating 2D object movement with matplotlib esamalihalil1993 0 1,874 Nov-23-2020, 05:49 PM
Last Post: esamalihalil1993
  AttributeError: 'str' object has no attribute 'size' russoj5 4 7,707 Nov-15-2020, 11:43 PM
Last Post: deanhystad
  Task that i can't pass c06a8acb 6 2,777 Nov-11-2020, 07:50 AM
Last Post: c06a8acb
  Object has no attribute 'replaceall' ? peterp 2 7,404 Nov-10-2020, 09:23 PM
Last Post: buran
  Help on stimulating approaching an object javesike1262 9 4,008 Oct-23-2020, 01:08 AM
Last Post: javesike1262
  Returning data from a pyobjc object to python environment newpythonuser100 3 2,586 Jul-28-2020, 12:08 PM
Last Post: newpythonuser100

Forum Jump:

User Panel Messages

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