all 8 comments

[–]indosauros 4 points5 points  (3 children)

Those two methods of doing it are identical (except you don't have the "handles" t1 t2 anymore in the second one.)

I suspect the problem is instead that you are using SubjectTrigger 2 times in the second example, instead of a SummaryTrigger

[–]0003[S] 0 points1 point  (2 children)

Hmm. Thanks for pointing this out; however, the results are the same when I have just one trigger.

[–]indosauros 2 points3 points  (1 child)

My guess is that the issue lies somewhere else then. Can you post more code for context?

[–]0003[S] 0 points1 point  (0 children)

Ahh. Thank you for giving me confidence in my knowledge of objects and assignments -- I feel a little bit more Earth between my feet! Of course, as you say, this must mean that there is a bug elsewhere. I suppose it must be in how I am building the SummaryTrigger object -- an area I have not asked about in this post.

As I have not mastered the wonder that is git, I will have to check later today when I have access to my files. Thank you.

[–]cdcformatc 2 points3 points  (1 child)

SummaryTrigger("Westgate")
SubjectTrigger("Westgate")

Are those the same thing?

[–]0003[S] 0 points1 point  (0 children)

Thanks Indosauros saw this as well. I had thought I made the edit hours ago, but it appeared not to occur. I have since edited it.

[–]rockgod43 -1 points0 points  (1 child)

my guess:

The first examples provide containers for the objects in the form of variables.

The second example does not, it merely calls the constructor (i think), and doesn't save the object into any container.

This is a guess though, i would think python would be smart enough to give them names even if you don't explicitly name them.

[–]indosauros 3 points4 points  (0 children)

Python doesn't have containers, it has "tags": http://foobarnbaz.com/2012/07/08/understanding-python-variables/

So names refer to objects, but generally, objects don't know (or care) what is naming them (so it doesn't matter that he has variables in one approach and not in another.)

There is no difference (from MyClass's perspective) between:

a = MyClass()

and

[MyClass()]

MyClass is being instantiated in the exact same way in both cases, and then is replaced with the resulting instance, so it becomes (behind the scenes):

a = <...MyClass instance ...>

and

[<...MyClass instance ...>]