Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generate list in class
#7
in addperson(), name and age should be class variables, i.e. self.name and self.age, which are visible throughout the class and remain as long as the class instance remains. name and age are local and so are garbage collected when the function exits.
Reply


Messages In This Thread
Generate list in class - by P13N - Dec-26-2018, 10:09 PM
RE: Generate list in class - by stullis - Dec-26-2018, 10:18 PM
RE: Generate list in class - by P13N - Dec-27-2018, 05:46 AM
RE: Generate list in class - by stullis - Dec-27-2018, 10:06 AM
RE: Generate list in class - by P13N - Dec-27-2018, 11:24 AM
RE: Generate list in class - by stullis - Dec-27-2018, 07:01 PM
RE: Generate list in class - by woooee - Dec-28-2018, 01:26 AM
RE: Generate list in class - by P13N - Dec-28-2018, 10:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read module/class from list of strings? popular_dog 1 499 Oct-04-2023, 03:08 PM
Last Post: deanhystad
  Class-Aggregation and creating a list/dictionary IoannisDem 1 1,945 Oct-03-2021, 05:16 PM
Last Post: Yoriz
  Generate a list sasitha96 5 2,415 Sep-20-2021, 07:03 PM
Last Post: sasitha96
  apendng to a list within a class gr3yali3n 4 2,380 Feb-16-2021, 06:30 AM
Last Post: buran
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 2,363 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92
  How to generate a log in a list style? wagnergt12 5 2,808 Apr-22-2020, 12:47 PM
Last Post: buran
  extract first and last 5 elements from given list and generate a new list. Raj_Kumar 1 2,395 Dec-07-2019, 05:03 PM
Last Post: ichabod801
  I created a function that generate a list but the list is empty in a new .py file mrhopeedu 2 2,337 Oct-12-2019, 08:02 PM
Last Post: mrhopeedu
  Appending a list in a class from a callback function snizbatch 5 3,772 Sep-01-2019, 06:27 AM
Last Post: snizbatch
  how to add class instance attributes from list 999masks 2 2,756 Jul-22-2019, 07:59 AM
Last Post: 999masks

Forum Jump:

User Panel Messages

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