Deletion of created object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psbasha
    Contributor
    • Feb 2007
    • 440

    #1

    Deletion of created object

    Hi,

    I have created objects 'n' number of times based on my requirement.Whe ther I have to delete this object variable for everytime ,when I use for next time

    Say

    for i in list:

    -----

    Obj = MyClass()

    func1(Obj)


    The above example shows that we are creating the objects for more than once and making use of it.But we are not deleting.

    Whether the above approach is correct.
    Thnaks
    PSB
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by psbasha
    Hi,

    I have created objects 'n' number of times based on my requirement.Whe ther I have to delete this object variable for everytime ,when I use for next time

    Say

    for i in list:

    -----

    Obj = MyClass()

    func1(Obj)


    The above example shows that we are creating the objects for more than once and making use of it.But we are not deleting.

    Whether the above approach is correct.
    Thnaks
    PSB
    Here is a useful-looking thread regarding Garbage Collection in Python.

    Comment

    Working...