Ben Vinger wrote:
> Thanks to all who responded. I ended up using a sender parameter as
> suggested by Andre and Alan, as this was very simple to do.
When confronted with problems like this I tend to create classes, then
subclass as needed for special circumstances. You might consider that
app
Thanks to all who responded. I ended up using a sender parameter as suggested by Andre and Alan, as this was very simple to do.
Ben
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Noufal Ibrahim wrote:
> On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote:
>
>>Hello
>>
>>I want myfunction in the pseudocode below return something different if it
>>was called from indexfunction.
>
>
> I'm new to this but maybe it would be good if you passed the appropriate
> "version" of "myfun
Hi Ben!
After looking at the modules I detected the traceback-Module in my installation:
>>> import traceback
>>> def two():
... one()
...
>>> two()
>>> def one():
... print traceback.extract_stack()
...
>>> def two():
... one()
...
>>> two()
[('', 1, '?', None), ('', 2, 'two', None),
On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote:
> Hello
>
> I want myfunction in the pseudocode below return something different if it
> was called from indexfunction.
I'm new to this but maybe it would be good if you passed the appropriate
"version" of "myfunction" to indexfunction from where t
Ben,
> I want myfunction in the pseudocode below return something
> different if it was called from indexfunction.
There are several approaches to this.
> def indexfunction(): blah
>
> def myfunction():
>if : return x
>else: return + x +
The simplest approach simply includes a "
On 3/2/06, Ben Vinger <[EMAIL PROTECTED]> wrote:
>
> Hello
>
> I want myfunction in the pseudocode below return something different if it
> was called from indexfunction.
>
How about adding a parameter to myfunction itself:
def indexfunction():
blah
myfunction(fromindexfunction=True)
d
Hello
I want myfunction in the pseudocode below return something different if it was called from indexfunction.
def indexfunction(): blah
def myfunction(): x = 'whatever' if : return x else: return + x +
Thanks
Ben
___
Tuto