Re: Iteration over two sequences

2005-02-11 Thread Scott David Daniels
David Isaac wrote:
"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]:
Numarray is the future, Numeric is the "past",
This statement is not obviously true.  See the recent discussion on the 
developer lists. (Search for Numeric3.)
Alan Isaac
I stand corrected.  Sorry to have conveyed a mis-impression that I have
held for a while.  It was my understanding that the Numeric code was so
hard to maintain that our fearless leader would never let it in the
codebase.  Hence, Numarray was born.  A quick look through some of the
Numeric3 messages leaves me with the impression that Numeric3 will be
more of a rebirth than a small change.  I have used Numeric for several
big projects (that died for commercial, rather than technical, reasons),
and have certainly appreciated it.  The thrust of my comment holds,
however, "learning both is not much harder than learning one."
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: [NooB] Using Escape Sesquences with Strings...

2005-02-11 Thread administrata
bruno modulix <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> administrata wrote:
> > Hello! :)
> > I've reading 'Python Programmin for the Absolute beginner'.
> > I got questions which is...
> > 
> > print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
> > 
> > rock = """
> > Igneous  Sedimentary  Metamorphic
> > 
> > Lava Grains   Marble
> > Ramdom crystals  LayerBands
> > Granite  Salt Schist
> > IntrusiveWeathering   Heat + Pressure
> >  Deposition   Change"""
> > print \trock
> > 
> > print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
> > 
> > error occurs!
> > 
> > I don't know how to \t The variable.
> 
> see Daniel's answer for the why.
> Now for the how, I guess you want a tab on each line so you have two 
> solutions :
> 1/ putting the tabs in the string:
> rock = """
> \tIgneous  Sedimentary  Metamorphic
> 
> \tLava Grains   Marble
> \tRamdom crystals  LayerBands
> \tGranite  Salt Schist
> \tIntrusiveWeathering   Heat + Pressure
> \t Deposition   Change"""
> 
> print rock
> 
> 2/ adding the tabs before printing:
> rock = """
> Igneous  Sedimentary  Metamorphic
> 
> Lava Grains   Marble
> Ramdom crystals  LayerBands
> Granite  Salt Schist
> IntrusiveWeathering   Heat + Pressure
>   Deposition   Change"""
> 
> 
> for line in rock.split("\n"):
>print "\t%s" % line
> 
> HTH,

thx 4 your helpful msg.

I'll input 1 instead of 2 which is a bit complicated for me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt documentation

2005-02-11 Thread Eric Jardim
[...]
> No having said that, I totally agree that such information is surely
needed
> - but I doubt that it really makes sense to create full docs at a api
> level. It would be hard to be in sync with the qt development itself.

I agree with that. But there are alternative ways of doing this without
being perfectly sync with Qt API.


> Instead a wiki which captures the various pitfalls would be cool. And
it
> appears it exists:
> http://www.diotavelli.net/PyQtWiki

Fine, we finnaly got the point. A Wiki is perfect for "imperfect"
tasks.


> So maybe enhancing that would be an option for you?

Yes, maybe. I'll take  look.

thanks again,


[Eric Jardim]

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


Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Fredrik Lundh wrote:
the problem is that the following may or may not reach the "done!" statement,
somewhat depending on python version, memory allocator, and what data you
pass to dumps.
import marshal
data = marshal.dumps((1, 2, 3, "hello", 4, 5, 6))
for i in range(len(data), -1, -1):
try:
print marshal.loads(data[:i])
except EOFError:
print "EOFError"
except ValueError:
print "ValueError"
print "done!"
(try different data combinations, to see how far you get on your platform...)
Python 2.4 on my windows box crashes with
Fatal Python error: PyString_InternInPlace: strings only please!
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
c:\> _
So indeed it seems that marshal is not safe yet :-|

fixing this should be relatively easy, and should result in a safe unmarshaller 
(your
application will still have to limit the amount of data fed into load/loads, of 
course).
Okay.
--Irmen
--
http://mail.python.org/mailman/listinfo/python-list


Re: goto, cls, wait commands

2005-02-11 Thread jean-michel

"Jeff Shannon" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
> jean-michel wrote:
>
> > Hi all,
> > I saw a lot of comments saying GOTO is not usefull, very bad, and we
> > should'nt use it because we don't need it.
> > I think that's true, but only if you *create* programs.
> > But if the goal is to provide some kind of converter to automatically
take
> > an old application written with an old language (using GOTO), and
generating
> > python code, it would certainly a great help to have this (unclean)
feature
> > in native python.
>
> But an automatic translator is certain to be imperfect.  One can no
> more translate mechanically between computer languages than one can
> translate mechanically between human languages -- and we've all seen
> the fun that can be had by machine-translating from language A ->
> language B -> language A, right?  What do you think the effect of that
> sort of meaning-drift would be on application code?
>
> In other words, any translation from one language to another will
> require significant human attention, by someone familiar with both
> languages, to ensure that the original meaning is preserved as close
> as possible.  You're going to have to rewrite chunks of code by hand
> no matter what you do; it'd be silly to *not* take that opportunity to
> purge things like GOTO.
>
> Jeff Shannon
> Technician/Programmer
> Credit International
>

The automated translations are very commonly used actually in computing
industry. If you want an overview, you can try "legacy migration" in google
for instance (or "as400 automated migration" or anything of that kind).
Translate a computer's language is not the same at all than to translate a
human language. In the first case, you have a good chance to know all the
rules. Even if the work is not perfect, it can offer you a chance to
continue to use a 1 programs application without having to rewrite all
(several years of work indeed).
The last time I did that, I converted arround 6000 cobol programs in a
couple of months, which is obviously not possible by hand (thanks to python
;-). And it was not possible to remove GOTO, because that would really need
to rewrite manually the programs, that means to entirely redo the
application (probably a 20 human years work !).

Regards,
jm


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


Re: PyQt documentation

2005-02-11 Thread Diez B. Roggisch
Eric Jardim wrote:
> *You* may not need. But think about other people. By the way, I found 9
> "I"s on your last message. Don't be that selfish :)

That's right - and it was done to express not my unarguably existing
selfishness, but to strech the fact that it was my opinion that not
necessarily qualifies as being "the one and only" opinion and didn't want
to discourage you too much. Never try to stop volontary workers (at least
not in documentation.. :)

But I'd still hold the impression that your problems might stem from you
wanting to code qt, before done in c++ and just by "accident" in python.
All real nasty problems I ran into appeared when I tried to do things that
are not complementary between python and qt (like the gui stuff) but in the
common subset. My troubles once came from using QThread (made my app
totally crash). QText*Stream plays for me in the same league: python itself
is perfectly capable of reading and writing data to disk/memory/your
wallpaper. So being a pythoneer, it never occured to me to use
QText*Streams :)

No having said that, I totally agree that such information is surely needed
- but I doubt that it really makes sense to create full docs at a api
level. It would be hard to be in sync with the qt development itself. 

Instead a wiki which captures the various pitfalls would be cool. And it
appears it exists:

http://www.diotavelli.net/PyQtWiki

So maybe enhancing that would be an option for you?

-- 
Regards,

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


Re: is there a safe marshaler?

2005-02-11 Thread Fredrik Lundh
(repost; gmane seems to have eaten my original post)

Irmen de Jong wrote:

>> I think marshal could be fixed; the only unsafety I'm aware of is that
>> it doesn't always act rationally when confronted with incorrect input
>> like bad type codes or truncated input. It only receives instances of
>> the built-in types and it never executes user code as a result of
>> unmarshalling.
>
> So it is not vulnerable in the way that pickle is? That's a start.
> The security warning in the marsal doc then makes it sound worse than
> it is...

the problem is that the following may or may not reach the "done!" statement,
somewhat depending on python version, memory allocator, and what data you
pass to dumps.

import marshal

data = marshal.dumps((1, 2, 3, "hello", 4, 5, 6))

for i in range(len(data), -1, -1):
try:
print marshal.loads(data[:i])
except EOFError:
print "EOFError"
except ValueError:
print "ValueError"

print "done!"

(try different data combinations, to see how far you get on your platform...)

fixing this should be relatively easy, and should result in a safe unmarshaller 
(your
application will still have to limit the amount of data fed into load/loads, of 
course).

 



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


Re: is there a safe marshaler?

2005-02-11 Thread Fredrik Lundh
Aahz wrote:

>>It's not clear to me that if marshal is unsafe how XML could be safe.  In
>>this context they are both just serializations of basic Python data
>>structures.
>
> The difference is that parsing XML -- even badly malformed -- won't
> crash Python.

optimist.

>>> import os
>>> os.path.getsize("BL.xml")
1302
>>> from xml.dom import minidom
>>> x = minidom.parse("BL.xml")

(have patience.  have lots of patience.)





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


Re: PyQt documentation

2005-02-11 Thread Eric Jardim
[...]
> So maybe a better way for you would be to learn python by its own,
then
> trying to use it in conjunction with qt.
[...]

The purpose of doing this help is not to help *me*, but help *anyone*
who wants to use PyQt. I myself am quite confortable with the Qtdoc.

But there are cases that the PyQt doc and Qt doc are not enough.

This happened to me when I tryed to use the QTextStream objects. There
is nothing on the docs where it says that you cannot use this object
for writing. It is silly, but I had to search the web and send a
message to the mailing list to know that one *don't* use the Qt stream
classes for writing.

It may be silly, but is time comsumption and can confuse someone,
especially newbies.


[...]
> So again: I don't see the
> need for that doc. But that's IMHO, of course.
[...]

*You* may not need. But think about other people. By the way, I found 9
"I"s on your last message. Don't be that selfish :)

The proposal is up.

[Eric Jardim]

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


