0 votes
1 view
in Python by (50.5k points)
Recently I got the theory of a class that will permit other classes to import classes on a primary versus that is -"if you use it you must import it". How would I go about performing it? Or, the task of importation is automatic? Does it damage classes, not in use from memory, and how so?

1 Answer

0 votes
by (108k points)

I know that Python uses garbage collection rather than standard memory management. You just spontaneously generate objects and the language's memory manager systematically scans for any objects that are no longer referenced by your application.

So if you want to endure onto an object, just hold a reference to it. If you want the object to be released(eventually) remove any references to it.

def foo(names):

  for name in names:

    print name

foo(["Eric", "Ernie", "Bert"])

foo(["Guthrie", "Eddie", "Al"])

If you are newbie and want to explore more about Python, then learn python from the below video tutorial:

Related questions

0 votes
2 answers
0 votes
1 answer
asked Sep 23, 2019 in Python by Sammy (47.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !