Re: Importing class from file in package

2004-12-05 Thread Joe Raul
from second import class


-- 
==

best regards

==
"Florian Lindner" <[EMAIL PROTECTED]> 
news:[EMAIL PROTECTED]
> Hello,
> I've two files in my package.
> In the first file I want to inport a class which is declared in the
> second file. How can do that without stating the absolute path to the
> file, just the relative one?
>
> Thanks,
>
> Florian


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


Re: Module list generation

2004-12-05 Thread Doug Kearns
In article <[EMAIL PROTECTED]>, Scott David Daniels wrote:
> Doug Kearns wrote:
>> Is this the best/simplest way to generate a module list?
>> 
>> python -c 'from pydoc import help; help("modules")'
>> 
>> Thanks,
>> Doug
> I am not sure if this is what you want, but how about:

I'm updating the zsh completion function for python and need to
generate a list of modules for completing the new '-m' option.

> For python 2.4, try:
> python -c "import sys; print sorted(sys.modules)"

I don't know python, but as I understand it, this only lists _loaded_
modules.

Thanks,
Doug
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Please help here: python <==> COM

2004-12-05 Thread mep
Resolved. Thanks anyway


-- 
Best Regards,
Wang Kebo

http://www.huihoo.org/~mep


"mep" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi,all
> I'm scripting flashget (A download management tool,
> http://www.amazesoft.com/) using
> python win32 extension, opening a downloading dialog.
> The following pythong code NOT work:
> CODE BEGIN
>  #!/usr/bin/env python
>  # -*- coding: cp936 -*-
>
>  import win32com.client
>
>  flashget = win32com.client.Dispatch('JetCar.Netscape')
>  params = ('http://test.com/1',
>'http://test.com/2',
>'http://test.com/3',
>'http://test.com/4',
>'http://test.com/5')
>
>  flashget.AddUrlList(params)
> CODE END
>
> It complaints the following:
>   File "", line 2, in AddUrlList
> pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None,
> None,  0, -2146828283), None)
>
> But the following VBS code does the tricky:
> CODE BEGIN
>  Dim params(4)
>  set flashget=CreateObject("JetCar.Netscape")
>
>  params(0) = "http://test.com/1";
>  params(1) = "http://test.com/2";
>  params(2) = "http://test.com/3";
>  params(3) = "http://test.com/4";
>  params(4) = "http://test.com/5";
>
>  flashget.AddUrlList params
> CODE END
>
> Any hints?
>
> -- 
> Best Regards,
> Wang Kebo
>
> http://www.huihoo.org/~mep
>
>


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


RE: Mean, median, and mode

2004-12-05 Thread Robert Brewer
(now that we have a meaningful subject line)

Alfred Canoy wrote:
> >>  I'm just new to programming and would like to ask for help..
> >>
> >> Build a module that contains three functions that do the following:
> >>
> >>   a.. Compute the average of a list of numbers
> >>   b.. Finds the statistical median value of a list of numbers
> >>   c.. Finds the mode of a list of numbers
> >>
> >> Can you please give me clue how I should start solving the
> >> following problem
> >> below? Here's the source code that I did so far:
> >>
> >> # compute the average of a list of numbers:
> >> # Keeps asking for numbers until 0 is entered
> >> # Prints the average value
> >>
> >> count = 0
> >> sum = 0
> >> number = 1
> >>
> >> print 'Enter 0 to exit the loop'
> >> while number != 0:
> >> number = input ('Enter a number: ')
> >> count = count + 1
> >> sum = sum + number
> >> count = count -1
> >> print ' The average is:', sum/count

For the mode, you might build a dictionary:

freq = {}
while number != 0:
number = input ('Enter a number: ')
count = count + 1
sum = sum + number
try:
freq[number] += 1
except KeyError:
freq[number] = 1

...then you can check for the largest value in that dictionary:

max = 0
mode = None
for k, v in freq.iteritems():
if v > max:
max = v
mode = k

I leave the rest in your capable hands... ;) Including the case where
two numbers occur in equal frequencies. ;;)


Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Book Recommendations

2004-12-05 Thread Fredrik Lundh
Nathan Weston wrote:

> I'm new to Python and am looking for a book to get me up to speed
> quickly. I'm an experienced programmer and very proficient with Ruby,
> so Python is coming easily to me and I don't need a gentle
> introduction -- I just need a quick way to get familiar with common
> Python idioms and important libraries.

http://effbot.org/zone/librarybook-index.htm

contains examples for all modules that were in 2.0, in idiomatic python
(see the "new modules in ..." for info on modules added in later versions).

 



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


Re: HTTP response code

2004-12-05 Thread Fredrik Lundh
Jonas Galvez wrote:

> Hi list, here's a question about urllib. Is it possible to simply
> retrieve the HTTP responde code for a given URL? I don't want to
> download the body of the HTTP message. I simply want to check the
> response code, like, if it is 200, 301 etc. Something like:
>
> if urllib.urlopen(the_url).response_code == 200:
># ...
>
> Is there an easy way to do this?

urllib processes the response code, and follows redirects etc.  If urllib gets a
response code that it cannot deal with, it raises an exception (which includes
the error code).

If you want to check the response code for any given resource, use httplib
(see Ian's reply).  If you're building a link checker of some kind, you might
prefer an asynchronous HTTP client (which lets you issue multiple requests
at once, and process the responses as they arrive):

http://effbot.org/zone/asyncore-http-client.htm






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


Re: [Python-Dev] PEP: __source__ proposal

2004-12-05 Thread bearophile
(I answer here because I'm still not at easy on python-dev)
It looks like an interesting feature. I think most LOGOs allows
something similar (or better, with a cleaner syntax). The shells of
many versions of this language keep a "pool" of functions defined with
"to" into a kind of database, so you can call them and edit them one
at a time (this is a small block from Wikipedia; note that LOGO allows
to do more than just turtle graphic):

to spiral :size
   if  :size > 30 [stop] ; a condition stop
   fd :size rt 15; many lines of action
   spiral :size *1.02; the tailend recursive call
end

In Mathematica you can edit "cells" of the interactive document, you
can press enter to go to the next line inside the same cell, and then
you press SHIFT+enter to "compile" and execute the text in the cell
(usually going to the cell that follows the output one).

Some similar "improvements" of the CPython shell can be useful... but
I think you first need to look in many places (Smalltalk, LOGO,
Mathematica, Mathcad, etc.) to find the best ideas to copy from.

Bear hugs,
Bearophile
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Help] (fwd)

2004-12-05 Thread Craig Ringer
On Sun, 2004-12-05 at 13:07, Alfred Canoy wrote:

>   a.. Compute the average of a list of numbers
>   b.. Finds the statistical median value of a list of numbers
>   c.. Finds the mode of a list of numbers
> 

> count = 0
> sum = 0
> number = 1
> 
> print 'Enter 0 to exit the loop'
> while number != 0:
> number = input ('Enter a number: ')
> count = count + 1
> sum = sum + number
> count = count -1
> print ' The average is:', sum/count

It looks to me like you'd be better off reading each input number into a
list. (tip: in the interactive interpreter, run 'help(list)' ). Once you
have a list, you can perform all sorts of computations on it to
determine the information you need.

>>> from __future__ import division
>>> x = []
>>> x.append(1)
>>> x
[1]
>>> x.append(5)
>>> x
[1,5]
>>> sum(x)
6
>>> sum(x) / len(x)
3

As you can see, it's much easier to work with data in lists. Some of the
other methods, like list.sort() and list "slices" will also be useful to
you, but I'll let you figure out the details ;-) . Remember that Python
is rather well documented, so that (usually) once you know what you need
you can find out about it...

--
Craig Ringer

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


Re: [Python-Help] (fwd)

2004-12-05 Thread Bob Gailer
At 10:07 PM 12/4/2004, Alfred Canoy wrote:
Hello,
I'm just new to programming and would like to ask for help..
Build a module that contains three functions that do the following:
 a.. Compute the average of a list of numbers
 b.. Finds the statistical median value of a list of numbers
The middle value in a distribution, above and below which lie an equal 
number of values.

 c.. Finds the mode of a list of numbers
The value or item occurring most frequently in a series of observations or 
statistical data.

Can you please give me clue how I should start solving the following problem
below? Here's the source code that I did so far:
# compute the average of a list of numbers:
# Keeps asking for numbers until 0 is entered
# Prints the average value
count = 0
sum = 0
number = 1
print 'Enter 0 to exit the loop'
while number != 0:
   number = input ('Enter a number: ')
   count = count + 1
   sum = sum + number
count = count -1
print ' The average is:', sum/count
Great start. In addition append each numbers to a list. Then it is easy to 
find the middle of the list for the median. Use a dictionary keyed by the 
numbers to count their frequency, then find the entry with the highest 
frequency.

See http://www.honors.montana.edu/~jjc/easytut/easytut/ for lists and 
dictionaries.

Give it a shot, show us what you come up with, and we'll take the next step.
Bob Gailer
[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell 

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


Re: [Python-Help] (fwd)

2004-12-05 Thread Steven Bethard
Craig Ringer wrote:
As you can see, it's much easier to work with data in lists. Some of the
other methods, like list.sort() and list "slices" will also be useful to
you, but I'll let you figure out the details ;-) . 
Something else that might be useful to you if you're using Python 2.4:
>>> lst = [1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8]
>>> import itertools
>>> for value, values in itertools.groupby(lst):
... print value, list(values)
... 
1 [1]
2 [2, 2]
3 [3]
4 [4]
5 [5, 5, 5]
6 [6]
7 [7]
8 [8]
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Help] (fwd)

2004-12-05 Thread Steven Bethard
Craig Ringer wrote:
It looks to me like you'd be better off reading each input number into a
list.
You may also find it useful to write a generator function to read your 
values in:

>>> def read_numbers():
... while True:
... number = int(raw_input('Enter a number: '))
... if number == 0:
... break
... yield number
...
>>> read_numbers()

>>> for number in read_numbers():
... print number
...
<... after typing 5 ...>
5
<... after typing 6 ...>
6
<... after typing 9 ...>
9
<... after typing 0 ...>
>>>
>>> list(read_numbers())
<... after typing 2, 4, 5, 5, 8, 0 ...>
[2, 4, 5, 5, 8]
The read_numbers function creates a generator object which will query 
the user for a number until it sees the number 0.  Because you get a 
generator object from this function, you can easily convert it to a list 
if you need to, or iterate on it directly.

Also note that I use int(raw_input(...)) instead of input(...).  It's a 
few more keystrokes, but it's probably a good habit to get into -- 
input(...) has some security holes.

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


Re: Power with modulu

2004-12-05 Thread Fredrik Lundh
Roie Kerstein wrote:

> I want to compute a**b%c for very long numbers.
> Computing a**b and then applying modulu is not practical, since it takes
> ages.
> There is a built-in optional parameter to the long.__pow__(a,b[,modulu]),
> and it works well.
> My question is: How can I write it is a form of an expression, like a**b?

if you look up __pow__ in the documentation, you'll find that it explains
that __pow__ is used to implement the built-in pow() function:

http://docs.python.org/lib/built-in-funcs.html#l2h-54

in other words,

pow(a, b, c)

does what you want.

 



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


Power with modulu

2004-12-05 Thread Roie Kerstein
Hello!

I want to compute a**b%c for very long numbers.
Computing a**b and then applying modulu is not practical, since it takes
ages.
There is a built-in optional parameter to the long.__pow__(a,b[,modulu]),
and it works well.
My question is: How can I write it is a form of an expression, like a**b?
I prefer not to fill my script with calls of the form long.__pow__(a,b,c).

-- 
Best regards
Roie Kerstein

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


Re: Python-Help ( Mean,Median & Mode)

2004-12-05 Thread Alfred Canoy
Hello,
I revised my source code. It was doing great but I'm having problem listing 
all the numbers that I'd input. How can I input all the numbers that I 
selected? The source code and the output below:

   Source code:
# compute the Mean, Median & Mode of a list of numbers:
sum = 0.0
print 'This program will take several numbers then average them'
count = input(' How many numbers would you like to sum: ')
current_count = 0
freq = {}
freq [current_count] = number
while current_count < count:
   current_count = current_count + 1
   number = input ('Enter a number: ')
   print "Number", current_count,":",number
   sum = sum + number
print ' The average is:', sum/count
# list the numbers selected by user then gets the median & mode
listNumbers=[]
for list in number:
   listNumbers[list]=listNumbers.get(x,0)+1
print listNumbers
freq = {}
current_count(freq)=number
while number != 0:
   number = input ('Enter a number: ')
   count = count + 1
   sum = sum + number
   try:
   freq[number] += 1
   except KeyError:
   freq[number] = 1
max = 0
mode = None
for k, v in freq.iteritems():
   if v > max:
   max = v
   mode = k
print mode
   Output:
This program will take several numbers then average them
Number 1 : 6
Number 2 : 9
Number 3 : 8
Number 4 : 4
Number 5 : 2
The average is: 5.8
Traceback (most recent call last):
 File 
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", 
line 310, in RunScript
   exec codeObject in __main__.__dict__
 File "A:\SLP5.py", line 23, in ?
   for x in number:
TypeError: iteration over non-sequence

Thank you much!
Al
_ _
_ _
Alfred Canoy
Agana, Guam
Pacific time
[EMAIL PROTECTED]
- Original Message - 
From: "Bob Gailer" <[EMAIL PROTECTED]>
To: "Alfred Canoy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; 
<[EMAIL PROTECTED]>
Sent: Sunday, December 05, 2004 7:50 PM
Subject: Re: [Python-Help] (fwd)


At 10:07 PM 12/4/2004, Alfred Canoy wrote:
Hello,
I'm just new to programming and would like to ask for help..
Build a module that contains three functions that do the following:
 a.. Compute the average of a list of numbers
 b.. Finds the statistical median value of a list of numbers
The middle value in a distribution, above and below which lie an equal 
number of values.

 c.. Finds the mode of a list of numbers
The value or item occurring most frequently in a series of observations or 
statistical data.

Can you please give me clue how I should start solving the following 
problem
below? Here's the source code that I did so far:

# compute the average of a list of numbers:
# Keeps asking for numbers until 0 is entered
# Prints the average value
count = 0
sum = 0
number = 1
print 'Enter 0 to exit the loop'
while number != 0:
   number = input ('Enter a number: ')
   count = count + 1
   sum = sum + number
count = count -1
print ' The average is:', sum/count
Great start. In addition append each numbers to a list. Then it is easy to 
find the middle of the list for the median. Use a dictionary keyed by the 
numbers to count their frequency, then find the entry with the highest 
frequency.

See http://www.honors.montana.edu/~jjc/easytut/easytut/ for lists and 
dictionaries.

Give it a shot, show us what you come up with, and we'll take the next 
step.

Bob Gailer
[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell 
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing class factories with the Python/C API?

2004-12-05 Thread Fredrik Lundh
Craig Ringer wrote:

> I'm currently faced with the need to write a class factory in C using
> the Python/C API. It's purpose is to automatically wrap C++ objects at
> run-time and provide a Python object. Thanks to the magic of Qt's
> meta-object system, getting the information required to wrap the C++
> object is the easy bit.
>
> What I'm not sure I can do is create 'built-in' Python classes at run
> time. I don't need to create classes in response to calls from Python
> code, only C code, but the newly created classes do need to be available
> to Python code of course. The newly created classes will be fairly
> simple subclasses of a more powerful parent, and all they really need to
> do is implement a bunch of methods and
>
> So, before I throw myself too deeply into this task, does this sound
> like something that's vaguely practical? All I'll really need to do is
> add a bunch of methods on the generated subclasses, so I'm hoping so...

Lib/exceptions.c contains C code that creates class objects, and
populates them with methods.  make a copy and hack it until it suits
your needs...

 



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


Re: rexec and bastion

2004-12-05 Thread Fredrik Lundh
Kay Schluehr wrote:

> Cited from Python-doc ( v.2.3 )
>
> [Warning:  In Python 2.3 these modules have been disabled due to
> various known and not readily fixable security holes. The modules are
> still documented here to help in reading old code that uses the rexec
> and Bastion modules.]
>
> My question about rexec and bastion may be anachronistic but I did not
> found much explanation, why rexec and bastion are swiss cheese? It may
> be helpfull to resume the problems to learn from them.

is google down today?

http://www.amk.ca/python/howto/rexec/rexec.html

says

For discussion of the problems with rexec, see the python-dev threads
starting at the following URLs:
http://mail.python.org/pipermail/python-dev/2002-December/031160.html
and http://mail.python.org/pipermail/python-dev/2003-January/031848.html

 



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


Linguistic challenge: name this program

2004-12-05 Thread Andr? Roberge
In 1981, Richard Pattis wrote a delightful little book titled "Karel
the Robot, a Gentle Introduction to the Art of Programming." Pattis's
"Karel the Robot" was named after the author Karel Capek, who
popularized the word "robot" in his play "Rossum's Universal Robots".
Pattis's approach was to introduce a robot who could follow 5 basic
instructions and be taught to accomplish tasks of increasing
complexity.

A few years ago, a first implementation of "Karel the Robot" in Python
was created and called PyKarel. A second, newer implementation is
called Guido van Robot (GvR for short), and is available at
gvr.sourceforge.net. Work is currently underway by the developpers of
GvR to produce a new-and-improved version.

I have been working on my own (better ;-) version (sometimes
collaborating with the GvR folks) in order to learn Python. It is now
90% finished. It is meant to be a complete environment to learn about
programming concepts, from simple sequences of instruction to OOP.

Given the origin of Pattis's name (Rossum's Universal Robot) and the
name of Python's BDFL, I find it difficult to think of a better name
than Guido van Robot to name a programming environment in which one
uses Python to teach a robot new tricks! (Hat's off to Steve Howell
for this one). Yet, I want a "clever" name for my version.

Any suggestions?

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


rexec and bastion

2004-12-05 Thread Kay Schluehr
Cited from Python-doc ( v.2.3 )

[Warning:  In Python 2.3 these modules have been disabled due to
various known and not readily fixable security holes. The modules are
still documented here to help in reading old code that uses the rexec
and Bastion modules.]

My question about rexec and bastion may be anachronistic but I did not
found much explanation, why rexec and bastion are swiss cheese? It may
be helpfull to resume the problems to learn from them.

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


Writing class factories with the Python/C API?

2004-12-05 Thread Craig Ringer
Hi folks

I'm currently faced with the need to write a class factory in C using
the Python/C API. It's purpose is to automatically wrap C++ objects at
run-time and provide a Python object. Thanks to the magic of Qt's
meta-object system, getting the information required to wrap the C++
object is the easy bit.

What I'm not sure I can do is create 'built-in' Python classes at run
time. I don't need to create classes in response to calls from Python
code, only C code, but the newly created classes do need to be available
to Python code of course. The newly created classes will be fairly
simple subclasses of a more powerful parent, and all they really need to
do is implement a bunch of methods and 

So, before I throw myself too deeply into this task, does this sound
like something that's vaguely practical? All I'll really need to do is
add a bunch of methods on the generated subclasses, so I'm hoping so...

--
Craig Ringer

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


string slicing

2004-12-05 Thread Ishwor
Hello all ,
  I am trying some interactive examples here where i have come across
inconsistencies??? :O
Anyway heres whats bothering me

>>> s = 'hello'
>>> s[0]
'h'
>>> s[:]
'hello'
>>> m = s[:]
>>> m
'hello'
>>> m is s
True

 I discussed the *is* operator with some of the pythoners before as
well but it is somewhat different than what i intended it to do. The
LP2E by Mark & David says -
" m gets a *full top-level copy* of a sequence object- an object with
the same value but distinct piece of memory." but when i test them
with *is* operator then the result is True. Why is this happening??
Any help is appreciated.. Thanx


-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: string slicing

2004-12-05 Thread Kent Johnson
Ishwor wrote:
s = 'hello'
m = s[:]
m is s
True
 I discussed the *is* operator with some of the pythoners before as
well but it is somewhat different than what i intended it to do. The
LP2E by Mark & David says -
" m gets a *full top-level copy* of a sequence object- an object with
the same value but distinct piece of memory." but when i test them
with *is* operator then the result is True. Why is this happening??
This behaviour is due to the way strings are handled. In some cases strings are 'interned' which 
lets the interpreter keep only a single copy of a string. If you try it with a list you get a 
different result:

>>> s=list('hello')
>>> s
['h', 'e', 'l', 'l', 'o']
>>> m=s[:]
>>> m
['h', 'e', 'l', 'l', 'o']
>>> m is s
False
Kent
--
http://mail.python.org/mailman/listinfo/python-list


Re: string slicing

2004-12-05 Thread Ishwor
On Sun, 05 Dec 2004 09:44:13 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:

[snip]

> 
> This behaviour is due to the way strings are handled. In some cases strings 
> are 'interned' which
> lets the interpreter keep only a single copy of a string. If you try it with 
> a list you get a
> different result:
> 
> >>> s=list('hello')
> >>> s
> ['h', 'e', 'l', 'l', 'o']
> >>> m=s[:]
> >>> m
> ['h', 'e', 'l', 'l', 'o']
> >>> m is s
> False
> 
> Kent

Thanx Kent.  so for lists Python doesn't keep the same object in the
cache??? So in that case it is not interned & hence any objects
created will **point** to seperate area in memory as seen by your
>>> m is s  #( for lists) 
>>> False

Thanx again :)
[snip]

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some pointers for a newbie

2004-12-05 Thread Abe Mathews
On Sun, 05 Dec 2004 02:26:48 +, Jon Mercer <[EMAIL PROTECTED]> wrote:
> On the matter of IDEs, I've found that Eclipse (http://www.eclipse.org)
> is amazing, although I suspect that it takes a bit of learning to get
> used to it and I'm nowhere near making full use of all it can do. It has
> a really useful plugin in the shape of PyDev. I strongly recommend
> having a play, although at 2am on a Sunday morning it may be peripheral
> to what you are trying to achieve!

I'd second the suggestion to look into Eclipse if you are interested
in an IDE.  I'm just starting to work in OS X (G5 now, possibly a
Powerbook in the future) coming from a Linux background.  What I like
about Eclipse is that it is cross-platform, and it also supports the
other languages I've worked with in the past (Java, C/C++).  PyDev
seems to work pretty well.  And I've seen lots of other folks
developing plug-ins for Eclipse that lead me to believe that this is
an IDE worth learning, even if you're going to do most of your work on
the command line.

I have installed XCode based on what I saw at the Apple booth at the
SC2004 - I really like the tools that Apple has developed.  However,
I've yet to really play with it and see what can be done.  I haven't
been able to find much about using XCode for Python, so I'm assuming
that there isn't much in the way of support.  (I take that back, I
just went to http://developer.apple.com and discovered that XCode will
interpret Python files and does provide syntax hilighting.  Learn
something new every day...)

I have done most of my Python programming in Linux using the command
line, IDLE, and Emacs.  This isn't supported very well out of the box
by OS X, as I prefer the "prettier" GUI Emacs implementations over the
straight Terminal if I can get it.  There are a couple of Carbon
implementations out there for Emacs, and one of them includes the
python Emacs module for syntax highlighting and auto-indentation.  I
don't remember off the top of my head which one it is.  If you're
interested, I can check on Monday when I get back to work and let you
know.

One of the Carbon implementations of Emacs plus macPython gets me
pretty much where I was comfortable in Linux, so I'm happy there.

The tools are available for OS X - it may take a bit of digging, but
I'm coming to the conclusion that OS X is the OS I've been looking for
for a while.  Good luck with your searching.

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


RE: Linguistic challenge: name this program

2004-12-05 Thread Robert Brewer
Andre Roberge wrote:
> In 1981, Richard Pattis wrote a delightful little book titled "Karel
> the Robot, a Gentle Introduction to the Art of Programming." Pattis's
> "Karel the Robot" was named after the author Karel Capek, who
> popularized the word "robot" in his play "Rossum's Universal Robots".
> Pattis's approach was to introduce a robot who could follow 5 basic
> instructions and be taught to accomplish tasks of increasing
> complexity.
> 
> A few years ago, a first implementation of "Karel the Robot" in Python
> was created and called PyKarel. A second, newer implementation is
> called Guido van Robot (GvR for short), and is available at
> gvr.sourceforge.net. Work is currently underway by the developpers of
> GvR to produce a new-and-improved version.
> 
> I have been working on my own (better ;-) version (sometimes
> collaborating with the GvR folks) in order to learn Python. It is now
> 90% finished. It is meant to be a complete environment to learn about
> programming concepts, from simple sequences of instruction to OOP.
> 
> Given the origin of Pattis's name (Rossum's Universal Robot) and the
> name of Python's BDFL, I find it difficult to think of a better name
> than Guido van Robot to name a programming environment in which one
> uses Python to teach a robot new tricks! (Hat's off to Steve Howell
> for this one). Yet, I want a "clever" name for my version.
> 
> Any suggestions?

