Re: pickling multiple dictionaries

2006-05-24 Thread Miki
Hello Matthew,

You can try either http://docs.python.org/lib/module-shelve.html or any
other database bindings with blobs.

HTH,
Miki
http://pythonwise.blogspot.com

-- 
http://mail.python.org/mailman/listinfo/python-list


problem select object in pyode

2006-05-24 Thread freshman
# test code: http://pyode.sourceforge.net/tutorials/tutorial3.html
#
#i want selecting object in pyode test code.
# what's wrong?
# under modify code
# see selectObject() function

# pyODE example 3: Collision detection

# Originally by Matthias Baas.
# Updated by Pierre Gay to work without pygame or cgkit.

import sys, os, random, time
from math import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *

import ode

# geometric utility functions
def scalp (vec, scal):
vec[0] *= scal
vec[1] *= scal
vec[2] *= scal

def length (vec):
return sqrt (vec[0]**2 + vec[1]**2 + vec[2]**2)

obj_map = {}

def _mousefunc(b, s, x, y):
if b == 0 and s == 0:
selectObject(x, y)

def selectObject(x, y):
print x, y

glSelectBuffer(512)
viewport = glGetIntegerv(GL_VIEWPORT)

glMatrixMode(GL_PROJECTION)
glPushMatrix()
glRenderMode(GL_SELECT)
glLoadIdentity()
gluPickMatrix(x, viewport[3]-y, 2, 2, viewport)
gluPerspective (45,1.333,0.1,100)
gluLookAt (2.4, 3.6, 4.8, 0.5, 0.5, 0, 0, 1, 0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
_drawfunc()
buffer = glRenderMode(GL_RENDER)

for hit_record in buffer:
print hit_record
if buffer:
obj_name = buffer[0][2][0]
else:
obj_name = 0
glMatrixMode(GL_PROJECTION)
glPopMatrix()
glMatrixMode(GL_MODELVIEW)

# prepare_GL
def prepare_GL():
"""Prepare drawing.
"""

# Viewport
glViewport(0,0,640,480)

# Initialize
glClearColor(0.8,0.8,0.9,0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST)
glDisable(GL_LIGHTING)
glEnable(GL_LIGHTING)
glEnable(GL_NORMALIZE)
glShadeModel(GL_FLAT)

# Projection
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective (45,1.,0.2,20)

# Initialize ModelView matrix
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()

# Light source
glLightfv(GL_LIGHT0,GL_POSITION,[0,0,1,0])
glLightfv(GL_LIGHT0,GL_DIFFUSE,[1,1,1,1])
glLightfv(GL_LIGHT0,GL_SPECULAR,[1,1,1,1])
glEnable(GL_LIGHT0)

# View transformation
gluLookAt (2.4, 3.6, 4.8, 0.5, 0.5, 0, 0, 1, 0)

# draw_body
def draw_body(body):
"""Draw an ODE body.
"""
global obj_map

x,y,z = body.getPosition()
R = body.getRotation()
rot = [R[0], R[3], R[6], 0.,
   R[1], R[4], R[7], 0.,
   R[2], R[5], R[8], 0.,
   x, y, z, 1.0]
glPushMatrix()
glMultMatrixd(rot)
if body.shape=="box":
sx,sy,sz = body.boxsize
glScale(sx, sy, sz)

glPushName(obj_map[body])
glutSolidCube(1)
glPopName()

glPopMatrix()


# create_box
def create_box(world, space, density, lx, ly, lz):
"""Create a box body and its corresponding geom."""

# Create body
body = ode.Body(world)
M = ode.Mass()
M.setBox(density, lx, ly, lz)
body.setMass(M)

# Set parameters for drawing the body
body.shape = "box"
body.boxsize = (lx, ly, lz)

# Create a box geom for collision detection
geom = ode.GeomBox(space, lengths=body.boxsize)
geom.setBody(body)

return body

# drop_object
def drop_object():
"""Drop an object into the scene."""

global bodies, counter, objcount

body = create_box(world, space, 1000, 1.0,0.2,0.2)
body.setPosition( (random.gauss(0,0.1),3.0,random.gauss(0,0.1)) )
theta = random.uniform(0,2*pi)
ct = cos (theta)
st = sin (theta)
body.setRotation([ct, 0., -st, 0., 1., 0., st, 0., ct])
bodies.append(body)
counter=0
objcount+=1

global obj_map
obj_map[body] = objcount

# explosion
def explosion():
"""Simulate an explosion.

Every object is pushed away from the origin.
The force is dependent on the objects distance from the origin.
"""
global bodies

for b in bodies:
l=b.getPosition ()
d = length (l)
a = max(0, 4*(1.0-0.2*d*d))
l = [l[0] / 4, l[1], l[2] /4]
scalp (l, a / length (l))
b.addForce(l)

# pull
def pull():
"""Pull the objects back to the origin.

Every object will be pulled back to the origin.
Every couple of frames there'll be a thrust upwards so that
the objects won't stick to the ground all the time.
"""
global bodies, counter

for b in bodies:
l=list (b.getPosition ())
scalp (l, -1000 / length (l))
b.addForce(l)
if counter%60==0:
b.addForce((0,1,0))

# Collision callback
def near_callback(args, geom1, geom2):
"""Callback function for the collide() method.

This function checks if the given geoms do collide and
creates contact joints if they do.
"""

# Check if the objects do collide
contacts = ode.collide(geom1, geom2)

# Create contact joints
world,contactgroup = args
for c in contacts:
c.setBounce(0.2)
c.setMu(5000)
j = ode.ContactJoint(world, contactgroup, c)

ftputil.py

2006-05-24 Thread Sheldon
Hi Everyone,

I recently installed a module called ftputil and I am trying to
understand how it works.
I created a simple program to download about 1500 files from my ftp and
the program looks like this:

**
#! /usr/bin/env python
#-*- coding: UTF-8 -*-

def ftp_fetch(newdir):
import sys
import ftputil
# download some files from the login directory
host = ftputil.FTPHost('ftp..xx', 'xx', 'xxx')
names = host.listdir(host.curdir)
print "There are %d files on the FTP server to be downloaded" %
len(names)
for name in names:
if host.path.isfile(name):
host.download(name, name, 'b')  # remote, local, binary
mode
#make a new directory and copy a remote file into it
host.mkdir('newdir')
source = host.file('index.html', 'r')  # file-like object
target = host.file('newdir/index.html', 'w')  # file-like object
host.copyfileobj(source, target)  # similar to shutil.copyfileobj
source.close()
target.close()

return 0

#
if __name__== "__main__":
import os
import sys
newdir = os.getcwd()
print "Downloading files from FTP into directory: %s" % newdir
#sys.exit(0)
stat = ftp_fetch(newdir)
**

 Now I also need to write another function to upload files and I
haven't the faintest idea yet.
Here is the part of the program that I need explained:

host.download(name, name, 'b')  # remote, local, binary mode
source = host.file('index.html', 'r')  # file-like object
target = host.file('newdir/index.html', 'w')  # file-like object
host.copyfileobj(source, target)  # similar to shutil.copyfileobj

Any help would be greatly appreciated!

Sincerely,
Sheldon

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pickling multiple dictionaries

2006-05-24 Thread Hans Georg Krauthaeuser
manstey wrote:
> Hi,
> 
> I am running a script that produces about 450,000 dictionaries. I tried
> putting them into a tuple and then pickling the tuple, but the tuple
> gets too big. Can I pickle dictionaries one after another into the same
> file and then read them out again?
> 
> Cheers,
> Matthew
> 
If you don't know, just try it:

In [1]:import pickle
In [2]:d1={'a':1}
In [3]:d2={'b':2}
In [4]:pfile=file('test.p','wb')
In [5]:pickle.dump(d1,pfile)
In [6]:pickle.dump(d2,pfile)
In [7]:pfile.close()
In [8]:del d1
In [9]:del d2
In [10]:pfile=file('test.p','rb')
In [11]:d1=pickle.load(pfile)
In [12]:d1
Out[12]:{'a': 1}
In [13]:d2=pickle.load(pfile)
In [14]:d2
Out[14]:{'b': 2}

If your data is *really* large, have a look to PyTables
(http://www.pytables.org/moin).

Regards,
Hans Georg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: No math module??

2006-05-24 Thread Tim Golden
Tim Roberts wrote:
> WIdgeteye <[EMAIL PROTECTED]> wrote:
> >
> >On Tue, 23 May 2006 12:40:49 +1000, Ben Finney wrote:
> >
> >Ok this is weird. I checked:
> >/usr/local/lib/python2.3/lib-dynload/math.so
> >
> >Just as you have on your system and it's there.
> >So why in the heck isn't it loading with:
> >import math
> >
> >This is strange.
>
> Is the Python that you are running actually 2.3?  Some Linux systems have
> both Python 1 and a Python 2 installed.  Typing "python" at a command line
> often gets Python 1, because the vendor's configuration scripts assume
> that.

Maybe he's running a UK-based distro which has
renamed the math module to maths? (I have to work
really hard to remember *not* to put the "s" on the
end when I import it!

;-) 

TJG

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: windows xp scripting

2006-05-24 Thread Tim Golden
Tim Roberts wrote:
> "oscartheduck" <[EMAIL PROTECTED]> wrote:
> >
> >It wasn't, but after seeing your success I discovered what was wrong.
> >My destination directory didn't exist, and for some reason windows
> >wasn't automatically creating it to dump the files in.
>
> Right.  The "copy" command never creates directories.  It will copy each
> individual file, in turn, to a file with whatever the last name in the list
> is.  Not terribly useful, but it is a behavior inherited from DOS 1.
>
> On the other hand, the "xcopy" command will do it:
>
>   xcopy /i C:\DIR1 C:\DIR2
>
> That will create DIR2 if it does not already exist.

I've done a v. simple comparison of a few techniques
for copying things on Win32. Might be of some use:

http://timgolden.me.uk/python/win32_how_do_i/copy-a-file.html

TJG

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Maxim Sloyko
I guess the following standard method will help :

class MyLocker(object):
def __init__(self, lock):
  self.lock = lock
  self.lock.acquire()

def __del__(self):
self.lock.release()

Then whenever you need to acquire a lock:
templock = MyLocker(self.__mutex)

del templock # will release the lock (provided you didn't create an
extra link to this object)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: documentation for win32com?

2006-05-24 Thread Tim N. van der Leeuw

Roger Upole wrote:
> The Excel docs are your best bet.  The examples they give
> are all MS-specific languages like VB, but most translate
> fairly easily to Python.
>
> You can also run makepy on the Excel typelib, which will
> generate a file with all the methods, events etc available
> thru the Excel object model.
>

You should definately run makepy, it will be a great help, but there
are objects for which you can still not get any 'help' from your IDE's
autocompletion...
In those cases you'll just have to wing it, and indeed refer to the
Excel helpfiles for VBA methods/objects/etc.

Look at some samples on the web, and experiment a lot (using the
PythonWin IDE seems to work quite well for this kind of experimenting,
perhaps IDLE would also do it quite well. Due to the dynamic nature of
this kind of explorations, the pydev Eclipse plugin doesn't work well
for it).


> Also, searching this group and the pywin32 mailing list
> for "excel.application" turns up a bunch of sample code.
> 
> hth
>Roger
> 
> 

Cheers,

--Tim

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ftputil.py

2006-05-24 Thread Miki
Hello Sheldon,

> Here is the part of the program that I need explained:
>
> host.download(name, name, 'b')  # remote, local, binary mode
Download file called "name" from host to a local file in the same name,
use binary mode.

> source = host.file('index.html', 'r')  # file-like object
Open a file (like built-in "open") on remote site in read mode

> target = host.file('newdir/index.html', 'w')  # file-like object
Open a file (like built-in "open") on remote site in write mode

> host.copyfileobj(source, target)  # similar to shutil.copyfileobj
Copy 1'st file to the second.

HTH,
Miki
http://pythonwise.blogspot.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dict literals vs dict(**kwds)

2006-05-24 Thread bruno at modulix
George Sakkis wrote:
> Bruno Desthuilliers wrote:
> 
> 
>>George Sakkis a écrit :
>>
>>>Although I consider dict(**kwds) as one of the few unfortunate design
>>>choices in python since it prevents the future addition of useful
>>>keyword arguments (e.g a default value or an orderby function), I've
>>>been finding myself lately using it sometimes instead of dict literals,
>>>for no particular reason. Is there any coding style consensus on when
>>>should dict literals be preferred over dict(**kwds) and vice versa ?
>>
>>using dict literals means that you'll always have a builtin dict - you
>>cannot dynamically select another dict-like class. OTHO, you can only
>>use valid python identifiers as keys with dict(**kw).
> 
> 
> This is all good but doesn't answer my original question: 

I thought it did - at least partly.

> under which
> circumstances (if any) would  {'name':'Mike, 'age':23} be preferred
> over dict(name='Mike', age=23) 

When you're sure you want a builtin dict (not any other dictlike) and/or
some keys are invalid Python identifiers.

> and vice versa, 

When all your keys are valid Python identifiers, and you may want to use
another dict-like instead of the builtin dict. It's easy to replace the
dict() factory in a function, class, or whole module :

class MyDict(...):
  # dict-like class

dict = MyDict

then all following calls to dict(**kw) in this namespace will use MyDict
instead of the builtin's one. Can't do that with dict litterals.

> or if it's just a matter
> of taste, 

Partly also, but...

> similar to using single vs double quote for string literals
> (when both are valid of course).

Nope, this is not so similar, cf above.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


John Bokma harassment

2006-05-24 Thread Xah Lee
I'm sorry to trouble everyone. But as you might know, due to my
controversial writings and style, recently John Bokma lobbied people to
complaint to my web hosting provider. After exchanging a few emails, my
web hosting provider sent me a 30-day account cancellation notice last
Friday.

I'm not sure I will be able to keep using their service, but I do hope
so. I do not like to post off-topic messages, but this is newsgroup
incidence is getting out of hand, and I wish people to know about it.

I wrote some full detail here:
http://xahlee.org/Periodic_dosage_dir/t2/harassment.html

If you believe this lobbying to my webhosting provider is unjust,
please write to my web hosting provider [EMAIL PROTECTED]

Your help is appreciated. Thank you.

   Xah
   [EMAIL PROTECTED]
 ∑ http://xahlee.org/

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: John Bokma harassment

2006-05-24 Thread Erik Max Francis
Xah Lee wrote:

> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style, recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice last
> Friday.

It's not simply harassment if your ISP considers it a TOS violation. 
You did something, it was reported to your ISP, your ISP considered it a 
violation of their TOS, were warned, failed to comply and continued 
doing it, and now are suffering the consequences.  Should this really be 
any surprise to you?

This has nothing to do with whether you feel that the complaint or the 
judgement against you was "right" -- this has happened before; this is 
familiar territory for you.  If you do something, your ISP tells you not 
to do it anymore, and then you continue doing it, why should you be 
surprised at the inevitable outcome?  (I'm impressed they're giving you 
a 30-day notice, quite frankly ... I'm sure you'll "take advantage" of it.)

> I'm not sure I will be able to keep using their service, but I do hope
> so. I do not like to post off-topic messages, but this is newsgroup
> incidence is getting out of hand, and I wish people to know about it.

Apart from the obvious fact of you being a general tool, why would you 
_want_ to consider continuing to use their service if you felt that they 
were cutting you off unfairly?

The alternative is that you're not surprised by this action and are 
simply trying to spin things in your favor.

-- 
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   The woman's movement is no longer a cause but a symptom.
   -- Joan Didion
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: logging

2006-05-24 Thread Baurzhan Ismagulov
Hello Vinay,

On Tue, May 23, 2006 at 04:13:38PM -0700, Vinay Sajip wrote:
> > [logger_root]
> > level=CRITICAL
> > handlers=console
> >
> > [logger_l01]
> > level=DEBUG
> > qualname=l01
> > handlers=console
> > 
> > I want logger_root to go to /dev/null, so I've configured it with level
> > CRITICAL. My understanding is that in this way debug messages are not
> > printed on logger_root's handler. However, running the program results
> > in the message being printed twice. What is the problem?
> 
> You've defined the handler against both the root logger and l01. You
> only need it configured for the root logger - events passed to l01 will
> be passed to all handlers up the hierarchy. So remove the
> "handlers=console" line from [logger_l01] and it should print the
> message just once.

Thanks for the idea! I think this should work for the example I sent.
However, I have more than one module, and I want to log only l01. How
can I do that?

Thanks in advance,
Baurzhan.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Dag Sunde
"Xah Lee" <[EMAIL PROTECTED]> skrev i melding 
news:[EMAIL PROTECTED]
> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style, recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice last
> Friday.

The solution to your problem is very simple:

Stop posting your "controversial writings and style" to public
newgroups, and keep them on your web-server where they belong.



-- 
Dag.


-- 
http://mail.python.org/mailman/listinfo/python-list


hi,every body. a problem with PyQt.

2006-05-24 Thread softwindow
i use QT-designer to design application GUI.
now i save the test.ui file into e:\test\test.ui
next step,how can i run it?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hi,every body. a problem with PyQt.

2006-05-24 Thread Giles Brown
The tool to create a python script from a Qt designer .ui file is
called pyuic.

I suggest you have a google for "pyqt tutorial" pages.

I found this one for example:
http://wiki.python.org/moin/JonathanGardnerPyQtTutorial

Regards,
Giles

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hi,every body. a problem with PyQt.

2006-05-24 Thread Luke Plant

> i use QT-designer to design application GUI.
> now i save the test.ui file into e:\test\test.ui
> next step,how can i run it?

You should have a look at a PyQt tutorial, such as this one:
http://vizzzion.org/?id=pyqt

Luke

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread ilitzroth

Xah Lee schreef:

> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style, recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice last
> Friday.
>
> I'm not sure I will be able to keep using their service, but I do hope
> so. I do not like to post off-topic messages, but this is newsgroup
> incidence is getting out of hand, and I wish people to know about it.
>
> I wrote some full detail here:
> http://xahlee.org/Periodic_dosage_dir/t2/harassment.html
>
> If you believe this lobbying to my webhosting provider is unjust,
> please write to my web hosting provider [EMAIL PROTECTED]
>
> Your help is appreciated. Thank you.
>
>Xah
>[EMAIL PROTECTED]
>  ∑ http://xahlee.org/

We seem to have strayed a long way from Voltaire's
"I do not agree with what you say, but I will defend to the death your
right to say it.",
but that was of course the age of enlightenment.
Immanuel

-- 
http://mail.python.org/mailman/listinfo/python-list

referrers

2006-05-24 Thread raghu
Hi All,

The sys.getrefcount() is very useful to get the number of references on
a particular object.

Is there any companion function to get "who" the referrers are ?

for e.g.

global x
global y
global z


x0=24012
y=x0
z=x0

print "ref count ",sys.getrefcount(x0)


This prints a ref count of 5.

Basically, I need to know which are the 5 entities who are referring to
x0 ?

Is there any way of doing it ?

Thanks.

Bye,
raghavan V

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hi,every body. a problem with PyQt.

2006-05-24 Thread softwindow
thanks everyone!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: referrers

2006-05-24 Thread Diez B. Roggisch
raghu wrote:

> Hi All,
> 
> The sys.getrefcount() is very useful to get the number of references on
> a particular object.
> 
> Is there any companion function to get "who" the referrers are ?
> 
> for e.g.
> 
> global x
> global y
> global z
> 
> 
> x0=24012
> y=x0
> z=x0
> 
> print "ref count ",sys.getrefcount(x0)
> 
> 
> This prints a ref count of 5.
> 
> Basically, I need to know which are the 5 entities who are referring to
> x0 ?
> 
> Is there any way of doing it ?

Look into the gc-module.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ant
>From my point of view, this issue has two sides:

1) Xah is posting to the newgroups valid topics for discussion - if
some find these controversial, then all the better: it means that the
topic has provoked some thought. You only need to look at the quantity
of Xah's threads to see how popular they are (even if you filter out
the "you're in my kill file", or "plonk" style spam that some people
feel the need to post)

2) Xah cross posted the posts to several newsgroups he has an interest
in.

Now this second point should be the only factor for reporting him to
his ISP. Given that it has gone this far, wouldn't it be fair to give
the guy a break on the condition that if he wants to post to a variety
of newgroups, that he does it individually rather than as a cross post?

-- 
Ant...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hi,every body. a problem with PyQt.

2006-05-24 Thread softwindow
but in my computer

pyuic is not a valid commond

may be i don't install something,but i  have installed PyQt4.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hi,every body. a problem with PyQt.

2006-05-24 Thread softwindow
i find it now

thanks !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A critic of Guido's blog on Python's lambda

2006-05-24 Thread Michele Simionato
Kay Schluehr wrote:
> http://www.fiber-space.de/EasyExtend/doc/EE.html

Well, I have not read that page yet, but the name "fiber space" reminds
me of old
memories, when I was doing less prosaic things than now. Old times ..
;)

 Michele Simionato

> It fits quite nice with Python and is conceptually simple, safe and
> reasonably fast. Using EasyExtend PyCells could be made an own language
> ( including Python ) defined in a Python package ( i.e. no C-code and
> complex build process is required ).  I would be interested in user
> experience. I wouldn't consider EE as "experimental" i.e. open for
> severe changes. It still lacks some comfort but it also improves
> gradually in this respect.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using python for a CAD program

2006-05-24 Thread baalbek
Paddy wrote:
> Hi Baalbek,
> Athouh they are database editors, they are not relational database
> editors. Relational database engines fit some type of problems but
> others have found that RDBMS don't fit CAD data. They are just too slow
> and add complexity in mapping the 'natural CAD data formats' to the
> RDBMS table format.

Well, considering that most CAD programs (at least those I'm familiar 
with) structures its data in a very similar fashion as a RDBMS, AND 
given the advanced object/relational mapping tools we have today, how 
hard could it be?

The CAD system does not even have to be a straight client-server, but a 
three-tiered system where the application server do batch 
update/fetching of the data for efficiency.


Regards,
Baalbek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: referrers

2006-05-24 Thread raghu
Diez,

I did look into gc, specifically gc.get_referrers(), but it seemed to
give me something that I cant decipher.

I added the following line.

print "referrers ",gc.get_referrers(x0)

This is what I got.

referrers  [{'__builtins__': ,
'__file__': './tst1.py', 'pdb': , 'sys':
, 'y': 24012, 'gc': ,
'myfuncs': ,
'__name__': '__main__', 'x0': 24012, 'z': 24012, 'os': ,
'__doc__': None, 'types': },
(None, '/home/Raghavan/tst', 'my pid is ', 24012, 'ref count ',
'referrers ')]

Also the len of this is 2, while I got refcount=5. So I dont know
whether this can be used in the same way.

Thanks.

Bye,
Raghavan V

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Zameer
Unindent your first return statement. The return statement in putVar is
not needed.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using python for a CAD program

2006-05-24 Thread baalbek
David Cuthbert wrote:
> baalbek wrote:
> 
>> David Cuthbert wrote:
>>
>>> This does not mean the design itself should be stored as an RDBMS.  
>>> As I've stated previously, CAD data (both electrical and, it appears, 
>>> mechanical) does not lend itself to RDBMS relationship modeling.
>>
>>
>> I simply do not agree with this.
>>
>> A CAD program (like Autocad) is nothing
>> but an advanced database editor: the program loads data from a binary 
>> file and creates its object (in memory) from the tables that it reads 
>> from the file on the disk.
> 
> 
> Well, then, good luck with this.  Let us know when you've rediscovered 
> that simply structuring data in a table does not make an RDBMS.

Remember, a CAD binary file (at least most of them) stores its data in 
tables that are already in a (first?) normal form, similar to that of a 
RDBMS.

The CAD program parses the data, and the CAD objects are created by 
database joins between the different tables (one table for layers, one 
table for colors, one table for geometrical data of the CAD entities, 
etc etc).

I never said it would be easy, but remember, the O/R mapping of today is 
far ahead of what one had only 10 years ago.

Of course, I would not have the CAD client talk directly to the RDBMS, 
with constantly updating the database, but through a O/R layer 
(Hibernate is a good one for this) that the CAD client connects to 
(either through CORBA, ICE or similar), and have the application server 
do batch update/fetching of the data.

I think that those that shy away from a RDBMS CAD solution exaggerates 
the complexity of the CAD structure, and underestimates the technologies 
we have available today.

Regards,
Baalbek




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ian Wilson
[EMAIL PROTECTED] wrote:
> Xah Lee schreef:
>
>> > off-topic postings>

Which reminds me of
http://www.catb.org/~esr/faqs/smart-questions.html#not_losing

> We seem to have strayed a long way from Voltaire's
> "I do not agree with what you say, but I will defend to the death your
> right to say it.",

I don't think we have. Surely Voltaire didn't support speaking in 
inappropriate fora? He didn't support causing a public nuisance?

Would you lay down *your* life to defend Xah's "right" to wallpaper your 
street, your church, your school with printed essays about his personal 
obsessions?

In societies with a right to free speech, there are limits on where and 
how you may exercise that right. For example, you don't have a right to 
force any newspaper or TV station to publish your speech.

Xah's ISP can decide whether their terms of service provide Xah with a 
"right" to publish anything he wishes through their facilities 
regardless of established standards of appropriateness.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ftputil.py

2006-05-24 Thread Sheldon
Thanks!

Sheldon

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Alan
With apologies to Voltaire:
If Xah Lee did not exist, it would be necessary for John Bokma to
invent him.

Xah and Bokma are both idiots, they truly deserve each other.  The
sooner you killfile these two clowns, the happier you'll be.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to change sys.path?

2006-05-24 Thread Steve Holden
Ju Hui wrote:
> yes, we can change PYTHONPATH to add some path to sys.path value, but
> how to remove item from sys.path?
> 
That would be

del sys.path[3]

for example. Of course you may need to search sys.path to determine the 
exact element you need to delete, but sys.path is just like any other 
list in Python and can (as many people have already said in this thread) 
be manipulated just like al the others.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Love me, love my blog  http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: referrers

2006-05-24 Thread Diez B. Roggisch
raghu wrote:

> Diez,
> 
> I did look into gc, specifically gc.get_referrers(), but it seemed to
> give me something that I cant decipher.
> 
> I added the following line.
> 
> print "referrers ",gc.get_referrers(x0)
> 
> This is what I got.
> 
> referrers  [{'__builtins__': ,
> '__file__': './tst1.py', 'pdb':  '/home/raghavan/Python-2.4/my_install/lib/python2.4/pdb.pyc'>, 'sys':
> , 'y': 24012, 'gc': ,
> 'myfuncs': ,
> '__name__': '__main__', 'x0': 24012, 'z': 24012, 'os':  from '/home/raghavan/Python-2.4/my_install/lib/python2.4/os.pyc'>,
> '__doc__': None, 'types':  '/home/raghavan/Python-2.4/my_install/lib/python2.4/types.pyc'>},
> (None, '/home/Raghavan/tst', 'my pid is ', 24012, 'ref count ',
> 'referrers ')]
> 
> Also the len of this is 2, while I got refcount=5. So I dont know
> whether this can be used in the same way.

The refcount is always precise - as it is a simple integer that happens to
be part of every python object. But the 1:n-relation to its referres is
computed and not necessarily complete, as the docs state very clear.

Additionally, they state that this method is only to be used for
debugging-purposes. 

I'm not sure what you are after here - if it is about solving a mem-leak, gc
might help. If it is some application logic, the advice must be clearly to
explicitly model the object graph bi-directional.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread ilitzroth
I agree there are limits to you right to free speech, but I believe Xah
Lee is not crossing
any boundaries. If he starts taking over newspapers and TV stations be
sure to notify me,
I might revise my position. 
Immanuel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ant
> Surely Voltaire didn't support speaking in inappropriate fora?

Who knows? But the fora Xah posts to are few (5 or so?) and
appropriate. "Software needs Philosophers" wasn't even his rant, but
was certainly appropriate to all groups he posted to.

If you don't like Xah's posts, then don't read them. Killfile him or
whatever. But they *are* generally on-topic, they are not frequent,
they are not spam and they do seem to be intended to provoke discussion
rather than being simply trolls.

I have no particular affinity for Xah's views, but what does get up my
nose is usenet Nazism.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Alex Hunsley
Xah Lee wrote:
> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style, recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice last
> Friday.
> 
> I'm not sure I will be able to keep using their service, but I do hope
> so. 


> I do not like to post off-topic messages, 

You don't? Then who has been forcing you to post off-topic essays? A man 
with a gun?

> but this is newsgroup
> incidence is getting out of hand, and I wish people to know about it.

Nothing out of hand here. You are abusing usenet, and for once an ISP is 
doing something prompt about it. More power them.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Tim N. van der Leeuw

[EMAIL PROTECTED] wrote:
> I agree there are limits to you right to free speech, but I believe Xah
> Lee is not crossing
> any boundaries. If he starts taking over newspapers and TV stations be
> sure to notify me,
> I might revise my position.
> Immanuel

Perhaps he's not crossing boundaries of free speech, but he's
repeatedly crossing boundaries on usenet nettiquette, even though
repeatedly he's being asked not to do so. (Extensive crossposting to
various usenetgroups / mailing lists, for instance).

