[Python-Dev] PEP: __source__ proposal

"Martin v. Löwis" martin at v.loewis.de
Sat Dec 4 15:10:06 CET 2004

Stelios Xanthakis wrote:
> The key point is that I think think should be the
> job of the parser and the functionality provided
> at the interactive prompt w/o the user having to
> write 'dyndef' or store the code of exec's or request
> from himself to use specific commands to create
> functions. It should be transparent built into python.

For the case of the interactive prompt, if preserving
the source code is somehow desirable (which I doubt),
it should be the job of the development environment
to offer saving interactively-defined methods.

Such IDE support is necessary even if __source__ was
available, since users probably would not want to write

open("demo.py").write(myfunc.__source__ + "\n" + myclass.__source)

> OTOH, programming python is easy and fun and I think
> the proposed feature will make it even more fun and it
> aims in increasing the number of people who program
> python for their every day tasks. It'd be interesting to
> hear if the developers of IDLE/ipython/etc could use this.

I think it is the other way 'round. If this is *only* for
interactive mode, than you should *first* change the interactive
environments. If you then find you absolutely need this feature
to implement the IDEs correctly, I'd like to hear the (new)
rationale for the change.


More information about the Python-Dev mailing list