RUR? Perhaps http://jerz.setonhill.edu/resources/RUR/ might give you
more ideas.


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


Re: string slicing

2004-12-05 Thread Kent Johnson
Ishwor wrote:
On Sun, 05 Dec 2004 09:44:13 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
This behaviour is due to the way strings are handled. In some cases strings are 
'interned' which
lets the interpreter keep only a single copy of a string. If you try it with a 
list you get a
different result

Thanx Kent.  so for lists Python doesn't keep the same object in the
cache??? 
Right, AFAIK lists are not cached in this way.
Kent
--
http://mail.python.org/mailman/listinfo/python-list


Re: string slicing

2004-12-05 Thread Fredrik Lundh
Ishwor wrote:

>  I am trying some interactive examples here where i have come across
> inconsistencies??? :O

obsession with implementation artifacts is a premature optimization,
and should be avoided.

> Anyway heres whats bothering me
>
 s = 'hello'
 s[0]
> 'h'
 s[:]
> 'hello'
 m = s[:]
 m
> 'hello'
 m is s
> True
>
> I discussed the *is* operator with some of the pythoners before as
> well but it is somewhat different than what i intended it to do. The
> LP2E by Mark & David says -
> " m gets a *full top-level copy* of a sequence object- an object with
> the same value but distinct piece of memory." but when i test them
> with *is* operator then the result is True. Why is this happening??

since you cannot modify a string in place, the string implementation can
safely return the original string as the "full copy".  "mutable" objects (such
as lists and arrays) cannot cheat.

a suggestion: if you really want to be productive in python, forget about
"is" for a while.  good code doesn't copy stuff much, either, by the way.
python's all about objects, and things that hold references to objects.

 



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


Re: Python-Help ( Mean,Median & Mode)

2004-12-05 Thread Cousin Stanley
| I revised my source code. It was doing great
| but I'm having problem listing all the numbers
| that I'd input.
|
| How can I input all the numbers that I selected?
Alfred 
  As a method to list the numbers that have been input
  and avoid having to know in advance how many numbers
  are needed, you might consider a simple input mode
  where a character other than an integer is input
  as a  stop-input-mode  character 
print '\nInput an integer at the  >  prompt \n'
print 'Enter a period  .  to end input mode'
print 'and begin processing  \n'
prompt = '> '
period = '.'
list_input = [ ]
while True :
this_str = raw_input( prompt )
if this_str  ==  period :
break
try :
list_input.append( int( this_str ) )
except :
print '\nInput Must be an Integer'
print 'or a period  .  to exit Input Mode \n'
num_entries = len( list_input )
print 'Input List  \n'
for this_item in list_input :
print '%s' % this_item
print '\n# Entries  %s \n' % num_entries
--
Cousin Stanley
Human Being
Phoenix, Arizona
--
http://mail.python.org/mailman/listinfo/python-list


Re: why no python setup.py uninstall?

2004-12-05 Thread Alia Khouri
I'm guessing that this is a non-issue for most people (-;
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: string slicing

2004-12-05 Thread Josiah Carlson

"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> 
> Ishwor wrote:
> 
> >  I am trying some interactive examples here where i have come across
> > inconsistencies??? :O
> 
> obsession with implementation artifacts is a premature optimization,
> and should be avoided.

[snip]

> a suggestion: if you really want to be productive in python, forget about
> "is" for a while.

The above two tips are in my "top-10 things to tell newbs" list.


 - Josiah

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


Re: long number multiplication

2004-12-05 Thread Jeremy Bowers
On Sun, 05 Dec 2004 09:02:18 +0530, I.V. Aprameya Rao wrote:
> i have been wondering, how does python store its very long integers and 
> perform aritmetic on it.
> 
> i needed to implement this myself and was thinking of storing the digits 
> of an integer in a list.

Uh, why? What possible environment are you programming in where the
correct answer isn't to grab one of many high-quality libraries to do it?

(Homework? If that's the case the Python source will likely prove too
complicated to be useful to you due to optimization, though I haven't read
it and I don't directly know.)

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


Re: Python2.4: building '_socket' extension fails with `INET_ADDRSTRLEN' undeclared

2004-12-05 Thread Dieter Maurer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes on Sat, 04 Dec 2004 00:37:43 +0100:
>...
> So it appears that on your system, INET_ADDRSTRLEN is not defined,
> even if it is supposed to be defined on all systems, regardless
> of whether they support IPv6.

I have met this problem in older Solaris versions: the Solaris
headers did not define the macro.

I fixed my problem by providing the lacking definition
in the relevant Python header file.
-- 
http://mail.python.org/mailman/listinfo/python-list


import fails

2004-12-05 Thread Laszlo Zsolt Nagy
Hello all,

Can anyone explain this:


C:\Python\Projects\DbDesigner>python
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from Db.FieldTypes import IdentifierFieldType
>>> from Db.FieldTypes import *
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: attribute name must be string
>>>

I can do anything except "import *" - in that case, I get this very
strange exception. Do you have any idea?

-- 
Best regards,
 Laszlo  

mailto:[EMAIL PROTECTED]
web: http://designasign.biz


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


Re: import fails

2004-12-05 Thread Jp Calderone
On Sun, 5 Dec 2004 19:52:57 +0100, Laszlo Zsolt Nagy <[EMAIL PROTECTED]> wrote:
>Hello all,
> 
> Can anyone explain this:
> 
> 
> C:\Python\Projects\DbDesigner>python
> Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from Db.FieldTypes import IdentifierFieldType
> >>> from Db.FieldTypes import *
> Traceback (most recent call last):
>   File "", line 1, in ?
> TypeError: attribute name must be string
> >>>
> 
> I can do anything except "import *" - in that case, I get this very
> strange exception. Do you have any idea?
> 

[EMAIL PROTECTED]:~$ cat foo.py
x = 10
__all__ = [x]
[EMAIL PROTECTED]:~$ cat bar.py 
x = 20
__all__ = ['x']
[EMAIL PROTECTED]:~$ python -c "from foo import *; print x"
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: attribute name must be string
[EMAIL PROTECTED]:~$ python -c "from bar import *; print x"
20
[EMAIL PROTECTED]:~$ 

  Hope this helps,

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


Chrooted Python problem

2004-12-05 Thread John



Hello to all
 
I lately installed the python 2.3 and mod_python 
2.7.10
 
My apache runs in a chrooted enviroment so i want 
to chroot pyton and mod_python as well.
 
I have copy the
 
 /usr/local/apache/libexec/mod_python.so -> 
/chroot /usr/local/apache/libexec/mod_python.so 
 
/usr/local/lib/python2.3 -> 
/chroot/usr/local/lib/python2.3
 
/usr/local/bin/python -> 
/chroot/usr/local/bin/python
 
And some .so files in the /chroot/lib directory 
that the 
 
ldd /usr/local/bin/python 
and
ldd 
/usr/local/apache/libexec/mod_python.so
indicated
 
 
The problem is that i can start the apache in the 
chrooted enviroment but its childs (or children) processes (of apache) 
increasing and increasing until the
apache crashes (160-200 apache 
process).
 

When i disable the loading of mod_pyton.so in the 
httpd.conf then everything works well like it used to.
 
 
Do you know any cure about that 
problem?
 
 
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: string slicing

2004-12-05 Thread Ishwor
On Sun, 05 Dec 2004 10:31:12 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> 
> "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:

> > a suggestion: if you really want to be productive in python, forget about
> > "is" for a while.

I know what Fredrik means here (Thanx Frederick :) ) but IMHO if the
pattern of forgetting something is taken everytime someone tries to
scratch under the hood, then seriously it'll take ages before someone
seriously learns a language!
 
> The above two tips are in my "top-10 things to tell newbs" list.

You should consider having your own *nice* nifty things to say about
newbs (like me) rather than try to point at someone else's
intellectual property. If you are running out of ideas consider
reading one of those "Complete Idiot's guide to " :)

> - Josiah
[snip]

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why no python setup.py uninstall?

2004-12-05 Thread Peter Hansen
Alia Khouri wrote:
I'm guessing that this is a non-issue for most people (-;
Well, you've allowed all of about 1.5 days for replies
to come, and on a weekend at that.
Be patient.
I would also guess it's a non-issue as well, however.
A quick perusal of the archives (which I leave to you)
would very likely show almost no discussion of this in
the past few years (at least, that's what I recall).
On your specific reason for asking: I would suggest
just not worrying about "being extra clean about it".
Python's generally pretty good about not messing up
when you install a new version of something without
uninstalling the previous version.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re[2]: import fails

2004-12-05 Thread Laszlo Zsolt Nagy

> [EMAIL PROTECTED]:~$ cat foo.py
> x = 10
> __all__ = [x]
> [EMAIL PROTECTED]:~$ cat bar.py 
> x = 20
> __all__ = ['x']
> [EMAIL PROTECTED]:~$ python -c "from foo import *; print x"
> Traceback (most recent call last):
>   File "", line 1, in ?
> TypeError: attribute name must be string
> [EMAIL PROTECTED]:~$ python -c "from bar import *; print x"
> 20
> [EMAIL PROTECTED]:~$ 

>   Hope this helps,


Definitely. However, it would be better if the exception occurred on the
bad assignment (e.g.  __all__ = [x]) but probably it would be
extremely hard to implement. Moreover, you can add items to __all__ in
runtime. Well okay, this is not something humans do. :-)

Another note: the same code was working with 2.3.x, the problem I'm
having is only 2.3.4. - I should have checked the change log.

Thank again

-- 
 Laszlo
 mailto:[EMAIL PROTECTED]
 web:http://designasign.biz
 

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


Re: rexec and bastion

2004-12-05 Thread Kay Schluehr
> is google down today?
> 
> http://www.amk.ca/python/howto/rexec/rexec.html

No, I'm down today ;)

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


Re: import fails

2004-12-05 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote:

> Definitely. However, it would be better if the exception occurred on the
> bad assignment (e.g.  __all__ = [x])

it does happen on the bad assignment (i.e. from foo import *)

 



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


Re: Please help here: python <==> COM

2004-12-05 Thread Ishwor
heheh... this was funny in your posting. :)
 >The following *pythong* ( so this is what a Python wearing a thong
is called ..
 > hmmm...) code NOT work.. 

On Sun, 5 Dec 2004 16:18:33 +0800, mep <[EMAIL PROTECTED]> wrote:
> Resolved. Thanks anyway

[snip]

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


help using sockets, and OOP?

2004-12-05 Thread Dfenestr8
Hi.

I realise, that there's probably something intrinsic to OOP that I don't
understand here. Or maybe it's something to do with sockets. I'm not sure.

Basically, I'm trying to hack up an IRC bot, that joins two servers at
once. I use two object instancs of the same class, both of which make
connections using the socket module.

Problem is, I can't seem to get both objects to connect to their
constituent servers at the same time. I'm not sure whether it's that both
objects can't instantiate at once, or whether only one can use the socket
module at any one time.

Here's my code:

http://plz.donthack.us/~hairyman/mybot.py

Can anybody see what it is I'm missing? 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help using sockets, and OOP?

2004-12-05 Thread Jp Calderone
On Mon, 06 Dec 2004 06:02:40 +1000, Dfenestr8 <[EMAIL PROTECTED]> wrote:
>Hi.
> 
> I realise, that there's probably something intrinsic to OOP that I don't
> understand here. Or maybe it's something to do with sockets. I'm not sure.
> 
> Basically, I'm trying to hack up an IRC bot, that joins two servers at
> once. I use two object instancs of the same class, both of which make
> connections using the socket module.
> 
> Problem is, I can't seem to get both objects to connect to their
> constituent servers at the same time. I'm not sure whether it's that both
> objects can't instantiate at once, or whether only one can use the socket
> module at any one time.
> 
> Here's my code:
> 
> http://plz.donthack.us/~hairyman/mybot.py
> 
> Can anybody see what it is I'm missing? 

  Your problem doesn't seem to have anything to do with "OOP" (whatever that 
is).  Rather, you are trying to use two blocking sockets at once.

  socket.connect() and socket.recv() are both "blocking" operations by default 
- they can take an arbitrary amount of time to return.  Additionally, 
Botling.receiveData, one of your own functions, is also blocking: it will 
actually loop forever, never returning (until an exception blows it up).  So 
execution of your program never even _gets_ to the "bert2 = ..." line.  It's 
stuck running bert1.receiveData().

  Handling concurrency can be quite tricky, but fortunately there are some 
tools to help you out.  For starters, check out http://www.twistedmatrix.com/ - 
in particular, you may be interested in 
http://www.twistedmatrix.com/documents/current/examples/ircLogBot.py

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


Re: string slicing

2004-12-05 Thread Josiah Carlson

Ishwor <[EMAIL PROTECTED]> wrote:
> 
> On Sun, 05 Dec 2004 10:31:12 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> > 
> > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> 
> > > a suggestion: if you really want to be productive in python, forget about
> > > "is" for a while.
> 
> I know what Fredrik means here (Thanx Frederick :) ) but IMHO if the
> pattern of forgetting something is taken everytime someone tries to
> scratch under the hood, then seriously it'll take ages before someone
> seriously learns a language!
>  
> > The above two tips are in my "top-10 things to tell newbs" list.
> 
> You should consider having your own *nice* nifty things to say about
> newbs (like me) rather than try to point at someone else's
> intellectual property. If you are running out of ideas consider
> reading one of those "Complete Idiot's guide to " :)

Goodness, you got right snippy with the 'intellectual property' thing.
I'm sorry if it sounded as if I had meant "I came up with this before",
I did not mean it that way.  What I meant was "good advice", "I've seen
this advice before", and "I've previously taken note of it".  As an
aside, I also believe that if Fredrik were concerned about my supposed
theft of his 'advice IP', he would mention it


Confusions about 'is' are quite common.  Perhaps every week a new thread
in regards to object identity is offered, usually asking about integer,
string or list identity.  I'm not having much luck with the google
incantation right now, but my email archive is spitting back a thread on
"interning strings" from early November, which discusses strings and
identity.

Really, everyone who is thinking of using 'is' should ask themselves
whether or not it is truely important to have the same object.  In some
cases it matters, and in others cases it doesn't matter.  The more
experience one has with Python and the implementations of algorithms,
the more obvious such choices will become.

A perfect example of a case when using 'is' is proper is by Barry Warsaw
(http://mail.python.org/pipermail/python-dev/2004-March/043224.html):

missing = object()

if d.get('somekey', missing) is missing:
   # it ain't there


In the case of it not mattering, there was a series of threads in March
of this year in python-dev, discussing replacing the 'is' operator
strictly comparing object identity with a 'can be replaced by' operator,
spelled 'is'.  See the threads entitled "redefining is" here:
http://mail.python.org/pipermail/python-dev/2004-March/thread.html
Of course it came out that it didn't happen ('is' is much faster, and
doesn't require objects to define a mechanism to get at their contents,
etc.), but it is not uncommon for people who think they want 'is' to
really want 'can be replaced by', especially in the case of tuples:

>>> a = tuple(list('hello'))
>>> b = tuple(list('hello'))
>>> a == b
True
>>> a is b
False
>>> CanBeReplacedBy(a, b)
True
>>> 

(of course you need a proper implementation of CanBeReplacedBy, of which
a few are offered in the previously mentioned 'replacing is' threads).


Now, whether or not knowing what 'is' does, or whether knowing the
internals in regards to how object identity works, is necessary for
learning the language, I don't know.  It's been a few years since I was
a newb, but considering all of the questions regarding 'is' usually
resulting with python-list saying "you want '=='", I'd offer, 'it is not
necessary'.


 - Josiah

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


Re: Audio interviews of Guido or other Python advocates?

2004-12-05 Thread Fredrik Lundh
Carlos Ribeiro wrote:

> BTW, do bots have a sense of humour?

it depends; it's not in the standard library:

>>> import humour
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named humour
>>> import humor
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named humor
>>> humor
Traceback (most recent call last):
  File "", line 1, in ?
NameError: name 'humor' is not defined
>>> humour
Traceback (most recent call last):
  File "", line 1, in ?
NameError: name 'humour' is not defined

 



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


Re[2]: import fails

2004-12-05 Thread Laszlo Zsolt Nagy
Hello Fredrik,

Sunday, December 5, 2004, 8:31:45 PM, you wrote:

> Laszlo Zsolt Nagy wrote:

>> Definitely. However, it would be better if the exception occurred on the
>> bad assignment (e.g.  __all__ = [x])

> it does happen on the bad assignment (i.e. from foo import *)

Well, the traceback isn't useful. It does not tell you the line
number not even the name of the module.




---
Best,
  Laszlo

mailto:[EMAIL PROTECTED]
web:http:/designasign.biz


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


Re: Power with modulu

2004-12-05 Thread Mitja
On Sun, 05 Dec 2004 12:59:40 +0200, Roie Kerstein  
<[EMAIL PROTECTED]> wrote:

Hello!
I want to compute a**b%c for very long numbers.
Computing a**b and then applying modulu is not practical, since it takes
ages.
There is a built-in optional parameter to the long.__pow__(a,b[,modulu]),
and it works well.
My question is: How can I write it is a form of an expression, like a**b?
AFAIK you can't.
I prefer not to fill my script with calls of the form  
long.__pow__(a,b,c).
That's a bit ugly, yes; pow is also a builtin, e.g.:
pow(21,443,2)==1
--
Mitja
--
http://mail.python.org/mailman/listinfo/python-list


Re: string slicing

2004-12-05 Thread Ishwor
I didn't mean to be extremely rude. Just a little bit..~:-). sorry.

On Sun, 05 Dec 2004 12:09:22 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> 
[snip]

> 
> Goodness, you got right snippy with the 'intellectual property' thing.
> I'm sorry if it sounded as if I had meant "I came up with this before",
> I did not mean it that way.  What I meant was "good advice", "I've seen
> this advice before", and "I've previously taken note of it".  As an
> aside, I also believe that if Fredrik were concerned about my supposed
> theft of his 'advice IP', he would mention it
> 
> Confusions about 'is' are quite common.  Perhaps every week a new thread
> in regards to object identity is offered, usually asking about integer,
> string or list identity.  I'm not having much luck with the google
> incantation right now, but my email archive is spitting back a thread on
> "interning strings" from early November, which discusses strings and
> identity.
> 
> Really, everyone who is thinking of using 'is' should ask themselves
> whether or not it is truely important to have the same object.  In some
> cases it matters, and in others cases it doesn't matter.  The more
> experience one has with Python and the implementations of algorithms,
> the more obvious such choices will become.
> 
> A perfect example of a case when using 'is' is proper is by Barry Warsaw
> (http://mail.python.org/pipermail/python-dev/2004-March/043224.html):
> 
> missing = object()
> 
> if d.get('somekey', missing) is missing:
>   # it ain't there
> 
> In the case of it not mattering, there was a series of threads in March
> of this year in python-dev, discussing replacing the 'is' operator
> strictly comparing object identity with a 'can be replaced by' operator,
> spelled 'is'.  See the threads entitled "redefining is" here:
> http://mail.python.org/pipermail/python-dev/2004-March/thread.html
> Of course it came out that it didn't happen ('is' is much faster, and
> doesn't require objects to define a mechanism to get at their contents,
> etc.), but it is not uncommon for people who think they want 'is' to
> really want 'can be replaced by', especially in the case of tuples:
> 
> >>> a = tuple(list('hello'))
> >>> b = tuple(list('hello'))
> >>> a == b
> True
> >>> a is b
> False
> >>> CanBeReplacedBy(a, b)
> True
> >>>
> 
> (of course you need a proper implementation of CanBeReplacedBy, of which
> a few are offered in the previously mentioned 'replacing is' threads).
> 
> Now, whether or not knowing what 'is' does, or whether knowing the
> internals in regards to how object identity works, is necessary for
> learning the language, I don't know.  It's been a few years since I was
> a newb, but considering all of the questions regarding 'is' usually
> resulting with python-list saying "you want '=='", I'd offer, 'it is not
> necessary'.
> 
> 
> - Josiah

Thanx. Appreciate it. :)

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help With Hiring Python Developers

2004-12-05 Thread Yet Another Mike
"Ed Leafe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Allow offsite workers and you'll have all the candidates you want.
>
> Exactly. I'm 5 hours away in Rochester, NY, and might be interested

And, if they are willing to go offsite, why not go to India and save lots of 
bucks?

If I had the skills, I'd be willing to take a contract up to 1 year with 
expenses paid
to visit Manhattan!



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


Re: import fails

2004-12-05 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote:

>>> Definitely. However, it would be better if the exception occurred on the
>>> bad assignment (e.g.  __all__ = [x])
>
>> it does happen on the bad assignment (i.e. from foo import *)
>
> Well, the traceback isn't useful. It does not tell you the line
> number not even the name of the module.

you're missing the point: the error happens on the "from - import" line,
which 1) assígns to all names in __all__, and 2) contains the name of
the module.

if you put your code in a module, you'll find that the traceback does tell
you the line number (for the import statement), and the name of the pro-
blematic module; example:

Traceback (most recent call last):
  File "myprogram.py", line 8, in ?
from mymodule import *
TypeError: attribute name must be string

in interactive mode, the line number is usually 1, and the offending line is
the one you just typed.  which contains the name of the module.

this doesn't mean that the error message cannot be improved, of course,
but things aren't quite as bad as you make them sound.

 



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


Re: Audio interviews of Guido or other Python advocates?

2004-12-05 Thread Jeremy Bowers
On Sun, 05 Dec 2004 21:21:50 +0100, Fredrik Lundh wrote:

> Carlos Ribeiro wrote:
> 
>> BTW, do bots have a sense of humour?
> 
> it depends; it's not in the standard library:
> 
 import humour
> Traceback (most recent call last):
> etc.

Considering where the name "Python" came from, I consider this a major
oversight. If Python can't lead the way in this domain, what hope does a
language like Java or APL have? 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why no python setup.py uninstall?

2004-12-05 Thread Colin J. Williams
Peter Hansen wrote:
Alia Khouri wrote:
I'm guessing that this is a non-issue for most people (-;

Well, you've allowed all of about 1.5 days for replies
to come, and on a weekend at that.
Be patient.
I would also guess it's a non-issue as well, however.
A quick perusal of the archives (which I leave to you)
would very likely show almost no discussion of this in
the past few years (at least, that's what I recall).
On your specific reason for asking: I would suggest
just not worrying about "being extra clean about it".
Python's generally pretty good about not messing up
when you install a new version of something without
uninstalling the previous version.
-Peter
"Cleanliness is next to godliness".  Why not facilitate a cleanup?
This is not a big issue but it does deserve a response.
Colin W.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How is Python designed?

2004-12-05 Thread Diez B. Roggisch
Hi,

> First, there is no abstract syntax tree generated for
> the whole program, except for arithmetic
> expression(even for this, it is slightly different
> from what you said, I will come back to this point).
> The Yuan (the name of the interpreter I designed)
> interpreter first scans the source script, when it see
> a pattern, for example "if(a>1)", it generates a
> phrase object containing the arithmetic expression and
> the ID (it is determined after all phrase objects are
> created) of other two phrase objects. This phrase
> object has a member method "execute()", whose
> execution will return one of the IDs depending on the
> value of "a>1". Then the next phrase object with that
> ID is executed, and so on. I don't know how is the AST
> for a whole program, I think it should be more
> complicated than this.

Ok, thats clearer. This whole thing sounds familiar - the technique you
describe seems to resemble continuation passing style. For a brief
discussion read here:

http://www.ps.uni-sb.de/~duchier/python/continuations.html

Python has a continuation-based interpreter implementation - its called
"stackless python". Google for it. It certainly is interesting.

And I don't see that the ast is more complicated, at least implementation
wise - in fact, your method requires more analysis as  for each statement
its pollible successors have to be computed and made known to it - where an
ast node only knows about its children that more or less directly stem from
the syntax analysis.

I have to admit that I don't know if continuation-based evaluation has
inherent performance-gains. The only thing I can think of is that you don't
need a stackframe in some cases as tail-recursion - useful, but not so
common that one would expect significant performance gains there. But as I
said - I'm not on sure ground here.

> Then about arithmetic expression, indeed, it is
> represented as tree. But in Yuan each node contains
> all the information it need for evaluation. For
> example, the leaves contains either a variable or a
> constant value or a function call, and other nodes
> contains the operators. So far it is more or less the
> same as what you mentioned. But the evaluation is
> performed on this tree directly with deep first
> search, which is different from the two methods you
> mentioned. The first one you mentioned is the same as
> my first implementation, which results an unefficient
> recursive function call. The second is the standard
> way of evaluating arithmetic expressions. I guess I am
> not the first one to evaluate arithmetic expression by
> deep-first search on the tree (I would be surprised if
> I am). Any way it is enough efficient.

Can you elaborate on what you consider beeing an unefficient recursive call
and where there is a difference between your method of evaluation and the
ast-evaluation I mentioned? After all, the ast-evaluation is a postorder
traversal which has the same complexity of a depth first search - the only
difference beeing the latter one using a fifo, the forme a lifo for
managing the list of untraversed nodes. I don't see any difference here. 

The second method I mentioned rids you of the traversal as it serialzes the
nodes as simple statements in the order of choice - but the number of steps
is the same.

> Your further comments and discussion are welcome, I'm
> not that type who is afraid of negative opinions :)
> Any way I will continue to improve that interpreter,
> it's an interesting thing for me.

I don't have negative opinions about yuan and by no meants want to
discourage you developing it. Its a nice project.

-- 
Regards,

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


Re: help using sockets, and OOP?

2004-12-05 Thread Dfenestr8
On Sun, 05 Dec 2004 20:17:31 +, Jp Calderone wrote:

>   Your problem doesn't seem to have anything to do with "OOP" (whatever
>   that is).  Rather, you are trying to use two blocking sockets at once.
> 
>   socket.connect() and socket.recv() are both "blocking" operations by
>   default - they can take an arbitrary amount of time to return.
>   Additionally, Botling.receiveData, one of your own functions, is also
>   blocking: it will actually loop forever, never returning (until an
>   exception blows it up).  So execution of your program never even
>   _gets_ to the "bert2 = ..." line.  It's stuck running
>   bert1.receiveData().


Ok, so what if I remove the while loop from the Botling class, and include
it in the __main__ ? Might this work as a solution then?
 
if __name__ == '__main__':
bert1 = Botling("^berty^", "#exciting", "irc.interesting.org")
bert2=Botling("^berty^", "#interesing", "irc.exciting.org")

bert1.connectBot()
bert2.connectBot()

while 1:
bert1.receiveData()
bert2.receiveData()
-- 
http://mail.python.org/mailman/listinfo/python-list


mod_python and the interpreter, no module _apache

2004-12-05 Thread Jeff
Ok, so I'm working on a project right now that is being done in psp
through apache.  This is working fine, except that in every one of my
modules I had to use the mod_python function of apache.import_module
for its autoreload capability.

Now I cannot open or run any of my classes in the interpreter without
getting a "No module named _apache" error.  I need to get this
working, as I am without unittesting right now.

I also tried making my unit test into a psp page, but then I get an
error about:


Mod_python error: "PythonHandler mod_python.psp"

Traceback (most recent call last):

  File 
"/usr/local/stow/Python-2.3.4/lib/python2.3/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
result = object(req)

  File 
"/usr/local/stow/Python-2.3.4/lib/python2.3/site-packages/mod_python/psp.py",
line 297, in handler
p.run()

  File 
"/usr/local/stow/Python-2.3.4/lib/python2.3/site-packages/mod_python/psp.py",
line 208, in run
exec code in global_scope

  File 
"/export/eecs/htdocs/eecs3550/team1/proj/lib/unittests/testRequestContainer.psp",
line 77, in ?
unittest.main()

  File "/usr/local/stow/Python-2.3.4/lib/python2.3/unittest.py", line
714, in __init__
argv = sys.argv

AttributeError: 'module' object has no attribute 'argv'


So that doesn't seem to work right for what I want either.

Does anybody know of a way to get both of these to coexist peacefully?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help using sockets, and OOP?

2004-12-05 Thread Jp Calderone
On Mon, 06 Dec 2004 07:45:34 +1000, Dfenestr8 <[EMAIL PROTECTED]> wrote:
>On Sun, 05 Dec 2004 20:17:31 +, Jp Calderone wrote:
> 
> >   Your problem doesn't seem to have anything to do with "OOP" (whatever
> >   that is).  Rather, you are trying to use two blocking sockets at once.
> > 
> >   socket.connect() and socket.recv() are both "blocking" operations by
> >   default - they can take an arbitrary amount of time to return.
> >   Additionally, Botling.receiveData, one of your own functions, is also
> >   blocking: it will actually loop forever, never returning (until an
> >   exception blows it up).  So execution of your program never even
> >   _gets_ to the "bert2 = ..." line.  It's stuck running
> >   bert1.receiveData().
> 
> 
> Ok, so what if I remove the while loop from the Botling class, and include
> it in the __main__ ? Might this work as a solution then?

  No.

>  
> if __name__ == '__main__':
>   bert1 = Botling("^berty^", "#exciting", "irc.interesting.org")
>   bert2=Botling("^berty^", "#interesing", "irc.exciting.org")
> 
>   bert1.connectBot()
>   bert2.connectBot()
>   
>   while 1:

  Try adding a simple print statement here, so you can see how often the 
program begins executing this while loop.

>   bert1.receiveData()

  And here so you can see when bert1.receiveData() has finished.

>   bert2.receiveData()

  And here so you can see when bert2.receiveData() has finished.

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


What's New on the Web : Today

2004-12-05 Thread etamp
What's New on the Web : Today
http://www.etamp.net/
===
Etamp(etamp.net) provides latest news of web sites around the globe. You can 
inform free of 
charge what is happening in your web site. To submit your releases, you must 
first become a 
member. It's free, fast and easy. 

==

[ url2image.com Offers New Service to Help Web site Designers and Webmasters 
Discover 
Problems with Lack of Browser Compatibility ]
url2image.com Offers New Service to Help Web site Designers and Webmasters 
Discover 
Problems with Lack of Browser Compatibility A new service of¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1049

 

[ ICQ joins webmail battles with new service ]
ICQ joins webmail battles with new service By Juan Carlos Perez The 
increasingly 
competitive webmail market has a new player: Instant messaging¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1048

 

[ Voiceglo Issues Call for Beta Users for GloConnect IM Application ]
Voiceglo Issues Call for Beta Users for GloConnect IM Application December 2004 
?Voiceglo, a global communications and networking company, to¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1047

 

[ OmniOutliner 3.0 announced, public beta available ]
OmniOutliner 3.0 announced, public beta available The Omni Group today 
announced 
a major new upgrade to its outlining and organizational applicati¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1046

 

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


I need to create the table and I want to edit its content from www level.

2004-12-05 Thread Rootshell
I need to create the table and I want to edit its content from www
level.

Here is some example:

http://www.rootshell.be/~flash44

There is a table.
Is there possibilty to edit the content using  command?

Could you show me the way how to do it?

My vision is:
User has its login and password. When he logs in the table space opens
and he can edit the content.

I need a few lines of code for example or url with similar idea.

Best regards.

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


Re: Linguistic challenge: name this program

2004-12-05 Thread Phil Schmidt
> A few years ago, a first implementation of "Karel the Robot" in Python
> was created and called PyKarel. A second, newer implementation is
> called Guido van Robot (GvR for short), and is available at
> gvr.sourceforge.net. Work is currently underway by the developpers of
> GvR to produce a new-and-improved version.

This thing is very cool, and it will be great for my kids to learn
with, once they're old enough to read.  :)

(I even had fun with it myself, spending much more time with it than I
should have!)

Thanks for the great work!

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


VIRUS ALERT: W32/Mydoom.O@mm

2004-12-05 Thread webmaster
This is a notice from Inter-netcom Mail Server. You sent an email infected with 
a virus. Please take action and clean your computerReceived: (qmail 12701 
invoked from network); 5 Dec 2004 21:41:05 -
Received: from corporativo?16780-209.pool.etb.net.co.80.167.65.in-addr.arpa 
(HELO python.org) (65.167.80.209)
  by ns.internet.com with SMTP; 5 Dec 2004 21:41:05 -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Returned mail: Data format error
Date: Sun, 5 Dec 2004 18:25:00 -0500
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_NextPart_000_0006_6F3805A9.6E84F71B"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.

Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit

Content-Type: application/octet-stream;
name="[EMAIL PROTECTED]"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="[EMAIL PROTECTED]"


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


Re: string slicing

2004-12-05 Thread Carlos Ribeiro
On Sun, 5 Dec 2004 17:07:47 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> a suggestion: if you really want to be productive in python, forget about
> "is" for a while.  good code doesn't copy stuff much, either, by the way.
> python's all about objects, and things that hold references to objects.

I believe that the "is-obsession" has its roots on the old C-ish
confusion about comparing pointers vs. actual contents pointed by
them. That's about the same here, except that Python isn't C, and that
object references in Python behave in a sane way :-) making "is"
unnecessary most of the time.

-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: [EMAIL PROTECTED]
mail: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help using sockets, and OOP?

2004-12-05 Thread Peter Hansen
Dfenestr8 wrote:
Basically, I'm trying to hack up an IRC bot, that joins two servers at
once. I use two object instancs of the same class, both of which make
connections using the socket module.
Problem is, I can't seem to get both objects to connect to their
constituent servers at the same time. I'm not sure whether it's that both
objects can't instantiate at once, or whether only one can use the socket
module at any one time.
What's the symptom of the problem?  I expect your answer
to include a traceback, but perhaps it's something else
like a segmentation fault or something you are observing
yourself...  whatever it is, providing a description of
it would be better than just saying you "can't seem to get"
it working...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: I need to create the table and I want to edit its content from www level.

2004-12-05 Thread Peter Hansen
Rootshell wrote:
I need to create the table and I want to edit its content from www
level.
Here is some example:
http://www.rootshell.be/~flash44
There is a table.
Is there possibilty to edit the content using  command?
Could you show me the way how to do it?
My vision is:
User has its login and password. When he logs in the table space opens
and he can edit the content.
I need a few lines of code for example or url with similar idea.
What you seem to be looking for might be described as very
similar to the "wiki" concept.  Search for that on, say,
wikipedia.org, or pay a quick visit to Google, and you'll
be a long step towards solving your problem.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


PajamaScript

2004-12-05 Thread Jerome Chan
I wrote something called PajamaScript. Basically, it parses a text
file and looks for  tags. Then it calls python to handle the
scripting. Why learn another language when you already know Python?



This is fun!


The Date is .
The Time is .





PajamaScript then calls the function "zdate" in module "misc" and the
output replaces the tag. This is not really tested in any production
system, just a proof of concept I did for a project that never
materialized. In order to access cgi variables, you can use the cgi
module or any other python module! Would this be useful to anyone?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help With Hiring Python Developers

2004-12-05 Thread Michael Fuhr
Ian Bicking <[EMAIL PROTECTED]> writes:

> ...that it's easy to learn and maintain means that there's less risk
> in using a highly skilled, highly productive programmer; in other
> languages you risk being left with a program that only another
> highly skilled programmer can maintain.

Indeed.  An acquaintance of mine advocates writing code that only
skilled programmers can maintain (he favors a language that shall
remain nameless but that has been known to resemble modem noise or
cartoon swearing).  His justification isn't that he wants to keep
the work in the good-ol'-boy network (although that might be part
of it), but that by making it difficult for anybody else, you're
ensuring that only good programmers ever work on the code.

Tell that to the poor slob who gets stuck with the job because the
department can't or won't hire anybody else.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pickle and py2exe

2004-12-05 Thread Justin Straube
On 3 Dec 2004 01:46:38 -0800, johan@ (Johan Lindberg) wrote:

Thanks Johan, 

>I'm assuming that your library.zip now has several encoding-files in
>it? And more specifically that you have a file called
>"string_escape.pyc" in path "encodings". Right?

I had found a stupid mistake in my setup.py. I corrected it and the .zip now has
the string_escape.pyc file in the correct path. And also the program runs as it
should. 

> # encoding= iso-8859-1
> spam= "Det här är svenska"
> print spam.decode("string-escape")
>
>What happens when you compile that script to an exe using the above
>setup.py?
>(don't forget to change windows= ["spam.py"] to console= ["spam.py"])

This gives a LookupError: no codec search function registered: can't find
encoding

I then tried with the encoding package added and the .exe did print the spam
string.  

>Also you might want to try the py2exe-users list (see
>http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/py2exe-users).

Thanks, Ill check this out. 


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


Re: How is Python designed?

2004-12-05 Thread Limin Fu
Well, you are the first who really want to join to the
development of Yuan, I'm quite glad. We can further
discuss in detail outside of this python mailing list,
since it is not the place for such discussion. Here I
just mention a few things here, maybe I can also get
some advices from some experienced guys, hopefully.

First, I don't doubt your C++ skill, theoretical
background and passion for developing a scripting
language. BUT YOU SHOULD MAKE SURE IF YUAN IS THE SAME
AS WHAT YOUR HAVE THOUGHT. I should point out that,
there is no virtual machine in Yuan, you can read some
discussion posts I made with others people in this
list. I can give more details on Yuan if you want. You
may also have a look to the website:
http://yuan-language.sourceforge.net/
Though Yuan is not well documented yet, you can get
some impression of it from that website.

Second, it is about licensing. Yuan will always be
available under GPL (as long as it will survive). But
I also wanted it can be used for commercial
applications. Now what I'm thinking and planing to do
is, to add one or two exceptions to GPL, so that Yuan
can be used for certain types of commercial
application without charging a fee, but COMPLETE
integration (I mean when the communication between
Yuan and other applications is beyond certain
predefined interfaces) of Yuan with no GPLed
applications would require a license fee(of course
part of it will be share by the developers
proportional to their contribution and the other part
will be used to promote Yuan). The main reason I want
to do so is, I want to setup a more or less
stable(maybe not, I want to try it out) financial
source for the development of Yuan. I am not sure if
this licensing model will work for the interpreter of
a scripting language :). Anyone tried it?

In the case of scripting language, licensing is just a
matter of strategy to enlarge the usage of itself
(maybe I'm wrong). The reason I don't adopt the same
strategy of python or perl etc. is that, I'm really
not sure how many companies are willing to support
such project voluntarily. Maybe somebody here can give
me a hint.

Anyway, anyone is welcome to join the develop of Yuan.
If you don't agree with me on some of the above
points, please tell me of your opinions, and I will
consider them carefully. Thanks in advance.

Best regards,

Limin



--- Robert <[EMAIL PROTECTED]> wrote:

> Sorry for my interrupting the discussion : ).  I am
> a graduate student
> in a chinese  university, and i am very interested
> in the Yuan
> language. I'd like to join in the development of
> Yuan and do some work
> for this language. BTW, i like this word, "Yuan" : )
> 
> I have 3 or 4 years experience in C++, and i have
> strong programming
> skills about C++(at least in my opinion :) ) . I am
> interested in the
> compiling technology and virtual machine technology.
> And i am reading
> the  C/C++> written by
> Bill Blunden now. I had the thought of starting an
> open source project
> which contains a virtual machine and a scripting
> language a few days
> ago, just like a very simple python. Well, i know it
> is very difficult,
> but it is my dream : ). Luckly i  found "Yuan" here.
> So it is my
> pleasure if i can become a member of "Yuan" :)
> 
> Waiting for your reply. :)
> 
> Best regards.
> 
> 
> Ru Chen
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




__ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help With Hiring Python Developers

2004-12-05 Thread Paul Rubin
[EMAIL PROTECTED] (Michael Fuhr) writes:
> Indeed.  An acquaintance of mine advocates writing code that only
> skilled programmers can maintain (he favors a language that shall
> remain nameless but that has been known to resemble modem noise or
> cartoon swearing).

TECO?  Some of the best programmers I know used it, but I hadn't heard
of anything being done in it in quite a while.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How is Python designed?

2004-12-05 Thread Limin Fu
Hi,

> Ok, thats clearer. This whole thing sounds familiar
> - the technique you
> describe seems to resemble continuation passing
> style. For a brief
> discussion read here:
> 
>
http://www.ps.uni-sb.de/~duchier/python/continuations.html
> 
> Python has a continuation-based interpreter
> implementation - its called
> "stackless python". Google for it. It certainly is
> interesting.

That's interesting. I heared of stackless pyton a few
days ago, I will have a more careful look at it. 

> And I don't see that the ast is more complicated, at
> least implementation
> wise - in fact, your method requires more analysis
> as  for each statement
> its pollible successors have to be computed and made
> known to it - where an
> ast node only knows about its children that more or
> less directly stem from
> the syntax analysis.

Not really. You think in this way, maybe because you
know more about AST and less about that technique I
mentioned. I thinked in the opposite
way because I know different things better. 
Hehe.

> I have to admit that I don't know if
> continuation-based evaluation has
> inherent performance-gains. The only thing I can
> think of is that you don't
> need a stackframe in some cases as tail-recursion -
> useful, but not so
> common that one would expect significant performance
> gains there. But as I
> said - I'm not on sure ground here.

I'm not sure either. Certainly it depends very much in
the implementation. If anybody want, we can make some
tests to check. I don't know if it's important,
because it seems people dosen't really care about the
efficiency of an interpreter (as long as it is not
really really too slow).

> Can you elaborate on what you consider beeing an
> unefficient recursive call
> and where there is a difference between your method
> of evaluation and the
> ast-evaluation I mentioned? After all, the
> ast-evaluation is a postorder
> traversal which has the same complexity of a depth
> first search - the only
> difference beeing the latter one using a fifo, the
> forme a lifo for
> managing the list of untraversed nodes. I don't see
> any difference here. 

Sorry maybe I didn't understand that part correctly
and took grant that it would be implemented in
recursive way. I just wondered if the following can be
extended for arbitrary length arithmetic expressions:
Assignment("foo", BinaryOp("+", Get("a"),
BinaryOp("*", Get("b"), Get("c"

> I don't have negative opinions about yuan and by no
> meants want to
> discourage you developing it. Its a nice project.
> 

If I upseted you or anybody here by un-properly used
words, please forgive me. I always feel my english
must be improved :)

Best regards,

Limin






__ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How is Python designed?

2004-12-05 Thread Limin Fu
> I'm
> > not that type who is afraid of negative opinions
> :)

In fact, I was trying to say it in joking way.
Unfortunately, it is not obvious due to my poor
english!

Limin



__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PajamaScript

2004-12-05 Thread Eric Pederson
Jerome (aka evil tofu) advised:

> I wrote something called PajamaScript. Basically, it parses a text
> file and looks for  tags. Then it calls python to handle the
> scripting. Why learn another language when you already know Python?
> 
> 
> 
> This is fun!
> 
> 
> The Date is .
> The Time is .
> 
> 
> 
> 
> 
> PajamaScript then calls the function "zdate" in module "misc" and the
> output replaces the tag. This is not really tested in any production
> system, just a proof of concept I did for a project that never
> materialized. In order to access cgi variables, you can use the cgi
> module or any other python module! Would this be useful to anyone?


Every tool has a use!  Offhand it occurs to me this might a simple, well 
organized structure for a cgi environment, though I wonder if the extra level 
of processing might make it a little slow.  Ought to be other uses too...

I _do_ think the  tags and the title "PajamaScript" is brilliant marketing. 
 Highest kudos!


["PajamaScript" beats "PyTxtParse2ModuleExecEnviron.py" !]

Any functioning examples of its use?



Eric Pederson
:::
def eAddy():
domainNot="@something.com"
domainIs=domainNot.replace("s","z")
ePrefix="".join([chr(ord(x)+1) for x in "do"])
mailMeAt=ePrefix+domainIs
return mailMeAt
:::

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


Re: [Python-Help] Programming help

2004-12-05 Thread Alfred Canoy
Please help me out:(.. I've been trying to figure this out for 2 days now..
I don't know what to use to print  all the list of numbers. I hve know idea 
how should I do this. I tried a lot of trial & error for the the def, dict, 
.list( ). have no luck.
I just need to find this out then I'm good to go for the whole thing. I have 
save the other test source code for this problem. I just need to combine it 
after I figure this out.
Thank you all!

Source code:
# compute the Mean, Median & Mode of a list of numbers:
sum = 0.0
print 'This program will take several numbers then average them'
count = input(' How many numbers would you like to sum: ')
current_count = 0
freq = {}
freq [current_count] = number
while current_count < count:
   current_count = current_count + 1
   number = input ('Enter a number: ')
   print "Number", current_count,":",number
   sum = sum + number
print " [x,...,x] ?"
Al
_ _
_ _
Alfred Canoy
Agana, Guam
Pacific time
[EMAIL PROTECTED]
- Original Message - 
From: "Matthew Dixon Cowles" <[EMAIL PROTECTED]>
To: "Alfred Canoy" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 06, 2004 11:50 AM
Subject: Re: [Python-Help] Programming help


Dear Alfred,
I'm stuck in the end of my source code. I'm trying to print all the
numbers. How can I print all the list of numbers that I selected?
What have you tried and how did the results differ from what you
expected?
Regards,
Matt 
--
http://mail.python.org/mailman/listinfo/python-list


Programming help

2004-12-05 Thread Alfred Canoy



Hello,
 
I'm stuck in the end of my source code. I'm trying 
to print all the numbers. How can I print all the list of numbers that I 
selected? 
 
 
Source 
code:# compute the Mean, Median & Mode of a list of 
numbers:sum = 0.0print 'This program will take several numbers 
then average them'count = input(' How many numbers would you like to sum: 
')current_count = 0freq = {}freq [current_count] = 
numberwhile current_count < count:    
current_count = current_count + 1    number = input ('Enter a 
number: ')    print "Number", 
current_count,":",number    sum = sum + 
numberprint " [x,...,x] ?"
 
Output:
 
This program will take several numbers then average them
number 1:  2
number  2:  3
number  3:  4
number  4:  2
 
How can I print: [2,3,4,2]?
 
Greatly appreciates!
Al _ __ _Alfred CanoyAgana, 
GuamPacific time[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

help asap

2004-12-05 Thread the_proud_family

HELP ME PLEASE!! my email is [EMAIL PROTECTED]

I can't get the ball to go up right side and then I need it to turn

around and keep turning until velocity=0 I have been at it for the

past 2 weeks now i give up and call for help. Please if anyone can

gide me through i will be so grateful!! I have pasted my code below





from cmath import *

from visual import *

floor1 = box(length=10, height=0.5, width=4, color=color.blue)

floor1.pos = (-6,4,0)

floor1.axis= (5,-5,0)

floor2 = box(length=10, height=0.5, width=4, color=color.blue)

floor2.pos = (6,4,0)

floor2.axis= (-5,-5,0)

floor3 = box(length=7, height=0.5, width=4, color=color.blue)

floor3.pos = (0,1.25,0)

ball= sphere(radius=0.5, color=color.red)

ball.pos=(-8.6,7.5,0)

m=3. #kg

angle=asin(3.6/5.)#radians

g=-9.8

mu=.2

N=mgcos(angle)

F=mgsin(angle)

f=mu*N

lax=(-Nsin(angle)+fcos(angle))/m

lay=(-Ncos(angle)-fsin(angle)+m*g)/m

rax=(+Nsin(angle)+fcos(angle))/m

ray=(-Ncos(angle)-fsin(angle)+m*g)/m

ds=0.01

dt=0.01

vx=lax*dt

vy=lay*dt

ball.velocity=vector(vx,vy,0)

#print a

while 1:

rate(100)

ball.velocity.x=ball.velocity.x+lax*dt

ball.velocity.y=ball.velocity.y+lay*dt

ball.pos=ball.pos+ball.velocity*dt

if ball.x>-3.5 and ball.x<=3.5:

vx=sqrt(2(-gball.y+0.5(vx2+vy2)-fds))

ball.velocity.x=ball.velocity.x+mugdt

ball.velocity.y=0

ball.pos=ball.pos+ball.velocity*dt

if ball.x>3.5 and ball.x<8.6:

vx=vx*cos(angle)

vy=sqrt(2/m(m-gball.y-fds))

#print vy

vy=vy*sin(angle)

#print vy

ball.velocity.x=ball.velocity.x+rax*dt

ball.velocity.y=ball.velocity.y+ray*dt

ball.pos=ball.pos+ball.velocity*dt

#print ball.pos




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


Re: [Python-Help] Programming help

2004-12-05 Thread Abe Mathews
I guess I don't understand what "freq" is doing.  However, you could
do something like:

num_list = []

while len(num_list) < count:
number = input("Enter a number:")
num_list.append(number)

print num_list

That may give you what you're looking for to print the list of input numbers.

Abe Mathews



On Mon, 6 Dec 2004 12:07:58 +1000, Alfred Canoy <[EMAIL PROTECTED]> wrote:
> Please help me out:(.. I've been trying to figure this out for 2 days now..
> I don't know what to use to print  all the list of numbers. I hve know idea
> how should I do this. I tried a lot of trial & error for the the def, dict,
> .list( ). have no luck.
> I just need to find this out then I'm good to go for the whole thing. I have
> save the other test source code for this problem. I just need to combine it
> after I figure this out.
> Thank you all!
> 
> 
> 
> 
> Source code:
> 
> # compute the Mean, Median & Mode of a list of numbers:
> 
> sum = 0.0
> 
> print 'This program will take several numbers then average them'
> count = input(' How many numbers would you like to sum: ')
> current_count = 0
> freq = {}
> freq [current_count] = number
> 
> while current_count < count:
> current_count = current_count + 1
> number = input ('Enter a number: ')
> print "Number", current_count,":",number
> sum = sum + number
> print " [x,...,x] ?"
> 
> Al
>  _ _
> _ _
> Alfred Canoy
> Agana, Guam
> Pacific time
> [EMAIL PROTECTED]
> 
> - Original Message -
> From: "Matthew Dixon Cowles" <[EMAIL PROTECTED]>
> To: "Alfred Canoy" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, December 06, 2004 11:50 AM
> Subject: Re: [Python-Help] Programming help
> 
> > Dear Alfred,
> >
> >> I'm stuck in the end of my source code. I'm trying to print all the
> >> numbers. How can I print all the list of numbers that I selected?
> >
> > What have you tried and how did the results differ from what you
> > expected?
> >
> > Regards,
> > Matt
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


exec and global puzzle

2004-12-05 Thread Andr? Roberge
I have the following two files:

#--testexec.py--
def exec_code(co):
try:
exec co
except:
print "error"

#-- test.py--
import thread
import testexec
import time

code = "def a():\n print 'a'\n\n" +\
   "def c():\n a()\n\nc()"

code2 = "def a():\n print 'a'\n\n" +\
   "def c():\n global a\n a()\n\nc()"

print " exec code - no global"
exec code
print " exec from thread - no global"
thread.start_new(testexec.exec_code, (code,))
time.sleep(1)
print "\n exec code2 - with global"
exec code2
print " exec from thread - with global"
thread.start_new(testexec.exec_code, (code2,))
#---

Here's the output when I execute test.py:

 exec code - no global
a
 exec from thread - no global
error

 exec code2 - with global
a
 exec from thread - with global
a
#-
Without the global statement, I get an error when trying to execute
the code.
I don't understand why I need to use the global statement within the
definition of c() in order for it to know what a() is.  If I define
exec_code() within test.py and use it there, I do not get any error,
with or without the use of a global statement.

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


Re: PajamaScript

2004-12-05 Thread Roger Binns

"Jerome Chan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>I wrote something called PajamaScript. Basically, it parses a text
> file and looks for  tags. Then it calls python to handle the
> scripting. Why learn another language when you already know Python?

Why write another templating tool, when there are so many already
(other than as a valuable learning exercise).  Check out the
Python Cookbook:

http://aspn.activestate.com/ASPN/Python/Cookbook/

It has several.  Here are the best:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52217
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/162292

Note that they also deal with the area you will have an issue
in which is how to add conditional statements.

Roger 


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


Seeking Python + Subversion hosting.

2004-12-05 Thread Tom Locke
Hi,

Anyone know of a good hosting company that offers both server-side
Python and a subversion repository?

I know of one: www.textdrive.com - they're a bit pricey, but I s'pose
you gets what you pays for - they look good.

Just FYI - right now I'm with sapphiresoft.co.uk. They're cheap and in
my brief experience have been pretty good at responding to support
issues. They gave me a big 'no' to subversion though. (tip: if you use
these guys, be sure to tell them you want the server with the latest
Python goodies *before* you sign up!)

Thanks,

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


python2.4 os.environ BUG

2004-12-05 Thread mahongquan
when i install moinmoin in python 2.4,windows server2000, I found it has a
bug,cgiHttpServer.py set environ,but the cgi python script can not get the
environ variant,such as environ['script_name'],so moin donot display correct
web page.


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


Re: Python-Help ( Mean,Median & Mode)

2004-12-05 Thread Dan Bishop
"Alfred Canoy" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Hello,
> 
> I revised my source code. It was doing great but I'm having problem listing 
> all the numbers that I'd input. How can I input all the numbers that I 
> selected? The source code and the output below:
> 
> Source code:
> 
> # compute the Mean, Median & Mode of a list of numbers:
> 
> sum = 0.0
> 
> print 'This program will take several numbers then average them'
> count = input(' How many numbers would you like to sum: ')
> current_count = 0
> freq = {}
> freq [current_count] = number
> 
> while current_count < count:
> current_count = current_count + 1

A cleaner way of writing this is

  for current_count in xrange(1, count+1):

However, there's still a better way.

> number = input ('Enter a number: ')

It's better to use float(raw_input('Enter a number: ')) to make sure
that the user is actually entering a number.  But there's a more
important problem with your code: when the user inputs a new number,
the old one is simply discarded, so you can't calculate the median and
mode.

> print "Number", current_count,":",number
> sum = sum + number
> print ' The average is:', sum/count

A better way of writing the above code is:

def input_numbers(count):
   "Asks the user for numbers, and returns them in a list."
   return [float(raw_input('Enter a number: ')) for i in
xrange(count)]

def mean(numbers):
   "Returns the arithmetic mean of a numeric list."
   return sum(numbers) / len(numbers)

numbers = input_numbers(count)
print 'The average is:', mean(numbers)

> # list the numbers selected by user then gets the median & mode
> 
> listNumbers=[]
> for list in number:
> listNumbers[list]=listNumbers.get(x,0)+1
> 
> print listNumbers

This isn't valid code.  "number" isn't a sequence.

Also, you don't have any code for computing the median.  The simplest
way to do this is:

def median(numbers):
   "Return the median of the list of numbers."
   # Sort the list and take the middle element.
   n = len(number)
   copy = numbers[:] # So that "numbers" keeps its original order
   copy.sort()
   if n & 1: # There is an odd number of elements
  return copy[n // 2]
   else:
  return (copy[n // 2 - 1] + copy[n // 2]) / 2

> freq = {}
> current_count(freq)=number
> while number != 0:
> number = input ('Enter a number: ')
> count = count + 1
> sum = sum + number

Don't ask for numbers twice.  Just iterate over the "number" list from
earlier.

> try:
> freq[number] += 1
> except KeyError:
> freq[number] = 1
>
> max = 0
> mode = None
> for k, v in freq.iteritems():
> if v > max:
> max = v
> mode = k
> print mode
> 
> 
> Output:
> >>> This program will take several numbers then average them
> Number 1 : 6
> Number 2 : 9
> Number 3 : 8
> Number 4 : 4
> Number 5 : 2
>  The average is: 5.8
> Traceback (most recent call last):
>   File 
> "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", 
> line 310, in RunScript
> exec codeObject in __main__.__dict__
>   File "A:\SLP5.py", line 23, in ?
> for x in number:
> TypeError: iteration over non-sequence
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Seeking Python + Subversion hosting.

2004-12-05 Thread Doug Holton
Tom Locke wrote:
Hi,
Anyone know of a good hosting company that offers both server-side
Python and a subversion repository?

With user-mode linux hosting you can have your own virtual root system 
with which you can run whatever python stuff you want as well as 
subversion or other server processes for about the price of standard 
shared (php+mysql) hosting.  I picked this option so that for example I 
could run mod_python.  The catch is that disk access is a little slower 
and RAM is more constricted, unless you pay for higher RAM.  See:
http://developers.coedit.net/UserModeLinux
--
http://mail.python.org/mailman/listinfo/python-list


Time for : comp.lang.python.newbies ??

2004-12-05 Thread gmduncan
Am I correct in detecting a greater presence of Newbies in
this  "Pierian Spring" aka c.l.p. ??
Seems there's more than the usual bunch of pleas for help
esp. from the Newbie Windoze fraternity.
And it seems the Uber-Gurus (You Know Who You ARE) have retreated
a bit - most are in the NH so it can't be that they are holidaying
in the Bahamas, Greece, and Corfu and the like, in their winter
"of discontent" no doubt.
Maybe a time for a new discussion group along that suggested
by the Subject line ?
I've got nothing against Newbies - I was one once - but there
is a limit.
Or is their increasing presence here a price we must pay for their
belated recognition of this wonderful language ?
- Gary ( GURU-aspirant ;)


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


Re: Power with modulu

2004-12-05 Thread Bengt Richter
On Sun, 05 Dec 2004 12:59:40 +0200, Roie Kerstein <[EMAIL PROTECTED]> wrote:

>Hello!
>
>I want to compute a**b%c for very long numbers.
>Computing a**b and then applying modulu is not practical, since it takes
>ages.
>There is a built-in optional parameter to the long.__pow__(a,b[,modulu]),
>and it works well.
>My question is: How can I write it is a form of an expression, like a**b?
>I prefer not to fill my script with calls of the form long.__pow__(a,b,c).
>
You could subclass long to use a fixed modulus stored as a class variable,
and make a factory function to return a class for a particular modulus, e.g.,

 >>> def mmod(modulus):
 ... class M(long):
 ... def __pow__(self, p):
 ... return type(self)(long.__pow__(self, p, self.modulus))
 ... def __repr__(self): return 'M(%s %%%s)'% (long.__repr__(self), 
self.modulus)
 ... M.modulus = modulus
 ... return M
 ...
 >>> M  = mmod(7)
 >>> M
 
 >>> M(2**55)
 M(36028797018963968L %7)

note that print will use the __str__ method of the underlying long
 >>> print M(2**55)
 36028797018963968
 >>> print M(2**55)**1
 2

I made the power operation return the same type
 >>> M(10)
 M(10L %7)
 >>> M(10)**1
 M(3L %7)
 >>> M(10)**2
 M(2L %7)
 >>> M(10)**3
 M(6L %7)
 >>> M(10)**4
 M(4L %7)

But if you use another operation, the result will be converted to the dominant 
type,
since the only operation I overrode was __pow__. But you could override them 
all, by hand
or automate the wrapping with a metaclass.

 >>> M(10)**4 *1
 4L
 >>> M(10)**4 +0
 4L
 >>> M(10)**4 +0.0
 4.0
 >>> M(10)**4 *1e1
 40.0

You could also make M take an optional initialization parameter to override 
what's set with mmod.
Or if you override all the time, not bother with mmod. Depends on what you need 
& how you are
going to use the stuff.

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


BayPIGgies: December 9, 7:30pm

2004-12-05 Thread Aahz
The next meeting of BayPIGgies will be Thurs, Dec 9 at 7:30pm.  

Stephen McInerney and Terry Carroll lead a discussion on how to make your
employer open-source-friendly:

- how to get your work published
- how to package your work for distribution
- how to negotiate open-source clauses in a contract
- the different types of license (which is suited to what)


BayPIGgies meetings are in Stanford, California.  For more information
and directions, see http://www.baypiggies.net/


Before the meeting, we may meet at 6pm for dinner in downtown Palo Alto.
Discussion of dinner plans is handled on the BayPIGgies mailing list.


Advance notice: The January 13 meeting agenda has not been set.  Please
send e-mail to [EMAIL PROTECTED] if you want to make a
presentation.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

WiFi is the SCSI of the 21st Century -- there are fundamental technical
reasons for sacrificing a goat.  (with no apologies to John Woods)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: assymetry between a == b and a.__eq__(b)

2004-12-05 Thread Mel Wilson
In article <[EMAIL PROTECTED]>,
Peter Otten <[EMAIL PROTECTED]> wrote:
>Tim Peters wrote:
>
>> See the Python (language, not library) reference manual, section 3.3.8
>> ("Coercion rules"), bullet point starting with:
>>
>> Exception to the previous item: if the left operand is an
>> instance of a built-in type or a new-style class, and the right
>> operand is an instance of a proper subclass of that type or
>> class, ...
>
>So that is settled then. Not the most likely place to investigate when one
>has just read that "Arguments to rich comparison methods are never coerced"
>in 3.3.1 ("Basic customization"), though.

   At some point Python will cease to be a simple language.

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


Re: Time for : comp.lang.python.newbies ??

2004-12-05 Thread Doug Holton
gmduncan wrote:
Maybe a time for a new discussion group along that suggested
by the Subject line ?
http://mail.python.org/mailman/listinfo/tutor
Or is their increasing presence here a price we must pay for their
belated recognition of this wonderful language ?
Don't forget the price we pay for not having a 
comp.lang.python.cynicaloldfarts
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing class factories with the Python/C API?

2004-12-05 Thread Craig Ringer
On Sun, 2004-12-05 at 21:41, Fredrik Lundh wrote:

> > So, before I throw myself too deeply into this task, does this sound
> > like something that's vaguely practical? All I'll really need to do is
> > add a bunch of methods on the generated subclasses, so I'm hoping so...
> 
> Lib/exceptions.c contains C code that creates class objects, and
> populates them with methods.  make a copy and hack it until it suits
> your needs...

Thankyou for the pointer to that. I was looking around Objects/object.c
but really not finding what I was after - I wouldn't have guessed what I
was looking for would be in the exception code.

Much appreciated.

--
Craig Ringer

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



[BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-05 Thread Bengt Richter
Peculiar boundary cases:

 >>> 2.0**31-1.0
 2147483647.0
 >>> int(2147483647.0)
 2147483647L
 >>> int(2147483647L )
 2147483647
 >>>
 >>> -2.0**31
 -2147483648.0
 >>> int(-2147483648.0)
 -2147483648L
 >>> int(-2147483648L )
 -2147483648

some kind of one-off error? I.e., just inside extremes works:

 >>> [int(x) for x in (-2.0**31, -2.0**31+1.0, 2.0**31-2.0, 2.0**31-1.0)]
 [-2147483648L, -2147483647, 2147483646, 2147483647L]

But those longs at the extremes can be converted successfully, so int(int(x)) 
works ;-/

 >>> [int(int(x)) for x in (-2.0**31, -2.0**31+1.0, 2.0**31-2.0, 2.0**31-1.0)]
 [-2147483648, -2147483647, 2147483646, 2147483647]

ISTM this is a buglet, or at least a wartlet for a 32-bit system ;-)

Almost forgot:
Python 2.4b1 (#56, Nov  3 2004, 01:47:27)
[GCC 3.2.3 (mingw special 20030504-1)] on win32

but same thing on 2.3.2:

 Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 >>> [int(x) for x in (-2.0**31, -2.0**31+1.0, 2.0**31-2.0, 2.0**31-1.0)]
 [-2147483648L, -2147483647, 2147483646, 2147483647L]
 >>> [int(int(x)) for x in (-2.0**31, -2.0**31+1.0, 2.0**31-2.0, 2.0**31-1.0)]
 [-2147483648, -2147483647, 2147483646, 2147483647]

Hm, ... except for the thought that CPUs with 64-bit integers might truncate 
maxint
when converting to float, I might say maybe these reprs should be tested
for equality in the system tests?

 >>> import sys
 >>> repr(int(float(sys.maxint))),  repr(sys.maxint)
 ('2147483647L', '2147483647')
 >>> repr(int(float(-sys.maxint-1))),  repr(-sys.maxint-1)
 ('-2147483648L', '-2147483648')

or maybe at least check for equality of these?:

 >>> type(int(float(sys.maxint))),  type(sys.maxint)
 (, )
 >>> type(int(float(-sys.maxint-1))),  type(-sys.maxint-1)
 (, )

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


Ptyon 2.3.5 probably coming in January; get your bugs/patches reported!

2004-12-05 Thread Brett C.
Anthony Baxter, our ever-diligent release manager, mentioned this past week 
that Python 2.3.5 will most likely come to fruition some time in January (this 
is not guaranteed date).  This means that in order to have enough time to 
proper evaluate new patches and bugs they must be reported **now**!  A one 
month lead time is necessary to properly look at, test, and commit patches, let 
alone coming up with solutions to any reported bugs.

Please realize, though, that reporting a bug or submitting a patch now does not 
guarantee that it will committed in time!  The free time of the development 
team is limited.  If you want to help a bug or patch along to make it easier to 
be evaluated and thus raise its chances of being dealt with please see the 
"Helping Out" section of the 'Intro to Development' essay at 
http://www.python.org/dev/dev_intro.html .

As always, both bugs and patches should be reported to Python's SourceForge 
tracker at http://sourceforge.net/bugs/?group_id=5470 and 
http://sourceforge.net/patch/?group_id=5470, respectively.

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


Policy Violation

2004-12-05 Thread SMTP-Scan_email1
The following message sent by this account has violated system policy:

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Mon, 06 Dec 2004 09:31:06 +0200
Subject: information about you?


The following violations were detected:

--- Scan information follows ---

Virus Name: [EMAIL PROTECTED]
File Attachment: final.zip
Attachment Status: deleted





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


Re: Mean, median, and mode

2004-12-05 Thread Sean McIlroy
>>> mean = lambda x: sum(x)/len(x)
>>> median = lambda x: (max(x)-min(x))/2
>>> mode = lambda x: max([(x.count(y),y) for y in x])[1]

"Robert Brewer" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> (now that we have a meaningful subject line)
> 
> Alfred Canoy wrote:
> > >>  I'm just new to programming and would like to ask for help..
> > >>
> > >> Build a module that contains three functions that do the following:
> > >>
> > >>   a.. Compute the average of a list of numbers
> > >>   b.. Finds the statistical median value of a list of numbers
> > >>   c.. Finds the mode of a list of numbers
> > >>
> > >> Can you please give me clue how I should start solving the
> > >> following problem
> > >> below? Here's the source code that I did so far:
> > >>
> > >> # compute the average of a list of numbers:
> > >> # Keeps asking for numbers until 0 is entered
> > >> # Prints the average value
> > >>
> > >> count = 0
> > >> sum = 0
> > >> number = 1
> > >>
> > >> print 'Enter 0 to exit the loop'
> > >> while number != 0:
> > >> number = input ('Enter a number: ')
> > >> count = count + 1
> > >> sum = sum + number
> > >> count = count -1
> > >> print ' The average is:', sum/count
> 
> For the mode, you might build a dictionary:
> 
> freq = {}
> while number != 0:
> number = input ('Enter a number: ')
> count = count + 1
> sum = sum + number
> try:
> freq[number] += 1
> except KeyError:
> freq[number] = 1
> 
> ...then you can check for the largest value in that dictionary:
> 
> max = 0
> mode = None
> for k, v in freq.iteritems():
> if v > max:
> max = v
> mode = k
> 
> I leave the rest in your capable hands... ;) Including the case where
> two numbers occur in equal frequencies. ;;)
> 
> 
> Robert Brewer
> MIS
> Amor Ministries
> [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


The python2.4 IDLE can't be lanuched.

2004-12-05 Thread AnkyHe
  I downloaded the python 2.4 final from the offical website and installed it 
on the WindowsXP+SP2 (Chinese version).
There was not any problem in this process, but the IDLE can't be lanuched 
without any warnning.  Is there anybody else 
encount this problem and how to resolve it?  Thanks!  


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


not able to link ucdsnmp and snmpy

2004-12-05 Thread muttu
hi there

i am trying to build snmpy over ucdsnmp and i am facing the problem in
linking of ucdsnmp and snmpy *.so files.
i am sending the steps what i have done till now

i build the ucdsnmp first in the following order
a) ./configure
b) make 
c) make install

  after i did all these libsnmp.a ,libsnmp.so and some other *.so
files got created in the /usr/local/lib

Then i built the snmpy-alpha-4 in the follwing order
   i ran the setup.py build
 so it created the snmpy.so 

which i am not sure whether it has got linked with ucdsnmp or not.

Now with my python script when i try to import this snmpy am getting
the following error.
ImportError: /usr/local/lib/python2.4/site-packages/snmpy.so:
undefined symbol: get_symbol

but when i saw the code , get_symbol function is defined in mib.c of
ucdsnmp,and  being called in snmpymodule.c of snmpy-alpha-4, but still
its giving undefined symbol.
Now is it because it hasnt got linked with the libsnmp.so(ucdsnmp's
library)
or is it because of some other problem.
please help me in this.
thanks in advance
muttu
-- 
http://mail.python.org/mailman/listinfo/python-list


convert string to raw string?

2004-12-05 Thread Phd
Hi,
I'm writing a regex related program that lets the user supplies the 
regex definition. Is there an easy way to convert a string into a raw 
string?

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


Re: Chrooted Python problem

2004-12-05 Thread John



        

  - Original Message - 
  From: 
  John 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, December 05, 2004 9:10 
  PM
  Subject: Chrooted Python problem
  
  Hello to all
   
  I lately installed the python 2.3 and mod_python 
  2.7.10
   
  My apache runs in a chrooted enviroment so i want 
  to chroot pyton and mod_python as well.
   
  I have copy the
   
   /usr/local/apache/libexec/mod_python.so 
  -> /chroot /usr/local/apache/libexec/mod_python.so 
   
  /usr/local/lib/python2.3 -> 
  /chroot/usr/local/lib/python2.3
   
  /usr/local/bin/python -> 
  /chroot/usr/local/bin/python
   
  And some .so files in the /chroot/lib directory 
  that the 
   
  ldd /usr/local/bin/python 
  and
  ldd 
  /usr/local/apache/libexec/mod_python.so
  indicated
   
   
  The problem is that i can start the apache in the 
  chrooted enviroment but its childs (or children) processes (of apache) 
  increasing and increasing until the
  apache crashes (160-200 apache 
  process).
   
  
  When i disable the loading of mod_pyton.so in the 
  httpd.conf then everything works well like it used to.
   
   
  Do you know any cure about that 
  problem?
   
   
   
  
  

  
  -- http://mail.python.org/mailman/listinfo/python-list
   
   
   
  Does anybody 
know?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Help With Hiring Python Developers

2004-12-05 Thread Ian Bicking
Yet Another Mike wrote:
"Ed Leafe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Allow offsite workers and you'll have all the candidates you want.
Exactly. I'm 5 hours away in Rochester, NY, and might be interested

And, if they are willing to go offsite, why not go to India and save lots of 
bucks?
Trust issues?  In general, Python requires you trust your programmers. 
People give Java grief about its restricted environment and static 
typing, but if you don't trust the programmer to do a good job, at least 
with Java they (maybe) can't mess things up as badly for everyone else 
working on a project.  You can mess things up royally with Python.  I 
like working with a language that respects my intelligence, but that's 
not without its costs.

In general, Python rewards highly-skilled programmers with a 
considerably increased productivity.  We talk about how Python is also 
easy to learn and maintain, and that's still true, but it doesn't mean 
that it evens out the differences in productivity between programmers. 
In fact, quite the opposite -- that it's easy to learn and maintain 
means that there's less risk in using a highly skilled, highly 
productive programmer; in other languages you risk being left with a 
program that only another highly skilled programmer can maintain.

Also, Python encourages agile methodologies, even if you aren't 
explicitly trying to use agile methodologies.  They just work well. 
They also work well when you can have a more intimate relationship 
between developer and project manager or customer.  Hiring in India or 
elsewhere makes that intimate relationship harder to create.  And 
frankly, Python is not the language for companies who expect mediocrity 
in their programmers, and I think that outsourcing is for companies that 
expect mediocrity.

I don't mean to insult Indian programmers -- certainly there are Indian 
programmers who are just as good as a good programmer in the US, able to 
communicate well, able to work independently, able to judge tradeoffs, 
etc.  But those aren't the cheap ones.  This isn't just about nation of 
origin.  Outsourcing is about turning programmers into a commodity, and 
you can only make a commodity out of something where quality isn't an 
issue.  In the case of programming, that means you must expect the 
lowest common denominator of quality given the constraints.  I think 
that's a stupid way to look at programming in general, but it's *way* 
more stupid with Python.

--
Ian Bicking  /  [EMAIL PROTECTED]  / http://blog.ianbicking.org
--
http://mail.python.org/mailman/listinfo/python-list


What's New on the Web : Today

2004-12-05 Thread etamp
What's New on the Web : Today
http://www.etamp.net/
===
Etamp(etamp.net) provides latest news of web sites around the globe. You can 
inform free of 
charge what is happening in your web site. To submit your releases, you must 
first become a 
member. It's free, fast and easy. 

==

[ url2image.com Offers New Service to Help Web site Designers and Webmasters 
Discover 
Problems with Lack of Browser Compatibility ]
url2image.com Offers New Service to Help Web site Designers and Webmasters 
Discover 
Problems with Lack of Browser Compatibility A new service of¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1049

 

[ ICQ joins webmail battles with new service ]
ICQ joins webmail battles with new service By Juan Carlos Perez The 
increasingly 
competitive webmail market has a new player: Instant messaging¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1048

 

[ Voiceglo Issues Call for Beta Users for GloConnect IM Application ]
Voiceglo Issues Call for Beta Users for GloConnect IM Application December 2004 
?Voiceglo, a global communications and networking company, to¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1047

 

[ OmniOutliner 3.0 announced, public beta available ]
OmniOutliner 3.0 announced, public beta available The Omni Group today 
announced 
a major new upgrade to its outlining and organizational applicati¡¦
http://www.etamp.net/beta/?etamp=check_dir/news.html?&part=ws&number=1046
 
-- 
http://mail.python.org/mailman/listinfo/python-list