Context-aware return

Grant Edwards invalid at invalid.invalid
Thu Sep 10 21:23:08 CEST 2015

On 2015-09-10, Steven D'Aprano <steve at> wrote:

> I have a function which is intended for use at the interactive interpreter,
> but may sometimes be used non-interactively. I wish to change it's output
> depending on the context of how it is being called.


Sounds like an excellent way to waste somebody's afternoon when they
start to troubleshoot code that's using your function.  Over and over
and over we tell newbies who have questions about what something
returns or how it works

    "Start up an interactive session, and try it!".

If word gets out about functions like yours, we sort of end up looking
like twits.  

> If I did this thing, would people follow me down the street booing
> and jeering and throwing things at me?

Only the people who use your function. :)

Grant Edwards               grant.b.edwards        Yow! FROZEN ENTREES may
                                  at               be flung by members of
                                opposing SWANSON SECTS ...

More information about the Python-list mailing list