473,573 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pythonic Nirvana - towards a true Object Oriented Environment [visionary rambling, long]

Pythonic Nirvana - towards a true Object Oriented Environment
=============== =============== =============== =============== =

IPython (by Francois Pinard) recently (next release - changes are
still in CVS) got the basic abilities of a system shell (like
bash). Actually, using it as a shell is rather comfortable. This all
made me think...

Why do we write simple scripts to do simple things? Why do we
serialize data to flat text files in order to process them? Everything
could be so much simpler and immensely more powerful if we operated on
data *directly* - we should operate on objects, lists, dictionaries,
functions, not files. We shouldn't write scripts to perform our
routines - and way too often, we don't even try, because moving the
data between scripts is too troublesome, involving file formats, argv
parsing and other tedious stuff.

If we use a shell with full Python capabilities, we can introduce new
funtionality for integrating our environments very easily. Consider a
project framework for managing a software project::
import pf
pf.projects
--> [<project 'foo'>, <project 'bar'>]
p = pf.projects[0] # we want to work with project 'foo'
headers = Set([f for f in p.files() if f.endswith(".h" )])
srcs = p.files - headers
found = Set([f for f in srcs if find_any(f, headers)]) r = findradio("kazo o classics")[0] # some diversion needed
music.play # manipulates our music player
music.vol 100
# back to work... notfound = srcs - found
# who has made a header that is not used? jackasses = Set([p.author(file) for file in notfound])

Now we have the names of our victims in 'jackasses' variable. We want
to make that variable accessible to all in our project team, in a
persistent store. We use tab completion to find the databases::
export jackasses <TAB>
Completions: "fooproject _db" "barproject _db" "private"

Note how tab completions for "export" notices that we are trying to
enter the second parameter. It knows that it is the database name, and
the completion mechanism (written for export) dynamically queries the
list of databases for which we are allowed to export data. After
seeing the choices we choose one of them::
export jackasses "fooproject _db" name="slackers"
Now the list of guys is accessible to everybody. We also compose a
volatile email to everybody::
xemacs tmp for m in [Mail(to=name, bodyfile="tmp") for name in jackasses]: m.send
And rat the guys to the management::
xemacs tmp2
# mail contents
# The following guys have not been doing their jobs:
# @("\n".join(jac kasses))
cont = open(tmp2).read ().expand() # runs it through EmPy template expansion system. Mail(to=p.boss, body=cont).send
Notice how jackasses variable was used inside the mail. We can also
schedule some extra hours for the guys to check if their headers are
needed, create a cron script to monitor that they have fixed the bugs,
etc.

The boss might want to fire them at once:
l = import "slackers"
[e.fire() for e in Employee(l)]
Or the boss might want to do some more extensive firing to invigorate
the company::
ent = MyEnterprise()
Auth needed!
Password: ******
st = stats(ent.allem ployees())
avgperf = st.average_perf ormance
def dead_weight(emp ): .. if emp.performance () < avgperf: return True
.. return False
ent.fire_if(dea d_weight)