Re: Commerical graphing packages?

2005-02-11 Thread Larry Bates
ReportLab has pretty good Graphics Module.  About the only thing
it needs is Python Imaging Library (which you would probably
want anyway).
Larry Bates
Erik Johnson wrote:
I am wanting to generate dynamic graphs for our website and would rather
not invest the time in developing the code to draw these starting from
graphics primitives. I am looking for something that is... "fairly robust"
but our needs are relatively modest: X-Y scatter plots w/ data point
symbols, multiple data set X-Y line plots, bar charts, etc.
Preferably this would come from a company that can provide support &
decent documentation, and a package that can be installed without a bunch of
extra hassle (e.g., needs Numeric Python, needs to have the GD library
installed, needs separate JPEG encoders, font libraries, etc.)
I am aware of ChartDirector (http://www.advsofteng.com/ ) which
explicitly supports python and seems to be about the right level of
sophistication. I don't really know of any other packages in this space, do
you? I am seeking feedback and reccomendations from people who have used
this package or similar ones. I am particularly interested to hear about any
limitations or problems you ran into with whatever package you are using.
Thanks for taking the time to read my post! :)
-ej

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


Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Alan Kennedy wrote:
I should learn to keep my mouth zipped :-L
:-D
OK, I really don't have time for a detailed examination of either the 
JSON spec or the python impl of same. And I *definitely* don't have time 
for a detailed security audit, much though I'd love to.
No problem. The patch you wrote is a very good start, I think!!

Interestingly enough, I just ran across "Flatten":
http://sourceforge.net/project/showfiles.php?group_id=82591&package_id=91311
"...which aids in serializing/unserializing networked data securely,
without having to fear execution of code or the like."
Sounds promising!
--Irmen
--
http://mail.python.org/mailman/listinfo/python-list


Re: sre is broken in SuSE 9.2

2005-02-11 Thread Fredrik Lundh
Serge Orlov wrote:

>> >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430')
>> [u'\xb5\xba\xe4\u0430']
>
> I can't find the strict definition of isalpha, but I believe average
> C program shouldn't care about the current locale alphabet, so isalpha
> is a union of all supported characters in all alphabets

nope.  isalpha() depends on the locale, as does all other ctype functions
(this also applies to wctype, on some platforms).

 



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


Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Fredrik Lundh wrote:
import os
os.path.getsize("BL.xml")
1302
from xml.dom import minidom
x = minidom.parse("BL.xml")

(have patience.  have lots of patience.)
Hehe, the XML killer file "BillionLaughs"... correct?
--Irmen
--
http://mail.python.org/mailman/listinfo/python-list


Re: is there a safe marshaler?

2005-02-11 Thread Fredrik Lundh
(repost; gmane seems to have eaten my original post)

Aahz wrote:

>>It's not clear to me that if marshal is unsafe how XML could be safe.  In
>>this context they are both just serializations of basic Python data
>>structures.
>
> The difference is that parsing XML -- even badly malformed -- won't
> crash Python.

optimist.

>>> import os
>>> os.path.getsize("BL.xml")
1302
>>> from xml.dom import minidom
>>> x = minidom.parse("BL.xml")

(have patience.  have lots of patience.)

 



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


Re: check if object is number

2005-02-11 Thread George Sakkis
> George Sakkis wrote:
> > "Steven Bethard" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Is there a good way to determine if an object is a numeric type?
> >
> > In your example, what does your application consider to be numeric?
>
> Well, here's the basic code:
>
> def f(max=None):
>  ...
>  while max is None or n <= max:
>  ...
>  # complicated incrementing of n
>
> So for 'max', technically all I need is <= support.  However, the code
> also depends on the fact that after incrementing 'n' enough, it will
> eventually exceed 'max'.  Currently, ints, longs, floats, and Decimals
> will all meet this behavior.  But I'd rather not specify only those 4
> (e.g. with a typecheck), since someone could relatively easily create
> their own new numeric type with the same behavior.  Do you know a better
> way to test for this kind of behavior?
>
> Steve

The problem is more conceptional rather than technical. So what you're saying 
is that 3 <= "3.0"
should not be allowed, but 3 <= SomeUserDefinedNumericClass(3) is ok, although 
your program knows
nothing a priori about SomeUserDefinedNumericClass. The idea suggested before, 
try if "x+1" fails or
not does not get you far; any class that overrides __add__ may fool this test:

class Dummy:
def __add__(self,other):
return 0

Is Dummy 'numeric' ? Probably not. Whether a given instance is "numeric" (or 
"sequence",
"file-like", etc. for that matter) is a semantic issue. It cannot be resolved 
by relying on which
methods are supported or not, but what these methods *do*; this is something 
that no programming
language can tell you now and in the (foreseeable) future.

George


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


Re: check if object is number

2005-02-11 Thread George Sakkis

"Michael Hartl" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As luck would have it, isnumber is a built-in Python function:
>
> >>> isnumber(1)
> True
> >>> isnumber(1.0)
> True
> >>> isnumber('1')
> False
>
> Michael
>
> --
> Michael D. Hartl, Ph.D.
> Chief Technology Officer
> http://quarksports.com/
>

Huh ? What python version has this ? Surely not 2.3 and 2.4.

George



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


Re: [perl-python] text pattern matching, and expressiveness

2005-02-11 Thread Aaron Sherman
John Bokma wrote:
Xah Lee wrote:

Perl is a language of syntactical variegations. Python on the other
hand, does not even allow changes in code's indentation, but its
efficiency and power in expression, with respect to semantics (i.e.
algorithms), showcases Perl's poverty in specification.

Clarify :-D.
Well, I think it's pretty clearly troll-bait. Semantics != algorithms 
and Perl (just like Python) has no such poverty WRT specification.

Sounds like someone who learned Python and forgot that it wasn't a 
religion. Too bad, but a disease unique to no particular language. Perl, 
Python, Ruby, C, APL, LISP... they've all had their unpleasant zealots.
--
http://mail.python.org/mailman/listinfo/python-list


Re: That horrible regexp idiom

2005-02-11 Thread Fredrik Lundh
Stephen Thorne wrote:

> but it occured to me today, that it is possible to do it in python
> without the extra line.
> '
> '>>> def xsearch(pattern, subject):
> '>>> yield pattern.search(subject)
>
> '>>> for m in xsearch(foo_pattern, subject):
> '>>> pass
> '>>> else:
> '>>> pass
>
> simple, concise, requires no new syntax, and is only a little confusing[1]!

don't forget "untested, and doesn't work unless you add more logic".  here's
a "working" version.

def xsearch(pattern, subject):
yield pattern.search(subject)

for m in xsearch(foo_pattern, subject):
if m:
print "match", m
break
else:
print "no match"

which is a rather odd way to write an assignment followed by an if-else.  but
alright, maybe it's an improvement if your "=" key is broken...

(you were joking, right?)

 



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


Re: check if object is number

2005-02-11 Thread Fredrik Lundh
Michael Hartl wrote

> As luck would have it, isnumber is a built-in Python function:
>
 isnumber(1)
> True
 isnumber(1.0)
> True
 isnumber('1')
> False

and what strange Python version would that be?

>>> isnumber(1)
Traceback (most recent call last):
  File "", line 1, in ?
NameError: name 'isnumber' is not defined

 



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


Re: is there a safe marshaler?

2005-02-11 Thread Fredrik Lundh
Irmen de Jong wrote:

>> but can't effbot's fast cElementree be used for PYROs XML_PICKLE and would 
>> it be safe and fast 
>> enough?
>
> ElementTree's not a marshaler.
> Or has it object (de)serialization included?

nope.  building a serialization layer on top of it is pretty trivial, and the 
result
is pretty fast, but nowhere close to C speed.

 



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


Re: check if object is number

2005-02-11 Thread Michael Hartl
As luck would have it, isnumber is a built-in Python function:

>>> isnumber(1)
True
>>> isnumber(1.0)
True
>>> isnumber('1')
False

Michael

--
Michael D. Hartl, Ph.D.
Chief Technology Officer
http://quarksports.com/

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


Re: sre is broken in SuSE 9.2

2005-02-11 Thread Fredrik Lundh
Serge Orlov wrote:

>> >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430')
>> [u'\xb5\xba\xe4\u0430']
>
> I can't find the strict definition of isalpha, but I believe average
> C program shouldn't care about the current locale alphabet, so isalpha
> is a union of all supported characters in all alphabets

btw, what does isalpha have to do with this example?

 



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


Re: A great Alan Kay quote

2005-02-11 Thread Curt
On 2005-02-10, Francis Girard <[EMAIL PROTECTED]> wrote:
>
> I think I've been enthouasistic too fast. While reading the article I grew 
> more and more uncomfortable with sayings like :



Yes, you may have grown uncomfortable because what you "read" has, at best,
only the most tenuous of relations with what was written.  There is no way
in God's frigid hell that your "sayings" (which were never uttered by Alan
Kay) can be construed as anything other than a hopefully transient
psychotic episode by anyone who read the interview with his head in a place
other than where the moon doesn't shine.

Please be so kind as to free your own from the breathless confines of your 
own fundamental delirium.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: check if object is number

2005-02-11 Thread Fredrik Lundh
Steven Bethard wrote:

> Is there a good way to determine if an object is a numeric type? Generally, I 
> avoid type-checks in 
> favor of try/except blocks, but I'm not sure what to do in this case:
>
> def f(i):
> ...
> if x < i:
> ...
>
> The problem is, no error will be thrown if 'i' is, say, a string:
>
> py> 1 < 'a'
> True
> py> 100 < 'a'
> True
>
> But for my code, passing a string is bad, so I'd like to provide an 
> appropriate error.

assert operator.isNumberType(i)

(but make sure you read the warning in the docs:
http://docs.python.org/lib/module-operator.html )

 



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


Re: PyQt documentation

2005-02-11 Thread Jarek Zgoda
djw napisał(a):
6. Convert QStrings with str() from Qt functions/methods if you want to 
work with them with std. Python string functions
No, no, no, don't do it, don't use str()! Your python will choke in any 
non-ascii character! Use unicode objects and you will be safe from those 
non-anglosaxons who use all these rubbish european characters such as 
umlauts, cedillas, ogoneks and so on.

--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-11 Thread BOOGIEMAN
On Fri, 11 Feb 2005 18:00:08 +0100, den wrote:

> Did you try this:
> 
> import msvcrt
> msvcrt.getch()

Yes, that's what I need. Thank you.
BTW, sometimes program continues 
without me pressing any button, why ? 
-- 
http://mail.python.org/mailman/listinfo/python-list


Commerical graphing packages?

2005-02-11 Thread Erik Johnson

I am wanting to generate dynamic graphs for our website and would rather
not invest the time in developing the code to draw these starting from
graphics primitives. I am looking for something that is... "fairly robust"
but our needs are relatively modest: X-Y scatter plots w/ data point
symbols, multiple data set X-Y line plots, bar charts, etc.

Preferably this would come from a company that can provide support &
decent documentation, and a package that can be installed without a bunch of
extra hassle (e.g., needs Numeric Python, needs to have the GD library
installed, needs separate JPEG encoders, font libraries, etc.)

I am aware of ChartDirector (http://www.advsofteng.com/ ) which
explicitly supports python and seems to be about the right level of
sophistication. I don't really know of any other packages in this space, do
you? I am seeking feedback and reccomendations from people who have used
this package or similar ones. I am particularly interested to hear about any
limitations or problems you ran into with whatever package you are using.

Thanks for taking the time to read my post! :)

-ej


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


Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
Diez B. Roggisch wrote:
I tried it but I got a syntax error. The interpreter didn't like the
equals sign in the lambda. I am using python 2.3.4. Is there another way
of writing that?

Strange. This script works and shows the desired behaviour - python is also
2.3.4:
def foo(x):
print x
fs = [lambda: foo(i) for i in xrange(5)]
for f in fs:
f()
fs = [lambda x=i: foo(x) for i in xrange(5)]
for f in fs:
f()

You're right! It was my fault. I left the colon after the lambda by 
mistake. e.g. lambda: num=verseNum:...

Thanks very much for the help it works great now! I wish I would have 
asked somebody sooner :)
-Matthew
--
http://mail.python.org/mailman/listinfo/python-list


Re: goto, cls, wait commands

2005-02-11 Thread Jeff Shannon
jean-michel wrote:
Hi all,
I saw a lot of comments saying GOTO is not usefull, very bad, and we
should'nt use it because we don't need it.
I think that's true, but only if you *create* programs.
But if the goal is to provide some kind of converter to automatically take
an old application written with an old language (using GOTO), and generating
python code, it would certainly a great help to have this (unclean) feature
in native python.
But an automatic translator is certain to be imperfect.  One can no 
more translate mechanically between computer languages than one can 
translate mechanically between human languages -- and we've all seen 
the fun that can be had by machine-translating from language A -> 
language B -> language A, right?  What do you think the effect of that 
sort of meaning-drift would be on application code?

In other words, any translation from one language to another will 
require significant human attention, by someone familiar with both 
languages, to ensure that the original meaning is preserved as close 
as possible.  You're going to have to rewrite chunks of code by hand 
no matter what you do; it'd be silly to *not* take that opportunity to 
purge things like GOTO.

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Diez B. Roggisch
> I tried it but I got a syntax error. The interpreter didn't like the
> equals sign in the lambda. I am using python 2.3.4. Is there another way
> of writing that?

Strange. This script works and shows the desired behaviour - python is also
2.3.4:

def foo(x):
print x


fs = [lambda: foo(i) for i in xrange(5)]
for f in fs:
f()

fs = [lambda x=i: foo(x) for i in xrange(5)]
for f in fs:
f()


-- 
Regards,

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


Re: check if object is number

2005-02-11 Thread Steven Bethard
George Sakkis wrote:
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Is there a good way to determine if an object is a numeric type?
In your example, what does your application consider to be numeric?
Well, here's the basic code:
def f(max=None):
...
while max is None or n <= max:
...
# complicated incrementing of n
So for 'max', technically all I need is <= support.  However, the code 
also depends on the fact that after incrementing 'n' enough, it will 
eventually exceed 'max'.  Currently, ints, longs, floats, and Decimals 
will all meet this behavior.  But I'd rather not specify only those 4 
(e.g. with a typecheck), since someone could relatively easily create 
their own new numeric type with the same behavior.  Do you know a better 
way to test for this kind of behavior?

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


Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
Diez B. Roggisch wrote:
Hi,
button = Button(self.songWin, text=verse, command=(lambda num=verseNum:
self.showVerse(num)) )
should do the trick. The reason is basically that your version kept a
reference to verseNum - and when executed, the value verseNum points to is
the lasts one stored.
Rebinding the argument to a parameter in the lambda will keep the right
value for each iteration.

I tried it but I got a syntax error. The interpreter didn't like the 
equals sign in the lambda. I am using python 2.3.4. Is there another way 
of writing that?

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


Re: PyQt and Python 2.4 - also WinXP LnF?

2005-02-11 Thread Simon John
I've just got Qt 3.3.3 and PyQt 3.1.3 compiled for Python 2.4 using the
instructions for MinGW here:

http://kscraft.sourceforge.net/convert_xhtml.php?doc=pyqt-windows-install.xhtml

It was a pretty nasty experience, hacking python24.dll and patching
sip/PyQt, but i got it all working after about 4 hours! It still
doesn't support the XP LnF, but at least I have a non-limited
QtDesigner etc. now, and something I can distribute for Windows which
supports Python 2.4/QScintilla.

I couldn't get it to work with the free MS compiler (VC2003 command
line tools and 1.1 SDK) as they were missing libraries etc. I guess the
docs are referring to a full Visual Studio .NET 2003

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


Re: check if object is number

2005-02-11 Thread George Sakkis

"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there a good way to determine if an object is a numeric type?
> Generally, I avoid type-checks in favor of try/except blocks, but I'm
> not sure what to do in this case:
>
>  def f(i):
>  ...
>  if x < i:
>  ...
>
> The problem is, no error will be thrown if 'i' is, say, a string:
>
> py> 1 < 'a'
> True
> py> 100 < 'a'
> True
>
> But for my code, passing a string is bad, so I'd like to provide an
> appropriate error.
>
> I thought about calling int() on the value, but this will also allow
> some strings (e.g. '1').  I guess this isn't horrible, but it seems
> somewhat suboptimal...
>
> Ideas?
>
> Steve

The thing is that python avoids giving a strict definition of what is a 
'numeric type', i.e. a
well-defined interface (the same holds for other frequently used interfaces 
such as 'sequence',
'mapping', 'file-like', etc). It's up to you (the user) to think of all the 
operations you
anticipate to be supported by each argument, attribute, etc. and define a 
'numeric type checker' (or
even better, adaptor) that suits *your application*. In your example, what does 
your application
consider to be numeric ? Strings are definitely not, integers and floats 
typically are; on the other
hand, complex numbers are usually not expected, even though mathematically they 
are 'numeric'.  In
this case, you can write something like:
def isNumeric(obj):
# consider only ints and floats numeric
return isinstance(obj,int) or isinstance(obj,float)

The bottom line is that python wisely doesn't enforce any universal numeric 
type ("in the face of
ambiguity, refuse the temptation to guess").

George


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


Re: newbie question

2005-02-11 Thread Jeff Shannon
Dennis Lee Bieber wrote:
On Thu, 10 Feb 2005 09:36:42 -0800, Jeff Shannon <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
And as Peter Hansen points out, none of the Python versions leave n in 
the same state that the C loop does, so that's one more way in which 
an exact translation is not really possible -- and (IMO again) further 
evidence that trying to do an exact translation would be 
ill-conceived.  Much better to consider the context in which the loop 
is used and do a looser, idiomatic translation.
Yeah, though my background tends to be one which considers loop
indices to be loop-local, value indeterminate after exit...
Well, even though I've programmed mostly in langauges where loop 
indices to retain a determinate value after exit, I almost always 
*treat* them as loop-local -- it just seems safer that way.  But not 
everyone does so, and especially with C while loops, often the point 
is to keep adjusting the control variable until it fits the 
requirements of the next section...

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Multi-Platform installer generator

2005-02-11 Thread Simon John
if you're referring to the installshield x/mp products, forget it, they
are really bad.

the last company i worked for who used x/mp actually went back to shell
scripts for unix and installshield pro for windows, as the java thing
was abismall, and even the ide was written in java, so horribly slow.

personally i'd stick with shell scripts for unix, and innosetup for
windows.

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


Re: PyQt documentation

2005-02-11 Thread djw
Eric Jardim wrote:
Hi,
Is there any site that gather all the documentation about PyQt?
The docs of the Riverbank site is poor, and I have found separate
tutorials on the net.
I know that the Kompany have made a "Qtdoc"-like to PyQt. But it is not
free doc.
Does anybody know anything about any project for making PyQt
development more easy?
thanks,
[Eric Jardim]
If you follow a few simple rules, you can use the C++ Qt docs as-is:
1. Replace ::'s with .'s
2. Replace ->'s with .'s
3. Access to things like .text member variables have to be done with .text()
4. .exec() becomes .exec_loop()
5. Follow the PyQt instructions on how to do signals and slots with 
connect()
6. Convert QStrings with str() from Qt functions/methods if you want to 
work with them with std. Python string functions

I'm sure there's a few more, but those are the main ones. Its actually 
very easy to convert in your head as you go to the proper Pythonic usage 
of Qt.

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


Re: check if object is number

2005-02-11 Thread Steven Bethard
Dan Bishop wrote:
Steven Bethard wrote:
Is there a good way to determine if an object is a numeric type?
How about this?
... def is_number(x):
...try:
...   x + 1
...   return True
...except TypeError:
...   return False
Great, thanks!  That's the kind of thing I was looking for!
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: check if object is number

2005-02-11 Thread Steven Bethard
Bill Mill wrote:
On Fri, 11 Feb 2005 12:11:44 -0700, Steven Bethard
<[EMAIL PROTECTED]> wrote:
Is there a good way to determine if an object is a numeric type?
How about:
if type(variable) == type(1):
print "is an integer"
else:
print "please input an integer" 
This checks if it is an integer, not if it is a numeric type:
py> x = 1
py> type(x) == type(1)
True
py> # using int instead of type(1)
py> type(x) == int
True
py> x = 1.0
py> type(x) == int
False
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: goto, cls, wait commands

2005-02-11 Thread Nick Craig-Wood
Grant Edwards <[EMAIL PROTECTED]> wrote:
>  I forgot to mention try/except.  When I do use goto in C
>  programming it's almost always to impliment what would have
>  been a try/except block in Python.

Yes I'd agree with that.  No more 'goto out'.

There is this also

for (i = 0; ...)
{
if (something)
goto found;
}
/* do stuff when not found */
found:;

(yes I hate setting flags in loops ;-)

This translates exactly to the for: else: construct

for i in xrange(...):
if something:
break
else:
# do stuff when not found

The last language I saw with this very useful feature was FORTH in
about 1984!

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Injecting a C side object into the local dict

2005-02-11 Thread python
Take a look at Pyrex.


  

More at

  


/Jean Brouwers


Jamie R. Parent wrote:
> Hello,
>
> How do you go about taking a variable which was declared in C and
pass
> that through to a Python script? I have tried doing this by adding a
> simple string which is a PyObject from C into the local dictionary
and
> retrieving it from script via a locals()["myCvar"] print statement.
> This however does not seem to work. It would seem that when the
scripts
> are ran the local dictionary with the added item is wiped clean and a
> new local dictionary is instead used. Any direction or help would be
> appreciated.
> 
> Cheers,
> Jamie.

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


Re: check if object is number

2005-02-11 Thread Dan Bishop
Steven Bethard wrote:
> Is there a good way to determine if an object is a numeric type?
> Generally, I avoid type-checks in favor of try/except blocks, but I'm

> not sure what to do in this case:
>
>  def f(i):
>  ...
>  if x < i:
>  ...
>
> The problem is, no error will be thrown if 'i' is, say, a string:
>
> py> 1 < 'a'
> True
> py> 100 < 'a'
> True
>
> But for my code, passing a string is bad, so I'd like to provide an
> appropriate error.
>
> I thought about calling int() on the value, but this will also allow
> some strings (e.g. '1').  I guess this isn't horrible, but it seems
> somewhat suboptimal...

How about this?

... def is_number(x):
...try:
...   x + 1
...   return True
...except TypeError:
...   return False

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


Re: check if object is number

2005-02-11 Thread Bill Mill
On Fri, 11 Feb 2005 12:11:44 -0700, Steven Bethard
<[EMAIL PROTECTED]> wrote:
> Is there a good way to determine if an object is a numeric type?
> Generally, I avoid type-checks in favor of try/except blocks, but I'm
> not sure what to do in this case:
> 
>  def f(i):
>  ...
>  if x < i:
>  ...
> 
> The problem is, no error will be thrown if 'i' is, say, a string:
> 
> py> 1 < 'a'
> True
> py> 100 < 'a'
> True
> 
> But for my code, passing a string is bad, so I'd like to provide an
> appropriate error.

How about:
if type(variable) == type(1):
print "is an integer"
else:
print "please input an integer" 

> 
> I thought about calling int() on the value, but this will also allow
> some strings (e.g. '1').  I guess this isn't horrible, but it seems
> somewhat suboptimal...
> 
> Ideas?
> 
> Steve
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Python UPS / FedEx Shipping Module

2005-02-11 Thread Gabriel Cooper
I've made UPS and FedEx shipping rate request modules in python using 
XML. Is there an interest in putting this on the web?
--
http://mail.python.org/mailman/listinfo/python-list


frozenset() without arguments should return a singleton

2005-02-11 Thread Stefan Behnel
Hi!
frozenset() doesn't behave as the other immutable empty data types in 2.4:
.>>> '' is ''
True
.>>> () is ()
True
.>>> frozenset() is frozenset()
False
.>>> id(()),id(())
(1077579820, 1077579820)
.>>> id(())
1077579820
.>>> id(frozenset()),id(frozenset())
(1077581296, 1077581296)
.>>> id(frozenset())
1077581440
.>>> id(frozenset(()))
1077582256
frozenset() called without arguments (or on empty sequences) should always 
return a singleton object. It is immutable, so I can't see a reason why it 
should take up more resources than necessary.

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


check if object is number

2005-02-11 Thread Steven Bethard
Is there a good way to determine if an object is a numeric type? 
Generally, I avoid type-checks in favor of try/except blocks, but I'm 
not sure what to do in this case:

def f(i):
...
if x < i:
...
The problem is, no error will be thrown if 'i' is, say, a string:
py> 1 < 'a'
True
py> 100 < 'a'
True
But for my code, passing a string is bad, so I'd like to provide an 
appropriate error.

I thought about calling int() on the value, but this will also allow 
some strings (e.g. '1').  I guess this isn't horrible, but it seems 
somewhat suboptimal...

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


frozenset() without arguments should return a singleton

2005-02-11 Thread Stefan Behnel
Hi!
frozenset() doesn't behave as the other immutable empty data types in 2.4:
.>>> '' is ''
True
.>>> () is ()
True
.>>> frozenset() is frozenset()
False
.>>> id(()),id(())
(1077579820, 1077579820)
.>>> id(())
1077579820
.>>> id(frozenset()),id(frozenset())
(1077581296, 1077581296)
.>>> id(frozenset())
1077581440
.>>> id(frozenset(()))
1077582256
frozenset() called without arguments (or on empty sequences) should always
return a singleton object. It is immutable, so I can see no reason why it
should take up more resources than necessary.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Iteration over two sequences

2005-02-11 Thread David Isaac

"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]:
> Numarray is the future, Numeric is the "past",

This statement is not obviously true.
See the recent discussion on the developer lists.
(Search for Numeric3.)
Alan Isaac


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


Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Diez B. Roggisch
Hi,

button = Button(self.songWin, text=verse, command=(lambda num=verseNum:
self.showVerse(num)) )

should do the trick. The reason is basically that your version kept a
reference to verseNum - and when executed, the value verseNum points to is
the lasts one stored.

Rebinding the argument to a parameter in the lambda will keep the right
value for each iteration.


-- 
Regards,

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


Re: Big development in the GUI realm

2005-02-11 Thread Jorge Luiz Godoy Filho
Max M wrote:

> GPL is not suitable for all kinds of software. It's nice if you are
> sharing code with others, but if you are developing something like a
> desktop application that you want to sell for money, using the GPL is a
> bad idea.

If you're earning money, why not pay for the libraries that allowed you to
do so?


Be seeing you,
Godoy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mxCGIPython binaries for Python 2.3.5

2005-02-11 Thread Oleg Broytmann
On Fri, Feb 11, 2005 at 10:13:21AM -0800, Titus Brown wrote:
> what does mxCGIPython do?  I can't find anything at that Web site that

   http://www.egenix.com/files/python/mxCGIPython.html

> doesn't involve downloading & unpacking a file.

   It is unpackable, ready-to-run python binary.

PS. I am neither author nor maintainer, I only provide binaries for
some platforms...

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
-- 
http://mail.python.org/mailman/listinfo/python-list


problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
Greetings, Maybe someone out there can lend me an eye? I've been 
stumped, banging my head against the wall trying to figure out why my 
script doesn't work. I've tried every thing I could think of, even 
unecessarily complicated mumbo-jumbo. Let me show you a snippet and then 
I'll explain what's happening.

for verse in self.activeSong['verses']:
verseNum = self.activeSong['verses'].index(verse)
activeSong = self.activeSong.copy()
firstLine = split(verse, '\n')[0]
button = Button(self.songWin, text=verse, command=(lambda: 
self.showVerse(verseNum)) )
button.config(bg='grey')
button.pack(expand=YES, fill=BOTH, side=TOP)
self.verseButtons.append(button)

This is as simple app for displaying the words of a song with an 
overhead projector. When you click on a song the program reads it and 
creates a button for each verse. When you click the button it is 
supposed to display that verse. As you can see above I am trying to call 
the showVerse method and pass it the verseNum.

The problem I am having is that every button gets assigned the verseNum 
for the last verse that gets processed. That is to say, if a sone has 4 
verses every button shows verse for, a 6 verse song loads verse 6 for 
every button, etc. I think that the value is getting passed by 
reference, so it gets updated with every iteration. I have seriously 
tried every thing I can think of to fix this.

If any one has any thoughts I would really appreciate it.
Thanks very much!
-Matthew
--
http://mail.python.org/mailman/listinfo/python-list


Re: is there a safe marshaler?

2005-02-11 Thread Aahz
In article <[EMAIL PROTECTED]>,
Skip Montanaro  <[EMAIL PROTECTED]> wrote:
>
>Carl> but can't effbot's fast cElementree be used for PYROs XML_PICKLE
>Carl> and would it be safe and fast enough?
>
>It's not clear to me that if marshal is unsafe how XML could be safe.  In
>this context they are both just serializations of basic Python data
>structures.

The difference is that parsing XML -- even badly malformed -- won't
crash Python.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-11 Thread Jeremy Bowers
On Fri, 11 Feb 2005 18:24:22 +0100, Damjan wrote:
> What you described is not ok according to the GPL - since you distributed
> a binary thats derived from GPL software (and you didn't publish it source
> code under the GPL too).

No you didn't. You distributed a binary completely free of any GPL code
whatsoever. The *user* combined your binary and the GPL to produce another
binary, which will never be distributed at all.

In copyright terms, which is what the GPL works under since that is the
law it has, what you distributed is completely unrelated to the GPL'ed
program; there's no grounds to call it "derived".

You may need to re-read the sequence more carefully, or I may have gotten
it wrong.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mxCGIPython binaries for Python 2.3.5

2005-02-11 Thread Titus Brown
what does mxCGIPython do?  I can't find anything at that Web site that
doesn't involve downloading & unpacking a file.

thanks,
--titus

On Fri, Feb 11, 2005 at 06:44:57PM +0300, Oleg Broytmann wrote:
-> http://phd.pp.ru/Software/Python/misc/mxCGI/
-> 
->mxCGIPython binaries for Python 2.1.3, 2.2.3, 2.3.5 and 2.4.0 on
-> Linux, Solaris 2.5.2, FreeBSD 4.9 and FreeBSD 5.3.
-> 
-> Oleg.
-> -- 
->  Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
->Programmers don't die, they just GOSUB without RETURN.
-> -- 
-> http://mail.python.org/mailman/listinfo/python-announce-list
-> 
-> Support the Python Software Foundation:
-> http://www.python.org/psf/donations.html
-> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ActivePython 2.3.5.236 and ActivePython 2.4.0.244 are available

2005-02-11 Thread Trent Mick
mep wrote:
ActivePython-2.4.0-243-win32-ix86.msi : 29M
ActivePython-2.4.0-244-win32-ix86.msi : 18M
What make so much difference of the size of them, which distinct  monir
version number for 1 only.
Any explaination?

Yes, build 243 accidentally included some debug-build bits from
the included PyWin32 build in the package. These debug bits are
only intended for the separate Windows "debug" package. I fixed
this for build 244.
$ diff -qr ActivePython-2.4.0-243-win32-ix86 ActivePython-2.4.0-244-win32-ix86 | grep 
"Only in"
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/isapi: 
PyISAPI_loader_d.dll
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/isapi: 
PyISAPI_loader_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
dde_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
dde_d.pyd
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
Pythonwin_d.exe
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
Pythonwin_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
scintilla_d.dll
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
win32ui_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
win32ui_d.pyd
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
win32uiole_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: 
win32uiole_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
dbi_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
dbi_d.pyd
Only in 
ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/Demos: 
BackupRead_BackupWrite.py
Only in 
ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/Demos: 
BackupSeek_streamheaders.py
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32/libs: 
pywintypes_d.lib
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
mmapfile_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
mmapfile_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
odbc_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
odbc_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
perfmondata_d.dll
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
perfmondata_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
perfmon_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
perfmon_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
pythonservice_d.exe
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
pythonservice_d.pdb
Only in 
ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32/scripts: 
setup_d.py
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
servicemanager_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
servicemanager_d.pyd
Only in 
ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/test: 
test_win32event.py
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
timer_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
timer_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win2kras_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win2kras_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32api_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32api_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32clipboard_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32clipboard_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32event_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32event_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32evtlog_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32evtlog_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32file_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32file_d.pyd
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32gui_d.pdb
Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: 
win32gui_d.pyd
Only in Ac

Re: Loading functions from a file during run-time

2005-02-11 Thread Bryant Huang
Ah, thanks a lot, Grant and Nick.

Let me try to clarify because I think I was unclear in specifying what
I want to do:

1. Read in a file containing a bunch of function definitions:

def f1(x):
  ...

def f2(x):
  ...

def f3(x):
  ...

def f4(x):
  ...

2. In wxPython, populate a CheckListBox with all the functions defined
in that file.

3. Allow the user to check some of the functions, say for example, f1()
and f3().

4. The program then executes f1() and f3() on some specified data.


The reason I asked these questions is because I don't know what
functions are contained in the function file ahead of time, but I still
want to be able to read those in, then based on which functions the
user selects, to run those accordingly, even though I still don't know,
at design-time, what functions are contained in the function file.

Does that make sense?

Thanks a lot!
Bryant

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


Re: Alternative to raw_input ?

2005-02-11 Thread Skip Montanaro

> Err, why?

>> It looks to ugly this way. I want to press 
>> any key without ENTER to continue

How about modifying it to

raw_input("Press ENTER to continue ")

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


Re: Install MySQLdb on Mac OS X (10.3)

2005-02-11 Thread Skip Montanaro

>> Try a more recent version of mysql-python.  I think 1.1.7 is the latest.

TK> It now works with MySQL-python-1.2.0

Andy's a busy guy... ;-)

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


Re: is there a safe marshaler?

2005-02-11 Thread Skip Montanaro

Carl> but can't effbot's fast cElementree be used for PYROs XML_PICKLE
Carl> and would it be safe and fast enough?

It's not clear to me that if marshal is unsafe how XML could be safe.  In
this context they are both just serializations of basic Python data
structures.

Skip

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


Partnership Opportunity

2005-02-11 Thread eliediamonds
Partnership Opportunity
Hello,
I am with a manufacturer of fine jewelry and am currently looking for
those interested in forming a partnership to sell jewelry on eBay or
anywhere else.  I work for Elie International, a manufacturer of fine
jewelry located in the heart of the diamond district in New York City.
We have been in the jewelry business for over 23 years and are
registered with the Jewelers Board of Trade (JBT registration #
0107) and Dunne & Bradstreet.
For the first time in our company's history we are looking to build
partnerships with individual sellers. We hold an extensive stock of
over 24,000 items and need vendors to keep it moving.  By selling our
merchandise on eBay, or to family and friends, we become your partner
not your competitor and offer you fine jewelry at wholesale prices
which are a FRACTION of what YOUR CUSTOMERS pay in retail stores.  We
understand that many buyers are apprehensive about paying for
merchandise up front, and we have devised our Direct Purchase
Partnership program with these concerns in mind.  Our Guaranteed Movers
Policy states that if you cannot sell one of our items within 6 months
we will exchange it.  This insures that you are never stuck with
merchandise you can't sell. We want to strongly emphasize that this
is a partnership and we offer our partners the full support that they
need, including pictures, prices and descriptions of all merchandise to
get them started. Please contact us via e-mail at [EMAIL PROTECTED] or at
(212) 719-0090 if you are interested or have any questions and please
include where you saw this message.  Thank You

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


Partnership Opportunity

2005-02-11 Thread eliediamonds
Partnership Opportunity
Hello,
I am with a manufacturer of fine jewelry and am currently looking for
those interested in forming a partnership to sell jewelry on eBay or
anywhere else.  I work for Elie International, a manufacturer of fine
jewelry located in the heart of the diamond district in New York City.
We have been in the jewelry business for over 23 years and are
registered with the Jewelers Board of Trade (JBT registration #
0107) and Dunne & Bradstreet.
For the first time in our company's history we are looking to build
partnerships with individual sellers. We hold an extensive stock of
over 24,000 items and need vendors to keep it moving.  By selling our
merchandise on eBay, or to family and friends, we become your partner
not your competitor and offer you fine jewelry at wholesale prices
which are a FRACTION of what YOUR CUSTOMERS pay in retail stores.  We
understand that many buyers are apprehensive about paying for
merchandise up front, and we have devised our Direct Purchase
Partnership program with these concerns in mind.  Our Guaranteed Movers
Policy states that if you cannot sell one of our items within 6 months
we will exchange it.  This insures that you are never stuck with
merchandise you can't sell. We want to strongly emphasize that this
is a partnership and we offer our partners the full support that they
need, including pictures, prices and descriptions of all merchandise to
get them started. Please contact us via e-mail at [EMAIL PROTECTED] or at
(212) 719-0090 if you are interested or have any questions and please
include where you saw this message.  Thank You

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


Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
cmkl wrote:
but can't effbot's fast cElementree be used for PYROs XML_PICKLE 
and would it be safe and fast enough?
ElementTree's not a marshaler.
Or has it object (de)serialization included?
--Irmen
--
http://mail.python.org/mailman/listinfo/python-list


1998 CNRI license compatibility

2005-02-11 Thread John Reuning
I'm interested in updating the very old kerberos extension module.
However, the code dates to 1998 and is licensed under what appears to be
a pre-python-1.6 CNRI license.  Does anyone have recommendations on
whether additions and changes to the old code can be licensed under a
newer OSI-approved license?  There is information on GPL, CNRI 1.6, and
python license compatibility, as well as a history of the python
licenses in the current python license file.  But I can't find
suggestions on what to do with such an old version of the CNRI license.

http://www.python.org/ftp/python/contrib-09-
Dec-1999/System/krb5module-0.1.tar.gz
http://www.python.org/ftp/python/contrib-09-
Dec-1999/System/krb5module.README

Any ideas will be appreciated.

Many thanks,

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


Re: Postgres and SSL

2005-02-11 Thread Jorge Luiz Godoy Filho
Greg Lindstrom wrote:

> I'm on a Linux box running python 2.3 and would like to connect to a
> postgres database via SSL, but have not been able to find a module to do
> this (or haven't figured out the syntax).  Can anyone help me out?

With both psycopg and pypgsql it depends on how your libpq was compiled.  If
the libraries from your PostgreSQL installation were compiled to support
SSL, then you can connect to the server without any problems. 


Be seeing you,
Godoy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient checksum calculating on lagre files

2005-02-11 Thread Nick Craig-Wood
Christos TZOTZIOY Georgiou <[EMAIL PROTECTED]> wrote:
>  On 09 Feb 2005 10:31:22 GMT, rumours say that Nick Craig-Wood
> <[EMAIL PROTECTED]> might have written:
> 
> >But you won't be able to md5sum a file bigger than about 4 Gb if using
> >a 32bit processor (like x86) will you?  (I don't know how the kernel /
> >user space VM split works on windows but on linux 3Gb is the maximum
> >possible size you can mmap.)
> 
>  Indeed... but the context was calculating efficiently checksums for large 
> files
>  to be /served/ by a webserver.  I deduce it's almost certain that the files
>  won't be larger than 3GiB, but ICBW :)

You are certainly right ;-)

However I did want to make the point that while mmap is extremely
attractive for certain things, it does limit you to files < 4 Gb which
is something that people don't always realise.

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-11 Thread Damjan
> The problem with this is what I've called the "patch hole" in another
> context [1]. The problem with this definition is that I can *always*
> distribute GPL'ed parts separately and re-combine them arbitrarily upon
> execution, and it's not even particularly hard. Write your code with the
> GPL'ed code embedded. At the end, before you distribute, extract it and
> record the extraction so your program can "rewind it"; you're left with
> nothing in your code that is GPLed. Later, the user will go get the GPL
> software, and you software "rewinds" the extraction process, and the user
> is left with something that is byte-for-byte identical to what you weren't
> allowed to distribute by the GPL so what good was the GPL?

What you described is not ok according to the GPL - since you distributed a
binary thats derived from GPL software (and you didn't publish it source
code under the GPL too).

> Nobody really knows what the GPL means when it gets down to it; 

If you don't know, you should ask the person whose GPL code you are using.

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


Re: Alternative to raw_input ?

2005-02-11 Thread den
BOOGIEMAN wrote:
On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote:

Err, why?

It looks to ugly this way. I want to press 
any key without ENTER to continue
Did you try this:
import msvcrt
msvcrt.getch()
--
http://mail.python.org/mailman/listinfo/python-list


Re: convert list of tuples into several lists

2005-02-11 Thread Steven Bethard
Pierre Quentel wrote:
Could someone explain why this doesn't work :
Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> def f(*args,**kw):
... print args, kw
...
 >>> f(*[1,2])
(1, 2) {}
 >>> f(*[1,2],x=1)
  File "", line 1
f(*[1,2],x=1)
 ^
SyntaxError: invalid syntax
 >>>
http://docs.python.org/ref/calls.html
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-11 Thread John Lenton
On Fri, Feb 11, 2005 at 05:37:19PM +0100, BOOGIEMAN wrote:
> On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote:
> 
> > Err, why?
> 
> It looks to ugly this way. I want to press 
> any key without ENTER to continue

read the documentation on readline.

Hmm! it says "Availability: Unix". Any particular reason? readline
should be fine on OSX and Win32

-- 
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
sugar daddy, n.:
A man who can afford to raise cain.


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Diez B. Roggisch
> They say that it makes no sense as an byte-order indicator but they
> indicate that it can be used as a file signature.
> 
> And I'm not sure what you mean about decoding a UTF-8 string given any
> 8-bit encoding. Of course the encoder must be know:

That every utf-8 string can be decoded in any byte-sized encoding. Does it
make sense? No. But does it fail (as decoding utf-8 frequently does)? No. 

So if you are in a situation where you _don't_ know the encoding, a decoding
can only be based on a heuristic. And a utf-8 BOM can be part of that
heuristic - but it still is only a hint. Besides that, lots of tools don't
produce it. E.g. everything that produces/consumes xml doesn't need it.

>  >>> u'T\N{LATIN SMALL LETTER U WITH DIAERESIS}r'
> ...   .encode('utf-8').decode('latin1').encode('latin1')
> 'T\xc3\xbcr'

If the encoder is to be known, using the BOM becomes obsolete.

> I can assume you that most Germans can differentiate between "Tür" and
> "Tã¼r".

Oh, germans can. Computers oth can't. You could try and use common words
like "für" and so on for a heuristic. But that is no guarantee.

> Using a BOM with UTF-8 makes it easy to indentify it as such AND it
> shouldn't break any probably written Unicode-aware tools.

As the faq states, that can very well happen.

-- 
Regards,

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


Concurrent Python

2005-02-11 Thread Dominic Fox
I've created a few classes to support some concurrent programming
concepts in Python:

AsyncResult represents the state of a process currently running in a
separate thread.
MultiEvent allows listeners to wait for any one of a list of events to
be signalled.
MultiQueue allows listeners to wait for an item to be added to any one
of a list of queues.
DataflowObject can be used to block while waiting for a
single-assignment variable to be bound.

The code can be found here:

http://www.codepoetics.com/code/concurrent.py

Comments and constructive criticism welcome.

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


Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-11 Thread rzed
Jeremy Bowers <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> On Fri, 11 Feb 2005 22:23:58 +1000, Nick Coghlan wrote:
>> This is one of the reasons why Steven's idea of switching to
>> proposing a new module is a good one. It then provides a
>> natural location for any future extensions of the idea such as
>> Records (i.e. namespaces with a defined set of legal fields)
>> and NamedTuples and NamedLists (i.e. namespaces with a defined
>> field order) 
> 
> I'm not very good at reading Guido's mind, but it might be worth
> feeling out whether mentioning this will improve the chances of
> this passing or not, because while I do not know, can not know,
> and am not trying to predict, it is at least possible that Guido
> may feel as I have been: That this proposal on its own isn't
> that exciting, but as the foundation of some *other* standard
> functionality as described it might be very good. In that case
> that should be emphasized. 
> 
> See, now it still doesn't make me jump up and down because I can
> write what I need fairly easily, but it would be a great boon to
> beginners or people who just want to do work and re-write this
> again, but slightly differently, and would also provide some
> standardization where otherwise we all roll our
> not-quite-similar-enough implementations, which would help us
> read each other's code. 
> 
> Y'all are bringing me around, slowly but surely :-)

Yes, it seems that the main benefit is to provide a Python-standard 
way of doing something that many individuals see as useful. Like 
many others, I've implemented my own variation (a class I call 
Data) to do essentially the same thing as the bunch/namespace 
proposal. If there had already been an existing standard way to do 
it, I would at most have needed to subclass the standard method. 