If he would just post his stuff on a blog and find a why to get people
to visit hist blog, without crossposting to 10 usenest groups for each
post he makes to his blog, then nobody would mind him expressing his
opinions, and those interested could discuss them wildly on the blog.

But I've repeatedly seen people telling him not to crosspost his essays
to so many newsgroups, yet he continues doing it.
If that's enough to quit his subscription with his ISP I don't know,
but since I've stopped following threads originated by him I don't know
what other grounds there would be.

Cheers,

--Tim

-- 
http://mail.python.org/mailman/listinfo/python-list


PEP 3102 for review and comment

2006-05-24 Thread molasses
I don't mind the naked star and will be happy if thats what we end up with.

Though how about using *None?
I think that makes the intention of the function clearer.

eg.
def compare(a, b, *None, key=None):

Which to me reads as "no further positional arguments".

Or alternatively:
def compare(a, b, *0, key=None):

-- Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PHP's openssl_sign() using M2Crypto?

2006-05-24 Thread KW
On 2006-05-23, [EMAIL PROTECTED] wrote:
> That is really strange, because PKey has had sign_init method since
> 2004. That code works for me (just tested). What version of M2Crypto
> are you using? I'd advice you upgrade to 0.15 if possible. See
>
> http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto

Great! I was using 0.13.1 from both Debian en Ubuntu and I thought no
further development was done on it..

It would be nice to get this version into Debian.

Best regards,
-- 
Konrad
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Xah's Edu Corner: Criticism vs Constructive Criticism

2006-05-24 Thread antroy
> 24. Learn when not to reply to a troll (and bother several groups while
>doing so).

25. Learn when not to reply to a reply to a troll (and bother several
groups while doing so).

This could go on and on... ;-)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple Version Install?

2006-05-24 Thread David C.Ullrich
On Fri, 05 May 2006 07:44:45 -0500, David C. Ullrich
<[EMAIL PROTECTED]> wrote:
[...]
>Just curious: How does pythonxx.dll determine things
>like where to find the standard library? That's the
>sort of thing I'd feared might cause confusion...

Ok, it was a stupid question, cuz right there in the
registry it says

Python/PythonCore/1.5/PYTHONPATH = whatever.

All I can say is the last few times I wondered about this
question I did search the registry for PYTHONPATH and
didn't find it. Maybe I spelled it wrong or somthing.






David C. Ullrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Timo Stamm
Tim N. van der Leeuw schrieb:
> [EMAIL PROTECTED] wrote:
>> I agree there are limits to you right to free speech, but I believe Xah
>> Lee is not crossing
>> any boundaries. If he starts taking over newspapers and TV stations be
>> sure to notify me,
>> I might revise my position.
>> Immanuel
> 
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so.

And repeatedly, others have encouraged him because they appreciate his 
posts.


> but since I've stopped following threads originated by him

That's all you need to do if you are not interested in his posts.


Timo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Roy Smith
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote:

> class Shared:
> def __init__(self):
> self.__userData= {}
> self.__mutex = threading.Lock() #lock object
> 
> def getVar(self, variableName):
> temp = None
> error = 0
> self.__mutex.acquire() #accessing shared dictionary
> try:
> try:
> temp = self.__userData[variableName]
> except:
> print "Variable doesn't exist in shared space"
> raise ValueError
> finally:
> self.__mutex.release()
> return temp

A few comments on this.

First, it's almost always a bad idea to have a bare "except:", because that 
catches *every* possible exception.  You want to catch as specific an 
exception as you can (in this case, I suspect that's KeyError).

Second, I'm not sure if your intent was to return from the function or to 
raise an exception on an unknown variableName.  You can't do both!  Quoting 
from http://docs.python.org/ref/try.html..

> When an exception occurs in the try clause, the exception is temporarily 
> saved, the finally clause is executed, and then the saved exception is 
> re-raised. If the finally clause raises another exception or executes a 
> return or break statement, the saved exception is lost.

so with the code you posted (from sight; I haven't tried running it), what 
will happen is:

1) __userData[variableName] raises KeyError

2) The KeyError is caught by the inner try block and the except block runs, 
which in turn raises ValueError

3) The ValueError is caught by the outer try block and the finally block 
runs, releasing the mutex, discarding the ValueError exception, and 
returning temp

4) Whoever called getVar() will see a normal return, with a return value of 
None (because that's what temp was set to in the first line of getVar()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Thomas Guettler
Am Tue, 23 May 2006 12:47:05 -0700 schrieb Carl J. Van Arsdall:

> Hey python people,
> 
> I'm interested in using the try/finally clause to ensure graceful 
> cleanup regardless of how a block of code exits.  However, I still am 
> interested in capturing the exception.

You can reraise the exception:

try:
something()
except:
cleanup()
raise # reraise the caught exception

-- 
Thomas Güttler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: [EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NEWB: how to convert a string to dict (dictionary)

2006-05-24 Thread Kent Johnson
manstey wrote:
> Hi,
> 
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
> 
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}

Try this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Roy Smith
In article <[EMAIL PROTECTED]>,
 "Maxim Sloyko" <[EMAIL PROTECTED]> wrote:

> I guess the following standard method will help :
> 
> class MyLocker(object):
> def __init__(self, lock):
>   self.lock = lock
>   self.lock.acquire()
> 
> def __del__(self):
> self.lock.release()
> 
> Then whenever you need to acquire a lock:
> templock = MyLocker(self.__mutex)
> 
> del templock # will release the lock (provided you didn't create an
> extra link to this object)

Warning!  Danger, Will Robinson!  Evil space aliens are trying to write C++ 
in Python!  Quick, we must get back to the ship before they eat our brains!

The problem here is that there is no guarantee that __del__() will get 
called at any predictable time (if at all).  C++ uses deterministic object 
destruction.  Python doesn't destroy (finalize?) objects until the garbage 
collector runs.

See PEP-343 (http://www.python.org/dev/peps/pep-0343/) for the new "with" 
statement which should solve problems like this.  If I understand things 
right, "with" will be included in Python-2.5, which is due out Real Soon 
Now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Programming Books?

2006-05-24 Thread herraotic
I have been getting ready to learn programming for a long time,
installed a GNU/Linux operating system, learnt the ins and outs but I
think it is time to pick up a book and learn to now program.

I have never actually programmed before only dabbed into XHTML so do
take it in mind that I need a book that could slowly progress me into
the fundamentals of programming.
I chose Python as my first programming language from hearing the praise
it got for elegant design and mainly the managment of the excessive
underlingy pins of machine resources and for it to teach you the
creative parts.

So now i'm hear to use all of your collective expertise for the ideal
book for a beginning programming who want's to start with python.

Your help is greatly appreciated.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread Rony Steelandt
1.Python for Dummies
 Maruch Stef;Maruch Aahz - Hungry Minds Inc,U.S. - 408 pages - 08 2006

2.Programming Python
 Lutz Mark - O Reilly - 1256 pages - 07 2006

3.Core Python Programming
 Chun Wesley J - Peachpit Press - 07 2006

4.Python
 Fehily Chris - Peachpit Press - 05 2006

5.Python Essential Reference
 Beazley David - Sams - 03 2006

6.Python Power!
 Thomson Course Technology Ptr Development - Course Technology Ptr - 03 
2006

7.The Book of Python
 Goebel J - No Starch Press - 1200 pages - 03 2006

8.Python Scripting for Computational Science
 Langtangen Hans P. - Springer-Verlag Berlin and Heidelberg GmbH & Co. 
K - 750 pages - 12 2005

9.WxPython in Action
 Rappin Noel;Dunn Robin - O Reilly USA - 12 2005

10.Python Programming for Gaming
 Dawson R. - Course Technology - 11 2005


11.Python Programming for the Absolute Beginner
 Dawson Michael - Premier Press - 10 2005

> I have been getting ready to learn programming for a long time,
> installed a GNU/Linux operating system, learnt the ins and outs but I
> think it is time to pick up a book and learn to now program.
>
> I have never actually programmed before only dabbed into XHTML so do
> take it in mind that I need a book that could slowly progress me into
> the fundamentals of programming.
> I chose Python as my first programming language from hearing the praise
> it got for elegant design and mainly the managment of the excessive
> underlingy pins of machine resources and for it to teach you the
> creative parts.
>
> So now i'm hear to use all of your collective expertise for the ideal
> book for a beginning programming who want's to start with python.
>
> Your help is greatly appreciated.


-- 
---
Rony Steelandt
BuCodi
rony dot steelandt (at) bucodi dot com

Visit the python blog at http://360.yahoo.com/bucodi


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NEWB: how to convert a string to dict (dictionary)

2006-05-24 Thread vbgunz
I am sure something much more elaborate will show it's face but this I
made in about 10 minutes. Didn't do much testing on it but it certainly
does convert your string modeled after a dictionary into a real
dictionary. You might wish to check against more variations and
possibilities and tweak and learn till your heart is content...

def stringDict(stringdictionary):
''' alpha! convert a string dictionary to a real dictionary.'''
x = str(stringdictionary[1:-1].split(':'))
res = {}
for index, keyval in enumerate(x.split(',')):
if index == 0:
keyval = keyval[2:]
if index % 2 == 0:
y = keyval.lstrip(" '").rstrip("'\" ")
res[y] = None
else:
z = keyval.lstrip(" \" '").rstrip("'")
res[y] = z

res[y] = z[:-2]
print res  # {'syllable': "u'cv-i b.v^ y^-f", 'ketiv-qere': 'n',
'wordWTS': "u'8'"}


sd = "{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS':
u'8'}"
stringDict(sd)

keep in mind the above code will ultimately return every value as a
substring of the main string fed in so may not be very helpful when
trying to save int's or identifiers. None the less, I hope it is useful
to some degree :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread bruno at modulix
Carl J. Van Arsdall wrote:
(snip)

Not an answer to your question, just a few comments on your code:

> class Shared:

class Shared(object):


>def __init__(self):
>self.__userData= {}
>self.__mutex = threading.Lock() #lock object

