473,770 Members | 5,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Try Python update

After spending time I should have been sleeping working on it, the try
python site is much more functional. It now allows statements,
including multi-line statements and expressions. You can't create code
objects yet, so it's still more a programmable calculator than
anything real.

I've got some of the tutorial text (literally) up as well. I hope to
make it easier to read the tutorial and interact with python at the
same time in the near future.

The url is http://www.mired.org/home/mwm/try_python/. Reports of
problems would appreciated.

If you want to try an online P{ython tool that lets you save code, try
Devan L's at http://www.datamech.com/devan/trypython/trypython.py.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 1 '06 #1
29 2233
Cool. I think its really a good thing. Could come in handy when one is
on a strange Windows machine with no Python installed, or when using a
PDA that doesn't have Python etc.

And its just a neat feat. ;-)))

Ron

Jan 1 '06 #2

Mike Meyer wrote:
After spending time I should have been sleeping working on it, the try
python site is much more functional. It now allows statements,
including multi-line statements and expressions. You can't create code
objects yet, so it's still more a programmable calculator than
anything real.

I've got some of the tutorial text (literally) up as well. I hope to
make it easier to read the tutorial and interact with python at the
same time in the near future.

The url is http://www.mired.org/home/mwm/try_python/. Reports of
problems would appreciated.

If you want to try an online P{ython tool that lets you save code, try
Devan L's at http://www.datamech.com/devan/trypython/trypython.py.


My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
Code Objects. It's limited to closures though, just like in the recipe.
So uh, you can't write closures in mine.

On a side note, my brother has tinkered with the C internals and now
__subclasses__ is restricted and many, many os and posix commands are
restricted (not that you can get them anyways, since importing is
broken!)

Jan 1 '06 #3
"Devan L" <de****@gmail.c om> writes:
If you want to try an online P{ython tool that lets you save code, try
Devan L's at http://www.datamech.com/devan/trypython/trypython.py. My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
Code Objects. It's limited to closures though, just like in the recipe.
So uh, you can't write closures in mine.


I don't have the dead trees version, and the online version doesn't
have chapter numbers. Is that <URL:
http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/212565>?
On a side note, my brother has tinkered with the C internals and now
__subclasses__ is restricted and many, many os and posix commands are
restricted (not that you can get them anyways, since importing is
broken!)


I got import to work by pickling pairs of names - the variable name
that references the module, and the name of the module. When it
unpickles the list, it reimports them and points the appropriate
variable at them. This had unwanted effects if you did an "import
this". It also doesn't work for objects that contain references to
modules.

I tried for a bit to restrict things, then gave up and did it
externally. There's no access to any files but those required to run
the script that deals with thing, and some other python modules that I
decided would be nice to have. Normally, nothing in the tree is
writable, either. Once I'm happy with it, I'll save a copy of the tree
somewhere and set up a cron job to "refresh" it at regular intervals.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 2 '06 #4
Mike Meyer wrote:
"Devan L" <de****@gmail.c om> writes:
If you want to try an online P{ython tool that lets you save code, try
Devan L's at http://www.datamech.com/devan/trypython/trypython.py. My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
Code Objects. It's limited to closures though, just like in the recipe.
So uh, you can't write closures in mine.


I don't have the dead trees version, and the online version doesn't
have chapter numbers. Is that <URL:
http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/212565>?


It was one of the recipes of the day, actually. They don't keep them up
for more than a week, though, I think. But more or less it has all of
the attributes used for creating an object from types.CodeType in
correct order.
On a side note, my brother has tinkered with the C internals and now
__subclasses__ is restricted and many, many os and posix commands are
restricted (not that you can get them anyways, since importing is
broken!)


I got import to work by pickling pairs of names - the variable name
that references the module, and the name of the module. When it
unpickles the list, it reimports them and points the appropriate
variable at them. This had unwanted effects if you did an "import
this". It also doesn't work for objects that contain references to
modules.


My general method of storing is to store everything possible. See a
function? Store the function object itself. See a class? Store the
class object. Unfortunately, I can't store builtin methods or
functions, so this breaks on most modules. Don't try to reference the
__builtins__, by the way, otherwise it won't be removed and modjelly
will break.

I tried for a bit to restrict things, then gave up and did it
externally. There's no access to any files but those required to run
the script that deals with thing, and some other python modules that I
decided would be nice to have. Normally, nothing in the tree is
writable, either. Once I'm happy with it, I'll save a copy of the tree
somewhere and set up a cron job to "refresh" it at regular intervals.


I don't have enough control on the server to effectively restrict it
externally (no running as an unprivelleged user!), so I have to lock it
down as tightly as possible internally.

Jan 2 '06 #5
"Devan L" <de****@gmail.c om> writes:
> On a side note, my brother has tinkered with the C internals and now
> __subclasses__ is restricted and many, many os and posix commands are
> restricted (not that you can get them anyways, since importing is
> broken!)

I got import to work by pickling pairs of names - the variable name
that references the module, and the name of the module. When it
unpickles the list, it reimports them and points the appropriate
variable at them. This had unwanted effects if you did an "import
this". It also doesn't work for objects that contain references to
modules.

My general method of storing is to store everything possible. See a
function? Store the function object itself. See a class? Store the
class object. Unfortunately, I can't store builtin methods or
functions, so this breaks on most modules. Don't try to reference the
__builtins__, by the way, otherwise it won't be removed and modjelly
will break.


I think the idea I used for modules would generalize: If you can't
store it, store the information you need to relocate it, and recreate
the binding.
I tried for a bit to restrict things, then gave up and did it
externally. There's no access to any files but those required to run
the script that deals with thing, and some other python modules that I
decided would be nice to have. Normally, nothing in the tree is
writable, either. Once I'm happy with it, I'll save a copy of the tree
somewhere and set up a cron job to "refresh" it at regular intervals.

I don't have enough control on the server to effectively restrict it
externally (no running as an unprivelleged user!), so I have to lock it
down as tightly as possible internally.


My ISP provides this facility. They provided a less strict version,
and worked with me to create this facility. While they aren't perfect,
I can't say enough good things about them. If you need internet
connectivity, web hosting, whatever - idiom.com is good people to work
with.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 2 '06 #6
Very nice :)

I found this online Ruby tutorial:
http://tryruby.hobix.com/

I think it would be cool to have something similar for Python. Want to
go further and make a nice tutorial to accompany this :)

wy

Jan 3 '06 #7
"au******@gmail .com" <au******@gmail .com> writes:
Very nice :)