I would bet that subclassing is *still* going to be common, though, 
as each of us individually roll our own version to get that one 
vital feature the standard doesn't cover (for me, it's update with 
numerous other types), so the net effect may actually not be all 
that different from what happens now. Still, I could happily give 
up some features as long as the functionality is still available 
and presuming I intended the code for public consumption, and for 
that, Namespace would be most useful. 

Though I'd like it to have a shorter name. I'm lazy.

-- 
rzed

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


Re: Performance Issues of MySQL with Python

2005-02-11 Thread Andy Dustman
Well, it does more than that. It converts each column from a string
(because MySQL returns all columns as strings) into the appropriate
Python type. Then you were converting all the Python types back into
strings. So it's no mystery that using the command line client is
faster, since it would take the string results and write them out
directly. (I assume it does this; there's no rational reason for it to
do otherwise.)

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


Re: a sequence question

2005-02-11 Thread David Isaac
> Alan Isaac wrote:
> > I see that [iter(l)]*N produces an N element list with each element
being
> > the same iterator object, but after that
> > http://www.python.org/doc/2.3.5/lib/built-in-funcs.html
> > just didn't get me there.

"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Py> itr = iter(range(10))
> Py> zipped = zip(*(itr,)*3) # How does this bit work?
> # Manual zip, actually behaving somewhat like the real thing
> Py> itr = iter(range(10))
> Py> zipped = []
> Py> try:
> ...   while 1: zipped.append((itr.next(), itr.next(), itr.next()))
> ... except StopIteration:
> ...   pass


