Python, passing objects?

So, I have just discovered a wonderful feature of passing objects to methods in python. This would potentially save me some import statements. Trouble is, I don't really know what happens under the hood and how it all impacts performance.
consider this:

#we'll call this module cls
class Cls:
 def __init__(self):
  self.x = 2
#this is the module that would use cls in it's constructor
#I don't want to inherit, since the two modules may not be alike
#We'll call this cls_user
class Cls_user:
 def __init__(self, creator):
  self.creation = creator()
#This is our main module
import cls, cls_user
d = cls_user.Cls_user(cls.Cls)
#Other stuff goes here

What impact, if any, would this code have if, say, we require an object to be given for every update method in our loop. Why should I avoid using this and just stick with the good old import statement.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : nyanchan via Audiogames-reflector

Reply via email to