I found this online Ruby tutorial:
http://tryruby.hobix.com/
That's what inspired me to create my version.
I think it would be cool to have something similar for Python. Want to
go further and make a nice tutorial to accompany this :)


Well, *I* like the python.org tutorial. I've already started steal,
uh, using, material from it. I intend to include more as time goes
by.

One thing that annoyed me about the tryruby version is that it changed
the text - apparently arbitrarily - with each expression. I *detest*
UI's that change things when they want to (I regularly close dialogs
accidently on OSX because they come up while I'm working in *some
other application* and steal the focus from me). I'm not going to do
that; that's why I list all the sections, and you can display (or not)
by clicking on them. I'm planning on adding a "suggested reading" link
(it's already there if you know where to look, but always does the
same thing :-) under the console that will do what the ruby thing
does, except when the user asks for it, not when I think it should
happen.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 3 '06 #8
I like the form, no matter what its limitations may be. Three notes:

It might be a good way to catch newbi mistakes (those are the kind I
make :P, thereby providing a feedback loop to improved error messages.

I had no trouble with from math import * followed by print pi, but
there was no >>> prompt after the result appeared .. is that part of
the 'closures' thing mentioned earlier?

Then I followed you "type 'help'" suggestion, which had me in stitches
(sorry, it's been a long day and the Knob Creek was kicking in) -- I
got exactly the message you'd expect, about help not being recognized
and maybe help() would work. That's what triggered the idea for
trapping errors.

Nice work!

George

Jan 4 '06 #9
br*****@verizon .net writes:
I like the form, no matter what its limitations may be. Three notes:

It might be a good way to catch newbi mistakes (those are the kind I
make :P, thereby providing a feedback loop to improved error messages.
I'm doing almost no error catching. I think I catch two:

If you muck with the prompt, it throws away what you sent it, because
I'd have to guess at the expression.

There were (I think I worked around them) browser bugs that caused
the result of an expression to get lost - it notices that, and tells
you about it.

Well, I do catch exceptions in general, to tailor the traceback for
the environment. But that's all I do.
I had no trouble with from math import * followed by print pi, but
there was no >>> prompt after the result appeared .. is that part of
the 'closures' thing mentioned earlier?
Hmm. Are you looking at mine <URL:
http://www.mired.org/home/mwm/try_python/ >, or Devans <URL:
http://www.datamech.com/devan/trypython/trypython.py >? Mine doesn't
handle code (though he's provide pointers I plan on using to make it
do so). I think he said his has problems with closures.
Then I followed you "type 'help'" suggestion, which had me in stitches
(sorry, it's been a long day and the Knob Creek was kicking in) -- I
got exactly the message you'd expect, about help not being recognized
and maybe help() would work. That's what triggered the idea for
trapping errors.


Hmm. help seems to work fine in both of them. license() fails the same
way in both of them (it tries to read from stdin, so....), which means
that you can probalby make help fail on them both if you work at it.

thanks,
<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 4 '06 #10

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

Similar topics

220
19156
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
18
6765
by: David Rysdam | last post by:
What module is most recommended for accessing Sybase from Python? This one: http://www.object-craft.com.au/projects/sybase/sybase/ ? Also, is there any module that provides a generic DB API and can be hooked to both Sybase and postgresql? This (http://www.python.org/peps/pep-0249.html) looks pretty old.
22
1767
by: lechequier | last post by:
Let's say I define a list of pairs as follows: >>l = Can anyone explain why this does not work? >>h = {}.update(l) and instead I have to go: >>h = {} >>h.update(l) to initialize a dictionary with the given list of pairs?
4
3052
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the dns records at my dns provider, zoneedit. So basically, I've setup dynamic dns using python. Once the ip compare and/or update is complete, I log the results to a text file called update.log. When I run the program in a bash shell with the...
0
1601
by: | last post by:
Greetings. In an effort to get python2.4 on my Centos 3.7, I installed the python bootstrap rpm. This installed 2.4 alongside 2.2 and updated yum to 2.4.0. Oddly, it didn't create a symlink 'python' for either 2.2 or 2.4. I also get a series of troubling dependency errors when I run yum update. Below is the output of the bootstrap install, which includes both a failure early on (possibly related to alternatives and/or the symlink?)...
0
1984
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open ( +4) / 291 closed ( +4) / 553 total ( +8) New / Reopened Patches ______________________
1
1708
by: Steve Mavronis | last post by:
I tried to install Python 2.51 on Microsoft Vista Ultimate 32-bit because I use the 3D modeler software Blender 2.44, in case I needed additional Python support in the future for add-on scripts. I got a warning about "files in use" during installation that needed updating. I aborted the install since the files were Intel Viiv and Microsoft Vista Media Center related so didn't want to mess them up. Can someone explain why Python wants to...
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10002
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9869
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7415
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.