http://www.python.org/doc/2.3.5/lib/built-in-funcs.html says:

"This function returns a list of tuples,
  where the i-th tuple contains the i-th element from each of the argument
sequences."

So an "argument sequence" can in fact be any iterable,
and these in turn are asked *in rotation* for their yield, right?
So we pass the (identical) iterables in a tuple or list,
thereby allowing a variable number of arguments.
We unpack the argument list with '*',
which means we have provided three iterables as arguments.
And then zip works as "expected",
once we have learned to expect zip to "rotate" through the arguments.
Is that about right?

If that is right, I still cannot extract it from the doc cited above.
So where should I have looked?

Thanks,
Alan Isaac


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


Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-11 Thread Jeremy Bowers
On Fri, 11 Feb 2005 22:23:58 +1000, Nick Coghlan wrote:
> This is one of the reasons why Steven's idea of switching to proposing a
> new module is a good one. It then provides a natural location for any
> future extensions of the idea such as Records (i.e. namespaces with a
> defined set of legal fields) and NamedTuples and NamedLists (i.e.
> namespaces with a defined field order)

I'm not very good at reading Guido's mind, but it might be worth feeling
out whether mentioning this will improve the chances of this passing or
not, because while I do not know, can not know, and am not trying to
predict, it is at least possible that Guido may feel as I have been: That
this proposal on its own isn't that exciting, but as the foundation of
some *other* standard functionality as described it might be very good. In
that case that should be emphasized.

See, now it still doesn't make me jump up and down because I can write
what I need fairly easily, but it would be a great boon to beginners or
people who just want to do work and re-write this again, but slightly
differently, and would also provide some standardization where otherwise
we all roll our not-quite-similar-enough implementations, which would help
us read each other's code.

Y'all are bringing me around, slowly but surely :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-11 Thread Grant Edwards
On 2005-02-11, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
> On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote:
>
>> Err, why?
>
> It looks to ugly this way. I want to press 
> any key without ENTER to continue

Like somebody already said: use the WConio module.  

Somebody already posted a link. 

I suggest you go look at it.

-- 
Grant Edwards   grante Yow!  ... the MYSTERIANS
  at   are in here with my
   visi.comCORDUROY SOAP DISH!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-11 Thread Jeremy Bowers
On Fri, 11 Feb 2005 13:57:47 +0100, Josef Dalcolmo wrote:
> You can distribute GPL'ed code in binary form, you just have to make the
> sources available as well.  And, yes I would use this as a test: if your
> program needs gpl-ed code for some of it's functionality, you have to
> licence your program according to the GPL - unless you distribute the
> GPL'ed parts separately and your program is still basically functioning
> without the GPL'ed code.

The problem with this is what I've called the "patch hole" in another
context [1]. The problem with this definition is that I can *always*
distribute GPL'ed parts separately and re-combine them arbitrarily upon
execution, and it's not even particularly hard. Write your code with the
GPL'ed code embedded. At the end, before you distribute, extract it and
record the extraction so your program can "rewind it"; you're left with
nothing in your code that is GPLed. Later, the user will go get the GPL
software, and you software "rewinds" the extraction process, and the user
is left with something that is byte-for-byte identical to what you weren't
allowed to distribute by the GPL so what good was the GPL?

(Compiling issues can of course be extracted away, which is what a linker
does.)

If this is all the protection that the GPL provides, than it is utterly
useless. But truly nailing down what it means is even harder.

Nobody really knows what the GPL means when it gets down to it; the entire
copyright-based model is broken and unrepairable in a software context.
It's like nailing jello to a wall, you just can't hold it up there.

[1]:http://www.jerf.org/writings/communicationEthics/node10.html#SECTION000105000
-- 
http://mail.python.org/mailman/listinfo/python-list


Postgres and SSL

2005-02-11 Thread Greg Lindstrom
I'm on a Linux box running python 2.3 and would like to connect to a 
postgres database via SSL, but have not been able to find a module to do 
this (or haven't figured out the syntax).  Can anyone help me out?

Thanks,
--greg
--
Greg Lindstrom   501 975.4859
Computer Programmer  [EMAIL PROTECTED]
NovaSys Health
Little Rock, Arkansas
"We are the music makers, and we are the dreamers of dreams."  W.W.
Confidentiality Notice
--
This email and any attachments to it are privileged and confidential and are 
intended solely for use of the individual or entity to which they are 
addressed. If the reader of this message is not the intended recipient, any 
use, distribution, or copying of this communication, or disclosure of all or 
any part of its content to any other person, is strictly prohibited. If you 
have received this communication in error, please notify the sender by replying 
to this message and destroy this message and delete any copies held in your 
electronic files. Thank you.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-11 Thread BOOGIEMAN
On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote:

> Err, why?

It looks to ugly this way. I want to press 
any key without ENTER to continue
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-11 Thread Simon Brunning
On Fri, 11 Feb 2005 17:26:04 +0100, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
> I need something like "Press any key to continue" code for my program.
> Currently I use : raw_input("Press Enter to continue ") but it's lame.

Err, why?

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Alternative to raw_input ?

2005-02-11 Thread BOOGIEMAN
I need something like "Press any key to continue" code for my program.
Currently I use : raw_input("Press Enter to continue ") but it's lame.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: THREAD_STACK_SIZE and python performance?

2005-02-11 Thread Courageous

>The FreeBSD patch, setting the value to 0x10
>seems to be enough for most of our zope servers,...

Is that value in /bytes/? In modern solaris implementations
of posix threads, the default stack size is 2 megabytes fo 64
bit machines.

I can't fathom what your performance consideration would be;
I'd think there'd not be one, with any reasonable amount of
memory on your server.

C//

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


MDaemon Warning - virus found: Returned mail: Data format error

2005-02-11 Thread Mail Delivery Subsystem

*** WARNING **
Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado 
un fichero anexo(s) infectado(s).  Por favor revise el reporte de abajo.

AttachmentVirus name   Action taken
--
mxs.zip   Email-Worm.Win32.Mydoom.m Removed


**


The message was not delivered due to the following reason:

Your message was not delivered because the destination computer was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 6 days:
Host 196.50.210.36 is not responding.

The following recipients could not receive this message:


Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.

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

Re: Install MySQLdb on Mac OS X (10.3)

2005-02-11 Thread Sion Arrowsmith
Skip Montanaro  <[EMAIL PROTECTED]> wrote:
>Try a more recent version of mysql-python.  I think 1.1.7 is the latest.

1.2.0 -- it appears to be moving extremely rapidly (especially given
how long it was at 0.9.2 -- although "Waiting for MySQL 4.1 to become
stable" would be a good explanation for that).

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list


Injecting a C side object into the local dict

2005-02-11 Thread Jamie R. Parent
Hello,

How do you go about taking a variable which was declared in C and pass
that through to a Python script? I have tried doing this by adding a
simple string which is a PyObject from C into the local dictionary and
retrieving it from script via a locals()["myCvar"] print statement.
This however does not seem to work. It would seem that when the scripts
are ran the local dictionary with the added item is wiped clean and a
new local dictionary is instead used. Any direction or help would be
appreciated.

Cheers,
Jamie.

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


Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Brian Quinlan
Diez B. Roggisch wrote:
I'm well aware of the need of a bom for fixed-size multibyte-characters like
utf16.
But I don't see the need for that on an utf-8 byte sequence, and I first
encountered that in MS tool output - can't remember when and what exactly
that was. And I have to confess that I attributed that as a stupidity from
MS. But according to the FAQ you mentioned, it is apparently legal in utf-8
too. Neverless the FAQ states:
[snipped]
So they admit that it makes no sense - especially as decoding a utf-8 string
given any 8-bit encoding like latin1 will succeed.
They say that it makes no sense as an byte-order indicator but they 
indicate that it can be used as a file signature.

And I'm not sure what you mean about decoding a UTF-8 string given any 
8-bit encoding. Of course the encoder must be know:

>>> u'T\N{LATIN SMALL LETTER U WITH DIAERESIS}r'
...   .encode('utf-8').decode('latin1').encode('latin1')
'T\xc3\xbcr'
I can assume you that most Germans can differentiate between "Tür" and 
"Tã¼r".

Using a BOM with UTF-8 makes it easy to indentify it as such AND it 
shouldn't break any probably written Unicode-aware tools.

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


Re: sre is broken in SuSE 9.2

2005-02-11 Thread Serge Orlov
Denis S. Otkidach wrote:
> On 10 Feb 2005 11:49:33 -0800
> "Serge Orlov" <[EMAIL PROTECTED]> wrote:
>
> > This thread is about problems only with LANG=C or LANG=POSIX, it's
not
> > about other locales. Other locales are working as expected.
>
> You are not right.  I have LANG=de_DE.UTF-8, and the Python
test_re.py
> doesn't pass.

I meant "only with C or POSIX locales" when I wrote "only with LANG=C
or LANG=POSIX". My bad.

> $LANG doesn't matter if I don't call setlocale.

Sure.

> Fortunately setting any non-C locale solves the problem for all (I
> believe) unicode character:
>
> >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430')
> [u'\xb5\xba\xe4\u0430']

I can't find the strict definition of isalpha, but I believe average
C program shouldn't care about the current locale alphabet, so isalpha
is a union of all supported characters in all alphabets

  Serge.

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


Re: Install MySQLdb on Mac OS X (10.3)

2005-02-11 Thread TK
Skip Montanaro wrote:
TK> I can't install MySQLdb on Mac OS X (Ver. 10.3) properly. Here's my 
TK> environment:

TK> 1. MySQL-python-1.0.0
...
Try a more recent version of mysql-python.  I think 1.1.7 is the latest.
Skip

Hi Skip,
> Try a more recent version of mysql-python.  I think 1.1.7 is the latest.
It now works with MySQL-python-1.2.0
And I have to set:
export 
PATH=$PATH:/usr/local/mysql-standard-4.1.9-apple-darwin7.7.0-powerpc/bin

Thanks for the hint.
o-o
Thomas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python in Makefile Question. try A.A.P

2005-02-11 Thread Bart van Deenen
Another option would be to move from Makefiles to AAP, the build
mechanism for vim. We did just that, and are very happy with it. Aap is
python based, so the kind of question you have is very easily handled
within the 'aap' file.

http://www.a-a-p.org/

Aap has the advantage that you don't need to define the dependencies
yourself, it understands C files, and does the work for you. Our
Makefile shrunk by a factor of 5 after converting to aap.

Highly recommended.

Bart van Deenen.

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


Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Nick Coghlan
Diez B. Roggisch wrote:
So they admit that it makes no sense - especially as decoding a utf-8 string
given any 8-bit encoding like latin1 will succeed.
So in the end, I stand corrected. But I still think its crap - But not MS
crap. :)
Oh, good. I'm not the only person who went "A BOM in UTF-8 data? WTF do you need 
a byte order marker for when you have 8-bit data?"

It also clarifies Martin's comment about the UTF-8 codec ignoring the existence 
of this piece of silliness :)

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: is there a safe marshaler?

