Re: String Identity Test

2009-03-03 Thread Gary Herron

Avetis KAZARIAN wrote:

After reading the discussion about the same subject ( From: "Thomas
Moore"  Date: Tue, 1 Nov 2005 21:45:56
+0800 ), I tried myself some tests with some confusing results (I'm a
beginner with Python, I'm coming from PHP)



# 1. Short alpha-numeric String without space

a = "b747"
b = "b747"

  

a is b


True



# 2. Long alpha-numeric String without space

a =
"averylongstringbutreallyaveryveryverylongstringwithabout68characters"
b =
"averylongstringbutreallyaveryveryverylongstringwithabout68characters"

  

a is b


True



# 3. Short alpha-numeric String with space

a = "x y"
b = "x y"

  

a is b


False



# 4. Long alpha-numeric String with space

a = "I love Python it s so much better than PHP but sometimes
confusing"
b = "I love Python it s so much better than PHP but sometimes
confusing"

  

a is b


False



# 5. Empty String

a = ""
b = ""

  

a is b


True


# 6. Whitecharacter  String : space

a = " "
b = " "

  

a is b


False



# 7. Whitecharacter String : new line

a = "\n"
b = "\n"

  

a is b


False



# 8. Non-ASCII without space

a = "é"
b = "é"

  

a is b


False



# 9. Non-ASCII with space

a = "é à"
b = "é à"

  

a is b


False



It seems that any strict ASCII alpha-numeric string is instantiated as
an unique object, like a "singleton" ( a = "x" and b = "x" => a is b )
and that any non strict ASCII alpha-numeric string is instantiated as
a new object every time with a new id.

Conclusion :

How does Python manage strings as objects?
  


However the implementors want. 

That may seem a flippant answer, but it's actually accurate.  The choice 
of whether a new string reuses an existing string or creates a new one 
is *not* a Python question, but rather a question of implementation.  
It's a matter of efficiency, and as such each implementation/version of 
Python may make its own choices.   Writing a program that depends on the 
string identity policy would be considered an erroneous program, and 
should be avoided. 

The question now is:  Why do you care?   The properties of strings do 
not depend on the implementation's choice, so you shouldn't care because 
of programming considerations.  Perhaps it's just a matter of curiosity 
on your part.



Gary Herron





--
Avétis KAZARIAN
--
http://mail.python.org/mailman/listinfo/python-list
  


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


Re: random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
On Mar 4, 2:26 am, "Diez B. Roggisch"  wrote:
> Amir Michail schrieb:
>
> > On Mar 3, 10:05 pm, Chris Rebert  wrote:
> >> On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
> >>> Hi,
> >>> Is it the case that the random module will always give the same
> >>> results if given the same seed across all configurations (e.g.,
> >>> architectures, compilers, etc.)?
> >> Your question is vague. Define what you mean by "same results" in this 
> >> context.
>
> > In Python 2.5, if you use the same seed, will calls to randrange yield
> > the same numbers across all configurations?
>
> What do you mean with "configurations"?
>
> Random uses AFAIK rand/srand from the stdlib.h of your platform (*nix,
> no idea how that beast is called in redmond).
>
> So whatever the behaviour, it will be driven by that, and I guess it
> varies between platforms.
>
> Diez

So far I get the same results under Mac OS X, Windows, and Linux
(Google App Engine).  I'm particularly interested in getting the same
results under the Google App Engine even as Google upgrades its
servers over time.

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


Re: Packaging modules with Bundlebuilder

2009-03-03 Thread Diez B. Roggisch

DLitgo schrieb:

Hello everyone,

I'm curious about creating .app files for the mac using bundlebuilder
(or py2app or even py2exe). I'm just about done creating a GUI for a
little set of scripts which basically perform batch image editing.

If I send this app to friends and family will they be able to use it?
Or would they have to download PIL (which the app uses). I guess what
I'm asking, does PIL get bundled into the app? I obviously wouldn't
want them to have to download anything as that would be embarrassing
to me :D



I never bundled PIL myself, but py2app at least comes with a recipe for 
it - which means that it should be included into the distribution.


And that should be self-contained, including even the python interpreter.


So friends and family ought to be safe.

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


Re: random module gives same results across all configurations?

2009-03-03 Thread Diez B. Roggisch

Amir Michail schrieb:

On Mar 3, 10:05 pm, Chris Rebert  wrote:

On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:

Hi,
Is it the case that the random module will always give the same
results if given the same seed across all configurations (e.g.,
architectures, compilers, etc.)?

Your question is vague. Define what you mean by "same results" in this context.


In Python 2.5, if you use the same seed, will calls to randrange yield
the same numbers across all configurations?


What do you mean with "configurations"?


Random uses AFAIK rand/srand from the stdlib.h of your platform (*nix, 
no idea how that beast is called in redmond).


So whatever the behaviour, it will be driven by that, and I guess it 
varies between platforms.


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


String Identity Test

2009-03-03 Thread Avetis KAZARIAN
After reading the discussion about the same subject ( From: "Thomas
Moore"  Date: Tue, 1 Nov 2005 21:45:56
+0800 ), I tried myself some tests with some confusing results (I'm a
beginner with Python, I'm coming from PHP)



# 1. Short alpha-numeric String without space

a = "b747"
b = "b747"

>>> a is b
True



# 2. Long alpha-numeric String without space

a =
"averylongstringbutreallyaveryveryverylongstringwithabout68characters"
b =
"averylongstringbutreallyaveryveryverylongstringwithabout68characters"

>>> a is b
True



# 3. Short alpha-numeric String with space

a = "x y"
b = "x y"

>>> a is b
False



# 4. Long alpha-numeric String with space

a = "I love Python it s so much better than PHP but sometimes
confusing"
b = "I love Python it s so much better than PHP but sometimes
confusing"

>>> a is b
False



# 5. Empty String

a = ""
b = ""

>>> a is b
True


# 6. Whitecharacter  String : space

a = " "
b = " "

>>> a is b
False



# 7. Whitecharacter String : new line

a = "\n"
b = "\n"

>>> a is b
False



# 8. Non-ASCII without space

a = "é"
b = "é"

>>> a is b
False



# 9. Non-ASCII with space

a = "é à"
b = "é à"

>>> a is b
False



It seems that any strict ASCII alpha-numeric string is instantiated as
an unique object, like a "singleton" ( a = "x" and b = "x" => a is b )
and that any non strict ASCII alpha-numeric string is instantiated as
a new object every time with a new id.

Conclusion :

How does Python manage strings as objects?


--
Avétis KAZARIAN
--
http://mail.python.org/mailman/listinfo/python-list


Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote:



> > 
> > Is your email program broken or what? Why are you sending the same
> > exact message 5 times!?
> 
> Not to mention that the name "Cool Dude" isn't exactly convincing me 
> that I should apply for a job there...

Quite so. 
The only name that could possibly be worse,
would be: "Hot Babe".

- Hendrik

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


Re: random module gives same results across all configurations?

2009-03-03 Thread Carl Banks
On Mar 3, 6:59 pm, Amir  Michail  wrote:
> Hi,
>
> Is it the case that the random module will always give the same
> results if given the same seed across all configurations (e.g.,
> architectures, compilers, etc.)?


If you need a repeatable sequence, such as for unit testing, you can
subclass random.Random to do it.  (See the source code to random.py
for example.)


Carl Banks

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


Packaging modules with Bundlebuilder

2009-03-03 Thread DLitgo
Hello everyone,

I'm curious about creating .app files for the mac using bundlebuilder
(or py2app or even py2exe). I'm just about done creating a GUI for a
little set of scripts which basically perform batch image editing.

If I send this app to friends and family will they be able to use it?
Or would they have to download PIL (which the app uses). I guess what
I'm asking, does PIL get bundled into the app? I obviously wouldn't
want them to have to download anything as that would be embarrassing
to me :D
--
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install with MySQL-python

2009-03-03 Thread Ske


Mike Driscoll wrote:
> 
> On Mar 3, 7:44 am, Ske  wrote:
>> Let me apologise in advance if I’m missing something obvious, I’m still
>> very
>> new to this!
>>
>> I’m attempting to install MySQL-python in Python2.6 on Windows. On
>> running
>> "easy_install MySQL-python" I get a "The system cannot find the file
>> specified" message. Full output is below:
>>
>> Searching for MySQL-python
>> Readinghttp://pypi.python.org/simple/MySQL-python/
>> Readinghttp://sourceforge.net/projects/mysql-python
>> Readinghttp://sourceforge.net/projects/mysql-python/
>> Best match: MySQL-python 1.2.3b1
>> Downloadinghttp://osdn.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python
>> -1.2.3b1.tar.gz
>> Processing MySQL-python-1.2.3b1.tar.gz
>> Running MySQL-python-1.2.3b1\setup.py -q bdist_egg --dist-dir
>> c:\docume~1\michae
>> ~1\locals~1\temp\easy_install-bmrwgu\MySQL-python-1.2.3b1\egg-dist-tmp-_uhixz
>> error: The system cannot find the file specified
>>
>> I've really no idea how to solve this, and searches turn up nothing of
>> help.
>> Any ideas?
>> Thanks!
>> --
> 
> It may be that the egg is incompatible with Python 2.6. Looking at the
> last location that easy_install downloads from, I found that there is
> no 2.6 egg there (see
> http://sourceforge.net/project/showfiles.php?group_id=22307&package_id=15775).
> 
> I've had some goofy issues with compressed files being weird. Try
> downloading the source yourself, unzipping it, then navigating to that
> folder via the command line and running something like this:
> 
> python setup.py install
> 
> If your python isn't on the path, you'll have to do something like
> this instead:
> 
> c:\python26\python.exe setup.py install
> 
> Hopefully that will get you going.
> 
> Mike
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
Thanks for your help, Mike.

On running "python setup.py install" in the extracted directory, I get this:

Traceback (most recent call last):
  File "setup.py", line 16, in 
metadata, options = get_config()
  File "C:\Python26\Lib\site-packages\MySQL-python-1.2.2\setup_windows.py",
line
 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
options['registry_ke
y'])
WindowsError: [Error 2] The system cannot find the file specified
-- 
View this message in context: 
http://www.nabble.com/easy_install-with-MySQL-python-tp22308862p22324329.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: Python alternatives to Text::SimpleTable?

2009-03-03 Thread Ethan Furman

Ray Van Dolson wrote:

So I'm looking for an easy (read: lazy) way to generate output in nice
ASCII tables like the Text::SimpleTable[1] module in perl.  I've come
across two so far in the Python world that look promising[2][3] but I'm
wondering if anyone else out there has some recommendations for me.

Thanks,
Ray

[1] http://search.cpan.org/dist/Text-SimpleTable/lib/Text/SimpleTable.pm
[2] http://pypi.python.org/pypi/text_table/0.02
[3] http://jefke.free.fr/stuff/python/texttable/
What would you be using the output for?  Is this just simple on-screen 
stuff, or dump to paper... should rows wrap at 80 columns, etc, etc.  My 
quick (dare I say lazy?  ;) ) perusal of the links did not reveal those 
behavior traits to me.


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


Configuration Files and Tkinter--Possible?

2009-03-03 Thread W. eWatson
I'm converting a Tkinter program (Win XP) that uses widgets that allows the 
user to change default values of various parameters like start and stop time 
in hh:mm:ss, time of exposure in seconds, and whether certain options should 
be on or off. The initial values are set in the code. I can pretty well 
modify matters, so the values of parameters can be saved and restored from a 
config file for use outside the widgets (dialogs). Basically, a list of 
parameter names and values are kept in the file.


However, it is a tricky job to set up values for a widget that allows the 
current values to appear in a dialog, and then return them to internal 
storage for use elsewhere. The problem is in trying to make control variable 
dynamic instead of as fixed code. There may be a solution, but it seems as 
though someone should have had a similar problem in the past.


Is Python or Tkinter capable of solving this problem in some fashion? It may 
be that there's another way to set and return values to the widget. However, 
there seems to be an implication one can only do this with Tkinter control 
variables? Another way of saying this is is why are control variables needed 
anyway?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: A Simple Menu , Stretching the Window Width--Tkinter

2009-03-03 Thread W. eWatson

John Posner wrote:
 >> 
 >> I'd like to create a simple Menu bar with one item in it, 
 >> say, called "My 
 >> Menu", and have a few submenu items on it like "Change 
 >> Data" and "Exit". I 
 >> can do that but I'd like the title I put on the enclosing 
 >> window to be 
 >> completely visible. The title is, for example, "Hello, out 
 >> there. This is a 
 >> simple menu". Presently the window shrinks in width the 
 >> accommodate "My 
 >> Menu", and I see "Hello, out th". How do I force the width 
 >> to accommodate 
 >> the whole title?


If you're having trouble with the size of the overall ("root" or "toplevel")
window, this might help:

  rootwin = Tk()
  # width=500, height=350, upper-left-corner at (50,50) -- revise to suit
  rootwin.geometry('500x350+50+50')
  rootwin.resizable(False, False)
  rootwin.title("Hello, out there")

-John





E-mail message checked by Spyware Doctor (6.0.0.386)
Database version: 5.11880
http://www.pctools.com/en/spyware-doctor-antivirus/

Yep, that works. Thanks.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: Python parser

2009-03-03 Thread Kay Schluehr
On 2 Mrz., 23:14, Clarendon  wrote:
> Thank you, Lie and Andrew for your help.
>
> I have studied NLTK quite closely but its parsers seem to be only for
> demo. It has a very limited grammar set, and even a parser that is
> supposed to be "large" does not have enough grammar to cover common
> words like "I".
>
> I need to parse a large amount of texts collected from the web (around
> a couple hundred sentences at a time) very quickly, so I need a parser
> with a broad scope of grammar, enough to cover all these texts. This
> is what I mean by 'random'.
>
> An advanced programmer has advised me that Python is rather slow in
> processing large data, and so there are not many parsers written in
> Python. He recommends that I use Jython to use parsers written in
> Java. What are your views about this?
>
> Thank you very much.

You'll most likely need a GLR parser.

There is

http://www.lava.net/~newsham/pyggy/

which I tried once and found it to be broken.

Then there is the Spark toolkit

http://pages.cpsc.ucalgary.ca/~aycock/spark/

I checked it out years ago and found it was very slow.

Then there is bison which can be used with a %glr-parser declaration
and PyBison bindings

http://www.freenet.org.nz/python/pybison/

Bison might be solid and fast. I can't say anything about the quality
of the bindings though.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What does self.grid() do?

2009-03-03 Thread Marc 'BlackJack' Rintsch
On Tue, 03 Mar 2009 18:06:56 -0800, chuck wrote:

> I am learning python right now.  In the lesson on tkinter I see this
> piece of code
> 
> from Tkinter import *
> 
> class MyFrame(Frame):
>def __init__(self):
>Frame.__init__(self)
>self.grid()
> 
> My question is what does "self.grid()" do?  I understand that the grid
> method registers widgets with the geometry manager and adds them to the
> frame

Not "the frame" but the container widget that is the parent of the widget 
on which you call `grid()`.  In this case that would be a (maybe 
implicitly created) `Tkinter.Tk` instance, because there is no explicit 
parent widget set here.  Which IMHO is not a good idea.

And widgets that layout themselves in the `__init__()` are a code smell 
too.  No standard widget does this, and it takes away the flexibility of 
the code using that widget to decide how and where it should be placed.

Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list


Re: random module gives same results across all configurations?

2009-03-03 Thread Chris Rebert
On Tue, Mar 3, 2009 at 7:11 PM, Amir Michail  wrote:
> On Mar 3, 10:05 pm, Chris Rebert  wrote:
>> On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
>> > Hi,
>>
>> > Is it the case that the random module will always give the same
>> > results if given the same seed across all configurations (e.g.,
>> > architectures, compilers, etc.)?
>>
>> Your question is vague. Define what you mean by "same results" in this 
>> context.
>
> In Python 2.5, if you use the same seed, will calls to randrange yield
> the same numbers across all configurations?

Ah, my apologies, I overlooked part of your original post. My
understanding is that yes, that should be the case (with the possible
exceptions of alternate Python implementations such as Jython and
IronPython, but sounds like you're only talking about CPython).

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
On Mar 3, 10:05 pm, Chris Rebert  wrote:
> On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
> > Hi,
>
> > Is it the case that the random module will always give the same
> > results if given the same seed across all configurations (e.g.,
> > architectures, compilers, etc.)?
>
> Your question is vague. Define what you mean by "same results" in this 
> context.

In Python 2.5, if you use the same seed, will calls to randrange yield
the same numbers across all configurations?

Amir

>
> Cheers,
> Chris
>
> --
> I have a blog:http://blog.rebertia.com

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


Re: random module gives same results across all configurations?

2009-03-03 Thread Chris Rebert
On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
> Hi,
>
> Is it the case that the random module will always give the same
> results if given the same seed across all configurations (e.g.,
> architectures, compilers, etc.)?

Your question is vague. Define what you mean by "same results" in this context.

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
Hi,

Is it the case that the random module will always give the same
results if given the same seed across all configurations (e.g.,
architectures, compilers, etc.)?

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


Re: Newbie - pass variable to cscript

2009-03-03 Thread Rhodri James

On Tue, 03 Mar 2009 15:22:20 -,  wrote:


It's not firing off the vbs script. Have I got the syntax correct?
Thanks.

My latest attempt:
vBS = "C:\\Program Files\\nasa\\nmail.vbs"
os.system('cscript /from:wrk-...@pittcountync.gov /
to:plsulli...@pittcountync.gov /sub:TEST /msg:hello ' + vBS)


Your problem is that vBS has a space in it, so the Windows
command interpreter is interpreting it as two separate arguments,
r"C:\Program" and r"Files\nasa\nmail.vbs".

Gabriel has already posted two solutions (which I won't repeat),
but he forgot to mention the problem itself!

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: siple for in expression

2009-03-03 Thread alex23
On Mar 4, 2:05 am, "Matko"  wrote:
> Can someone help me to understand the following code:
> uv_face_mapping = [[0,0,0,0] for f in faces]

As others have mentioned, this is a list comprehension, which is a
simpler way of writing the following:

  uv_face_mapping = []
  for f in faces:
uv_face_mapping.append([0,0,0,0])

Which seems to be setting a default uv_face_mapping for each element
in faces :)

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


Re: Looking for a General Method to Configure Tkinter Widgets

2009-03-03 Thread W. eWatson

W. eWatson wrote:

odeits wrote:

On Mar 2, 7:14 am, "W. eWatson"  wrote:
I'm modifying a Tkinter Python program that uses hard coded initial 
values
for several widgets. For example, latitude = 40. My plan is to put 
the names

and values for configuration purposes into a file. For example, a pseudo
statement like the one just given. ConfigObj provides a mechanism for 
it.


I am only at an early stage of learning Tkinter, but it looks like a 
hang up
is in the use of control variables passed between widgets and 
non-Tkinter
objects that setup up the widget and retrieve the changed values. 
Roughly,
the main loop contains code like self.longitude = 40. Non-Tkinter 
objects

set up the parameters to the widgets, and when a widget* is complete the
setup program resets the main loop globals. As I see it, it looks like
IntVar, etc. used must be hard coded, as in the original program, to
preserve types like boolean, strings, integers, floats, etc. It's either
that or use of eval or some like function. Comments?

* For example, in one setup program, I see code like this after its 
call to

a dialog returns:

 try:
 s = dialog.stopVar.get()
 d = [ int(x) for x in s.split(":") ]
 self.stop_time = datetime.time(d[0],d[1],d[2])

stop_time is a string like "10:30:15".
--
W. eWatson

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

 Web Page: 


I am sorry, I am a bit confused. Is your question how to preserve the
value and/or type of the data in the config file? Or are you having
trouble getting the values from the file to the widget?

I'm probably confused too. :-) Let's try this. In
s=dialog.stopVar.get()
I'd like to eliminate the statement and replace it with something like:
s="dialog." + "stopV.get()"
)and execute that--I'm aware of the exec operation--problems)
where StopV is a string name taken from the config file. That is, in the 
config file there would be something like:

stop_time = 18:00:00, stopV.

Initially, when starting the program, reading that line would create a 
self.stop_time variable with the value 18:00:00 (string). To communicate 
with the dialog widget where the user enters a new value, I need to use 
control variables. but ones that are not in the code itself. Instead, I 
would like to manufacture them from what I see in the config file.



I've been told that there may be another way to communicate with Tkinter 
than control variables. I'm not quite sure what, but will probably know 
tomorrow. I think I will discontinue this thread, and re-post if necessary.




--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: looking for template package

2009-03-03 Thread Philip Semanchuk


On Mar 3, 2009, at 9:06 PM, Neal Becker wrote:

I'm looking for something to do template processing.  That is,  
transform
text making various substitutions.  I'd like to be able to do  
substitutions

that include python expressions, to do arithmetic computations within
substitutions.

I know there are lots of template packages, but most seem aimed at  
web use.

This is just text processing, not part of any web stuff.

Any suggestions?


Hi Neal,
There are lots of template packages out there that will do the job. I  
think you'll have a hard time finding one that's not aimed primarily  
at Web use.


I like Mako. The templating language has a pretty shallow learning  
curve and it's not too hard to run Mako from the command line  
independently of any Web framework. FWIW I've used Mako to generate  
Apache config files and it worked fine for that.


As I said, there are lots of choices and the template syntax varies  
widely. Some use XML-based templates which I find painful. But people  
who use lots of XMLish tools probably appreciate the structure. You  
know your preferences best, so pick a template package that has a  
syntax you won't hate.


Good luck
Philip


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


Re: Looking for a General Method to Configure Tkinter Widgets

2009-03-03 Thread Rhodri James
On Tue, 03 Mar 2009 18:58:47 -, W. eWatson   
wrote:



I'm probably confused too.  Let's try this. In
s=dialog.stopVar.get()
I'd like to eliminate the statement and replace it with something like:
s="dialog." + "stopV.get()"
)and execute that--I'm aware of the exec operation--problems)
where StopV is a string name taken from the config file. That is, in the  
config file there would be something like:

stop_time = 18:00:00, stopV.


I'm trying to think of a case where opening up this security hole is
even marginally wise, and I'm failing.  If you absolutely must prat
around with indirections like this, wouldn't

  s = getattr(dialog, variable_containing_the_string_stopV).get()

be a much less unsafe idea?

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: looking for template package

2009-03-03 Thread David Lyon

> I know there are lots of template packages, but most seem aimed at web
> use.
> This is just text processing, not part of any web stuff.
> 
> Any suggestions?

It doesn't matter if it is web or not. it's worth using a template
package.

You might very much like Cheatah... only takes a day to learn
and and it works well in non-web applications..

My recommendation...

David

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


What does self.grid() do?

2009-03-03 Thread chuck
I am learning python right now.  In the lesson on tkinter I see this
piece of code

from Tkinter import *

class MyFrame(Frame):
   def __init__(self):
   Frame.__init__(self)
   self.grid()

My question is what does "self.grid()" do?  I understand that the grid
method registers widgets with the geometry manager and adds them to
the frame

But in this case am I adding the frame to the frame?  Not able to
understand the response from my class discussion board, hence posting
here.

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


looking for template package

2009-03-03 Thread Neal Becker
I'm looking for something to do template processing.  That is, transform 
text making various substitutions.  I'd like to be able to do substitutions 
that include python expressions, to do arithmetic computations within 
substitutions.

I know there are lots of template packages, but most seem aimed at web use.  
This is just text processing, not part of any web stuff.

Any suggestions?


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


Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Craig Allen
On Mar 3, 10:17 am, Cool Dude  wrote:
> Hello ,
> This is Aniket from Techclique, a New Jersey based software
> development and IT consulting firm providing top quality technical and
> software professionals on a permanent and contractual basis to
> Government and commercial customer including fortune 500 companies and
> most of states and federal governments. I am contacting you to see if
> you are comfortable to the skills mentioned below, please forward
> resume to this e-mail address ani...@techclique.com
>
> Python Programmer (someone with industry knowledge/asset mgt)
> Location: Newport Beach, CA (Need Local)
> Duration: 6+ months
> Note: Communication MUST be perfect!, Plus submit with 3 professional
> references
>
> Python programming skills (with web development and dynamically
> generated charts/plots in particular) and working knowledge of Linux/
> UNIX Shell Scripts and SQL.
> Knowledge of Python integration with C/C++ - a definite plus.
>
> Qualifications/Requirements
> * 3+ years of Python programming on Linux/Unix platform; recent (2007)
> required
need programmer to write bot that doesn't multipost... please submit
three references so I can check to see if you've ever multiposted on
usenet.

> * Programming skills building forms, lay-outs, charts, and graphing
> required
> * Designing, coding, and testing web based applications preferred.
> * Strong organizational, oral and written communications skills
> * High energy/self starter with the ability to work independently
> within the firm*s demanding and highly focused environment
>
> Thanks & Regards,
> Aniket
> Techclique Inc.
> Jersey City, NJ
> Email: ani...@techclique.com
> Yahoo IM : aniket_mitta...@yahoo.com
> Contact No : 732-357-3844

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


Re: Pickle Problem

2009-03-03 Thread Gabriel Genellina

En Tue, 03 Mar 2009 23:11:30 -0200, Fab86  escribió:


On Mar 4, 12:00 am, MRAB  wrote:

Fab86 wrote:
> On Mar 3, 8:59 pm, "Gabriel Genellina"  wrote:



>> How to "spell" exactly the exception name should appear in the  
>> documentation; might be yahoo.SearchError, or  
yahoo.search.SearchError, or  

>> yahoo.errors.SearchError, or similar.

> I have been trying except SearchError: however I get the error:

> Traceback (most recent call last):
>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
> line 19, in 
>     except SearchError:
> NameError: name 'SearchError' is not defined

> I have searched all documents for terms along the lines of searcherror
> but am finding nothing..

It's defined in the module you imported to get the search functionality.


I imported:
from yahoo.search.web import WebSearch

However there is nothing re SearchError in that doc or in the .py.

I can only find a reference to SearchError in the __init__ file as a
class called SearchError


The __init__.py indicates a package  

You didn't tell the package name (the name of the directory containing  
__init__.py) so this is somewhat generic. If the package name is foo, use:

from foo import SearchError
If foo is a subpackage under bar, use:
from bar.foo import SearchError

It *might* be:
from yahoo.search.web import WebSearch
or perhaps:
from yahoo.search import WebSearch

You can enter those lines in the interactive interpreter to discover the  
right form. (This really ought to have been documented)


--
Gabriel Genellina

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


Re: Python parser

2009-03-03 Thread Gabriel Genellina
En Tue, 03 Mar 2009 22:39:19 -0200, Alan G Isaac   
escribió:



This reminds me: the SimpleParse developers ran into
some troubles porting to Python 2.6.  It would be
great if someone could give them a hand.


Do you mean the simpleparser project in Sourceforge? Latest alpha released  
in 2003? Or what?


--
Gabriel Genellina

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


Re: Pickle Problem

2009-03-03 Thread Fab86
On Mar 4, 12:00 am, MRAB  wrote:
> Fab86 wrote:
> > On Mar 3, 8:59 pm, "Gabriel Genellina"  wrote:
> >> En Tue, 03 Mar 2009 16:50:25 -0200, Fab86  escribió:
>
> >>> On Mar 3, 6:48 pm, "Gabriel Genellina"  wrote:
>  En Tue, 03 Mar 2009 16:39:43 -0200, Fab86   
>  escribió:
> > I am having a bit on an issue getting my program to work. The online
> > database which I am trying to contact keep timing out meaning I can
> > not carry out my 200 searches without being interupted.
> > I believe that the solution would be to include an exception handler
> > with a timer delay if this error occurs so wait a bit then carry on
> > however having spent hours looking at this I can not get my head
> > around how to do such a thing.
>  Exactly. How to handle  
>  exceptions:http://docs.python.org/tutorial/errors.html
>  Use time.sleep() to wait for some  
>  time:http://docs.python.org/library/time.html#time.sleep
> >>> Thanks for that I will give it a read.
> >>> Do I need to know what error I am getting?
> >> Usually it's best to be as specific as possible.
>
> >>> IDLE is giving me this:
> >>> Traceback (most recent call last):
> >>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
> >>> 13, in 
> >>>     res = srch.parse_results()
> >>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> >>> \__init__.py", line 765, in parse_results
> >>>     xml = self.get_results()
> >>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> >>> \__init__.py", line 738, in get_results
> >>>     stream = self.open()
> >>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> >>> \__init__.py", line 723, in open
> >>>     raise SearchError(err)
> >>> SearchError: service temporarily unavailable [C:28]
> >> That means that, in line 13 of test6.py [first line in the stack trace],  
> >> after several function calls [intermediate lines in the stack trace]  
> >> leading to function open in the search package [last line of the stack  
> >> trace], a SearchError exception was raised.
> >> If you want to catch that exception:
>
> >> try:
> >>     ... some code ...
> >> except SearchError:
> >>    ... code to handle the exception ...
>
> >> How to "spell" exactly the exception name should appear in the  
> >> documentation; might be yahoo.SearchError, or yahoo.search.SearchError, or 
> >>  
> >> yahoo.errors.SearchError, or similar.
>
> > I have been trying except SearchError: however I get the error:
>
> > Traceback (most recent call last):
> >   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
> > line 19, in 
> >     except SearchError:
> > NameError: name 'SearchError' is not defined
>
> > I have searched all documents for terms along the lines of searcherror
> > but am finding nothing..
>
> > Any ideas?
>
> It's defined in the module you imported to get the search functionality.

I imported:
from yahoo.search.web import WebSearch

However there is nothing re SearchError in that doc or in the .py.

I can only find a reference to SearchError in the __init__ file as a
class called SearchError
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python parser

2009-03-03 Thread Alan G Isaac

This reminds me: the SimpleParse developers ran into
some troubles porting to Python 2.6.  It would be
great if someone could give them a hand.

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


Re: Python AppStore / Marketplace

2009-03-03 Thread David Lyon

Hi all,

I only just noticed this thread... :-(

At the moment, I am working on a Python Package Manager project on
Sourceforge.

http://sourceforge.net/projects/pythonpkgmgr/

Firstly, I would welcome any developers who are willing to assist.

Secondly, I think there is much work to be done with python and it's
handling
of packages. To me it seems to need a great deal of streamlining. But I am
working mainly on windows.. and i know it is really easy with ubuntu and
so forth because the os seems to do the job really well.

>> The client (there should be one for every supported platform) is a
>> front-end application for the (PSF-) hosted "super-cheeseshop", which
>> end-users are not expected to access directly.
>> 
>> 
>> Is my nirvana really that far away? ;-)

That's kindof what we're working on...

David

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


Re: Multiple conditional expression

2009-03-03 Thread John Machin
On Mar 4, 10:53 am, Mel  wrote:
> bearophileh...@lycos.com wrote:
> > Chris Rebert:
> >> That seems to just be an overly complicated way of writing:
> >> spaces = bool(form.has_key('spaces') and form.getvalue('spaces') == 1)
> > Better:
> > spaces = bool(('spaces' in form) and form.getvalue('spaces') == 1)
>
> Is it still necessary to convert the result (and of two comparison
> operations) to bool?
>


Still? It never was necessary.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.6.1 urllib error on Mac os x PPC

2009-03-03 Thread ati
On Tue, 2009-03-03 at 14:10 -0800, Ned Deily wrote:
> Ah, "OS X Server" and "2.5.4 works fine"!  For 2.6, I see that the 
> getproxies code in urllib was re-written to eliminate use of the 
> deprecated python mac Carbon interfaces and instead use ctypes to call 
> the SystemConfiguration framework directly.  It could very well be that 
> there are differences in the proxy configurations between OS X and OS X 
> Server.  It wouldn't surprise me if that hasn't been tested by anyone 
> yet; unfortunately, I don't have an OS X Server instance handy to try it 
> myself.

> I guess the easiest workaround would be to patch urllib.py to avoid 
> those calls to SystemConfiguration.  Look at getproxies_macosx_sysconf.  
> If the OS X Server system is in on a network that doesn't require HTTP 
> proxies, return an empty dict, otherwise hardwire in the proxy 
> configuration.  Ugh.

hmm.. i think, i don't want to patch it.. i will be wait for the python
developers. i am not a python developer and i am too busy to play with
this workaround..


> You should open a tracker issue about this at http://bugs.python.org/.  
> And nice job documenting the problem!

thanks :)

issue is opened:
http://bugs.python.org/issue5413


thank you for your answers.



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


Re: Chandler, Python, speed

2009-03-03 Thread Alan G Isaac

On Mar 2, 1:11 am, Paul Rubin wrote:
Mitch Kapor (of Lotus 1-2-3 fame) spent a lot of money hiring 
very sharp Python programmers to write an email client called 
Chandler, but from what I understand, progress so far has been 
disappointing, at least in part for performance reasons. 



Paul McGuire wrote:
Yipes, have you read the book ("Dreaming in Code")?  
Chandler's problems were much more organizational than 
technical.



This discussion makes me curious about a couple things.

1. It is hard to see how Python could make a "slow"
email client.  Is that the actual claim?  Where is the
demand for computational speed coming from?

2. This is especially true for IMAP, where it seems any
computationally intensive work (e.g., sorting very large
mailboxes) will be done on the server.

3. Chandler is not really an email client.  So specifically,
which of its functionalities is it slow, and what evidence
if any is there that Python is causing this?

Thanks,
Alan Isaac

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


Re: Pickle Problem

2009-03-03 Thread MRAB

Fab86 wrote:

On Mar 3, 8:59 pm, "Gabriel Genellina"  wrote:

En Tue, 03 Mar 2009 16:50:25 -0200, Fab86  escribió:




On Mar 3, 6:48 pm, "Gabriel Genellina"  wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86   
escribió:

I am having a bit on an issue getting my program to work. The online
database which I am trying to contact keep timing out meaning I can
not carry out my 200 searches without being interupted.
I believe that the solution would be to include an exception handler
with a timer delay if this error occurs so wait a bit then carry on
however having spent hours looking at this I can not get my head
around how to do such a thing.
Exactly. How to handle  
exceptions:http://docs.python.org/tutorial/errors.html
Use time.sleep() to wait for some  
time:http://docs.python.org/library/time.html#time.sleep

Thanks for that I will give it a read.
Do I need to know what error I am getting?

Usually it's best to be as specific as possible.




IDLE is giving me this:
Traceback (most recent call last):
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
13, in 
res = srch.parse_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 765, in parse_results
xml = self.get_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 738, in get_results
stream = self.open()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 723, in open
raise SearchError(err)
SearchError: service temporarily unavailable [C:28]
That means that, in line 13 of test6.py [first line in the stack trace],  
after several function calls [intermediate lines in the stack trace]  
leading to function open in the search package [last line of the stack  
trace], a SearchError exception was raised.

If you want to catch that exception:

try:
... some code ...
except SearchError:
   ... code to handle the exception ...

How to "spell" exactly the exception name should appear in the  
documentation; might be yahoo.SearchError, or yahoo.search.SearchError, or  
yahoo.errors.SearchError, or similar.




I have been trying except SearchError: however I get the error:

Traceback (most recent call last):
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
line 19, in 
except SearchError:
NameError: name 'SearchError' is not defined

I have searched all documents for terms along the lines of searcherror
but am finding nothing..

Any ideas?


It's defined in the module you imported to get the search functionality.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python AppStore / Marketplace

2009-03-03 Thread Steve Holden
Marcel Luethi wrote:
> Hi Steve
> 
[I've probably replied to this once already, but here's another try]

> I really appreciate your feedback!
> Certainly I'm no expert "for the many differences in package formats and
> install requirements between the different platforms".
> 
> But let me explain a bit more:
> I don't have the idea that the multi-platform client should handle all
> the different package formats - instead it should define a new one: a
> simple zip-file.

OK, but have you asked yourself why the "simple zip file" isn't the
current basis of any Python distribution format?

> For me "self-contained, independent of an already installed Python"
> means that there is a complete, isolated Python environment for each app
> (see virtualenv). So Python would go into APP/lib/..., APP/bin/... and
> the app itself into APP/app/... Certainly there would be also some more
> files like the app icons and a description file APP/app.xml
> The packaged app is a zip/gzip of the whole APP directory. Installing is
> simply unpacking to a defined directory (into something like
> PythonApps/APP) and setting it up as an os app.
> 
This might work. I have for a while now advocated that each Python
application should carry its own interpreter and all other dependencies
with it. This doesn't solve all problems, though: imagine two apps with
different versions of the same library using incompatible media formats ...

> Because there is a complete Python environment for each app (disk space
> and bandwidth are cheap nowadays!) and all 3rd party libs are
> "integrated" there shouldn't be any other local dependencies. So there
> could be APP1 with a Python 2.5.2 + a wxPython/wxWidgets and another
> APP2 with Python 2.6.1 + PyQt4.
> (This is something I'm not really sure about: is it possible to setup
> all binary 3rd party libs «*.so/*.pyo/*.dll/*.pyd/...» into an isolated
> Python environment?)

Time, perhaps, for a little research into what the "simple zip file"
actually needs to contain and where it gets dropped?

> Of course there can't be a single APP1 for all possible platforms. But
> there could be one setup for each: APP1_Linux, APP1_MacOsX10.5, APP1_WinXP
> The developer has to setup/test every supported platform anyway.
> 
The recently announced Snakebite project, when it gets off the ground,
might be able to offer helpful resources. Mike Driscoll has done some
work on building Windows installers for Python apps, though they were to
integrate with an existing Python installation.

> The "bootstrap" (standing on the shoulders of giants) could work like this:
> - first there is a base app "Python 2.5.1 for Mac OS X 10.5" built by
> developer A
> - next developer B creates "Django 1.0.2 for Mac OS X 10.5" based on the
> one above
> - then developer C integrates Pinax into B's app and creates "Pinax
> 0.5.1 for Mac OS X 10.5"
> 
Why do you need a "Python x.y.z for Mac OS 10.5" if every app brings its
own Python with it?

> All those "apps" could be found in Python AppStore and a developer could
> search for the one which matches his requirements best. His
> implementation cost is therefore minimized.
> 
A developer could, perhaps, but we need to think of the end-users who
will not have the sophistication to make such decisions.

> A iTunes-like client would allow the end-user to find apps - assumed
> that all (or most) developers upload their apps into the one and only
> Python AppStore.

Or that the AppStore is suitable distributed. This, I think, is possibly
the most fanciful part of the scheme. What does this "iTunes-like"
client do for the user?

> The client (there should be one for every supported platform) is a
> front-end application for the (PSF-) hosted "super-cheeseshop", which
> end-users are not expected to access directly.
> 
> 
> Is my nirvana really that far away? ;-)
> 
Well it doesn't seem to be getting closer very fast ... but I wish you
luck, and hope to see progress.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: Pickle Problem

2009-03-03 Thread Tim Wintle
On Tue, 2009-03-03 at 15:33 -0800, Fab86 wrote:
> I have been trying except SearchError: however I get the error:
> 
> Traceback (most recent call last):
>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
> line 19, in 
> except SearchError:
> NameError: name 'SearchError' is not defined
> 
> I have searched all documents for terms along the lines of searcherror
> but am finding nothing..

Try looking at the file
C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py

and see where it imports SearchError from (or defines it)

Exceptions are just classes, so you'll have to import and reference it
like you'd reference any other class you import.

Hope that helps


Tim Wintle

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


Re: Multiple conditional expression

2009-03-03 Thread Mel
bearophileh...@lycos.com wrote:
> Chris Rebert:
>> That seems to just be an overly complicated way of writing:
>> spaces = bool(form.has_key('spaces') and form.getvalue('spaces') == 1)

> Better:
> spaces = bool(('spaces' in form) and form.getvalue('spaces') == 1)

Is it still necessary to convert the result (and of two comparison
operations) to bool?

Mel.

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


Re: qt, gtk, wx for py3 ?

2009-03-03 Thread Peter Billam
>> Peter Billam wrote:
>> > I've been trying (newbie warning still on) tkinter with python3.0,
>> > and I'm getting to that stage where I'm beginning to think there
>> > must be a better a way to do this...  But I'm unsure if the
>> > big names Qt, Gtk and Wx are available for Py3 yet - e.g.
>> >http://pypi.python.org/pypi?:action=browse&c=533&show=alldoesn't
>> > seem to show any... What's the gossip on these toolkits for Py3 ?

> On Mar 3, 1:15 pm, Scott David Daniels  wrote:
>> Well, here are my biases (you will only get biased answers, because
>> this is clearly a taste question).
>> Tkinter: solid, well-established (hence fairly stable), relatively
>>          well-documented, comprehensible in a "from the roots" way.
>> Wx: a lot of mileage, looks best of the machine-independent packages
>>      across a raft of systems (does native interaction well), not so
>>      well-documented, but has a plethora of examples, comprehensible
>>      in a "grab and modify" way.
>> Qt: simplest model, well-documented, until very recently not available
>>      on Windows w/o a restrictive license or substantial cost.

Thanks for that.  I also checked out:
  http://wiki.wxwidgets.org/WxWidgets_Compared_To_Other_Toolkits
which seemed surprisingly even-handed.

On 2009-03-03, Mike Driscoll  wrote:
> It should be noted that the port for 3.0 hasn't started yet for
> wxPython and I'm not seeing anything about a port for PyQt either
> on their website.

I couldn't see them either, so I'm glad to hear I wasn't hallucinating.

Nobody mentioned gtk yet, perhaps because its "primary development
and focus is for Unix, with multi-platform development mostly as an
afterthought."

Qt4 for windows is GPL, though its direct access to /dev/fb in linux
(potentially important) is commercial and royalty dependent.

> When I started out with Tkinter, I didn't find the docs to be any
> better than what I found in wxPython. Each toolkit has it's own ups
> and downs. I would recommend trying them until you find something you
> like.

I think that's what I'm embarked on...  But I'm coming to Python at
the 3.0.1 version (from a perl5 background, as an alternative to
perl6 which I'll evaluate when it's available) so I'm hanging out
for those Py3 versions...

Thanks,  regards,  Peter

-- 
Peter Billam   www.pjb.com.auwww.pjb.com.au/comp/contact.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pickle Problem

2009-03-03 Thread Fab86
On Mar 3, 8:59 pm, "Gabriel Genellina"  wrote:
> En Tue, 03 Mar 2009 16:50:25 -0200, Fab86  escribió:
>
>
>
> > On Mar 3, 6:48 pm, "Gabriel Genellina"  wrote:
> >> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86   
> >> escribió:
>
> >> > I am having a bit on an issue getting my program to work. The online
> >> > database which I am trying to contact keep timing out meaning I can
> >> > not carry out my 200 searches without being interupted.
>
> >> > I believe that the solution would be to include an exception handler
> >> > with a timer delay if this error occurs so wait a bit then carry on
> >> > however having spent hours looking at this I can not get my head
> >> > around how to do such a thing.
>
> >> Exactly. How to handle  
> >> exceptions:http://docs.python.org/tutorial/errors.html
>
> >> Use time.sleep() to wait for some  
> >> time:http://docs.python.org/library/time.html#time.sleep
>
> > Thanks for that I will give it a read.
>
> > Do I need to know what error I am getting?
>
> Usually it's best to be as specific as possible.
>
>
>
> > IDLE is giving me this:
>
> > Traceback (most recent call last):
> >   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
> > 13, in 
> >     res = srch.parse_results()
> >   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> > \__init__.py", line 765, in parse_results
> >     xml = self.get_results()
> >   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> > \__init__.py", line 738, in get_results
> >     stream = self.open()
> >   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
> > \__init__.py", line 723, in open
> >     raise SearchError(err)
> > SearchError: service temporarily unavailable [C:28]
>
> That means that, in line 13 of test6.py [first line in the stack trace],  
> after several function calls [intermediate lines in the stack trace]  
> leading to function open in the search package [last line of the stack  
> trace], a SearchError exception was raised.
> If you want to catch that exception:
>
> try:
>     ... some code ...
> except SearchError:
>    ... code to handle the exception ...
>
> How to "spell" exactly the exception name should appear in the  
> documentation; might be yahoo.SearchError, or yahoo.search.SearchError, or  
> yahoo.errors.SearchError, or similar.
>
> --
> Gabriel Genellina

I have been trying except SearchError: however I get the error:

Traceback (most recent call last):
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
line 19, in 
except SearchError:
NameError: name 'SearchError' is not defined

I have searched all documents for terms along the lines of searcherror
but am finding nothing..

Any ideas?
--
http://mail.python.org/mailman/listinfo/python-list


Re: geospatial python and how to convert multilinestrings to kml

2009-03-03 Thread Terry Reedy

Danny Shevitz wrote:

Howdy,

I need to do some geospatial work and am a complete newbie at this. I have
access to a PostGIS database and there are lots of MultiLineString objects.
I want to run a python algorithm that determines a group of these 
MultiLineString
objects and creates a KML file of the results. 


Is there a pythonic way (some existing module) to

convert PostGIS MultiLineStrings to a KML file format

Have you tried web search (ie, Google)?

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


Re: RichCompare and RichCompareBool

2009-03-03 Thread Aaron Brady
On Mar 3, 6:01 am, "Gabriel Genellina"  wrote:
> En Tue, 03 Mar 2009 04:42:02 -0200, Aaron Brady   
> escribió:
>
> > Also, did not receive Gabriel's post.
>
> That's because I replied a month ago - and probably you had no idea what I  
> was talking about by that time.
>
> (Sorry, I inadvertedly set the clock one month back. You didn't miss  
> anything)
>
> --
> Gabriel Genellina

BoolRichCompare( one month ago )?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Shared library Python on Mac OS X 64-bit

2009-03-03 Thread Graham Dumpleton
On Mar 4, 2:29 am, Uberman  wrote:
> Graham Dumpleton wrote:
> > Why don't you want to use MacOS X Framework libraries? It is the
> > better installation method.
>
> Because I'm not installing Python, I'm building it.  If I were just interested
> in installing Python, I wouldn't care whether it was static or shared 
> libraries.
>
> This is all very specific to my product.  We are not just OS X, but Windows
> and Linux as well.  Because of this, we use an SDK/ folder that has all the
> third-party dependencies contained within it (in a non-platform way).
> Frameworks are OS X-specific.  I build Python within its distribution folder,
> and then package that same folder up into an archive that gets deposited into
> the SDK/ folder.  The product then builds against that.

I don't understand the problem, you can say where it installs the
framework, it doesn't have to be under /Library, so can be in your
special SDK folder. For example:

./configure --prefix=/usr/local/python-2.5.4  \
 --enable-framework=/usr/local/python-2.5.4/frameworks \
 --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.5 \
 --with-universal-archs=all

This would put stuff under /usr/local/python-2.5.4.

The only thing am not sure about though is what happens to some MacOS
X .app stuff it tries to install. I vaguely remember it still tried to
install them elsewhere, so may have to disable them being installed
somehow.

Graham

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


Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Diez B. Roggisch


Is your email program broken or what? Why are you sending the same
exact message 5 times!?


Not to mention that the name "Cool Dude" isn't exactly convincing me 
that I should apply for a job there...


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


pexpect on solaris 10

2009-03-03 Thread Chris Pella
Has anybody had success getting pexpect to work well on solaris 10
(x86)? I am trying to do some test automation which involves
controlling some other processes. Soon after I spawn the process I am
trying to control a message comes up on stdout telling me that a tty
has been closed.
If there is something peculiar with the solaris pty than I may be
better off just using plain old expect and controlling it from python
because I don't have a lot of time to go on a fishing expedition.  I
was hoping to be able to use the same code on various linux
distros,solaris,AIX, and HP-UX.
If anybody has had success on solaris 10 with pexpect I'd be grateful
to hear about it.

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


geospatial python and how to convert multilinestrings to kml

2009-03-03 Thread Danny Shevitz
Howdy,

I need to do some geospatial work and am a complete newbie at this. I have
access to a PostGIS database and there are lots of MultiLineString objects.
I want to run a python algorithm that determines a group of these 
MultiLineString
objects and creates a KML file of the results. 

Is there a pythonic way (some existing module) to convert PostGIS 
MultiLineStrings to a KML file format?

thanks,
Danny

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


Re: Perl-python regex-performance comparison

2009-03-03 Thread python

>> Python 2.7's regex will include possessive quantifiers, atomic groups,
>> variable-length lookbehinds, and Unicode properties (at least the common
>> ones), amongst other things.

> Wow, that's excellent news!
> Many thanks for all your efforts to enhance the re capabilities in
> Python!

+1 !!

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


Re: Python 2.6.1 urllib error on Mac os x PPC

2009-03-03 Thread Ned Deily
In article <1236111699.4546.4.ca...@localhost>, ati  
wrote:
> I recompiled Python-2.6.1 with MACOSX_DEPLOYMENT_TARGET=10.3, but no
> change..
> I updated developertools to xcode312_2621, no change..
> 
> Btw.. Python-2.5.4 compiled from scratch works fine.
> 
> I forgot to mention the ppc computer is a Mac OS X Server version and
> the Intel computer is a normal Mac OS X.

Ah, "OS X Server" and "2.5.4 works fine"!  For 2.6, I see that the 
getproxies code in urllib was re-written to eliminate use of the 
deprecated python mac Carbon interfaces and instead use ctypes to call 
the SystemConfiguration framework directly.  It could very well be that 
there are differences in the proxy configurations between OS X and OS X 
Server.  It wouldn't surprise me if that hasn't been tested by anyone 
yet; unfortunately, I don't have an OS X Server instance handy to try it 
myself.

I guess the easiest workaround would be to patch urllib.py to avoid 
those calls to SystemConfiguration.  Look at getproxies_macosx_sysconf.  
If the OS X Server system is in on a network that doesn't require HTTP 
proxies, return an empty dict, otherwise hardwire in the proxy 
configuration.  Ugh.

And, not to belabor the point but:
> I have to compile my own python, because i can't install the dmg under
> /usr/local/bin,lib, etc..
> 
> I have to install python under /usr/local/some_other_dir/python. (this
> is a custom install for an application and i can't change ist
> requirements...)

... the python.org installer installs to 
/Library/Frameworks/Python.framework which is reserved for 3-party apps, 
meaning it doesn't interfere with any of the Apple-supplied stuff, 
including the Apple python.  By default the 2.x installers *do* install 
symlinks in /usr/local/bin but that can be de-selected during the 
install, if necessary.  Then you could create your own symlinks from 
/usr/local/some_other_dir.  But it's unlikely that that will directly 
solve the problem above.   You'll almost certainly still have to patch 
urllib.

You should open a tracker issue about this at http://bugs.python.org/.  
And nice job documenting the problem!

-- 
 Ned Deily,
 n...@acm.org

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


Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Mike Driscoll
On Mar 3, 2:17 pm, Cool Dude  wrote:
> Hello ,
> This is Aniket from Techclique, a New Jersey based software
> development and IT consulting firm providing top quality technical and
> software professionals on a permanent and contractual basis to
> Government and commercial customer including fortune 500 companies and
> most of states and federal governments. I am contacting you to see if
> you are comfortable to the skills mentioned below, please forward
> resume to this e-mail address ani...@techclique.com
>
> Python Programmer (someone with industry knowledge/asset mgt)
> Location: Newport Beach, CA (Need Local)
> Duration: 6+ months
> Note: Communication MUST be perfect!, Plus submit with 3 professional
> references
>
> Python programming skills (with web development and dynamically
> generated charts/plots in particular) and working knowledge of Linux/
> UNIX Shell Scripts and SQL.
> Knowledge of Python integration with C/C++ - a definite plus.
>
> Qualifications/Requirements
> * 3+ years of Python programming on Linux/Unix platform; recent (2007)
> required
> * Programming skills building forms, lay-outs, charts, and graphing
> required
> * Designing, coding, and testing web based applications preferred.
> * Strong organizational, oral and written communications skills
> * High energy/self starter with the ability to work independently
> within the firm*s demanding and highly focused environment
>
> Thanks & Regards,
> Aniket
> Techclique Inc.
> Jersey City, NJ
> Email: ani...@techclique.com
> Yahoo IM : aniket_mitta...@yahoo.com
> Contact No : 732-357-3844

Is your email program broken or what? Why are you sending the same
exact message 5 times!?

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


Re: best way to parse a function-call-like string?

2009-03-03 Thread mh
Paul McGuire  wrote:
> Pyparsing will easily carve up these function declarations, and will

I didn't know about this module, it looks like what I was looking
for... Thanks!!!

-- 
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list


Re: Perl / python regex / performance comparison

2009-03-03 Thread Terry Reedy

Ivan wrote:

Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:


Which way are *you* more comfortable with?  There are people who 
regularly use both, and many who do not.




1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?


This is not relevant to your application below.  In any case, the 
differences are in rather esoteric details.


2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)


For one file and simple processing, the time difference should be less 
than the time you spent asking the question.  For complex processing or 
multiple files, a Python user might use numpy, scipy, or other 
pre-written analysis extensions.



3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?


Python ;-) at least for me.

Terry Jan Reedy

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


Re: Python Launcher.app on OS X

2009-03-03 Thread kp8
Looks like the instructions found on

http://wiki.python.org/moin/MacPython/Leopard

have been updated. Who ever did that: Thanks!

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


Re: Indentifying types?

2009-03-03 Thread Terry Reedy

Oltmans wrote:

I'm reading from a file that contains text like


5
google_company
apple_fruit
pencil_object
4
test_one
tst_two


When I read the integer 5 I want to make sure it's an integer.
Likewise, for strings, I want to make sure if something is indeed a
string. So how do I check types in Python? I want to check following
types

1- integers
2- strings
3- testing types of a particular class
4- decimal/floats


You read the lines of a file as text strings.
You can convert a string with int() or float() or get ValueError if 
invalid.  Note that decimal int literals are also float literals.


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


Re: Perl-python regex-performance comparison

2009-03-03 Thread Vlastimil Brom
2009/3/3 MRAB wrote:

>>
> Python 2.7's regex will include possessive quantifiers, atomic groups,
> variable-length lookbehinds, and Unicode properties (at least the common
> ones), amongst other things.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Wow, that's excellent news!
Many thanks for all your efforts to enhance the re capabilities in Python!

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


Re: siple for in expression

2009-03-03 Thread Mark Wooding
"Matko"  writes:

> Can someone help me to understand the following code:
>
> uv_face_mapping = [[0,0,0,0] for f in faces]

It constructs a fresh list, with the same number of elements as are in
the iterable object referred to by `faces', and where each element is a
distinct list of four zero-valued integer objects; it then makes
uv_face_mapping be a name for this list.

(This is therefore not the same as

uv_face_mapping = [[0, 0, 0, 0]] * len(faces)

which constructs a list, each of whose elements is (well, refers to) the
/same/ list of four zero-valued integers.)

-- [mdw]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Perl-python regex-performance comparison

2009-03-03 Thread Steve Holden
Ivan wrote:
> Hello everyone,
> 
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:
> 
http://isperldeadyet.com/

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: Perl-python regex-performance comparison

2009-03-03 Thread MRAB

Chris Rebert wrote:

On Tue, Mar 3, 2009 at 9:05 AM, Ivan  wrote:

Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?


I would think that either they're currently equal in power or Perl's
are just slightly more powerful, as pretty much all languages have
basically copied Perl's regular expressions almost exactly. If you're
talking about Perl6, then combined with the new "rules" feature it's
much more powerful; however, like Perl's regular expressions, someone
will probably write a library like pcre that implements it for all
other languages, so it'll probably just be a matter of syntax.


Python 2.7's regex will include possessive quantifiers, atomic groups,
variable-length lookbehinds, and Unicode properties (at least the common
ones), amongst other things.
--
http://mail.python.org/mailman/listinfo/python-list


"run" Package Query

2009-03-03 Thread Rohan Hole
When I write program (.py) with IDLE , I am able to use run package .


- - - -   start  - - - -

if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

- - - -  end - - - - -

above code works simply with the IDLE.

But problem arises , when I use Eric or pyScriptter , On other editor it
gives the error "Exceptions.ImportError : No Module named run"
Do i need to set any variable ? or path ?
run is a system package or third party ?
Thanx In Advance
--
http://mail.python.org/mailman/listinfo/python-list


Re: removing duplication from a huge list.

2009-03-03 Thread Adam Olsen
On Feb 27, 9:55 am, Falcolas  wrote:
> If order did matter, and the list itself couldn't be stored in memory,
> I would personally do some sort of hash of each item (or something as
> simple as first 5 bytes, last 5 bytes and length), keeping a reference
> to which item the hash belongs, sort and identify duplicates in the
> hash, and using the reference check to see if the actual items in
> question match as well.
>
> Pretty brutish and slow, but it's the first algorithm which comes to
> mind. Of course, I'm assuming that the list items are long enough to
> warrant using a hash and not the values themselves.

Might as well move all the duplication checking to sqlite.

Although it seems tempting to stick a layer in front, you will always
require either a full comparison or a full update, so there's no
potential for a fast path.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Get bound method by name

2009-03-03 Thread Chris Rebert
On Tue, Mar 3, 2009 at 12:54 PM, Steve Holden  wrote:
> Graham Breed wrote:
>> Johannes Bauer wrote:
>>> Hello group,
>>>
>>> I'm looking for a Python function but have forgotten it's name.
>>> Essentially what I want is:
>>>
>>> class Foo():
>>>     def bar(self):
>>>         pass
>>>
>>> x = Foo()
>>> y = x.MAGIC("bar")
>>> print(y)
>>> >
>>>
>>> So the question is: How is the magic function called which returns me
>>> the bound method of a class instance by its name? I know there was a way
>>> but just can't remember...
>>
>> y = getattr(x, "bar")
>
> Or, as a method call (which was requested):

The OP was a bit inconsistent. He only used the word "function", but
his pseudocode used a method.
Either way, one shouldn't normally use magic methods directly.

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pickle Problem

2009-03-03 Thread Gabriel Genellina

En Tue, 03 Mar 2009 16:50:25 -0200, Fab86  escribió:

On Mar 3, 6:48 pm, "Gabriel Genellina"  wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86   
escribió:


> I am having a bit on an issue getting my program to work. The online
> database which I am trying to contact keep timing out meaning I can
> not carry out my 200 searches without being interupted.

> I believe that the solution would be to include an exception handler
> with a timer delay if this error occurs so wait a bit then carry on
> however having spent hours looking at this I can not get my head
> around how to do such a thing.

Exactly. How to handle  
exceptions:http://docs.python.org/tutorial/errors.html


Use time.sleep() to wait for some  
time:http://docs.python.org/library/time.html#time.sleep



Thanks for that I will give it a read.

Do I need to know what error I am getting?


Usually it's best to be as specific as possible.


IDLE is giving me this:

Traceback (most recent call last):
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
13, in 
res = srch.parse_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 765, in parse_results
xml = self.get_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 738, in get_results
stream = self.open()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 723, in open
raise SearchError(err)
SearchError: service temporarily unavailable [C:28]


That means that, in line 13 of test6.py [first line in the stack trace],  
after several function calls [intermediate lines in the stack trace]  
leading to function open in the search package [last line of the stack  
trace], a SearchError exception was raised.

If you want to catch that exception:

try:
   ... some code ...
except SearchError:
  ... code to handle the exception ...

How to "spell" exactly the exception name should appear in the  
documentation; might be yahoo.SearchError, or yahoo.search.SearchError, or  
yahoo.errors.SearchError, or similar.


--
Gabriel Genellina

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


Re: Characters aren't displayed correctly

2009-03-03 Thread Steve Holden
Philip Semanchuk wrote:
> 
> On Mar 2, 2009, at 5:26 PM, John Machin wrote:
[...]
> I (mostly) agree with your rule. But as I said, there's more than one
> way to solve this problem. Or perhaps I should say that there's more
> than one way to lead the OP to a solution to this problem. We teach
> differently, you and I. I believe there's room in the world for *both*
> styles -- perhaps even a third or fourth!  =)
> 
Clue stick!

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: Get bound method by name

2009-03-03 Thread Steve Holden
Graham Breed wrote:
> Johannes Bauer wrote:
>> Hello group,
>>
>> I'm looking for a Python function but have forgotten it's name.
>> Essentially what I want is:
>>
>> class Foo():
>> def bar(self):
>> pass
>>
>> x = Foo()
>> y = x.MAGIC("bar")
>> print(y)
>> >
>>
>> So the question is: How is the magic function called which returns me
>> the bound method of a class instance by its name? I know there was a way
>> but just can't remember...
> 
> y = getattr(x, "bar")

Or, as a method call (which was requested):

y = x.__getattr__("bar")

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: Perl / python regex / performance comparison

2009-03-03 Thread Ciprian Dorin, Craciun
On Tue, Mar 3, 2009 at 7:03 PM, Ivan  wrote:
> Hello everyone,
>
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:
>
> 1. Although it is all relatively similar, there are differences
> between regexes of these two. Which do you believe is the more
> powerful variant (maybe an example) ?
>
> 2. They are both interpreted languages, and I can't really be sure how
> they measure in speed. In your opinion, for handling large files,
> which is better ?
> (I'm processing files of numerical data of several hundred mb - let's
> say 200mb - how would python handle file of such size ? As compared to
> perl ?)
>
> 3. This last one is somewhat subjective, but what do you think, in the
> future, which will be more useful. Which, in your (humble) opinion
> "has a future" ?
>
> Thank you for all the info you can spare, and expecially grateful for
> the time in doing so.
> -- Ivan
> --
> http://mail.python.org/mailman/listinfo/python-list

I could answer to your second question (will Python handle large
files). In my case I use Python to create statistics from some trace
files from a genetic algorithm, and my current size is up to 20MB for
about 40 files. I do the following:
* use regular expressions to identify each line type, extract the
information (as numbers);
* either create statistics on the fly, either load the dumped data
into an Sqlite3 database (which got up to a couple of hundred MB);
* everything works fine until now;

I've also used Python (better said an application built in Python
with cElementTree?), that took the Wikipedia XML dumps (7GB? I'm not
sure, but a couple of GB), then created a custom format file, from
which I've tried to create SQL inserts... And everything worked good.
(Of course it took some time to do all the processing).

So my conclusion is that if you try to keep your in-memory data
small, and use the smart (right) solution for the problem you could
use Python without (big) overhead.

Another side-note, I've also used Python (with NumPy) to implement
neural networks (in fact clustering with ART), where I had about 20
thousand training elements (arrays of thousands of elements), and it
worked remarkably good (I would better than in Java, and comparable
with C/C++).

I hope I've helped you,
Ciprian Craciun.

P.S. If you just need one regular expression transformation to
another, or you need regular expression searching, then just use sed
or grep as you would not get anything better than them.
--
http://mail.python.org/mailman/listinfo/python-list


Re: qt, gtk, wx for py3 ?

2009-03-03 Thread Mike Driscoll
On Mar 3, 1:15 pm, Scott David Daniels  wrote:
> Peter Billam wrote:
> > I've been trying (newbie warning still on) tkinter with python3.0,
> > and I'm getting to that stage where I'm beginning to think there
> > must be a better a way to do this...  But I'm unsure if the
> > big names Qt, Gtk and Wx are available for Py3 yet - e.g.
> >http://pypi.python.org/pypi?:action=browse&c=533&show=alldoesn't
> > seem to show any... What's the gossip on these toolkits for Py3 ?
>
> Well, here are my biases (you will only get biased answers, because
> this is clearly a taste question).
>
> Tkinter: solid, well-established (hence fairly stable), relatively
>          well-documented, comprehensible in a "from the roots" way.
>
> Wx: a lot of mileage, looks best of the machine-independent packages
>      across a raft of systems (does native interaction well), not so
>      well-documented, but has a plethora of examples, comprehensible
>      in a "grab and modify" way.
>
> Qt: simplest model, well-documented, until very recently not available
>      on Windows w/o a restrictive license or substantial cost.
>
> --Scott David Daniels
> scott.dani...@acm.org

It should be noted that the port for 3.0 hasn't started yet for
wxPython and I'm not seeing anything about a port for PyQt either on
their website.

When I started out with Tkinter, I didn't find the docs to be any
better than what I found in wxPython. Each toolkit has it's own ups
and downs. I would recommend trying them until you find something you
like.

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


RE: A Simple Menu , Stretching the Window Width--Tkinter

2009-03-03 Thread John Posner
 >> 
 >> I'd like to create a simple Menu bar with one item in it, 
 >> say, called "My 
 >> Menu", and have a few submenu items on it like "Change 
 >> Data" and "Exit". I 
 >> can do that but I'd like the title I put on the enclosing 
 >> window to be 
 >> completely visible. The title is, for example, "Hello, out 
 >> there. This is a 
 >> simple menu". Presently the window shrinks in width the 
 >> accommodate "My 
 >> Menu", and I see "Hello, out th". How do I force the width 
 >> to accommodate 
 >> the whole title?

If you're having trouble with the size of the overall ("root" or "toplevel")
window, this might help:

  rootwin = Tk()
  # width=500, height=350, upper-left-corner at (50,50) -- revise to suit
  rootwin.geometry('500x350+50+50')
  rootwin.resizable(False, False)
  rootwin.title("Hello, out there")

-John





E-mail message checked by Spyware Doctor (6.0.0.386)
Database version: 5.11880
http://www.pctools.com/en/spyware-doctor-antivirus/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.6.1 urllib error on Mac os x PPC

2009-03-03 Thread ati
On Mon, 2009-03-02 at 13:59 -0800, Ned Deily wrote:
Am 2.3.2009 22:59 Uhr schrieb "Ned Deily" unter :

> 
> First, make sure this is the real problem by trying this snippet:
> 
> /usr/local/test/python/bin/python2.6
 from ctypes import cdll
 from ctypes.util import find_library
 sc = cdll.LoadLibrary(find_library("SystemConfiguration"))
 x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)
> 
> Presumably, if your original test failed, this snippet should fail,
too.

Yes, it fails on PPC and runs without errors on Intel:

/usr/local/test/python/bin/python2.6 /tmp/tt.py
Traceback (most recent call last):
  File "/tmp/tt.py", line 4, in 
x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)
  File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line
366,
in __getattr__
func = self.__getitem__(name)
  File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line
371,
in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, CFStringCreateWithCString): symbol
not
found


Content of /tmp/tt.py:

from ctypes import cdll
from ctypes.util import find_library
sc = cdll.LoadLibrary(find_library("SystemConfiguration"))
x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)


I recompiled Python-2.6.1 with MACOSX_DEPLOYMENT_TARGET=10.3, but no
change..
I updated developertools to xcode312_2621, no change..

Btw.. Python-2.5.4 compiled from scratch works fine.

I forgot to mention the ppc computer is a Mac OS X Server version and
the Intel computer is a normal Mac OS X.


Some detailed info about the macs:

ppc:
Model Name: Xserve G5
Model Identifier: RackMac3,1
Processor Name: PowerPC G5  (3.1)
Processor Speed: 2.3 GHz
Number Of CPUs: 2
L2 Cache (per CPU): 512 KB
Boot ROM Version: 5.1.7f2
System Version: Mac OS X Server 10.5.6 (9G55)
Kernel Version: Darwin 9.6.0


intel:
Model Name: MacBook Pro
Model Identifier: MacBookPro3,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Bus Speed: 800 MHz
Boot ROM Version: MBP31.0070.B07
SSC Version: 1.16f8
System Version: Mac OS X 10.5.6 (9G55)
Kernel Version: Darwin 9.6.0



> 
> If you can, download the python.org 2.6.1 OSX installer and make sure
> your original test works with it.  If so, perhaps you don't need to
> build your own?  That install works on both Intel and PPC.  One
> difference: it is built with MACOX_DEPLOYMENT_TARGET=10.3, meaning it
> will work on systems >= 10.3 but if you really need 10.5 only there
> might be some side-effects that are important to you.

I have to compile my own python, because i can't install the dmg under
/usr/local/bin,lib, etc..

I have to install python under /usr/local/some_other_dir/python. (this
is a custom install for an application and i can't change ist
requirements...)

I don't need universal binaries, i need only ppc, the intel version was
just a test. (but precompiled universql binary is o.k., if it installs
under a custom directory)


> Otherwise, you might want to try rebuilding on the PPC from scratch
> (i.e. an empty build directory) using the 2.6.1 tarball.  By "same
> build" on Intel CPU, you do mean you've rebuilt on PPC?  You could
build
> a "fat" Universal python on either architecture that will work on both
> but you'll need to add a few more options to configure to do that.

It was build from scratch. I rebuild it on intel with the same
configuration to test it, but on intel runs whitout errors.

I dig a bit deeper with otool and discover some differences:

Intel MacOS.so: Carbon, libSystem.B.dylib, CoreServices,
ApplicationServices

PPC MacOS.so: Carbon, libmx.A.dylib, libSystem.B.dylib

Intel _ctypes.so: libSystem.B.dylib
PPC _ctypes.so: libmx.A.dylib, libSystem.B.dylib

---
Intel with deploymant target 10.3, xcode312:
---
sh-3.2# otool
-L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so
/usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so:
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.0.0, current version 136.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)

/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
(compatibility version 1.0.0, current version 32.0.0)

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Applicat
ionServices (compatibility version 1.0.0, current version 34.0.0)

---

sh-3.2# otool
-L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so
/usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version
111.1.3)

--
PPC with deployment_target 10.3, xcode312_2621
--

otool -L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so
/usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so:
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.

Opening for Python Programmer at Newport Beach

2009-03-03 Thread Cool Dude
Hello ,
This is Aniket from Techclique, a New Jersey based software
development and IT consulting firm providing top quality technical and
software professionals on a permanent and contractual basis to
Government and commercial customer including fortune 500 companies and
most of states and federal governments. I am contacting you to see if
you are comfortable to the skills mentioned below, please forward
resume to this e-mail address ani...@techclique.com

Python Programmer (someone with industry knowledge/asset mgt)
Location: Newport Beach, CA (Need Local)
Duration: 6+ months
Note: Communication MUST be perfect!, Plus submit with 3 professional
references

Python programming skills (with web development and dynamically
generated charts/plots in particular) and working knowledge of Linux/
UNIX Shell Scripts and SQL.
Knowledge of Python integration with C/C++ - a definite plus.

Qualifications/Requirements
* 3+ years of Python programming on Linux/Unix platform; recent (2007)
required
* Programming skills building forms, lay-outs, charts, and graphing
required
* Designing, coding, and testing web based applications preferred.
* Strong organizational, oral and written communications skills
* High energy/self starter with the ability to work independently
within the firm*s demanding and highly focused environment


Thanks & Regards,
Aniket
Techclique Inc.
Jersey City, NJ
Email: ani...@techclique.com
Yahoo IM : aniket_mitta...@yahoo.com
Contact No : 732-357-3844
--
http://mail.python.org/mailman/listinfo/python-list


Opening for Python Programmer at Newport Beach

2009-03-03 Thread Cool Dude
Hello ,
This is Aniket from Techclique, a New Jersey based software
development and IT consulting firm providing top quality technical and
software professionals on a permanent and contractual basis to
Government and commercial customer including fortune 500 companies and
most of states and federal governments. I am contacting you to see if
you are comfortable to the skills mentioned below, please forward
resume to this e-mail address ani...@techclique.com

Python Programmer (someone with industry knowledge/asset mgt)
Location: Newport Beach, CA (Need Local)
Duration: 6+ months
Note: Communication MUST be perfect!, Plus submit with 3 professional
references

Python programming skills (with web development and dynamically
generated charts/plots in particular) and working knowledge of Linux/
UNIX Shell Scripts and SQL.
Knowledge of Python integration with C/C++ - a definite plus.

Qualifications/Requirements
* 3+ years of Python programming on Linux/Unix platform; recent (2007)
required
* Programming skills building forms, lay-outs, charts, and graphing
required
* Designing, coding, and testing web based applications preferred.
* Strong organizational, oral and written communications skills
* High energy/self starter with the ability to work independently
within the firm*s demanding and highly focused environment


Thanks & Regards,
Aniket
Techclique Inc.
Jersey City, NJ
Email: ani...@techclique.com
Yahoo IM : aniket_mitta...@yahoo.com
Contact No : 732-357-3844
--
http://mail.python.org/mailman/listinfo/python-list


Opening for Python Programmer at Newport Beach

2009-03-03 Thread Cool Dude
Hello ,
This is Aniket from Techclique, a New Jersey based software
development and IT consulting firm providing top quality technical and
software professionals on a permanent and contractual basis to
Government and commercial customer including fortune 500 companies and
most of states and federal governments. I am contacting you to see if
you are comfortable to the skills mentioned below, please forward
resume to this e-mail address ani...@techclique.com

Python Programmer (someone with industry knowledge/asset mgt)
Location: Newport Beach, CA (Need Local)
Duration: 6+ months
Note: Communication MUST be perfect!, Plus submit with 3 professional
references

Python programming skills (with web development and dynamically
generated charts/plots in particular) and working knowledge of Linux/
UNIX Shell Scripts and SQL.
Knowledge of Python integration with C/C++ - a definite plus.

Qualifications/Requirements
* 3+ years of Python programming on Linux/Unix platform; recent (2007)
required
* Programming skills building forms, lay-outs, charts, and graphing
required
* Designing, coding, and testing web based applications preferred.
* Strong organizational, oral and written communications skills
* High energy/self starter with the ability to work independently
within the firm*s demanding and highly focused environment


Thanks & Regards,
Aniket
Techclique Inc.
Jersey City, NJ
Email: ani...@techclique.com
Yahoo IM : aniket_mitta...@yahoo.com
Contact No : 732-357-3844
--
http://mail.python.org/mailman/listinfo/python-list


Opening for Python Programmer at Newport Beach

2009-03-03 Thread Cool Dude
Hello ,
This is Aniket from Techclique, a New Jersey based software
development and IT consulting firm providing top quality technical and
software professionals on a permanent and contractual basis to
Government and commercial customer including fortune 500 companies and
most of states and federal governments. I am contacting you to see if
you are comfortable to the skills mentioned below, please forward
resume to this e-mail address ani...@techclique.com

Python Programmer (someone with industry knowledge/asset mgt)
Location: Newport Beach, CA (Need Local)
Duration: 6+ months
Note: Communication MUST be perfect!, Plus submit with 3 professional
references

Python programming skills (with web development and dynamically
generated charts/plots in particular) and working knowledge of Linux/
UNIX Shell Scripts and SQL.
Knowledge of Python integration with C/C++ - a definite plus.

Qualifications/Requirements
* 3+ years of Python programming on Linux/Unix platform; recent (2007)
required
* Programming skills building forms, lay-outs, charts, and graphing
required
* Designing, coding, and testing web based applications preferred.
* Strong organizational, oral and written communications skills
* High energy/self starter with the ability to work independently
within the firm*s demanding and highly focused environment


Thanks & Regards,
Aniket
Techclique Inc.
Jersey City, NJ
Email: ani...@techclique.com
Yahoo IM : aniket_mitta...@yahoo.com
Contact No : 732-357-3844
--
http://mail.python.org/mailman/listinfo/python-list


Opening for Python Programmer at Newport Beach

2009-03-03 Thread Cool Dude
Hello ,
This is Aniket from Techclique, a New Jersey based software
development and IT consulting firm providing top quality technical and
software professionals on a permanent and contractual basis to
Government and commercial customer including fortune 500 companies and
most of states and federal governments. I am contacting you to see if
you are comfortable to the skills mentioned below, please forward
resume to this e-mail address ani...@techclique.com

Position : Python programmer
Location : Newport Beach
Duration : 6+month

I need local people (or someone that can be here QUICKLY for an in
person interview).
 Communication MUST be perfect!

Plus submit with 3 professional references I can call I check myself.
MUST BE MANAGERS THEY REPORTED TO!! No candidate will be submitted
without a reference check. I need names ASAP. I only have today before
other people get this.


Position Summary

We are seeking a Python programmer with web-based development
experience to assist with developing web based applications. The
successful candidate should have excellent Python programming skills
(with web development and dynamically generated charts/plots in
particular) and working knowledge of Linux/UNIX Shell Scripts and SQL.
Knowledge of Python integration with C/C++ - a definite plus.

Selected candidate will be working with our ABS/MBS trade desk to
develop and enhance applications used by Fixed Income Portfolio
Management. You will assist in the design, construction and
enhancement of applications used. Qualified candidates must possess a
four-year college degree with a preferred major in Computer Science,
Computer Engineering, or other technical/IT degree. A strong
familiarity with Python on Linux; recent (2007) experience is
required. Knowledge with web technologies including Apache, JavaScript/
AJAX, CSS, HTML, designing, coding, and testing web based applications
a plus. Programming experience in C++ is also a plus.

Our selected individual must be a team player, be self-motivated, and
have excellent verbal communication skills. In addition, the ability
to project manage and work within a team environment will be critical
to being successful in this role. Experience in the Securities
industry, preferably Fixed Income is a plus.

Qualifications/Requirements
* 3+ years of Python programming on Linux/Unix platform; recent (2007)
required
* Programming skills building forms, lay-outs, charts, and graphing
required
* Designing, coding, and testing web based applications preferred.
* Strong organizational, oral and written communications skills
* High energy/self starter with the ability to work independently
within the firm*s demanding and highly focused environment


Thanks & Regards,
Aniket
Techclique Inc.
Jersey City, NJ
Email: ani...@techclique.com
Yahoo IM : aniket_mitta...@yahoo.com
Contact No : 732-357-3844
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wanting to fire an event when property content changes

2009-03-03 Thread Albert Hopkins
On Tue, 2009-03-03 at 13:41 -0600, nuwandame wrote:
> What I am wanting to do is execute code whenever a property of a class
> object has been changed.
> 
> i.e.
> 
> class test:
> 
> testproperty = None
> 
> 
> bob = test()
> bob.testproperty = 'something'
> 
> So, when bob.testproperty is set to a new value I can run code that
> changes other dependent yet loosly tied properties in containing class
> objects.
> 
> I have looked at using metaclass for this but havn't found anything for
> property attributes, just methods...
> 
> Anyone have ideas how this can be done?

Use Python properties:

http://docs.python.org/library/functions.html#property


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


Wanting to fire an event when property content changes

2009-03-03 Thread nuwandame
What I am wanting to do is execute code whenever a property of a class
object has been changed.

i.e.

class test:

testproperty = None


bob = test()
bob.testproperty = 'something'

So, when bob.testproperty is set to a new value I can run code that
changes other dependent yet loosly tied properties in containing class
objects.

I have looked at using metaclass for this but havn't found anything for
property attributes, just methods...

Anyone have ideas how this can be done?

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


Re: qt, gtk, wx for py3 ?

2009-03-03 Thread Scott David Daniels

Peter Billam wrote:

I've been trying (newbie warning still on) tkinter with python3.0,
and I'm getting to that stage where I'm beginning to think there
must be a better a way to do this...  But I'm unsure if the
big names Qt, Gtk and Wx are available for Py3 yet - e.g.
http://pypi.python.org/pypi?:action=browse&c=533&show=all doesn't
seem to show any... What's the gossip on these toolkits for Py3 ?


Well, here are my biases (you will only get biased answers, because
this is clearly a taste question).

Tkinter: solid, well-established (hence fairly stable), relatively
well-documented, comprehensible in a "from the roots" way.

Wx: a lot of mileage, looks best of the machine-independent packages
across a raft of systems (does native interaction well), not so
well-documented, but has a plethora of examples, comprehensible
in a "grab and modify" way.

Qt: simplest model, well-documented, until very recently not available
on Windows w/o a restrictive license or substantial cost.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Perl python - regex performance comparison

2009-03-03 Thread pruebauno
On Mar 3, 12:38 pm, Ivan  wrote:
> Hello everyone,
>
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:
>
> 1. Although it is all relatively similar, there are differences
> between regexes of these two. Which do you believe is the more
> powerful variant (maybe an example) ?
>
> 2. They are both interpreted languages, and I can't really be sure how
> they measure in speed. In your opinion, for handling large files,
> which is better ?
> (I'm processing files of numerical data of several hundred mb - let's
> say 200mb - how would python handle file of such size ? As compared to
> perl ?)
>
> 3. This last one is somewhat subjective, but what do you think, in the
> future, which will be more useful. Which, in your (humble) opinion
> "has a future" ?
>
> Thank you for all the info you can spare, and expecially grateful for
> the time in doing so.
> -- Ivan
>
> p.s. Having some trouble posting this. If you see it come out several
> times, please ignore the copies.

1. They are so similar that, unless they added a lot in Perl lately,
both are about equally powerful. I think the difference had mainly to
do with how certain multiline constructs were handled. But that
doesn't make one more powerful than the other, it just means that you
have to make minor changes to port regexes from one to the other.

2. Speed is pretty similar too, Perl probably has a more optimized
regex engine because regexes are usually used a more in Perl programs.
Python probably has more optimized function calls, string methods,
etc. So it probably depends on the mix of functionality you are using.

3. Both languages have been around for a while and too much
infrastructure depends on them that they are not going to go away.
Perl is extensively used for sysadmin tasks, nagios, etc. and Python
is used in Gentoo, Redhat distributions. Of course COBOL is not dying
quickly either for the same reason which isn't the same than wanting
to program in it.

On this list you will find quite a few that have switched from Perl to
Python because we like the later better, but there are many
programmers that are quite happy with Perl. I myself want to play
around with Perl 6 at some point just for fun. Since a lot of the
reasons to choose one or another seem to be mostly syntax, I would
recommend you to write a couple of short programs in both of them and
see what you like more and use that.
--
http://mail.python.org/mailman/listinfo/python-list


A Simple Menu , Stretching the Window Width--Tkinter

2009-03-03 Thread W. eWatson
I'd like to create a simple Menu bar with one item in it, say, called "My 
Menu", and have a few submenu items on it like "Change Data" and "Exit". I 
can do that but I'd like the title I put on the enclosing window to be 
completely visible. The title is, for example, "Hello, out there. This is a 
simple menu". Presently the window shrinks in width the accommodate "My 
Menu", and I see "Hello, out th". How do I force the width to accommodate 
the whole title?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: Looking for a General Method to Configure Tkinter Widgets

2009-03-03 Thread W. eWatson

odeits wrote:

On Mar 2, 7:14 am, "W. eWatson"  wrote:

I'm modifying a Tkinter Python program that uses hard coded initial values
for several widgets. For example, latitude = 40. My plan is to put the names
and values for configuration purposes into a file. For example, a pseudo
statement like the one just given. ConfigObj provides a mechanism for it.

I am only at an early stage of learning Tkinter, but it looks like a hang up
is in the use of control variables passed between widgets and non-Tkinter
objects that setup up the widget and retrieve the changed values. Roughly,
the main loop contains code like self.longitude = 40. Non-Tkinter objects
set up the parameters to the widgets, and when a widget* is complete the
setup program resets the main loop globals. As I see it, it looks like
IntVar, etc. used must be hard coded, as in the original program, to
preserve types like boolean, strings, integers, floats, etc. It's either
that or use of eval or some like function. Comments?

* For example, in one setup program, I see code like this after its call to
a dialog returns:

 try:
 s = dialog.stopVar.get()
 d = [ int(x) for x in s.split(":") ]
 self.stop_time = datetime.time(d[0],d[1],d[2])

stop_time is a string like "10:30:15".
--
W. eWatson

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

 Web Page: 


I am sorry, I am a bit confused. Is your question how to preserve the
value and/or type of the data in the config file? Or are you having
trouble getting the values from the file to the widget?

I'm probably confused too. :-) Let's try this. In
s=dialog.stopVar.get()
I'd like to eliminate the statement and replace it with something like:
s="dialog." + "stopV.get()"
)and execute that--I'm aware of the exec operation--problems)
where StopV is a string name taken from the config file. That is, in the 
config file there would be something like:

stop_time = 18:00:00, stopV.

Initially, when starting the program, reading that line would create a 
self.stop_time variable with the value 18:00:00 (string). To communicate 
with the dialog widget where the user enters a new value, I need to use 
control variables. but ones that are not in the code itself. Instead, I 
would like to manufacture them from what I see in the config file.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: Pickle Problem

2009-03-03 Thread Fab86
On Mar 3, 6:48 pm, "Gabriel Genellina"  wrote:
> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86  escribió:
>
> > I am having a bit on an issue getting my program to work. The online
> > database which I am trying to contact keep timing out meaning I can
> > not carry out my 200 searches without being interupted.
>
> > I believe that the solution would be to include an exception handler
> > with a timer delay if this error occurs so wait a bit then carry on
> > however having spent hours looking at this I can not get my head
> > around how to do such a thing.
>
> Exactly. How to handle exceptions:http://docs.python.org/tutorial/errors.html
>
> Use time.sleep() to wait for some 
> time:http://docs.python.org/library/time.html#time.sleep
>
> --
> Gabriel Genellina

Thanks for that I will give it a read.

Do I need to know what error I am getting?

IDLE is giving me this:

Traceback (most recent call last):
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
13, in 
res = srch.parse_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 765, in parse_results
xml = self.get_results()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 738, in get_results
stream = self.open()
  File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
\__init__.py", line 723, in open
raise SearchError(err)
SearchError: service temporarily unavailable [C:28]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pickle Problem

2009-03-03 Thread Gabriel Genellina

En Tue, 03 Mar 2009 16:39:43 -0200, Fab86  escribió:


I am having a bit on an issue getting my program to work. The online
database which I am trying to contact keep timing out meaning I can
not carry out my 200 searches without being interupted.

I believe that the solution would be to include an exception handler
with a timer delay if this error occurs so wait a bit then carry on
however having spent hours looking at this I can not get my head
around how to do such a thing.


Exactly. How to handle exceptions:
http://docs.python.org/tutorial/errors.html

Use time.sleep() to wait for some time:
http://docs.python.org/library/time.html#time.sleep

--
Gabriel Genellina

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


Re: Indentifying types?

2009-03-03 Thread andrew cooke

oh crap.  sorry about that - replied to the wrong thread.  andrew

andrew cooke wrote:
>
> either will work for what you want.  people in the python list prefer
> python.  you only have to post a question once.  this gives an idea of the
> relative popularity and trends:
> http://www.google.com/trends?q=python+language%2C+perl+language
>
> andrew
>
> Oltmans wrote:
>> I'm reading from a file that contains text like
>>
>> 
>> 5
>> google_company
>> apple_fruit
>> pencil_object
>> 4
>> test_one
>> tst_two
>> 
>>
>> When I read the integer 5 I want to make sure it's an integer.
>> Likewise, for strings, I want to make sure if something is indeed a
>> string. So how do I check types in Python? I want to check following
>> types
>>
>> 1- integers
>> 2- strings
>> 3- testing types of a particular class
>> 4- decimal/floats
>>
>> Please excuse my ignorance & enlighten me. I will really appreciate
>> any help.
>>
>> Thanks,
>> Oltmans
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


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


Re: Perl-python regex-performance comparison

2009-03-03 Thread Chris Rebert
On Tue, Mar 3, 2009 at 9:05 AM, Ivan  wrote:
> Hello everyone,
>
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:
>
> 1. Although it is all relatively similar, there are differences
> between regexes of these two. Which do you believe is the more
> powerful variant (maybe an example) ?

I would think that either they're currently equal in power or Perl's
are just slightly more powerful, as pretty much all languages have
basically copied Perl's regular expressions almost exactly. If you're
talking about Perl6, then combined with the new "rules" feature it's
much more powerful; however, like Perl's regular expressions, someone
will probably write a library like pcre that implements it for all
other languages, so it'll probably just be a matter of syntax.

> 2. They are both interpreted languages, and I can't really be sure how
> they measure in speed. In your opinion, for handling large files,
> which is better ?
> (I'm processing files of numerical data of several hundred mb - let's
> say 200mb - how would python handle file of such size ? As compared to
> perl ?)

They're probably both about the same. Your problem is probably
IO-bound, so the slowness of either language will likely be made
irrelevant by the comparative slowness of your hard disk. If you
really care about maximum speed here, you should probably write a C
extension for the most intensive part of your algorithm (fairly easy
to do with Python, probably about the same with Perl), though Python
also has Psyco and Cython available as other ways to speed up your
program without resorting to C; don't know if Perl has any similar
tools.

> 3. This last one is somewhat subjective, but what do you think, in the
> future, which will be more useful. Which, in your (humble) opinion
> "has a future" ?

Python is already well on its way to a smooth transition to Python 3.0
(Python's Perl6 equivalent) with few drastic changes to the language;
most of the changes are pretty incremental but just happen to break
backward compatibility; and the resulting language is still quite
clearly identifiable as Python.
Perl, on the other hand, is currently quagmired in a long,
indeterminate wait for the epic and drastically-revised Perl 6 to be
released.
They both have a future, but Python's definitely appears more secure
at this point. It's more wait-and-see with Perl. But take this with a
grain of salt due to the obvious pro-Python bias you'll get on this
list.

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Indentifying types?

2009-03-03 Thread Mike Driscoll
On Mar 3, 11:44 am, Chris Rebert  wrote:
> On Tue, Mar 3, 2009 at 9:03 AM, Mike Driscoll  wrote:
> > - Show quoted text -
> > On Mar 3, 10:57 am, Oltmans  wrote:
> >> I'm reading from a file that contains text like
>
> >> 
> >> 5
> >> google_company
> >> apple_fruit
> >> pencil_object
> >> 4
> >> test_one
> >> tst_two
> >> 
>
> >> When I read the integer 5 I want to make sure it's an integer.
> >> Likewise, for strings, I want to make sure if something is indeed a
> >> string. So how do I check types in Python? I want to check following
> >> types
>
> >> 1- integers
> >> 2- strings
> >> 3- testing types of a particular class
> >> 4- decimal/floats
>
> >> Please excuse my ignorance & enlighten me. I will really appreciate
> >> any help.
>
> >> Thanks,
> >> Oltmans
>
> > I think when you're reading from a file, it will just read each line
> > as a string. So you'd probably need to either try casting the line
> > into something else and catch it in an exception handler or use eval.
>
> > The normal way to check types is to use the keyword isinstance or just
> > use the "type" keyword.
>
> isinstance() and type() are callables, *not* keywords; and IMHO,
> type() should never be used for typechecking (ironically), since such
> checks are always written more clearly using isinstance().
>
> Cheers,
> Chris
>
> --
> I have a blog:http://blog.rebertia.com

Yeah, I never use type except in IDLE or for debugging purposes. But
IDLE does change their color, so they are builtins, so I thought
keywords was a more understandable term for a newb.

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


Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-03-03 Thread dazaster59
I am interested in the possibilities of a CAD system built on top of a
computer algebra system. I would be willing to contribute
implementations of your "entities" (and associated transforms) using
sympy, using the current 2d geometry module as a starting point. For
adequate performance it would soon need to be ported to sympy-core or
another CAS.

I'm interested in this because I like:
- the accuracy that is possible with algebraic expressions even after
cumulative transforms (eg. rotations)
- the potential for elegant, generic implementations of geometric
operations (eg. finding intersections)
- the possibilities for analysing cumulative tolerancing effects
- the benefits for simulation and analysis of physics problems (eg.
optical systems)

What do you think?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Attribute error-- but I'm innocent(?)

2009-03-03 Thread Denis Kasak
On Tue, Mar 3, 2009 at 6:13 AM, Dennis Lee Bieber  wrote:
> On Mon, 2 Mar 2009 16:56:58 -0800 (PST), Nick Mellor
>  declaimed the following in
>>
>>     def __init(self):
>>         self.forename = RandomName("h:\\Testing\\NameDb\
>> \Forenames.csv", namefield = "Forename")
>
>        Where is "RandomName" defined? Python is case sensitive, and the
> method further down is "randomName".

You could ask the same for dictfile(), which is also not shown, though
you could probably deduce from the filename (and the fact that it
works now) that it is defined elsewhere in the same file.

>        Furthermore, given the indentation you show, randomName is a method
> of RandomPerson... If that is true, you'll need to do
>
>                target = self.randomName(...)
>
>>         self.surname = RandomName("h:\\Testing\\NameDb\\Surnames.csv",
>> namefield = "Surname")
>>         self.randomAddress = dictfile("h:\\Testing\\NameDb\
>> \Addresses.csv").cycleShuffled() it should be obvious
>> [...]
>>
>>     def randomName(self):

As the OP said, RandomName is a class and, judging by the
capitalization, he is instantiating objects of the said class and not
the method of RandomPerson.

>        Up above you are pass two arguments (besides the "self" with my
> noted change would supply), but here you do not have anything to accept
> them... Where is that file name and that keyword argument supposed to be
> received?
>
>        def randomName(self, fileid, namefield):
>        #have to use "namefield" as you used a keyword passing mechanism
>
>>         return {"Forename" : self.forename.randomByWeight(),
>>                 "Surname" : self.surname.randomByWeight()}
>>
>        This will return a dictionary containing both forename and
> surname... Assuming you have forename and surname OBJECTS with contain a
> randomByWeight method.

In all probability, forename and surname *are* instances of RandomName
and contain the randomByWeight() method.

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


Re: getting all HTTP headers from urllib2 Request?

2009-03-03 Thread cgoldberg
> > Looking at the httplib sources, the only headers it may add are Host,  
> > Accept-Encoding: identity, and Content-Length.


now that I think of it, if it is only 3 headers, I can just override
them explicitly from urllib2 and then log that.

thanks a lot for looking into the httplib source!

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


Re: Indentifying types?

2009-03-03 Thread andrew cooke

either will work for what you want.  people in the python list prefer
python.  you only have to post a question once.  this gives an idea of the
relative popularity and trends:
http://www.google.com/trends?q=python+language%2C+perl+language

andrew

Oltmans wrote:
> I'm reading from a file that contains text like
>
> 
> 5
> google_company
> apple_fruit
> pencil_object
> 4
> test_one
> tst_two
> 
>
> When I read the integer 5 I want to make sure it's an integer.
> Likewise, for strings, I want to make sure if something is indeed a
> string. So how do I check types in Python? I want to check following
> types
>
> 1- integers
> 2- strings
> 3- testing types of a particular class
> 4- decimal/floats
>
> Please excuse my ignorance & enlighten me. I will really appreciate
> any help.
>
> Thanks,
> Oltmans
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


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


Perl python - regex performance comparison

2009-03-03 Thread Ivan
Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?

Thank you for all the info you can spare, and expecially grateful for
the time in doing so.
-- Ivan


p.s. Having some trouble posting this. If you see it come out several
times, please ignore the copies.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Indentifying types?

2009-03-03 Thread Chris Rebert
On Tue, Mar 3, 2009 at 9:03 AM, Mike Driscoll  wrote:
> - Show quoted text -
> On Mar 3, 10:57 am, Oltmans  wrote:
>> I'm reading from a file that contains text like
>>
>> 
>> 5
>> google_company
>> apple_fruit
>> pencil_object
>> 4
>> test_one
>> tst_two
>> 
>>
>> When I read the integer 5 I want to make sure it's an integer.
>> Likewise, for strings, I want to make sure if something is indeed a
>> string. So how do I check types in Python? I want to check following
>> types
>>
>> 1- integers
>> 2- strings
>> 3- testing types of a particular class
>> 4- decimal/floats
>>
>> Please excuse my ignorance & enlighten me. I will really appreciate
>> any help.
>>
>> Thanks,
>> Oltmans
>
> I think when you're reading from a file, it will just read each line
> as a string. So you'd probably need to either try casting the line
> into something else and catch it in an exception handler or use eval.
>
> The normal way to check types is to use the keyword isinstance or just
> use the "type" keyword.

isinstance() and type() are callables, *not* keywords; and IMHO,
type() should never be used for typechecking (ironically), since such
checks are always written more clearly using isinstance().

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Indentifying types?

2009-03-03 Thread Gabriel Genellina
En Tue, 03 Mar 2009 14:57:29 -0200, Oltmans   
escribió:



I'm reading from a file that contains text like


5
google_company
apple_fruit
pencil_object
4
test_one
tst_two


When I read the integer 5 I want to make sure it's an integer.
Likewise, for strings, I want to make sure if something is indeed a
string. So how do I check types in Python? I want to check following
types

1- integers
2- strings
3- testing types of a particular class
4- decimal/floats

Please excuse my ignorance & enlighten me. I will really appreciate
any help.


Item 3 requires special knowledge of the class.
You cannot be sure of the "original" data type. 5 looks like an integer,  
but it's a string too. You may arrange your tests for "most strict" to  
"less strict":


int
float
string

and for each of them, try to do the conversion. If you don't get an  
exception, fine; else continue with the next one.


--
Gabriel Genellina

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


Re: Perl-python regex-performance comparison

2009-03-03 Thread Tino Wildenhain

Ivan wrote:

Hello everyone,


...


1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?


I guess both languages have their use and future. You should come to
your own conclusion when you work with both languages for a while.
I can only say for myself, I know both and prefer python for its
nice straight forward way. And you don't need the hammer (aka regex)
for everything. Several hundred megabytes is not much, you would
work thru them sequentially, that is with python you would almost
exclusively work with generators.

HTH
Tino


smime.p7s
Description: S/MIME Cryptographic Signature
--
http://mail.python.org/mailman/listinfo/python-list


Perl-python regex-performance comparison

2009-03-03 Thread Ivan
Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?

Thank you for all the info you can spare, and expecially grateful for
the time in doing so.
-- Ivan


p.s. Having some trouble posting this. If you see it come out several
times, please ignore the copies.
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to manage CLOB type with cx_oracle

2009-03-03 Thread Gabriel Genellina
En Tue, 03 Mar 2009 15:23:38 -0200, Loredana   
escribió:



I try this code and it works:

curs.execute(sqlstr)
for rows in curs:
for col in rows:
try:
print col.read()
except:
print col


onother question?
which is the best wey (fastest way) to discern LOB from other type?


type()? Add a line like this in the code above:
print type(col)

--
Gabriel Genellina

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


Re: Server programming

2009-03-03 Thread koranthala
On Mar 3, 8:09 pm, Bruno Desthuilliers  wrote:
> koranthala a écrit :
> (snip)
>
> > Hi Bruno,
> >    After reading your email, I tried reworking my code so that most of
> > my logic moves to Models.
> >    But, most probably because this is my first application
> > development, I am unable to do so.
> >    For example:
> >     I have Models A,B, C, D . Now, there is not much model specific
> > code (preprocessing before updating code inside Models)in it. Rather
> > most of the code is of the format:
> >      data received and to be added to D. But for adding to D, check
> > whether it is already in C - if not add to C and B. etc...
>
> And you don't find it "model specific" ? Man, this is business rules,
> and as such belongs to the models part, not to views. You surely want to
> make sure these rules always apply, don't you ?
>
> >    Now, I tried putting this code inside Model D,but it does not seem
> > to belong there - since it modifies other Models.
>
> And ? Who said a Model (or ModelManager) shouldn't touch other models ?
>
> >    Is keeping such code inside views against Django's/Application-
> > Developments philosophy?
>
> FWIW, I see this antipattern (AnemicDomainModel) way too often in django
> apps. This doesn't make it less of an antipattern.
>
> > In that case, where will this go?
>
> It's impossible to say exactly where in the models module without a
> sufficiant knowledge of the domain, rules etc. Sorry, but my crystal
> ball is out for repair.

Thank you, Bruce.
Sorry for the rather naive questions.
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to manage CLOB type with cx_oracle

2009-03-03 Thread Loredana
On Mar 3, 5:12 pm, "Gabriel Genellina"  wrote:
> En Tue, 03 Mar 2009 13:33:19 -0200, Loredana   
> escribió:
>
>
>
>
>
> > On Mar 3, 1:01 pm, Loredana  wrote:
> >> Hi,
>
> >> I need to read CLOB field type (it is long text)
>
> >> if I use this code:
>
> >> curs.execute(sqlstr)
> >> rows['name_of_columns']     =   name_of_columns
> >> rows['data']                         =   curs.fetchall()
>
> >> it returns me this values:
>
> >> test = {'name_of_columns': ['FILENAME', 'CRONTIME', 'SHORT_TAIL',
> >> 'LONG_TAIL'], 'data': [('dd','asdds','adadsa', >> 0x2a955bc230>')]}
>
> >> any ideas?
>
> >> Thanks
>
> >> Lory
>
> > Hi all,
> > I success to read one row with the following code:
>
> >         curs.execute(sqlstr)
> >         name_of_columns =   []
> >         for fieldDesc in curs.description:
> >             name_of_columns.append(fieldDesc[0])
> >         for rows_ in curs.fetchone():
> >             try:
> >                 print rows_.read()
> >             except:
> >                 print "except. ",rows_
>
> > but if I try with fetchmany() it doesn't work
> > any ideas?
>
> cx_Oracle implements DBAPI 2.0, then you should follow the general  
> guidelines in the specification:http://www.python.org/dev/peps/pep-0249/
>
> LOBs are an extension to DBAPI -- see  
> http://cx-oracle.sourceforge.net/html/lob.htmland carefully read the  
> second note:
>
> """Note: Internally, Oracle uses LOB locators which are allocated based on  
> the cursor array size. Thus, it is important that the data in the LOB  
> object be manipulated before another internal fetch takes place. The  
> safest way to do this is to use the cursor as an iterator. In particular,  
> do not use the fetchall() method. The exception “LOB variable no longer  
> valid after subsequent fetch” will be raised if an attempt to access a LOB  
> variable after a subsequent fetch is detected."""
>
> --
> Gabriel Genellina- Hide quoted text -
>
> - Show quoted text -

ok...
I try this code and it works:

curs.execute(sqlstr)
for rows in curs:
for col in rows:
try:
print col.read()
except:
print col


onother question?
which is the best wey (fastest way) to discern LOB from other type?

thanks

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


Re: Jerry Pournelle gives award to Python and Guido for 2008

2009-03-03 Thread Richard Hanson
[Tardy as well as drifting off-topic:]

Terry Reedy wrote:

> Richard Hanson wrote:
>
> > Jerry Pournelle commends Python and Guido in "The Annual Orchid
> > and Onions Parade" portion of his Chaos Manor Reviews column:
> > 
> > >
> > 
> > [snip]
> 
> Great nomination. 

Thanks for the kind words, Terry.

> In October [Jerry Pournelle] wrote
> "Languages to Begin With
> 
> If you want to try learning what programming is like, I recommend you 
> start with Python. (Python.org) It's free, it's fast, and there are a 
> lot of example programs you can look through. The Wikipedia article on 
> Python gives a good description of the language and its history, as well 
> as an example of a Python program. Don't let the capability of the 
> language fool you into thinking you need to learn a lot before you can 
> do anything: you can write simple good programs in Python within a 
> couple of hours of beginning. O'Reilly has several books on the 
> language; I recommend Learning Python as a beginning, and those more 
> serious about learning the language need the O'Reilly Python Cookbook — 
> at least if you are like me and more comfortable learning languages by 
> studying examples.
> 
> Peter Glaskowsky notes that "Python is a language that relies on dynamic 
> typing and other kinds of looseness in order to increase programmer 
> productivity," and may not be entirely suitable for learning good 
> programming practices. I have to agree, but it is free, it does work, 
> and I confess I use it when I have a job that needs doing fast. In my 
> case I often craft filters and other specialized text processing, and 
> Python is excellent for that. I've never attempted to write a large and 
> complex Python program."

Thanks as well for that quote, Terry. I'd missed those comments
of Jerry's.

Nowadays, I hardly have time to keep up with colapy, py-dev, and
Jerry's View and Mail pages -- let alone unimportant, real-life
stuff. :-)

On-topic to the thread: It's gratifying to see Python taking over
the world of programming so thoroughly -- Jerry reaches a
different audience and his evangelizing (above) can but add to
the pythonicalization of the world.

Lookin'-through-the-wrong-end-of-Guido's-time-machine-again-ly
y'rs -- 

Richard "Tardis" Hanson

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


Perl-python regex-performance comparison

2009-03-03 Thread Ivan
Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?

Thank you for all the info you can spare, and expecially grateful for
the time in doing so.
-- Ivan
--
http://mail.python.org/mailman/listinfo/python-list


Python-URL! - weekly Python news and links (Mar 3)

2009-03-03 Thread Gabriel Genellina
QOTW:  "A sort of premature pessimization, then." - Steve Holden, in search
of an adequate description for a clever indexing scheme
http://groups.google.com/group/comp.lang.python/msg/37e7e9e5f9ba6159


Java best coding styles aren't adequate for Python:
http://groups.google.com/group/comp.lang.python/t/7d6b74b4904d48ec/

Challenge: break out of this (experimental) restricted execution
environment:
http://mail.python.org/pipermail/python-list/2009-February/702214.html

How to execute an application from inside a zip file (like Java .jar):
http://groups.google.com/group/comp.lang.python/t/9c15ce45b6a41192/

How to test functions that depend on today's date:
http://groups.google.com/group/comp.lang.python/t/5d1bd739644bc843/

Iterator class to allow restarting a generator:
http://groups.google.com/group/comp.lang.python/t/83bd33d29520d71e/

A nested conditional expression (in C) that progressively becomes more
and more simple when rewritten in Python:
http://groups.google.com/group/comp.lang.python/t/bdd3e0de802fdf7d/

Some people seems worried about the relative performance of Python 3.0
against Ruby 1.9:
http://groups.google.com/group/comp.lang.python/t/b2f8043ba168ad75/

A proposed implementation for an Ordered Dictionary:
http://groups.google.com/group/comp.lang.python/t/9c2f039e61bd81fb/

A followup revives an old thread (is it "call by value" or "by
reference"?) -- but no flames this time:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/75a63598d7f0b60c/49dbd06aa0b17344?#49dbd06aa0b17344



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily

Just beginning with Python?  This page is a great place to start:
http://wiki.python.org/moin/BeginnersGuide/Programmers

The Python Papers aims to publish "the efforts of Python enthusiats":
http://pythonpapers.org/
The Python Magazine is a technical monthly devoted to Python:
http://pythonmagazine.com

Readers have recommended the "Planet" sites:
http://planetpython.org
http://planet.python.org

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.
http://groups.google.com/group/comp.lang.python.announce/topics

Python411 indexes "podcasts ... to help people learn Python ..."
Updates appear more-than-weekly:
http://www.awaretek.com/python/index.html

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance.
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donations/

The Summary of Python Tracker Issues is an automatically generated
report summarizing new bugs, closed ones, and patch submissions. 

http://search.gmane.org/?author=status%40bugs.python.org&group=gmane.comp.python.devel&sort=date

Although unmaintained since 2002, the Cetus collection of Python
hyperlinks retains a few gems.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://code.activestate.com/recipes/langs/python/

Many Python conferences around the world are in preparation.
Watch this space for links to them.

Among several Python-oriented RSS/RDF feeds available, see:
http://www.python.org/channews.rdf
For more, see:
http://www.syndic8.com/feedlist.php?ShowMatch=python&ShowStatus=all
The old Python "To-Do List" now lives principally in a
SourceForge reincarnation.
http://sourceforge.net/tracker/?atid=355470&group_i

Perl / python regex / performance comparison

2009-03-03 Thread Ivan
Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?

Thank you for all the info you can spare, and expecially grateful for
the time in doing so.
-- Ivan
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >