Python Forum
Is it safe to use outside a class created inside the function?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it safe to use outside a class created inside the function?
#3
That's fine. Python uses "reference counting" to keep track of objects. The list has a reference to the newly created class so its memory has not been cleaned up(aka "garbage collected") even after returning from the function.
Reply


Messages In This Thread
RE: Is it safe to use outside a class created inside the function? - by mpd - Dec-27-2017, 01:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The function of double underscore back and front in a class function name? Pedroski55 9 728 Feb-19-2024, 03:51 PM
Last Post: deanhystad
  When is it safe to compare (==) two floats? Radical 4 757 Nov-12-2023, 11:53 AM
Last Post: PyDan
  with open context inside of a recursive function billykid999 1 590 May-23-2023, 02:37 AM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 811 May-02-2023, 08:40 AM
Last Post: Gribouillis
  TimeOut a function in a class ? Armandito 1 1,672 Apr-25-2022, 04:51 PM
Last Post: Gribouillis
  Calling a class from a function jc4d 5 1,854 Dec-17-2021, 09:04 PM
Last Post: ndc85430
  a function common to methods of a class Skaperen 7 2,660 Oct-04-2021, 07:07 PM
Last Post: Skaperen
  Tuple generator, and function/class syntax quazirfan 3 3,927 Aug-10-2021, 09:32 AM
Last Post: buran
  How to make global list inside function CHANKC 6 3,127 Nov-26-2020, 08:05 AM
Last Post: CHANKC
  Parameters aren't seen inside function Sancho_Pansa 8 2,965 Oct-27-2020, 07:52 AM
Last Post: Sancho_Pansa

Forum Jump:

User Panel Messages

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