Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inferring background code.
#1
Given an object instantiation and invocation, can I broadly say the following?

Given the following two lines of code,
test = Test()
test()
Broadly, it could originate from one of the following two situations,

Situation 1:
class Test():  
   def __init__(self): # constructor  
      pass  
  
   def __call__(self): # called during object() invocation  
      pass
Situation 2:
def Test():
	def innerTest():
		pass

	return innerTest
Am I right? Or are there other broad categories I am missing.

I come from Java background, and you can tell a lot by variable declaration and innovation, which does not seem to be the case for Python.
Reply


Messages In This Thread
Inferring background code. - by quazirfan - Apr-15-2023, 10:34 PM
RE: Inferring background code. - by jefsummers - Apr-17-2023, 11:36 AM
RE: Inferring background code. - by quazirfan - Apr-18-2023, 05:49 AM
RE: Inferring background code. - by Gribouillis - Apr-18-2023, 09:42 AM
RE: Inferring background code. - by quazirfan - Apr-19-2023, 05:26 AM
RE: Inferring background code. - by Gribouillis - Apr-19-2023, 06:32 PM

Forum Jump:

User Panel Messages

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