Typing all that might seem like a lot of work. However, a lot of it
will probably be implemented as functions aggregating the
functionality. Most of the lines here could be factored out to
a function (note that I didn't say script)::

def unused_headers( prj):
""" returns the header files that are not used in the project """
... implementation ...
With conventional scripting techniques, nobody would want to do all
this. With the pythonic approach, creating this kind of business
intelligence is a breeze, eliminating tons of tedious routine!

Obviously this all can be done in specific scripts, which start doing
the thing "from the start" - open database connections, ask the user
to select the project, etc. However, writing such scripts is a lot of
work. With the interactive, much more dynamic approach, pieces of
functionality can be implemented one by one, and they become usable
immediately.

I can imagine that for power users and "knowledge workers", this type
of system would yield immense power. The payback is also incremental -
the whole system grows and gets refactored, streamlining the
process. In the end most of it will probably be driven by a simple
GUI. Especially the "fire below average employees" function, which
should not be run in a yearly cron job - only when needed. Various GUI
threads could be running in the same Python process, manipulating the
same namespace

What needs to be done
---------------------

Not surprisingly, "we're not there yet".

- IPython needs some refactoring (the codebase isn't quite scalable
and extensible enough yet). Francois can use some help.

- Flexible persistence system needs to be itengrated. ZODB, perhaps?

- Domain specific modules (like project / "employee management"
systems) need to be implemented. This luckily mostly writes itself.

- Flexible, but easy to use protocols need to be specified for
documenting the functions, argument expansion, gui interaction etc. A
gui module should display the documentation for the "current" function
and possible arguments, so there's no need to press tab at all times.

Still, all in all, we're almost there. This has the perhaps same
"feel" of tight integration that I imagine the Lisp Macine guys were
experiencing, but Python is much more scripting-friendly, community
driven and easier to learn.

Ergo, world domination.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #1
15 2262
>>>>> "Ville" == Ville Vainio (yes, that's me) writes:

Ville> IPython (by Francois Pinard) recently (next release - changes are

Minor correction - it's Fernando Perez, not Francois Pinard. I
apologize.

IPython web page is at http://ipython.scipy.org/, for the googlically
challenged.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #2
Ville Vainio <vi***@spammers .com> writes:
Why do we write simple scripts to do simple things? Why do we
serialize data to flat text files in order to process them? Everything
could be so much simpler and immensely more powerful if we operated on
data *directly* - we should operate on objects, lists, dictionaries,
functions, not files. We shouldn't write scripts to perform our
routines - and way too often, we don't even try, because moving the
data between scripts is too troublesome, involving file formats, argv
parsing and other tedious stuff.


http://www.scsh.net/
Jul 18 '05 #3
>>>>> "Jacek" == Jacek Generowicz <ja************ **@cern.ch> writes:

Jacek> http://www.scsh.net/

Yes, scsh appears to be doing the same thing as ipython now (though
ipython doesn't yet do job control or other "lower level"
stuff). However, it *is* in Scheme, which kinda muddens the
integration / universality / user acceptance aspects ;-).

Still, scsh appears is a good place to look for further development,
especially as far as process control/redirection goes.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #4
I'm forwarding this to the Unununium <http://unununium.org/> mailing
list. I think the two projects are solving the same problem from
opposite ends.

On Tue, Jun 29, 2004 at 05:03:18PM +0300, Ville Vainio wrote:
Pythonic Nirvana - towards a true Object Oriented Environment
=============== =============== =============== =============== =

IPython (by Francois Pinard) recently (next release - changes are
still in CVS) got the basic abilities of a system shell (like
bash). Actually, using it as a shell is rather comfortable. This all
made me think...

...


Jul 18 '05 #5
>>>>> "Phil" == Phil Frost <in****@bitglue .com> writes:

Phil> I'm forwarding this to the Unununium <http://unununium.org/> mailing
Phil> list. I think the two projects are solving the same problem from
Phil> opposite ends.

Very interesting link :-).

Actually, IPython is so far not actively solving the problem Ununium
is solving, and I wasn't really talking on behalf of IPython the
project, more like visions of what I might want it to be (and
Fernando, the author, probably too, but his time resources are
limited). If you Ununium guys have developer resources to throw at
IPython's direction, I would bet Fernando wouldn't mind a little help
at all - just join the ipython-dev mailing list, IPython is in need of
refactoring :-).

And if you want to check ipython out, do a cvs checkout as instructed
on the webpage and start ipython by "ipython -p pysh", which starts it
in shell mode.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #6
mjt
Ville Vainio wrote:
Pythonic Nirvana - towards a true Object Oriented Environment


.... with every new language/scripting language,
we are supposed to discover nirvana

as my 13 YO daughter would say: "what--*EVER*..."
..
--
<< http://michaeljtobler.homelinux.com/ >>
I don't need to compromise my principles, because they don't have the
slightest bearing on what happens to me anyway. -- Calvin

Jul 18 '05 #7
>>>>> "mjt" == mjt <mjtobler@remov ethis_mail.ru> writes:

mjt> Ville Vainio wrote:
Pythonic Nirvana - towards a true Object Oriented Environment


mjt> ... with every new language/scripting language, we are
mjt> supposed to discover nirvana

Nirvana is not discovered - Nirvana just is ;-).

The point was not liberation-through-Python, it was
liberation-through-interactive-integration-at-deeper-level.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #8
has
Ville Vainio <vi***@spammers .com> wrote in message news:<du******* ******@mozart.c c.tut.fi>...
Pythonic Nirvana - towards a true Object Oriented Environment


Try Squeak for ideas: http://www.squeak.org/
Jul 18 '05 #9
Actually, the last time somebody propsed writing a python based OS, I
had pretty much the same idea. The idea you have currently looks good
for a pure text environment, but you may want to think about what
enhancements would look like as people add things like GUIs in the mix
and see how that works. I suppose it could wind up looking something
like a Naked Object framework, but it could go a lot of different
ways. But in general, putting together an interactive object based
interface will probably lead you down the OS optimization path. As
main memory gets cluttered with objects, you'll want to swap some back
to disk, so you'll need some kind of virtual memory system, and some
way to store those objects on disk, which implies an object file
system, and once you start screwing with file systems, you may as well
get right into the OS level. And that sounds like a vaguely good
idea, although the top down approach seems like a different way of
doing it, start with a basic linux kernel, then start modifying what
you need to, rewriting parts in python as needed, until you get down
to a core and the python object space.

But to take another tack, you may also want to think about the user
experience. Generally, if the system works on a text level, you'll
definitely want to bring it into a gui framework, and when people see
a gui, they'll want to start doing all the things they can do on other
systems, like creating documents, spreadsheets, databases, listening
to mp3s, looking at pictures and movies, and so on. So you may want
to start thinking about more complicated standard types above list and
dict, like Picture, Document, Sound, Table, and so on. Then make sure
that creating these basic objects is fairly easy, then think about how
scripting data flow in and around these objects can be done, object
casting (for instance, casting a picture to a document would seem to
require an OCR engine) and so on, and then you can begin to see how a
whole framework could work, and act somewhat as expected in a normal
setting.

Of course, this has certain implications, for a system like this to
interoperate with other normal file based systems, you'll need
automatic conversion of incoming and outgoing files into your base
object types, so it would probably help to pick current standards as
the basis for your object models (like jpeg for pictures and so on) so
that they can easily be cast as files to the outside world. So I
wouldn't go too crazy coloring outside the lines with this. But it
could be a great thing.

And yes, I have thought about this before.

Ville Vainio <vi***@spammers .com> wrote in message news:<du******* ******@mozart.c c.tut.fi>...
>> "mjt" == mjt <mjtobler@remov ethis_mail.ru> writes:
mjt> Ville Vainio wrote: >> Pythonic Nirvana - towards a true Object Oriented Environment


mjt> ... with every new language/scripting language, we are
mjt> supposed to discover nirvana

Nirvana is not discovered - Nirvana just is ;-).

The point was not liberation-through-Python, it was
liberation-through-interactive-integration-at-deeper-level.

Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1638
by: Benjamin C. Pierce | last post by:
The Twelth International Workshop on Foundations of Object-Oriented Languges (FOOL 12) Saturday 15 January 2005 Long Beach, California, USA Following POPL 05 The search for sound principles for object-oriented languages has given rise to much work on the theory of programming languages during the past two decades, leading to a better...
11
5034
by: Charles Krug | last post by:
I've a function that needs to maintain an ordered sequence between calls. In C or C++, I'd declare the pointer (or collection object) static at the function scope. What's the Pythonic way to do this? Is there a better solution than putting the sequence at module scope?
12
1931
by: Thomas Lotze | last post by:
Hi, I'm trying to figure out what is the most pythonic way to interact with a generator. The task I'm trying to accomplish is writing a PDF tokenizer, and I want to implement it as a Python generator. Suppose all the ugly details of toknizing PDF can be handled (such as embedded streams of arbitrary binary content). There remains one...
5
2911
by: Martin | last post by:
When was inheritance intruduced into object oriented programming? More generally, does anyone know or have any sources on when the different features were introduced into object oriented programming?
11
9224
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
6
1401
by: Chip | last post by:
Hi all, I've just gone thru a so called e-learning course on the web and I found that one of the test question is interesting. Here is the question: What is the relationship between the C and C++ programming languages? 1. They are both object-oriented programming languages
11
3810
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you experts. I would like to produce Javascript classes that can be "subclassed" with certain behaviors defined at subclass time. There are plenty of...
4
1790
by: Carl J. Van Arsdall | last post by:
It seems the more I come to learn about Python as a langauge and the way its used I've come across several discussions where people discuss how to do things using an OO model and then how to design software in a more "Pythonic" way. My question is, should we as python developers be trying to write code that follows more of a python standard...
5
2200
by: akameswaran | last post by:
Disclaimer - I recognize this is not a practical exercise. There are many implementations around that would do the job better, more efficiently (Meaning in C) or whatever. I caught some thread about sorting and started thinking about shell sort.... and as part of my trying to pythonise my mind and break my java mindset So I decided to...
0
8202
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7787
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8065
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5593
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5291
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3733
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2213
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1041
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.