Don't use __names unless you have a *really* strong reason to do so.
'protected' attributes are usually noted as _name.

>def getVar(self, variableName):
>temp = None
>error = 0
>self.__mutex.acquire() #accessing shared dictionary
>try:
>try:
>temp = self.__userData[variableName]
>except:

Don't use bare except clauses. Specify the exceptions you intend to
handle, let the other propagate.

I once spent many hours trying to debug a badly written module that has
such a catch-all clause with a misleading error message saying some file
could not be opened when the actual problem was with a wrong login/pass
for a connection.

>print "Variable doesn't exist in shared
> space"

stdout is for normal program outputs. Error messages should go to stderr.

>raise ValueError

Should be a LookupError subclass. And the message should go with the
exception:
  raise MyLookupErrorSubclass("Variable '%s' doesn't exist in shared
space" % variableName)


>finally:
>self.__mutex.release()
>return temp
> 
>def putVar(self, variableName, value):
>self.__mutex.acquire() #accessing shared dictionary
>try:
>self.__userData[variableName] = value
>finally:
>self.__mutex.release()
>return

The return statement is useless here.

My 2 cents.
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread vbgunz
Learning Python by Mark Lutz will be the most perfect book to get you
started! Perhaps there are others aimed at the non-programmer but after
getting through that book (2 times) I finally left it with wings... It
is a great book for the n00b in my humble opinion. After that, you'll
pretty much start flying higher on your own as long as you always keep
the python docs handy along with the addresses to comp.lang.python and
it's IRC channel #python on irc.freenode.net...

Good luck, welcome to Python!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread herraotic
Thanks, if you don't mind could I have a small personal
description on the quality of the books (pros, cons).

I also am interested if anyone has used "Python Programming: An
Introduction to Computer Science" and if I could be given a detailes
evaluation about it.

Thanks again.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ben Bullock
"Xah Lee" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> If you believe this lobbying to my webhosting provider is unjust,
> please write to my web hosting provider [EMAIL PROTECTED]

Why don't you just change your provider? It would take less time than this. 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread herraotic
Thanks vbgunz that was the reply I was looking for!
Do you think it is wise to hold back for a 3rd edition?

My 1:47 pm message was a reply to Rony Steelandt.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread bruno at modulix
[EMAIL PROTECTED] wrote:
(snip)

> So now i'm hear to use all of your collective expertise for the ideal
> book for a beginning programming who want's to start with python.

'ideal' greatly depends on the reader !-)

But FWIW, this is a FAQ (well : 2):
http://www.python.org/doc/faq/general/#i-ve-never-programmed-before-is-there-a-python-tutorial
http://www.python.org/doc/faq/general/#are-there-any-books-on-python

And you may get good answers here:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

and by googling this ng (someone asked the same question yesterday...).

HTH
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Python keywords vs. English grammar

2006-05-24 Thread Roy Smith
I noticed something interesting today.  In C++, you write:

try {
   throw foo;
} catch {
}

and all three keywords are verbs, so when you describe the code, you can 
use the same English words as in the program source, "You try to execute 
some code, but it throws a foo, which is caught by the handler".

In Python, you write:

try:
   raise foo
except:

and now you've got a mix of verbs and (I think), a preposition.  You can't 
say, "You try to execute some code, but it raises a foo, which is excepted 
by the handler".  It just doesn't work grammatically.

Sigh.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread Rony Steelandt
Since I'm a professional developper,I don't think that my personnal 
view on those books would be of any use to you. I actually have no idea 
how to start Python if you're not a developper, I know it is possible 
since quit a lot of matimatical engineers use it.

But I'm sure some people here will give you good advise.

> Thanks, if you don't mind could I have a small personal
> description on the quality of the books (pros, cons).
>
> I also am interested if anyone has used "Python Programming: An
> Introduction to Computer Science" and if I could be given a detailes
> evaluation about it.
>
> Thanks again.


-- 
---
Rony Steelandt
BuCodi
rony dot steelandt (at) bucodi dot com

Visit the python blog at http://360.yahoo.com/bucodi


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python keywords vs. English grammar

2006-05-24 Thread Rony Steelandt
I'm not a english speaker, so I just accepted it...;

I understood it as :
'Try' allways to execute this code, 'except' when it doesn't work do 
this


> I noticed something interesting today.  In C++, you write:
>
> try {
>throw foo;
> } catch {
> }
>
> and all three keywords are verbs, so when you describe the code, you can 
> use the same English words as in the program source, "You try to execute 
> some code, but it throws a foo, which is caught by the handler".
>
> In Python, you write:
>
> try:
>raise foo
> except:
>
> and now you've got a mix of verbs and (I think), a preposition.  You can't 
> say, "You try to execute some code, but it raises a foo, which is excepted 
> by the handler".  It just doesn't work grammatically.
>
> Sigh.


-- 
---
Rony Steelandt
BuCodi
rony dot steelandt (at) bucodi dot com

Visit the python blog at http://360.yahoo.com/bucodi


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with writing a simple module

2006-05-24 Thread nephish
cool, thanks, i was running on some thinner examples i found on the
net.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to open https Site and pass request?

2006-05-24 Thread Nico Grubert
> That depends on your OS.  In Windows, I believe you would have to
> recompile Python from source.  On Linux, you could probably just get a
> package.  From Debian, I know that it's python-ssl.  I'm sure most the
> others would have one as well.

Hi Jerry,

thank you for your reply. I use Linux and installed the package 
"python-openssl" which allows me to import the module "OpenSSL"
(import OpenSSL) but I think installing this package has nothing to do 
with the SSL support of my python installation. Is that true?

Regards,
Nico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python keywords vs. English grammar

2006-05-24 Thread Duncan Smith
Roy Smith wrote:
> I noticed something interesting today.  In C++, you write:
> 
> try {
>throw foo;
> } catch {
> }
> 
> and all three keywords are verbs, so when you describe the code, you can 
> use the same English words as in the program source, "You try to execute 
> some code, but it throws a foo, which is caught by the handler".
> 
> In Python, you write:
> 
> try:
>raise foo
> except:
> 
> and now you've got a mix of verbs and (I think), a preposition.  You can't 
> say, "You try to execute some code, but it raises a foo, which is excepted 
> by the handler".  It just doesn't work grammatically.
> 
> Sigh.

It does, but it's maybe not 'plain English'.

http://dictionary.reference.com/search?q=except

Duncan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread olsongt

Tim N. van der Leeuw wrote:
> [EMAIL PROTECTED] wrote:
> > I agree there are limits to you right to free speech, but I believe Xah
> > Lee is not crossing
> > any boundaries. If he starts taking over newspapers and TV stations be
> > sure to notify me,
> > I might revise my position.
> > Immanuel
>
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so. (Extensive crossposting to
> various usenetgroups / mailing lists, for instance).
>
> If he would just post his stuff on a blog and find a why to get people
> to visit hist blog, without crossposting to 10 usenest groups for each
> post he makes to his blog, then nobody would mind him expressing his
> opinions, and those interested could discuss them wildly on the blog.
>
> But I've repeatedly seen people telling him not to crosspost his essays
> to so many newsgroups, yet he continues doing it.
> If that's enough to quit his subscription with his ISP I don't know,
> but since I've stopped following threads originated by him I don't know
> what other grounds there would be.
>
> Cheers,
>
> --Tim

The trouble is there's no definitive definition of 'nettiquette' (and
no the RFC on nettiquette doesn't count).  Should people get kicked off
of thier ISP for top posting? What about not asking 'smart' questions
as defined by Eric Raymond?

In addition, the people telling him not to cross-post don't really have
any authority.  They're just random people on the internet.  For
example, you've cross posted to several groups.  I'm telling you to
stop.  Of course I'm doing the same thing and you can feel free to
ignore me.  I'm not the Supreme Master of comp.lang.python.

But I think you would agree that it would be harrassment if I went to
your ISP- nl.unisys.com - and said that you were abusing the internet
and 'spamming' the usenet, especially if you are a unisys employee (not
sure if they're a service provider over there, but I'm guessing not).
If I got a hold of the wrong person on the wrong day, you could lose
your job.

Xah is an crackpot, but he doesn't spam or mailbomb groups.  And
besides, what fun would the usenet be without crackpots?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getattr for modules not classes

2006-05-24 Thread Piet van Oostrum
> Heiko Wundram <[EMAIL PROTECTED]> (HW) wrote:

>HW> y.py
>HW> ---
>HW> from x import test
>HW> print test.one
>HW> print test.two
>HW> print test.three
>HW> ---

Or even:
import x
x = x.test
print x.one
print x.two
print x.three

-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Access C++, Java APIs from Python..

2006-05-24 Thread [EMAIL PROTECTED]
check out the pywin32 extension by Mark Hammond

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread Brian

[EMAIL PROTECTED] wrote:
> Thanks, if you don't mind could I have a small personal
> description on the quality of the books (pros, cons).
>
> I also am interested if anyone has used "Python Programming: An
> Introduction to Computer Science" and if I could be given a detailes
> evaluation about it.
>

I have a copy of this book on my shelf.  I think it may be a good
choice since you are new to programming.  One thing to keep in mind is
that is it a Computer Science book that uses Python to teach CS.  As a
result, you do not get too deep into the language.

One book that I think you should definitely look at is Beginning Python
from Novice to Professional.  I think that it is one of the best books
out there on the subject, is an easy read, has clear and concise
examples, and does a great job of explaining the whys without making
you think you are reading a PhD thesis.

On a final note, I think that Python Essential Reference is a good
reference book on the language.

One thing you might want to look at is Safari Bookshelf by O'Reilly
http://safari.oreilly.com/ .  They have all of their books online for
your to read.  It costs $14/month, but you get a 2 week free trial to
decide if you want it.  You can even download whole chapters as pdf's.
In my mind it is a great place to test drive a book, or to have one
that you only need to see one or two things in.

