[wxPython-dev] ipython like features in pyshell/pycrust

Robin Dunn robin at alldunn.com
Sun Mar 25 18:57:38 PDT 2007


Nevare Stark wrote:
> I have added some small features to pyshell/pycrust that are similar to 
> ipython :
> 
> - calling functions even without ending parentheses :
>  >>> dir
> --> dir()
> ['__builtins__', '__doc__', '__file__', '__name__', 'a', 'filling', 
> 'magic', 'notebook', 'pp', 'shell', 'yam', 'yaml']
> 
> - magical functions that takes the rest of the line whatever is it as a 
> string parameter (and I implemented a few) :
>  >>> pwd
> '/home/nevare'
>  >>> cd Desktop
> '/home/nevare/Desktop'
>  >>> exe date
> 'samedi 24 mars 2007, 20:11:38 (UTC+0100)\n'
> 
> - a special magical function : '?' that can be placed before or after an 
> object and returns its doc
>  >>> ?dir
> Python Library Documentation: built-in function dir in module __builtin__
> 
> dir(...)
>     dir([object]) -> list of strings
>    
>     Return an alphabetized list of names comprising (some of) the attributes
>     of the given object, and of attributes reachable from it:
> 
> Would you be interested in having me commenting a bit my code and make a 
> patch that could be integrated in pyshell ?

Yes, these sound like useful things.  Please also add ways for the user 
to discover these features at runtime, such as text in the help dialog 
or etc.  Maybe it's time we gave PyShell/PyCrust a real help document...


> 
> I would also like to give it a better completion (it is limited for the 
> time being).

In what way?


> 
> And also had some features that enable people to write python modules 
> entirely in a shell. Like :
> export.file = '~/Desktop/parrot.py'
> class parrot
>     ...
> math.__init__ = ...
> def isDead(self,...):
>     ...
> math.isDead = isDead
> math.isMoving = ...
> export(math)
> 
> And it would export refactored source code of the math class and all its 
> modifications to the .py file.
> Don't you think that would be cool ?

Cool?  Yes.  Useful?  Maybe.  Something that would be commonly used?  I 
don't know.  I guess I would have to see it in action to be able to 
decide if I really like it or not.

> 
> I suppose you wouldn't be interested to have me work on it for the 
> summer of code. (well I understand it's not really related to core of 
> wxpython).

I think it would certainly apply as a SoC project.  PyShell has become 
an important part of wxPython, and I think that any SoC projects that 
benefit things related to wxPython are just as important to the project 
as a whole as those that are related to the core.  Go ahead and submit a 
proposal.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-dev mailing list