2005-02-11 Thread cmkl
Irmen de Jong <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Pierre Barbier de Reuille wrote:
> > Irmen de Jong a écrit :
> > 
> >> Pickle and marshal are not safe. They can do harmful
> >> things if fed maliciously constructed data.
> >> That is a pity, because marshal is fast.
> >> I need a fast and safe (secure) marshaler.
> >> Is xdrlib the only option?
> >> I would expect that it is fast and safe because
> >> it (the xdr spec) has been around for so long.
> >>
> >> Or are there better options (perhaps 3rd party libraries)?
> >>
> >> Thanks
> >>
> >> Irmen.
> > 
> > 
> > What exactly do you mean by "safe" ? Do you want to ensure your objects 
> > cannot receive corrupted data ? Do you want to ensure no code will be 
> > evaluated during the unmarshalling ?
> 
> "safe (secure)"
> But to be more precise, let's look at the security warning that
> is in the marshal documentation:
> "The marshal module is not intended to be secure against erroneous or 
> maliciously constructed data. Never unmarshal data received from an 
> untrusted or unauthenticated source."
> 
> So essentially I want the opposite of that ;-)
> 
> I want a marshalar that is okay to use where the data it processes
> comes from unknown, external sources (untrusted). It should not crash
> on corrupt data and it should not execute arbitrary code when
> unmarshaling, so that it is safe against hacking attempts.
> 
> Oh, preferrably, it should be fast :)
> Some XML-ish thing may be secure but is likely to be not fast at all.
> 
> Ideally it should be able to transfer user defined Python types,
> but if it is like marshal (can only marshal builtin types) that's
> okay too.
> 
> --Irmen

I'm just curious,

but can't effbot's fast cElementree be used for PYROs XML_PICKLE 
and would it be safe and fast enough?

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


Re: PyQt documentation

2005-02-11 Thread Diez B. Roggisch
> The point is that if someone is familiar just to Python and not Qt, or
> the reverse, familiar to Qt and not to Python, it is difficult to see
> the *little* details of implementation.
> 
> I say this because I am familiar to Qt and not much to Python, and
> there are simple little mistake I do, that could be avoided if a simple
> example explained it. And a searchable API with examples would be
> perfect for rapid development.
> 
> Think about more *new* people using PyQt. I think PyQt if a great
> (actually the gratest ever, IMO) development "enviroment" and as more
> people use it, better it gets.
> 
> Thats the reason I want to know if there is a "Qtdoc-like" PyQt doc. If
> it does not exists, let's make it :)
> 
> Wanna join?

No. I did do some heavy qt development the last fall, and I never ran into
troubles because of lack of documentation. So at least for me, there is no
need for such a kind of documentation.

Above that I think that your desire for that docs stems from the need for
getting into pythonesque programming whilst developing a qt-app, I have to
say that I don't think that that's a too viable approach in general. Think
of trying to learn C++ using Qt. It's hard enough to grasp the gist of the
language itself - let alone the complications a elaborated - and in this
case even with special preprocessors equipped - library as qt. 

So maybe a better way for you would be to learn python by its own, then
trying to use it in conjunction with qt. 

Apart from that, I personally found that nearly _no_ python specific stuff
was necessary for my doings - at least out of my head I can't come up with
an example, except name clashes (exec renamed to exec_loop, as its a
keyword in python). All I had to do to make e.g. examples given in C++ work
was to strip curly braces and type declarations. So again: I don't see the
need for that doc. But that's IMHO, of course.

-- 
Regards,

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


Re: Unit Testing in Python

2005-02-11 Thread Grig Gheorghiu
A great place to start for TDD-related stuff is testdriven.com. On the
topic of Python-specific unit testing, there's also a recent thread on
the newly-created extreme-python google group:
http://groups-beta.google.com/group/extreme-python/browse_thread/thread/f39844c4cf6c844f?tvc=2

Grig


http://agiletesting.blogspot.com

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


Re: Testing web applications

2005-02-11 Thread Grig Gheorghiu
The Jython / HttpUnit combination worked well for me too. There's also
maxq (http://maxq.tigris.org/), which looks promising, but I haven't
used it yet.

Grig


http://agiletesting.blogspot.com

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


Re: PyQt documentation

2005-02-11 Thread Eric Jardim
> You can use the qt c++ doc from trolltech.
> The pyqt bindings are so close to he original that
> you usually can simply use that.

Yes, I currently use it.


>  Additionally, there is a book from boudewijn rempt
> about coding in python+qt which is for qt2, but
> it covers all the signal slot basics and is completely
> available online.

I know the book, too. But It would be more practical to have a
Qtdoc-like for python, don't you think?


> There is an python-based ide which has the same
> name as your first name - try that.

Sure, I use it too. It's great.

The point is that if someone is familiar just to Python and not Qt, or
the reverse, familiar to Qt and not to Python, it is difficult to see
the *little* details of implementation.

I say this because I am familiar to Qt and not much to Python, and
there are simple little mistake I do, that could be avoided if a simple
example explained it. And a searchable API with examples would be
perfect for rapid development.

Think about more *new* people using PyQt. I think PyQt if a great
(actually the gratest ever, IMO) development "enviroment" and as more
people use it, better it gets.

Thats the reason I want to know if there is a "Qtdoc-like" PyQt doc. If
it does not exists, let's make it :)

Wanna join?

[Eric Jardim]

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


Re: [NooB] Using Escape Sesquences with Strings...

2005-02-11 Thread bruno modulix
administrata wrote:
Hello! :)
I've reading 'Python Programmin for the Absolute beginner'.
I got questions which is...
print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
rock = """
Igneous  Sedimentary  Metamorphic
Lava Grains   Marble
Ramdom crystals  LayerBands
Granite  Salt Schist
IntrusiveWeathering   Heat + Pressure
 Deposition   Change"""
print \trock
print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
error occurs!
I don't know how to \t The variable.
see Daniel's answer for the why.
Now for the how, I guess you want a tab on each line so you have two 
solutions :
1/ putting the tabs in the string:
rock = """
\tIgneous  Sedimentary  Metamorphic

\tLava Grains   Marble
\tRamdom crystals  LayerBands
\tGranite  Salt Schist
\tIntrusiveWeathering   Heat + Pressure
\t Deposition   Change"""
print rock
2/ adding the tabs before printing:
rock = """
Igneous  Sedimentary  Metamorphic
Lava Grains   Marble
Ramdom crystals  LayerBands
Granite  Salt Schist
IntrusiveWeathering   Heat + Pressure
 Deposition   Change"""
for line in rock.split("\n"):
  print "\t%s" % line
HTH,
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| 
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
--
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python v.s. c++

2005-02-11 Thread bruno modulix
xiaobin yang wrote:
Hi,  if i am already skillful with c++.  Is it useful to learn python? thanks!
Q : If I'm already skillfull with driving a big truck, is it useful to 
learn driving a motorcycle?

(tip : Have you ever tried driving a big truck in a big city at rush 
hour?-)

--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| 
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
--
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Diez B. Roggisch
> What are you talking about? The BOM and UTF-16 go hand-and-hand.
> Without a Byte Order Mark, you can't unambiguosly determine whether big
> or little endian UTF-16 was used. If, for example, you came across a
> UTF-16 text file containing this hexidecimal data: 2200> 
> what would you  assume? That is is quote character in little-endian
> format or that it is a for-all symbol in big-endian format?

I'm well aware of the need of a bom for fixed-size multibyte-characters like
utf16.

But I don't see the need for that on an utf-8 byte sequence, and I first
encountered that in MS tool output - can't remember when and what exactly
that was. And I have to confess that I attributed that as a stupidity from
MS. But according to the FAQ you mentioned, it is apparently legal in utf-8
too. Neverless the FAQ states:

"""
Q: Can a UTF-8 data stream contain the BOM character (in UTF-8 form)? If
yes, then can I still assume the remaining UTF-8 bytes are in big-endian
order?


A: Yes, UTF-8 can contain a BOM. However, it makes no difference as to the
endianness of the byte stream. UTF-8 always has the same byte order. An
initial BOM is only used as a signature ? an indication that an otherwise
unmarked text file is in UTF-8. Note that some recipients of UTF-8 encoded
data do not expect a BOM. Where UTF-8 is used transparently in 8-bit
environments, the use of a BOM will interfere with any protocol or file
format that expects specific ASCII characters at the beginning, such as the
use of "#!" of at the beginning of Unix shell scripts. [AF] & [MD]
"""

So they admit that it makes no sense - especially as decoding a utf-8 string
given any 8-bit encoding like latin1 will succeed.

So in the end, I stand corrected. But I still think its crap - But not MS
crap. :)

-- 
Regards,

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


Re: Python versus Perl ?

2005-02-11 Thread rzed
"Mauro Cicognini" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> 
> Alex Martelli wrote:
> 
>> URK -- _my_ feeling is that we have entirely *too many* options
>> for stuff like web application frameworks, GUI toolkits, XML
>> processing, 
> ...
>>
>>
>> Alex
> 
> I entirely second that.
> 
> More, I'd heartily welcome an authoritative word on which to
> focus on for each category... I hate to see scarce resources
> wasted. 
> 

Alex also suggested that a revival of the anygui interface would be 
a Good Thing. I would certainly love to see that.

It seems to me that Python should in fact include either anygui or 
an equivalent to it as part of its core. Then to interface with a 
given GUI package, it would be necessary to create a wrapper that 
maps the wrapper's API to that standard Pythonic API. More work for 
the package maintainers, and not easy to do in some cases, but for 
the Python community it would be a huge gain. The same argument 
could be made for the anydbm interface. 

In both cases, the interface should not hinder the ability of a 
developer to access any part of the package API, which implies that 
parameters must be flexible. Maybe this is a strong use case for 
bunch/data/namespace arguments and return values.

-- 
rzed

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


  1   2   >