HTH,
Brian

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread SamFeltus
I was considering opening an account with Dreamhost.  Can't say I agree
with all of Xah's writings, but they often raise important points.
Dreamhost is a company I will never spend money with.  Usenet is full
of narrow minded group thinking that needs to be questioned.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to find out a date/time difference

2006-05-24 Thread Lad
I use  datetime class in my program and now
I have two fields that have the datetime format like this
datetime.datetime(2006, 5, 24, 16, 1, 26)

How can I find out the date/time difference ( in days) of such two
fields?


Thank you for help?
L

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread George Sakkis
Alan wrote:

> With apologies to Voltaire:
> If Xah Lee did not exist, it would be necessary for John Bokma to
> invent him.
>
> Xah and Bokma are both idiots, they truly deserve each other.  The
> sooner you killfile these two clowns, the happier you'll be.

Well said, I couldn't put it better.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Eli Gottlieb
Tim N. van der Leeuw wrote:
> [EMAIL PROTECTED] wrote:
> 
>>I agree there are limits to you right to free speech, but I believe Xah
>>Lee is not crossing
>>any boundaries. If he starts taking over newspapers and TV stations be
>>sure to notify me,
>>I might revise my position.
>>Immanuel
> 
> 
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so. (Extensive crossposting to
> various usenetgroups / mailing lists, for instance).
> 
> If he would just post his stuff on a blog and find a why to get people
> to visit hist blog, without crossposting to 10 usenest groups for each
> post he makes to his blog, then nobody would mind him expressing his
> opinions, and those interested could discuss them wildly on the blog.
> 
> But I've repeatedly seen people telling him not to crosspost his essays
> to so many newsgroups, yet he continues doing it.
> If that's enough to quit his subscription with his ISP I don't know,
> but since I've stopped following threads originated by him I don't know
> what other grounds there would be.
> 
> Cheers,
> 
> --Tim
> 
Who reads blogs?  They're well known for housing crackpots far worse 
than Xah, and I estimate he doesn't want to associate himself with that 
sort.

-- 
The science of economics is the cleverest proof of free will yet 
constructed.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ken Tilton


Tim N. van der Leeuw wrote:
> [EMAIL PROTECTED] wrote:
> 
>>I agree there are limits to you right to free speech, but I believe Xah
>>Lee is not crossing
>>any boundaries. If he starts taking over newspapers and TV stations be
>>sure to notify me,
>>I might revise my position.
>>Immanuel
> 
> 
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so. 

This would be a more compelling argument if people on newsgroups 
everywhere did not regularly carry on the most inane threads, often 
off-topic to begin with, but mostly threads that stray from something 
relevant to the NG to , ending only when 
Hitler is reached.

And I am talking about NG regulars who really do usually talk about 
stuff specific to the NG. Those are the worst spammers of c.l.l, anyway.

Xah's stuff, as wild as it is, is at least technical, and it is only an 
article here and an article there.

John Bokma on the other hand well, I have to go write to the dorks 
at dreamhost now.

kenny
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: graphs and charts

2006-05-24 Thread Bryan
Terry Hancock wrote:
> Yaron Butterfield wrote:
>>  What's the best way to on-the-fly graphs and charts using Python? Or
>>  is Python not really the best way to do this?
> 
> I quite enjoyed using Biggles for this:
> 
> http://biggles.sf.net
> 
> There are many different choices, though.
> 
> Cheers,
> Terry
> 

Terry Hancock wrote:
 > Yaron Butterfield wrote:
 >>  What's the best way to on-the-fly graphs and charts using Python? Or
 >>  is Python not really the best way to do this?
 >
 > I quite enjoyed using Biggles for this:
 >
 > http://biggles.sf.net
 >
 > There are many different choices, though.
 >
 > Cheers,
 > Terry
 >

hi terry,

this is the first time i've heard of biggles.  it looks really nice and simple 
to use?  and i especially like your use of gradients in example 9.  does 
biggles 
integrate well wxPython?  if so, do you have an example of how to add it to a 
wxPython panel?

thanks,

bryan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to find out a date/time difference

2006-05-24 Thread SaskMan
Convert datetime.datetime(2006, 5, 24, 16, 1, 26) to an ordinal number
like:
datetime.datetime(2006, 5, 24, 16, 1, 26).toordinal()
and subtract them to get number of days.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Ken Tilton


Ben Bullock wrote:
> "Xah Lee" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> 
>> If you believe this lobbying to my webhosting provider is unjust,
>> please write to my web hosting provider [EMAIL PROTECTED]
> 
> 
> Why don't you just change your provider? It would take less time than this.

Are you joking. "Just change your provider?" Do you have a little button 
on your computer that says "Change provider"? Cool! :)

C'mon, John Bokma (and everyone else dumb enough to crosspost their 
shushing to every group on the crosspost list -- why do they do that? So 
Xah will hear them six times? No, they want everyone to see how witty 
they are when they tell Xah off. Now /that/ is spam) is the problem.

kenny

-- 
Cells: http://common-lisp.net/project/cells/

"Have you ever been in a relationship?"
Attorney for Mary Winkler, confessed killer of her
minister husband, when asked if the couple had
marital problems.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to find out a date/time difference

2006-05-24 Thread Klaus Alexander Seistrup
Lad skrev:

> How can I find out the date/time difference ( in days) of such 
> two fields?

Did you try to subtract one value from the other?

Mvh, 

-- 
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to find out a date/time difference

2006-05-24 Thread Nico Grubert


 > I use  datetime class in my program and now
 > I have two fields that have the datetime format like this
 > datetime.datetime(2006, 5, 24, 16, 1, 26)

 > How can I find out the date/time difference ( in days) of such two
 > fields?

Hi Lad,

you could do this:

 >>> a = datetime.datetime(2006, 5, 24, 16, 1, 26)
 >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26)
 >>> a-b
datetime.timedelta(4)
# 4 days

 >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26)
 >>> x = a-b
 >>> x
datetime.timedelta(4, 14400)
 >>> str(x)
'4 days, 4:00:00'


Regards,
Nico
-- 
http://mail.python.org/mailman/listinfo/python-list


Scipy: vectorized function does not take scalars as arguments

2006-05-24 Thread ago
Once I vectorize a function it does not acccept scalars anymore. Es

def f(x): return x*2
vf = vectorize(f)
print vf(2)

AttributeError: 'int' object has no attribute 'astype'

Is this the intended behaviour?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dict literals vs dict(**kwds)

2006-05-24 Thread George Sakkis
bruno at modulix wrote:

> When all your keys are valid Python identifiers, and you may want to use
> another dict-like instead of the builtin dict. It's easy to replace the
> dict() factory in a function, class, or whole module :
>
> class MyDict(...):
>   # dict-like class
>
> dict = MyDict
>
> then all following calls to dict(**kw) in this namespace will use MyDict
> instead of the builtin's one. Can't do that with dict litterals.

Hm, as far as I know shadowing the builtins is discouraged. This is not
the same as duck typing, when you may define a function like

def foo(dict_like_class):
return dict_like_class(x=1,y=2).iteritems()

and call it as foo(MyDict)

In either case, I would guess that for the vast majority of cases the
builtin dicts are just fine and  there's no compelling reason for
dict(**kwds). Perhaps it's something that should be reconsidered for
Py3K.

George

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Zameer
Doing cleaup in except is not the Python way. This is what finally is
for. Using except you would have to at least say:

try:
stuff()
cleanup()
except:
cleanup()
raise

Duplicate code - not nice. finally is the Python way:

try:
stuff()
finally:
cleanup()

That's it. But the return statement should not be a part of finally if
you want exceptions to propagate out of the function containing
try/finally. As mentioned multiple times in the thread.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Mitch
[EMAIL PROTECTED] wrote:
> Xah Lee schreef:
> 
[...]
>>
>> If you believe this lobbying to my webhosting provider is unjust,
>> please write to my web hosting provider [EMAIL PROTECTED]
>>
>> Your help is appreciated. Thank you.
>>
>>Xah
>>[EMAIL PROTECTED]
>>  ∑ http://xahlee.org/
> 
> We seem to have strayed a long way from Voltaire's
> "I do not agree with what you say, but I will defend to the death your
> right to say it.",
> but that was of course the age of enlightenment.
> Immanuel
> 

I would have to say +1 for Voltaire.  Xah has as much right to post to 
the newsgroups as I do to skip over them.  One of the reasons I enjoy 
lurking on newsgroups is the passion with which a lot of you speak; 
however, I do think there are a lot of short tempers flying around. 
Perhaps its because you've been putting up with this guy a lot longer 
than I have, but I can't imagine it takes that much effort to 
skip/block/kill file his posts.  It's his as much as anyone else's, and 
all the while this is an unmoderated medium he has the *right* to say as 
he pleases.


That said, if the ISP is kicking you off, it should be because you have 
broken a TOC.  IF you don't think that that is the case, then that is 
your beef with them.

Secondarily, all these essays end up on your site anyway, so why post 
the whole thing /again/ on the newsgroups when you could just link to 
the page, perhaps with a brief summary.  Will that not

A) still allow you to advertise the essays

B) Save resources rather than copying everything twice

and

C) Piss less people off?

I'm sure you aren't worried about pissing people off, but when it 
results in you getting kicked from your ISP, this just seems so much 
more sensible an answer.

My 2 cents.

P.S.
The Universal Declaration of Human Rights (Summary) says:


Article 19.

   Everyone has the right to freedom of opinion and expression; this 
right includes freedom to hold opinions without interference and to 
seek, receive and impart information and ideas through any media and 
regardless of frontiers.

http://www.un.org/Overview/rights.html

This debate boils down to whether or not he has broken the ISP's TOCs, 
nothing more.
-- 
http://mail.python.org/mailman/listinfo/python-list

linking errors with debug build of Python2.4.3

2006-05-24 Thread Martin Wiechert
Hi list,

I've created a fresh build of Python 2.4.3 using the following configuration

$ ./configure --with-pydebug --prefix=/usr/local/debug --enable-shared 
--with-fpectl --with-signal-module

in particular I used --with-pydebug.

Now when I start the interpreter some dynamically loaded modules do not see 
debug-related symbols:

$ /usr/local/debug/bin/python
Python 2.4.3 (#1, May 12 2006, 05:35:54)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in ?
import readline
ImportError: /usr/local/debug/lib/python2.4/lib-dynload/readline.so: undefined 
symbol: _Py_RefTotal
>>>

I've attached a shell session with the outputs of ldd and nm on readline.so

What did I do wrong?
My System is SuSE Linux 10.1 on Intel.

Any help would be much appreciated.

Thanks, Martin.
[EMAIL PROTECTED]:~> ldd /usr/local/debug/lib/python2.4/lib-dynload/readline.so
linux-gate.so.1 =>  (0xe000)
libreadline.so.5 => /lib/libreadline.so.5 (0xb7edd000)
libncursesw.so.5 => /usr/lib/libncursesw.so.5 (0xb7e9)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7e7c000)
libc.so.6 => /lib/libc.so.6 (0xb7d5c000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb7d14000)
libdl.so.2 => /lib/libdl.so.2 (0xb7d1)
/lib/ld-linux.so.2 (0x8000)
[EMAIL PROTECTED]:~> nm /usr/local/debug/lib/python2.4/lib-dynload/readline.so
 U add_history
4e68 b begidx
4e30 A __bss_start
1780 t call_gmon_start
2bb7 t call_readline
 U clear_history
4e40 b completed.5751
4e64 b completer
 U completion_matches
4004 d __CTOR_END__
4000 d __CTOR_LIST__
 w __cxa_finalize@@GLIBC_2.1.3
4840 d doc_add_history
4b60 d doc_clear_history
4640 d doc_get_begidx
49e0 d doc_get_completer
4880 d doc_get_completer_delims
4aa0 d doc_get_current_history_length
46a0 d doc_get_endidx
4a40 d doc_get_history_item
4b00 d doc_get_line_buffer
4ba0 d doc_insert_text
4c60 d doc_module
4260 d doc_parse_and_bind
4340 d doc_read_history_file
42c0 d doc_read_init_file
4be0 d doc_redisplay
4760 d doc_remove_history
47c0 d doc_replace_history
48e0 d doc_set_completer
4700 d doc_set_completer_delims
4580 d doc_set_startup_hook
43c0 d doc_write_history_file
2e10 t __do_global_ctors_aux
17b0 t __do_global_dtors_aux
4240 d __dso_handle
400c d __DTOR_END__
4008 d __DTOR_LIST__
4014 a _DYNAMIC
4e30 A _edata
 U emacs_meta_keymap
4f1c A _end
4e6c b endidx
 U __errno_location@@GLIBC_2.0
2e44 T _fini
286e t flex_complete
1810 t frame_dummy
31ac r __FRAME_END__
 U free@@GLIBC_2.0
1e6a t get_begidx
22a1 t get_completer
2242 t get_completer_delims
23c1 t get_current_history_length
1ea2 t get_endidx
231f t get_history_item
1bf3 t get_history_length
4500 d get_history_length_doc
2404 t get_line_buffer
4148 a _GLOBAL_OFFSET_TABLE_
 w __gmon_start__
 U history_get
 U history_get_history_state
433c d _history_length
 U history_truncate_file
1847 t __i686.get_pc_thunk.bx
2e09 t __i686.get_pc_thunk.cx
13e8 T _init
2da9 T initreadline
2477 t insert_text
4e80 b jbuf
4010 d __JCR_END__
4010 d __JCR_LIST__
 w _Jv_RegisterClasses
 U longjmp@@GLIBC_2.0
 U malloc@@GLIBC_2.0
26d7 t on_completion
2542 t on_hook
2ad8 t onintr
26b1 t on_startup_hook
4244 d p.5749
184c t parse_and_bind
21c2 t py_add_history
 U PyArg_ParseTuple
 U PyCallable_Check
242c t py_clear_history
 U _Py_Dealloc
 U PyErr_Clear
 U PyErr_Format
 U PyErr_NoMemory
 U PyErr_Occurred
 U PyErr_SetFromErrno
 U PyErr_SetString
 U PyExc_IOError
 U PyExc_TypeError
 U PyExc_ValueError
 U Py_FatalError
 U PyGILState_Ensure
 U PyGILState_Release
 U Py_InitModule4TraceRefs
 U PyInt_AsLong
 U PyInt_FromLong
 U PyMem_Malloc
 U _Py_NegativeRefcount
 U _Py_NoneStruct
 U PyObject_CallFunction
 U PyOS_InputHook
 U PyOS_ReadlineFunctionPointer
 U PyOS_setsig
 U PyOS_snprintf
 U _Py_RefTotal
1f74 t py_remove_history
2090 t py_replace_history
 U PyString_AsString
 U PyString_FromString
 U read_history
19db t read_history_file
1929 t read_init_file
 U readline
4cc0 d readline_methods
2b00 t readline_until_enter_or_signal
24f7 t redisplay
 U remove_history
 U replace_history_entry
 U rl_attempted_completion_function
 U rl_attempted_completion_over
 U rl_bind_key
 U rl_bind_key_in_map
 U rl

Re: how to change sys.path?

2006-05-24 Thread John Salerno
Dennis Lee Bieber wrote:
> On Tue, 23 May 2006 20:21:10 GMT, John Salerno
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
> 
>> I meant actually adding the PYTHONPATH variable to the environment 
>> variables list.
> 
>   You're looking at editing the Windows registry for that...

I just right-clicked on My Computer --> Properties --> Advanced --> 
Environment Variables, and added a new one called PYTHONPATH. I don't 
know if that edits the registry, but you don't *manually* have to edit 
the registry if you do it that way...unless of course you aren't 
supposed to be doing it that way! But it worked anyway. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread John Salerno
vbgunz wrote:
> Learning Python by Mark Lutz will be the most perfect book to get you
> started! Perhaps there are others aimed at the non-programmer but after
> getting through that book (2 times) I finally left it with wings... It
> is a great book for the n00b in my humble opinion. After that, you'll
> pretty much start flying higher on your own as long as you always keep
> the python docs handy along with the addresses to comp.lang.python and
> it's IRC channel #python on irc.freenode.net...
> 
> Good luck, welcome to Python!
> 

I second this opinion completely. Use this book to start with! It is a 
wonderful intro to the language and will give you a solid foundation.

As for waiting for a 3rd edition, don't do it! If you're like me, you'll 
want the latest there is, so I was tempted to start with something newer 
too (since this book covers up to 2.2), but honestly it covers 
everything you need to know. There are maybe two or three new additions 
that you can read about elsewhere, but Learning Python is THE book to 
start with, IMO.

Get it now! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread John Salerno
Brian wrote:

> One book that I think you should definitely look at is Beginning Python
> from Novice to Professional.  I think that it is one of the best books
> out there on the subject, is an easy read, has clear and concise
> examples, and does a great job of explaining the whys without making
> you think you are reading a PhD thesis.

I disagree, and I'm surprised so many people think this book is that 
great. I found it to be way too cursory of an introduction to the 
language. Fortunately I had already read Learning Python, so Beginning 
Python made sense to me, but even still, as I was reading it I kept 
saying to myself "I know this passage here, or this sentence there, 
would make no sense to me if I didn't already understand it from LP." 
Beginning Python does not do a good job of explaining how Python works, 
it only introduces all the parts of it, rather too quickly, IMO, for 
someone just learning the language.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread John Salerno
[EMAIL PROTECTED] wrote:
> Thanks, if you don't mind could I have a small personal
> description on the quality of the books (pros, cons).
> 
> I also am interested if anyone has used "Python Programming: An
> Introduction to Computer Science" and if I could be given a detailes
> evaluation about it.
>

I'm actually getting this book in the mail today. I'll let you know what 
I think of it if you're interested, but I say don't wait, go buy 
Learning Python (2nd ed.) now!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread bradb

> C'mon, John Bokma (and everyone else dumb enough to crosspost their
> shushing to every group on the crosspost list -- why do they do that? So
> Xah will hear them six times? No, they want everyone to see how witty
> they are when they tell Xah off. Now /that/ is spam) is the problem.
>
> kenny

I agree.  It is not Xah who is the problem, but the 200 replies to him
telling him to go away.  Look at Xah's posting to replies ratio, it is
enormous - Xah is the ultimate troll and everything he posts turns into
huge threads.  At c.l.l at least his threads are almost certainly the
longest by far.
The answer is easy, don't respond to his posts.

Cheers
Brad

(sigh, now I am one of the crossposting Xah repliers)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Claudio Grondi
Tim N. van der Leeuw wrote:
> [EMAIL PROTECTED] wrote:
> 
>>I agree there are limits to you right to free speech, but I believe Xah
>>Lee is not crossing
>>any boundaries. If he starts taking over newspapers and TV stations be
>>sure to notify me,
>>I might revise my position.
>>Immanuel
> 
> 
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so. (Extensive crossposting to
> various usenetgroups / mailing lists, for instance).
> 
> If he would just post his stuff on a blog and find a way to get people
> to visit his blog, without crossposting to 10 usenest groups for each
> post he makes to his blog, then nobody would mind him expressing his
> opinions, and those interested could discuss them wildly on the blog.
> 
> But I've repeatedly seen people telling him not to crosspost his essays
> to so many newsgroups, yet he continues doing it.
> If that's enough to quit his subscription with his ISP I don't know,
> but since I've stopped following threads originated by him I don't know
> what other grounds there would be.
> 
> Cheers,
> 
> --Tim
> 
Well said, Tim.

Claudio
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
fup to poster

"Xah Lee" <[EMAIL PROTECTED]> wrote:

> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style,

You're mistaken. Not that I or many other people with some brains had 
expected anything else. The problem is that you crosspost to 5 groups (5, 
which I am sure is a limitation Google Groups set to you, and has nothing 
to do with you respecting Usenet a bit) for the sole purpose of 
spamvertizing your website.

> recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice last
> Friday.

Which shows that your actions are frowned upon by others, for good 
reasons. Of course you are going in cry baby mode now.

> I'm not sure I will be able to keep using their service, but I do hope
> so. I do not like to post off-topic messages,

Liar. 

> but this is newsgroup
> incidence is getting out of hand, and I wish people to know about it.
> 
> I wrote some full detail here:
> http://xahlee.org/Periodic_dosage_dir/t2/harassment.html

You mean your brain farted again some bullshit.

> If you believe this lobbying to my webhosting provider is unjust,
> please write to my web hosting provider [EMAIL PROTECTED]

dreamhost has made a decission, a right one IMO. And now you ask people to 
harass them more?

You really are just a pathetic little shit now aren't you?

Not even the balls nor the guts to fix the issue that you are.

-- 
John Bokma  Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
"Dag Sunde" <[EMAIL PROTECTED]> wrote:

> "Xah Lee" <[EMAIL PROTECTED]> skrev i melding 
> news:[EMAIL PROTECTED]
>> I'm sorry to trouble everyone. But as you might know, due to my
>> controversial writings and style, recently John Bokma lobbied people to
>> complaint to my web hosting provider. After exchanging a few emails, my
>> web hosting provider sent me a 30-day account cancellation notice last
>> Friday.
> 
> The solution to your problem is very simple:
> 
> Stop posting your "controversial writings and style" to public
> newgroups, and keep them on your web-server where they belong.

Or post them to one, and just one, relevant news group instead of 
spamvertizing your site with a hit & run post in 5 (which is a Google 
Groups limit, if it was 10, Xah would use 10)

-- 
John Bokma  Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python keywords vs. English grammar

2006-05-24 Thread John Salerno
Roy Smith wrote:

> try {
>throw foo;
> } catch {
> }

> try:
>raise foo
> except:

But which one is prettier? ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
Ken Tilton <[EMAIL PROTECTED]> wrote:

> Ben Bullock wrote:
>> "Xah Lee" <[EMAIL PROTECTED]> wrote in message 
>> news:[EMAIL PROTECTED]
>> 
>>> If you believe this lobbying to my webhosting provider is unjust,
>>> please write to my web hosting provider [EMAIL PROTECTED]
>> 
>> 
>> Why don't you just change your provider? It would take less time than
>> this. 
> 
> Are you joking. "Just change your provider?" Do you have a little
> button on your computer that says "Change provider"? Cool! :)

No, it will cost Xah money. In the end he will be with a bullet proof 
hoster, like other kooks on Usenet, or get the message.

> C'mon, John Bokma (and everyone else dumb enough to crosspost their 
> shushing to every group on the crosspost list -- why do they do that?

So other people can read that reporting Xah *does* have an effect. A lot 
of people think that a kill file is the only solution.

> So Xah will hear them six times? No, they want everyone to see how
> witty they are when they tell Xah off.

So you haven't noticed that Xah does just hit & run posting? 

In short, you have no clue what this is about, or are one of the fans Xah 
seem to have?

Get a clue Kenny.

-- 
John Bokma  Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
Timo Stamm <[EMAIL PROTECTED]> wrote:

> Tim N. van der Leeuw schrieb:

>> Perhaps he's not crossing boundaries of free speech, but he's
>> repeatedly crossing boundaries on usenet nettiquette, even though
>> repeatedly he's being asked not to do so.
> 
> And repeatedly, others have encouraged him because they appreciate his 
> posts.

Of which I am sure a large part are just in for the troll fest that 
follows. Some probably have also bumped into the netiquette. And instead 
of using their brains, they can't handle the dent in their ego, and what 
is not with them, must be shit, so they love stuff like this.

Every Usenet kook has a group of pathetic followers and sock puppets.

>> but since I've stopped following threads originated by him
> 
> That's all you need to do if you are not interested in his posts.

You're mistaken. All you need to do is report it. After some time Xah will 
either walk in line with the rest of the world, or has found somewhere 
else to yell. As long as it's not my back garden and not around 4AM, I am 
ok with it.


-- 
John Bokma  Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
Eli Gottlieb <[EMAIL PROTECTED]> wrote:

> Who reads blogs?  They're well known for housing crackpots far worse 
> than Xah, and I estimate he doesn't want to associate himself with that 
> sort.

Yup, he seems to be quite happy as a Usenet Kook

-- 
John Bokma  Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread herraotic
I borrowed Learning Python 2nd edtion from a library once and it felt
condensed with information and I didn't think I could start with it
"yet" as I want a book made for a beginner programmer and I don't think
Learning Python 2nd edtion is made for my audience.

I want something that explains programming fundamentals and explains it
in general while also showing the reason in practise and from reading
some free PDF's of "Python Programming: An Introduction to Computer
Science" I think it fit the bill perfectly, I would have it already but
i'm only 15 and my dad is a bit weary of using his credit card online
:-).

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Mitch
John Bokma wrote:
[...]
> You're mistaken. All you need to do is report it. After some time Xah will 
> either walk in line with the rest of the world, or has found somewhere 
> else to yell. As long as it's not my back garden and not around 4AM, I am 
> ok with it.
> 

Walk in line with the rest of the world?  Pah.

This is no-ones back garden.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Bill Atkins
Ken Tilton <[EMAIL PROTECTED]> writes:

> C'mon, John Bokma (and everyone else dumb enough to crosspost their
> shushing to every group on the crosspost list -- why do they do that?
> So Xah will hear them six times? No, they want everyone to see how
> witty they are when they tell Xah off. Now /that/ is spam) is the
> problem.

+12 !

-- 
You fool! You fell victim to one of the classic blunders! The most
famous is, "Never get involved in a land war in Asia", but only
slightly less well-known is this: "Never go in against a Sicilian when
death is on the line"!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
"Ant" <[EMAIL PROTECTED]> wrote:

> I have no particular affinity for Xah's views, but what does get up my
> nose is usenet Nazism.

That's because you're clueless.

-- 
John   MexIT: http://johnbokma.com/mexit/
   personal page:   http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Programming Books?

2006-05-24 Thread John Salerno
[EMAIL PROTECTED] wrote:
> I borrowed Learning Python 2nd edtion from a library once and it felt
> condensed with information and I didn't think I could start with it
> "yet" as I want a book made for a beginner programmer and I don't think
> Learning Python 2nd edtion is made for my audience.
> 
> I want something that explains programming fundamentals and explains it
> in general while also showing the reason in practise and from reading
> some free PDF's of "Python Programming: An Introduction to Computer
> Science" I think it fit the bill perfectly, I would have it already but
> i'm only 15 and my dad is a bit weary of using his credit card online
> :-).
> 

Well, I *would* say that Learning Python does assume a little knowledge 
of programming in general, so in your case it might not be a good start. 
On the same note, neither is Beginning Python.

If your problem is limited access to books, you might want to try this 
site: http://www.ibiblio.org/obp/thinkCSpy/index.htm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread John Bokma
Mitch <[EMAIL PROTECTED]> wrote:

> John Bokma wrote:
> [...]
>> You're mistaken. All you need to do is report it. After some time Xah
>> will either walk in line with the rest of the world, or has found
>> somewhere else to yell. As long as it's not my back garden and not
>> around 4AM, I am ok with it.
>> 
> 
> Walk in line with the rest of the world?  Pah.
> 
> This is no-ones back garden.

Funny how people who always think they can "change Usenet" have no clue 
about what Usenet is and how it works in the first place.

Usenet is just that, each server participating can be thought of as being 
the back yard of the news master.

If you have no clue about how Usenet works, first read up a bit. What a 
Usenet server is, a feed, and how Usenet is distributed.

And then come back if you finally have something to say that you can back 
up.

-- 
John   MexIT: http://johnbokma.com/mexit/
   personal page:   http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread Bill Atkins
John Bokma <[EMAIL PROTECTED]> writes:

> Ken Tilton <[EMAIL PROTECTED]> wrote:
>
>> Ben Bullock wrote:
>>> "Xah Lee" <[EMAIL PROTECTED]> wrote in message 
>>> news:[EMAIL PROTECTED]
>>> 
 If you believe this lobbying to my webhosting provider is unjust,
 please write to my web hosting provider [EMAIL PROTECTED]
>>> 
>>> 
>>> Why don't you just change your provider? It would take less time than
>>> this. 
>> 
>> Are you joking. "Just change your provider?" Do you have a little
>> button on your computer that says "Change provider"? Cool! :)
>
> No, it will cost Xah money. In the end he will be with a bullet proof 
> hoster, like other kooks on Usenet, or get the message.
>
>> C'mon, John Bokma (and everyone else dumb enough to crosspost their 
>> shushing to every group on the crosspost list -- why do they do that?
>
> So other people can read that reporting Xah *does* have an effect. A lot 
> of people think that a kill file is the only solution.

You win my unofficial contest for "Usenet Tool of the Year."  It is
not difficult to skip to the next file or to add a sender to a
killfile.  It is certainly less of a hassle than all this complaining
you do.

Life is short, John Bokma.  There are more important things in the
world than tattling on Xah to his host.  Maybe you can start
experiencing them if you learn to make use of the 'next message' key.

>> So Xah will hear them six times? No, they want everyone to see how
>> witty they are when they tell Xah off.
>
> So you haven't noticed that Xah does just hit & run posting? 

I've noticed it - but have you?  

It would be only one post that could easily be ignored, if not for all
this rubbish that you and people like you feel the need to post (sure,
I realize I'm contributing to the problem).  Isn't "hit & run posting"
better than a thread full of nonsense?

-- 
You fool! You fell victim to one of the classic blunders! The most
famous is, "Never get involved in a land war in Asia", but only
slightly less well-known is this: "Never go in against a Sicilian when
death is on the line"!
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >