Calling ImageMagick's convert

2008-12-22 Thread [email protected]
Hello group!

I'm a Python beginner. I'm trying to call ImageMagick's convert
program from my code.
My OS is Debian testing, and my version of Python is 2.5.

I've just stumbled upon a problem:

(1) subprocess.call('convert in.png -resize 640x480 out.png', shell =
True)

works, but none of the following does:

(2) subprocess.call('convert in.png -resize 640x480 out.png')
(3) subprocess.call(['convert', 'in.png', '-resize 640x480',
'out.png'])
(4) subprocess.call(['convert', 'in.png', '-resize 640x480',
'out.png'], shell = True)

In these cases, convert program says 'unrecognized option -resize
640x480'.
At the same time,

subprocess.call(['ls', '-l'])

works as expected.

I'd like to use variant (3), as it seems the most handy. I don't
understand why is shell = True required in case of convert. Is it a
bug in Python, in ImageMagick, or am I missing something very basic
here?
Any hint appreciated.

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


Re: Calling ImageMagick's convert

2008-12-22 Thread Chris Rebert
On Mon, Dec 22, 2008 at 12:15 AM, [email protected]  wrote:
> Hello group!
>
> I'm a Python beginner. I'm trying to call ImageMagick's convert
> program from my code.
> My OS is Debian testing, and my version of Python is 2.5.
>
> I've just stumbled upon a problem:
>
> (1) subprocess.call('convert in.png -resize 640x480 out.png', shell =
> True)
>
> works, but none of the following does:
>
> (2) subprocess.call('convert in.png -resize 640x480 out.png')
> (3) subprocess.call(['convert', 'in.png', '-resize 640x480',
> 'out.png'])

I think this needs to be:

subprocess.call(['convert', 'in.png', '-resize', '640x480', 'out.png'])

Otherwise, it gets '-resize 640x480' as a single escaped option when
it's really 2 options, which is the error message you're getting.
You have to split the arguments up just like the shell would, which
basically means at whitespace unless quoting is used, which is not the
case here.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com

> (4) subprocess.call(['convert', 'in.png', '-resize 640x480',
> 'out.png'], shell = True)
>
> In these cases, convert program says 'unrecognized option -resize
> 640x480'.
> At the same time,
>
> subprocess.call(['ls', '-l'])
>
> works as expected.
>
> I'd like to use variant (3), as it seems the most handy. I don't
> understand why is shell = True required in case of convert. Is it a
> bug in Python, in ImageMagick, or am I missing something very basic
> here?
> Any hint appreciated.
>
> Andrey
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent a sequence of raw bytes

2008-12-22 Thread James Mills
On Mon, Dec 22, 2008 at 4:56 PM, Steven Woody  wrote:
> I thing "\x11\x22\x33" in python is not the {0x11, 0x22, 0x33} in C.
> Since, a string in python is immutable, I can _not_ do something like:
>  b[1] = "\x55".
>
> And, how about char buf[200] in my original question?  The intension
> is to allocate 200 undefined bytes in memory. Thanks.

Steven, one piece of advice.

Python is not C.

Thank.

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


Re: HMAC with RIPEMD-160

2008-12-22 Thread Kless
On 21 dic, 23:53, "Chris Rebert"  wrote:
> On Sun, Dec 21, 2008 at 4:21 AM, Kless  wrote:
> > Is there any way of use HMAC with RIPEMD-160?
>
> > Since that to create a ripemd-160 hash there is to use:
> >    h = hashlib.new('ripemd160')
> > it looks that isn't possible
>
> > For HMAC-SHA256 would be:
> > -
> > import hashlib
> > import hmac
>
> > hm = hmac.new('key', msg='message', digestmod=hashlib.sha256)
>
> Untested, but should work according to the docs:
> hm = hmac.new('key', msg='message', digestmod=lambda: 
> hashlib.new('ripemd160'))
>
It works, thank you
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent a sequence of raw bytes

2008-12-22 Thread Steven Woody
On Mon, Dec 22, 2008 at 4:35 PM, James Mills
 wrote:
> On Mon, Dec 22, 2008 at 4:56 PM, Steven Woody  wrote:
>> I thing "\x11\x22\x33" in python is not the {0x11, 0x22, 0x33} in C.
>> Since, a string in python is immutable, I can _not_ do something like:
>>  b[1] = "\x55".
>>
>> And, how about char buf[200] in my original question?  The intension
>> is to allocate 200 undefined bytes in memory. Thanks.
>
> Steven, one piece of advice.
>
> Python is not C.
>
> Thank.
>
> cheers
> James
>

Ok, I will study all your advices. I think I may find my way when
doing real tasks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Are python objects thread-safe?

2008-12-22 Thread Rhamphoryncus
On Dec 21, 11:51 am, RajNewbie  wrote:
> Say, I have two threads, updating the same dictionary object - but for
> different parameters:
> Please find an example below:
> a = {file1Data : '',
>        file2Data : ''}
>
> Now, I send it to two different threads, both of which are looping
> infinitely:
> In thread1:
> a['file1Data'] = open(filename1).read
>           and
> in thread2:
> a['file2Data'] = open(filename2).read
>
> My question is  - is this object threadsafe? - since we are working on
> two different parameters in the object. Or should I have to block the
> whole object?

In general, python makes few promises.  It has a *strong* preference
towards failing gracefully (ie an exception rather than a segfault),
which implies atomic operations underneath, but makes no promise as to
the granularity of those atomic operations.

In practice though, it is safe to update two distinct keys in a dict.
--
http://mail.python.org/mailman/listinfo/python-list


We are looking for boys and girls to have fun, orgie s, trios, and whatever. If you want a do it, don’t be shy and contact. That’s going to be great!

2008-12-22 Thread [email protected]
We are looking for boys and girls to have fun, orgies, trios, and
whatever. If you want a do it, don’t be shy and contact. That’s going
to be great!
By the way, we are bisexual and we don’t care about gender…
Sign in to enjoy with us:
http://xxxgente.chueca.com/sexocontacto/
http://galeon.com/sexocontacto/2451.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Aaron Brady
On Dec 21, 8:42 pm, MRAB  wrote:
> Aaron Brady wrote:
> > On Dec 21, 6:14 pm, MRAB  wrote:
snip
> >> Yes, I suggested that earlier, but it isn't needed because you can
> >> create a format object with "Format(string)". However, most of the time
> >> you won't bother to create a format object explicitly because of:
>
> >> class str(object):
> >>      def __mod__(self, value):
> >>          return Format(self) % value
>
> >> f = f"%r %i"
> >> type(f)
> >>> 
> >>  >>> # Explicitly
> >>  >>> f = Format("%r %i")
> >>  >>> f
> >> 
> >>  >>> f % (2, 3, 4)
> >> 
>
> >>  >>> # Implicitly, relying on the __mod__ method of str
> >>  >>> f = "%r %i"
> >>  >>> f
> >> '%r %i'
> >>  >>> f % (2, 3, 4)
> >> 
>
> >> I'd also like to add that there's nothing to prevent format objects from
> >> having other methods where multiple placeholders can be filled in one call:
>
> >>  >>> # By position
> >>  >>> f = Format("%r %i")
> >>  >>> f
> >> 
> >>  >>> f.fill([(2, 3, 4), 1])
> >> '(2, 3, 4) 1'
>
> >>  >>> # By name
> >>  >>> f = Format("%{tuple}r %{int}i")
> >>  >>> f
> >> 
> >>  >>> f.fill({"tuple": (2, 3, 4), "int": 1})
> >> '(2, 3, 4) 1'
>
> > You're choosing to favor the '.chain()' method over the '.fill()'
> > method for the behavior of '%'.  I don't think you've justified it
> > though.
>
>  Format( "%r %i" ).chain( ( 2, 3, 4 ) ).chain( 0 )
> > '(2, 3, 4) 0'
>  Format( "%r %i" ).fill( ( 2, 3, 4 ), 0 )
> > '(2, 3, 4) 0'
>
> > Plus, I almost think we've almost attained defeating the purpose.
>
> The disadvantage of the chaining method is that it's positional,
> left-to-right. For the purposes of i18n you want tagged placeholders,
> whether they be integers or names. I think... OK, if the placeholders
> include a positional tag, eg "%(0)s %(1)s", then they could be filled in
> according to _that_ order. Not sure about named placeholders, though.
> Perhaps, like at present, if a dict is given to a format with named
> placeholders then several placeholders could be filled, the problem
> being how to fill a _single_ named placeholder with a dict.

Just pass a keyword argument to chain.

>>> Format( "%(tup)r %(int_)i" ).chain( tup= ( 2, 3, 4 ) ).chain( int_= 0 )
'(2, 3, 4) 0'

You might want to call it 'fchain' or 'chainf'.
--
http://mail.python.org/mailman/listinfo/python-list


Basic misunderstanding of generators

2008-12-22 Thread Barak, Ron
Hi All,

I want to use generators to print lines taken from a gzipped file.
I've never used generators, so probably my problem is basic misunderstanding of 
generators.

In the below program, I expected the last line ("print line_") to print the 
first line of the sac.log.gz file.
Instead, I get:



Could you tell me what I'm doing wrong (or point me to a URL that could set me 
straight) ?

Thanks,
Ron.

$ cat LogManager_try.py
#!/usr/bin/env python
import gzip
import os
class LogStream():
"""
"""

def __init__(self, filename):
self.filename = filename
self.input_file = self.open_file(filename)
def open_file(self, in_file):
"""
The gzip module checks if the input file is a gzipped file, only at the 
read stage.
This is why the f.readline() is needed.
"""
try:
f = gzip.GzipFile(in_file, "r")
f.readline()
except IOError:
f = open(in_file, "r")
f.readline()
f.seek(0)
return(f)
def next_line(self, in_file):
"""
"""
for line_ in in_file:
yield line_.strip()
if __name__ == "__main__":
filename = "sac.log.gz"
log_stream = LogStream(filename)
line_ = log_stream.next_line(log_stream.input_file)
print line_
$ python LogManager_try.py

$

--
Ron Barak, System Development Engineer
LSI Technologies Israel Ltd
63 Bar Yehuda Road, Nesher 36651 Israel
Tel: (+972) 4 8203454 x1542   Fax: (+972) 4 8203464
[cid:263372909@22122008-2BEE][cid:263372...@22122008-2bf5]


Remember, Ginger Rogers did everything Fred Astaire did, but backwards and in 
high heels. (Faith Whittlesey)


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


Re: Basic misunderstanding of generators

2008-12-22 Thread Chris Rebert
On Mon, Dec 22, 2008 at 1:47 AM, Barak, Ron  wrote:
> Hi All,
>
> I want to use generators to print lines taken from a gzipped file.
> I've never used generators, so probably my problem is basic misunderstanding
> of generators.
>
> In the below program, I expected the last line ("print line_") to print the
> first line of the sac.log.gz file.
> Instead, I get:
>
> 
>
> Could you tell me what I'm doing wrong (or point me to a URL that could set
> me straight) ?
>
> Thanks,
> Ron.
>
>
> $ cat LogManager_try.py
> #!/usr/bin/env python
>
> import gzip
> import os
>
> class LogStream():
> """
> """
>
> def __init__(self, filename):
> self.filename = filename
> self.input_file = self.open_file(filename)
>
> def open_file(self, in_file):
> """
> The gzip module checks if the input file is a gzipped file, only at
> the read stage.
> This is why the f.readline() is needed.
> """
> try:
> f = gzip.GzipFile(in_file, "r")
> f.readline()
> except IOError:
> f = open(in_file, "r")
> f.readline()
>
> f.seek(0)
> return(f)
>
> def next_line(self, in_file):
> """
> """
> for line_ in in_file:
> yield line_.strip()
>
> if __name__ == "__main__":
> filename = "sac.log.gz"
> log_stream = LogStream(filename)
 generator = log_stream.next_line(log_stream.input_file) #create generator
 line_ = generator() #get next item from generator
 print line_

And as you can see, this makes next_line a bit of a misnomer.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent a sequence of raw bytes

2008-12-22 Thread bieffe62
On 22 Dic, 03:23, "Steven Woody"  wrote:
> Hi,
>
> What's the right type to represent a sequence of raw bytes.  In C, we usually 
> do
>
> 1.  char buf[200]  or
> 2.  char buf[] = {0x11, 0x22, 0x33, ... }
>
> What's the equivalent representation for above in Python?
>
> Thanks.
>
> -
> narke

Usually, if I have to manipulate bytes (e.g. computing checksum,
etc...) i just use a list of numbers:

buf = [11, 22, 33, ...]

then when I need to put it in a buffer similar to the one in C (e.g.
before sending a packet of bytes through a socket
or another I/O channel), I use struct.pack

import struct
packed_buf = struct.pack('B'*len(buf), buf )

similarly, if I get a packet of bytes from an I/O channel and I need
to do operation on them as single bytes, I do:

buf = struct.unpack('B'*len(packed_buf), packed_buf )

Note that struct.pack and struct.unpack can trasform packed bytes in
other kind of data, too ...

There are other - maybe more efficient - way of handling bytes in
python programs, like using array as already suggested, but, up
to now, I never needed them in my python programs, which are not real-
time stuff, but sometime need to process steady flows of
data.

Ciao

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


using subprocess module in Python CGI

2008-12-22 Thread ANURAG BAGARIA
Hello,

I am a Python Newbie and would like to call a short python script via
browser using a CGI script, but initially I am trying to call the same
python script directly through python command line. The script intends to
perform a few command line in a pipe and I have written the script (a short
one) as follows.

#!/usr/bin/python

import cgi, string, os, sys, cgitb, commands, subprocess
import posixpath, macpath
#file = "x.tar.gz"
#comd = "tar -xf %s" % (file)
#os.system(comd)
#commands.getoutput('tar -xf x.tar.gz | cd demo; cp README ../')
comd = [\
"tar -xf x.tar.gz", \
"cd demo", \
"cp README ../", \
  ]
outFile = os.path.join(os.curdir, "output.log")
outptr = file(outFile, "w")
errFile = os.path.join(os.curdir, "error.log")
errptr = file(errFile, "w")
retval = subprocess.call(comd, 0, None, None, outptr, errptr)
errptr.close()
outptr.close()
if not retval == 0:
errptr = file(errFile, "r")
errData = errptr.read()
errptr.close()
raise Exception("Error executing command: " + repr(errData))


but after trying to execute this independently, I get the following error
which I am unable to interpret :

Traceback (most recent call last):
  File "process.py", line 18, in 
retval = subprocess.call(comd, 0, None, None, outptr, errptr)
  File "/usr/lib/python2.5/subprocess.py", line 443, in call
return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
  File "/usr/lib/python2.5/subprocess.py", line 1135, in _execute_child
raise child_exception


Could someone suggest where am I going wrong and if corrected, what is the
probability of this script being compatible with being called through the
browser. Thanking you people in advance.

Regards.

-- 
I just want to LIVE while I'm alive.


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


Re: [Help] The pywinauto Can't select the MDI's menu using the MenuItems() which return [].

2008-12-22 Thread Simon Brunning
2008/12/21  :
> The code below opens the Choose Font dialog on my Spanish Windows version:
>
> py> from pywinauto.application import Application
> py> app = Application.start("Notepad.exe")

Notepad's menus are build with MFC. Word's menus are not. Trust me,
give it up. For automating Word, COM (with Mark Hammond's excellent
Python/COM bridge) is the only way to go.

-- 
Cheers,
Simon B.
[email protected]
--
http://mail.python.org/mailman/listinfo/python-list


Re: wxpython for python 3.0 ?

2008-12-22 Thread Vlastimil Brom
>> The wxpython web describes compatability with python 2.4 & 2.5 .
>> Does it work with 3.0 ?   If not, anyone have a clue as to when ?
>
> This question was asked a couple of times on the wxpython-users mailing
> list. It's probably going to take a while. For now, I'd stick to python 2.x.
> The next version of wxPython should support 2.6, so use that and try to make
> your code relatively compatible with Python 3 ...

The last version of wxPython (2.8.9.1) available on
http://wxpython.org/download.php already supports python 2.6; there
are prebuilt binaries for this version too.
The 3.0 will probably need a bit more time.

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


Re: wxpython for python 3.0 ?

2008-12-22 Thread CM
On Dec 21, 4:42 pm, dlemper wrote:
> The wxpython web describes compatability with python 2.4 & 2.5 .
> Does it work with 3.0 ?   If not, anyone have a clue as to when ?

Not yet. I think it will be a while until then.
--
http://mail.python.org/mailman/listinfo/python-list


RE: Basic misunderstanding of generators - resolved

2008-12-22 Thread Barak, Ron
Hi Chris,

Thanks for the super fast reply.

I tried your fix (with a slight modification, namely, I changed your line to 
be: line_ = generator.next())

And I got the printout I expected.

Many thanks,
Ron.

P.S.: My program looks like so, with your suggestion:

$ cat LogManager_try.py
#!/usr/bin/env python

import gzip
import os

class LogStream():
"""
"""

def __init__(self, filename):
self.filename = filename
self.input_file = self.open_file(filename)

def open_file(self, in_file):
"""
The gzip module checks if the input file is a gzipped file, only at the 
read stage.
This is why the f.readline() is needed.
"""
try:
f = gzip.GzipFile(in_file, "r")
f.readline()
except IOError:
f = open(in_file, "r")
f.readline()

f.seek(0)
return(f)

def next_line(self, in_file):
"""
"""
for line_ in in_file:
yield line_.strip()

if __name__ == "__main__":
filename = "sac.log.gz"
log_stream = LogStream(filename)
generator = log_stream.next_line(log_stream.input_file) #create generator
line_ = generator.next() #get next item from generator
print line_



-Original Message-
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Rebert
Sent: Monday, December 22, 2008 11:53
To: Barak, Ron
Cc: [email protected]
Subject: Re: Basic misunderstanding of generators

On Mon, Dec 22, 2008 at 1:47 AM, Barak, Ron wrote:
> Hi All,
>
> I want to use generators to print lines taken from a gzipped file.
> I've never used generators, so probably my problem is basic
> misunderstanding of generators.
>
> In the below program, I expected the last line ("print line_") to
> print the first line of the sac.log.gz file.
> Instead, I get:
>
> 
>
> Could you tell me what I'm doing wrong (or point me to a URL that
> could set me straight) ?
>
> Thanks,
> Ron.
>
>
> $ cat LogManager_try.py
> #!/usr/bin/env python
>
> import gzip
> import os
>
> class LogStream():
> """
> """
>
> def __init__(self, filename):
> self.filename = filename
> self.input_file = self.open_file(filename)
>
> def open_file(self, in_file):
> """
> The gzip module checks if the input file is a gzipped file,
> only at the read stage.
> This is why the f.readline() is needed.
> """
> try:
> f = gzip.GzipFile(in_file, "r")
> f.readline()
> except IOError:
> f = open(in_file, "r")
> f.readline()
>
> f.seek(0)
> return(f)
>
> def next_line(self, in_file):
> """
> """
> for line_ in in_file:
> yield line_.strip()
>
> if __name__ == "__main__":
> filename = "sac.log.gz"
> log_stream = LogStream(filename)
 generator = log_stream.next_line(log_stream.input_file) #create generator
 line_ = generator() #get next item from generator
 print line_

And as you can see, this makes next_line a bit of a misnomer.

Cheers,
Chris

--
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
I don't find any sign(x) function in the math library (return the sign
of the value).
I've read that math module is a wrapper to C math lib and that C math
lib has not sign(), so...

I've implement my own sign function of course (it's easy) but a standard
one in math would be better and could be faster.

How do you implement this or is there any other module with a sign()
function ?

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"

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


Re: How to represent a sequence of raw bytes

2008-12-22 Thread Steven D'Aprano
On Mon, 22 Dec 2008 14:56:45 +0800, Steven Woody wrote:

> The intension is to allocate 200 undefined bytes in memory.

You *want* undefined bytes? Out of curiosity, what do you intend to do 
with them?


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


Re: no sign() function ?

2008-12-22 Thread Christian Heimes
Pierre-Alain Dorange schrieb:
> I don't find any sign(x) function in the math library (return the sign
> of the value).
> I've read that math module is a wrapper to C math lib and that C math
> lib has not sign(), so...

Starting with Python 2.6 the math and cmath modules have a copysign
function.

> I've implement my own sign function of course (it's easy) but a standard
> one in math would be better and could be faster.

Sure? :) Are you aware that the IEEE 754 standard makes a difference
between the floats +0.0 and -0.0?

from math import atan2
def sign(x):
if x > 0 or (x == 0 and atan2(x, -1.) > 0.):
return 1
else:
return -1

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


Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
Christian Heimes  wrote:

> Pierre-Alain Dorange schrieb:
> > I don't find any sign(x) function in the math library (return the sign
> > of the value).
> > I've read that math module is a wrapper to C math lib and that C math
> > lib has not sign(), so...
> 
> Starting with Python 2.6 the math and cmath modules have a copysign
> function.

I'm using 2.5.2 at that time, but copysign() is fine.

with :
s=copysign(1.0,x)
it return the sign (-1.0, 0.0, +1.0)

 
> > I've implement my own sign function of course (it's easy) but a standard
> > one in math would be better and could be faster.
> 
> Sure? :)

I was...

> Are you aware that the IEEE 754 standard makes a difference
> between the floats +0.0 and -0.0?
> 
> from math import atan2
> def sign(x):
> if x > 0 or (x == 0 and atan2(x, -1.) > 0.):
> return 1
> else:
> return -1

Thanks
As my need is for a game and that i do not have IEEE real concern, i
would simply using my simple function (but not as accurate) :

def sign(x):
if x==0.0:
return 0.0
elif x>0.0:
return 1.0
else:
return -1.0

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"

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


Re: no sign() function ?

2008-12-22 Thread Robert Lehmann
On Mon, 22 Dec 2008 12:31:44 +0100, Pierre-Alain Dorange wrote:

>> > I don't find any sign(x) function in the math library (return the
>> > sign of the value).
>> > I've read that math module is a wrapper to C math lib and that C math
>> > lib has not sign(), so...
[snip]
> As my need is for a game and that i do not have IEEE real concern, i
> would simply using my simple function (but not as accurate) :
> 
> def sign(x):
> if x==0.0:
> return 0.0
> elif x>0.0:
> return 1.0
> else:
> return -1.0

I found this snippet to be quite succinct (even though being smart 
*might* be wrong in programming)::

sign = lambda x:+(x > 0) or -(x < 0)

HTH,

-- 
Robert "Stargaming" Lehmann
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-22 Thread Stephen Thorne
On 2008-12-22, Pierre-Alain Dorange wrote:
> def sign(x):
> if x==0.0:
> return 0.0
> elif x>0.0:
> return 1.0
> else:
> return -1.0

Isn't this approximately this? ::

def sign(x):
return float(cmp(x, 0))

Or if you don't want a float response::

def sign(x):
return cmp(x, 0)

-- 
Regards,
Stephen Thorne
Development Engineer
NetBox Blue - 1300 737 060
--
http://mail.python.org/mailman/listinfo/python-list


excluding non-data files from distutils package_data

2008-12-22 Thread Robin Becker
Is there a convenient way in a distutils setup to determine which files will be 
included as part of the package setup. The need arises because I want to exclude 
those files from the package_data argument  after doing a recursive sweep of the 
package folder to locate all files inclding .py etc etc.

--
Robin Becker

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


pg_result_status

2008-12-22 Thread Qian Xu
Hi All,

I am using the pg module (http://www.pygresql.org/pg.html) for database
testing.

I have got a problem now:
I want to check the result status of postgresql database, which can be done
in php by using pg_result_status
(http://www.phpbuilder.com/manual/en/function.pg-result-status.php)

How can I do the same thing in python (2.5)?

Thanks in advance
--
Qian Xu
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
Stephen Thorne  wrote:

> > def sign(x):
> > if x==0.0:
> > return 0.0
> > elif x>0.0:
> > return 1.0
> > else:
> > return -1.0
> 
> Isn't this approximately this? ::
> 
> def sign(x):
> return float(cmp(x, 0))

Yes cmp() is probably the closest function to sign.

I'm new to python and here i discover at least 4 methods, i just make a
small script for timing those methods (100 000 times each on a set of 10
values).
I do not use timeit, i can't make it work easyly as it need a standalone
env for each test.

 the test script 
#!/usr/bin/env python

from math import atan2
import time


def sign_0(x):
if x==0.0:
return 0.0
elif x>0.0:
return 1.0
else:
return -1.0

def sign_1(x):
if x > 0 or (x == 0 and atan2(x, -1.) > 0.):
return 1
else:
return -1

def sign_2(x):
return cmp(x, 0)

sign_3 = lambda x:+(x > 0) or -(x < 0)

def main():
candidates=[1.1,0.0,-0.0,-1.2,2.4,5.6,-8.2,74.1,-23.4,7945.481]

startTime = time.clock()
for i in range(10):
for value in candidates:
s=sign_0(value)
print "sign_0 : ",time.clock() - startTime

startTime = time.clock()
for i in range(10):
for value in candidates:
s=sign_1(value)
print "sign_1 : ",time.clock() - startTime

startTime = time.clock()
for i in range(10):
for value in candidates:
s=sign_2(value)
print "sign_2 : ",time.clock() - startTime

startTime = time.clock()
for i in range(10):
for value in candidates:
s=sign_3(value)
print "sign_3 : ",time.clock() - startTime


if __name__ == '__main__' :
main()

 the results -
My config :
iMac (2,66 GHz intel dual core 2 duo)
MacOS X 10.5.5
Python 2.5.1

sign_0 = 0.4156 second (0%)
sign_1 = 0.5316 second (+28%)
sign_2 = 0.6515 second (+57%)
sign_3 = 0.5244 second (+26%)

 conclusions ---

1/ python is fast
2/ method (0) is the fastest
3/ cmp method (2) is the slowest
4/ the precise one (IEEE 754) is also fast (1)

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"

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


Re: no sign() function ?

2008-12-22 Thread Istvan Albert

>  conclusions ---

try testing on a large number of candidates that are all (or mostly)
positive or all (or mostly) negative and you'll see performance
numbers that are substantially different than the ones you report:

candidates = range(1000)

In general the function sign_1() is expected to be the fastest because
in most cases will detect the sign with the fewest operations, it only
visits the rest of the comparison when it hits the corner cases. Only
if you have lots of +/-0.0 cases will it be slower than the rest, due
to having to call an expensive operation.

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


Re: Are Django/Turbogears too specific?

2008-12-22 Thread Philip Semanchuk


On Dec 22, 2008, at 1:52 AM, Tino Wildenhain wrote:


Philip Semanchuk wrote:
...

I prefer Mako over the other template languages I've seen.


From what I can tell Mako is nearly identical to all other
template languages you might have seen (e.g. PHP style
tags). Thats why I personally would not consider it. Its just
much of a hassle to mix code and design this way.

I prefer TAL (template attribute language, ZPT) [1]
much over the other attempts I've seen ( and I've seen a lot)


That's an excellent example of how Python can accommodate different  
tastes. =) I can't stand TAL; I find it awkward and unPythonic. Your  
comment makes sense, though. Mako and TAL have very different design  
philosophies, and if you really like one, you're probably going to  
find the other strange at best.



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


Start Earning With Commission junction

2008-12-22 Thread [email protected]
Start Earning With Commission junction

one of the biggest affiliate programes i.e running on internet in
these days

details  on http://megalinesolutions.googlepages.com/cj_1
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent a sequence of raw bytes

2008-12-22 Thread Steven Woody
On Mon, Dec 22, 2008 at 6:44 PM, Steven D'Aprano
 wrote:
> On Mon, 22 Dec 2008 14:56:45 +0800, Steven Woody wrote:
>
>> The intension is to allocate 200 undefined bytes in memory.
>
> You *want* undefined bytes? Out of curiosity, what do you intend to do
> with them?
>

to receive/send network packets, read raw files, etc.  After read
replies of the thread, I think 'array' or 'struct' maybe what I
wanted, may a plain list can do, but I am not sure.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-22 Thread Lou Pecora
In article ,
 "James Mills"  wrote:

> In case anyone is not aware, Python is
> also used for heavy scientific computational
> problems, games such as Civilisation and
> others, and I believe (correct me if I"m wrong)
> it's also used by NASA.
> 
> --JamesMills

Python has become very popular in scientific computation.  You'll find 
it in use lots of places (universities, national labs, defense labs).  I 
use it for solving partial differential equations for quantum chaos 
calculations and went to C for speed up where needed using ctypes which 
is very straightforward and plays nice with numpy array/matrix 
libraries.  I've been doing scientific programming for 30 years.  Python 
with C extensions and libraries is the best approach I've ever used.  
Calculation speed is not a problem and the code can be "tweaked" to 
increase it easily.  Programming speed is incredible.  I can get 
substantial object oriented code up and running much faster than 
anything I've ever used.

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


Event Driven programming - Doubts

2008-12-22 Thread Kottiyath
Hi,
I have been looking at Twisted and lately Circuits as examples for
event driven programming in Python.
Even though I understood how to implement the code in these and
what is deferred etc, I have not yet understood the implementation of
deferred. I went through a lot of tutorials, but I guess most places
they expect that the user already understands how events are
generated. The tutorials mention that there is no more threads once
twisted is used.

My question is as follows:
I have not understood how the callbacks are hit without (a)
blocking the code or (b) having new threads.

The usual example given is that of a program waiting for data coming
through a socket. In the tutorials, it is mentioned that -in an event
driven program, we schedule the code to hit when the remote server
gets back to us - .
Now, my question is - somebody has to still wait on that socket and
check whether the data is received, and once all the data is received,
call the appropriate callbacks.

Is twisted creating a micro-thread which just waits on the socket and
once the data is received, calls callFromThread for it to run on the
main loop?

If so, Even though data locking etc is not a problem, are we not still
having threads? Will it not still cause scalability problems in high
traffic?
If not, could somebody let me know how it is done?
--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread walterbyrd
On Dec 21, 12:28 pm, Bruno Desthuilliers
 wrote:
> Strange enough,
> no one seems to complain about PHP or Ruby's performances...

A few years back, there was a certain amount of chest thumping, when
python/django easily beat ror in a benchmark test. Now that ruby is
faster, I guess speed is no big issue.

By the same reasoning, python advocates used to sneer at php because
php constantly broke backward compatibility. Now that python does it,
breaking backward compatibility is no big deal. I guess unicode
support was not that important, until python caught up to perl.

I guess, the way it works is: you first assume that python is
superior, then you figure out why.

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


Re: Event Driven programming - Doubts

2008-12-22 Thread Jean-Paul Calderone

On Mon, 22 Dec 2008 06:57:55 -0800 (PST), Kottiyath  
wrote:

Hi,
   I have been looking at Twisted and lately Circuits as examples for
event driven programming in Python.
[snip]

   My question is as follows:
   I have not understood how the callbacks are hit without (a)
blocking the code or (b) having new threads.


There is blocking code - but just in one place.  For example,

http://twistedmatrix.com/trac/browser/trunk/twisted/internet/selectreactor.py#L93

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


Python's popularity

2008-12-22 Thread walterbyrd
I have read that python is the world's 3rd most popular language, and
that python has surpassed perl in popularity, but I am not seeing it.

>From what I have seen:

- in unix/linux sysadmin, perl is far more popular than python,
windows sysadmins typically don't use either.
- in web-development, php is far more popular than python - it's not
even close.
- when I did a search on dice, I found over 20X more jobs advertised
for ruby on rails developers, than for python dango developers.
- application development is dominated by java, c/c++, and maybe a
little visual basic.
- as I understand it, fortran is still the most popular language for
numberical programming.

Of course, these are just observations on my part, nothing scientific
about it. But, I can't help but wonder how python's popularity was
determined. I suspect that a lot of people use python as a secondary
skill. For example, I use ms-word, but I'm not an ms-word
professional.

Please note: I am not confusing popularity with quality. I am not
saying that php is better for web-dev, or anything like that. I am
just wondering how python is rated as being so popular, when python
does not seem to dominate anything.
--
http://mail.python.org/mailman/listinfo/python-list


join a samba domain

2008-12-22 Thread Toff
hi,

I 'm trying to write a script to make my computer join a samba.

domeone have any idea ??


thanks regards,

*
# -*- coding: iso-8859-1 *-*

import win32com.client
import os,sys
import win32api
import impers
import socket
from win32com.client import GetObject
import wmi

def main():
test()
joindom()
def test():
import wmi
c = wmi.WMI()
os = c.Win32_ComputerSystem
for method_name in os.methods:
  method = getattr(os, method_name)
  print method

def joindom():
#Joining a computer to a domain
#=
JOIN_DOMAIN = 1
ACCT_CREATE = 2
ACCT_DELETE = 4
WIN9X_UPGRADE   = 16
DOMAIN_JOIN_IF_JOINED   = 32
JOIN_UNSECURE   = 64
MACHINE_PASSWORD_PASSED = 128
DEFERRED_SPN_SET= 256
INSTALL_INVOCATION  = 262144
strDomain   = "mydom"
strPassword = "mydompw"
strUser = "admin"

strComputer = socket.gethostname()
print strComputer
#objComputer = win32com.client.GetObject(r"winmgmts:
{impersonationLevel=Impersonate}!\\mypc\root
\cimv2:Win32_ComputerSystem.Name='mypc'")
import wmi
c = wmi.WMI()
d = c.Win32_ComputerSystem
d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")


if __name__=='__main__':
  main()
***
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Kevin Kelley
Python has it's place, usually getting things done, rather than being
flashy.

For example, while Java is still the "Enterprise King", both the leading
application servers (Weblogic and Websphere) adopted Jython as their
internal scripting language last year (or was it 2006?).

It's used heavily for internal game scripting (Eve Online uses it very
heavily (specifically Stackless), as does BF 2142).

I don't know if in fact Python is the 3rd most popular language, but I would
not be surprised by it passing up other high level scripting languages like
Perl and Ruby.

Kevin

On Mon, Dec 22, 2008 at 9:11 AM, walterbyrd  wrote:

> I have read that python is the world's 3rd most popular language, and
> that python has surpassed perl in popularity, but I am not seeing it.
>
> >From what I have seen:
>
> - in unix/linux sysadmin, perl is far more popular than python,
> windows sysadmins typically don't use either.
> - in web-development, php is far more popular than python - it's not
> even close.
> - when I did a search on dice, I found over 20X more jobs advertised
> for ruby on rails developers, than for python dango developers.
> - application development is dominated by java, c/c++, and maybe a
> little visual basic.
> - as I understand it, fortran is still the most popular language for
> numberical programming.
>
> Of course, these are just observations on my part, nothing scientific
> about it. But, I can't help but wonder how python's popularity was
> determined. I suspect that a lot of people use python as a secondary
> skill. For example, I use ms-word, but I'm not an ms-word
> professional.
>
> Please note: I am not confusing popularity with quality. I am not
> saying that php is better for web-dev, or anything like that. I am
> just wondering how python is rated as being so popular, when python
> does not seem to dominate anything.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: Basic misunderstanding of generators

2008-12-22 Thread David Stanek
On Mon, Dec 22, 2008 at 4:47 AM, Barak, Ron  wrote:
>
> if __name__ == "__main__":
> filename = "sac.log.gz"
> log_stream = LogStream(filename)
> line_ = log_stream.next_line(log_stream.input_file)
> print line_
>
> $ python LogManager_try.py
> 
>

A method or function containing a yield statement will return a
generator instance when called. Which is what is happening in your
example.

What you want to do is something like:

for line in log_stream.next_line(log_stream.input_file):
   print line

To make the code bit simpler and more OO you should not need to pass
anything into next_line(). It is a part the object so it naturally has
access to its properties. That being said you can then use __iter__
instead and then you can then do something like:

for line in log_stream:
  print line

OTOH If your LogStreamer class doesn't keep any additional state I
would probably just create a single generator function.

-- 
David
http://www.traceback.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Marco Mariani

walterbyrd wrote:


I have read that python is the world's 3rd most popular language, and
that python has surpassed perl in popularity, but I am not seeing it.



In 20 days, you've gone from trying to import a module by using:

> load "test.py"


to questioning the popularity of python.

You have many other subject you want to enlighten us about, I suppose?
Cause I wonder what you'll come up with, next.

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


Re: Event Driven programming - Doubts

2008-12-22 Thread David Stanek
On Mon, Dec 22, 2008 at 9:57 AM, Kottiyath  wrote:
>
> If so, Even though data locking etc is not a problem, are we not still
> having threads? Will it not still cause scalability problems in high
> traffic?
> If not, could somebody let me know how it is done?

This somewhat depends on the application. Is it IO bound or CPU bound?
>From what I understand about twisted you will only have one process
and one thread which means you will only be using one CPU.

-- 
David
http://www.traceback.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent a sequence of raw bytes

2008-12-22 Thread Grant Edwards
On 2008-12-22, Steven D'Aprano  wrote:
> On Mon, 22 Dec 2008 14:56:45 +0800, Steven Woody wrote:
>
>> The intension is to allocate 200 undefined bytes in memory.
>
> You *want* undefined bytes? Out of curiosity, what do you intend to do 
> with them?

Predict the future, of course.

-- 
Grant Edwards   grante Yow! MERYL STREEP is my
  at   obstetrician!
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread skip
Walter> From what I have seen:

Walter> - in unix/linux sysadmin, perl is far more popular than python,
Walter> windows sysadmins typically don't use either.
Walter> - in web-development, php is far more popular than python - it's not
Walter> even close.
Walter> - when I did a search on dice, I found over 20X more jobs advertised
Walter> for ruby on rails developers, than for python dango developers.
Walter> - application development is dominated by java, c/c++, and maybe a
Walter> little visual basic.
Walter> - as I understand it, fortran is still the most popular language for
Walter> numberical programming.

Looking at specific application domains doesn't tell the entire story.  If
you look back at the Tour de France results from the 80's I believe Greg
Lemond won it one year without ever winning a stage.  What you are reporting
is akin to that.  Fortran is almost certainly the king of numerical
programming, but Python might be #2 or #3 there (behind Matlab).  I'm pretty
sure it dwarfs Perl, PHP and Ruby in that domain.  In web development, while
PHP is more popular than Python, Python is probably much more popular than
Perl and Tcl.  Maybe not ahead of Ruby due to RoR.  etc etc.

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


Re: join a samba domain

2008-12-22 Thread Tim Golden

Toff wrote:

hi,

I 'm trying to write a script to make my computer join a samba.

domeone have any idea ??


Ummm. It's not clear if you're saying that your code doesn't
work, or asking for general advice, or what? I'm not in a
position to have my machine join a domain or workgroup, but
you seem to have got most things in place already. The only
thing I would expect to have to change is this last line:


import wmi
c = wmi.WMI()
d = c.Win32_ComputerSystem
d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")


because the d is only a WMI *class*, not a WMI *instance*,
so doesn't refer as it should to your computer system but
to the class of computer systems. Try something like this (untested):


import wmi

c = wmi.WMI ()
for d in c.Win32_ComputerSystem ():
 d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")



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


Re: Beep

2008-12-22 Thread Tobias Andersson

Jeffrey Barish skrev:

Chris Rebert wrote:

Is the 'pcspkr' kernel module built and loaded?


Yes.  And I should have mentioned that I get sound from Ubuntu applications
that produce sound.


Also, is the terminal bell set to "visual"? If so chr(7) only 
produces a brief flash (or similar).

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


Re: Are python objects thread-safe?

2008-12-22 Thread Duncan Booth
RajNewbie  wrote:

> Say, I have two threads, updating the same dictionary object - but for
> different parameters:
> Please find an example below:
> a = {file1Data : '',
>file2Data : ''}
> 
> Now, I send it to two different threads, both of which are looping
> infinitely:
> In thread1:
> a['file1Data'] = open(filename1).read
>   and
> in thread2:
> a['file2Data'] = open(filename2).read
> 
> My question is  - is this object threadsafe? - since we are working on
> two different parameters in the object. Or should I have to block the
> whole object?
> 
It depends exactly what you mean by 'threadsafe'. The GIL will guarantee 
that you can't screw up Python's internal data structures: so your 
dictionary always remains a valid dictionary rather than a pile of bits.

However, when you dig a bit deeper, it makes very few guarantees at the 
Python level. Individual bytecode instructions are not guaranteed 
atomic: for example, any assignment (including setting a new value into 
the dictionary) could overwrite an existing value and the value which is 
overwritten may have a destructor written in Python. If that happens you 
can get context switches within the assignment.

Other nasty things can happen if you use dictionaries from multiple 
threads. You cannot add or remove a dictionary key while iterating over 
a dictionary. This isn't normally a big issue, but as soon as you try to 
share the dictionary between threads you'll have to be careful never to 
iterate through it.

You will probably find it less error prone in the long run if you get 
your threads to write (key,value) tuples into a queue which the 
consuming thread can read and use to update the dictionary.

-- 
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Alvin ONeal
I decided to start learning python for 2 reasons:
#A The white-space is wonderful - you can't code unreadable code.
#B I noticed that just about every application I use has extensions
written in python.

Although it isn't as "cool" as ruby, it certainly has been in widespread
use longer.

I think that job postings inflate apparant popularity. For example if you
look up jobs for "Flex developers", you'll see a lot of posts. There are a
lot of people that hear the buzz and they think that they want a programmer
with that skill, but in reality what they should be looking for is a java
dev
who is willing to learn flex because there just aren't that many poeple that
know flex yet). I imagine the same is true of ruby.

Also worthy of mention:
I've seen python pre-installed on consumer HP desktops (I think as
part of a backup/restore script, but I'm not sure)

I would believe that python is in the top 5 for sure.

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


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Michael Torrie
r wrote:
> Steven,
> Would you like to elaborate on -why- escaped backslashes are needed in
> strings... i waiting???

Some character was needed.  It just happens that backslashes have been
used in this manner for composing nonprintable sequences, codes, etc.
It's only in use because someone arbitrarily picked it about 40 years
ago.  Any character could have been used; any such character would still
be have to escaped.

Kind of funny that you are complaining about Python in particular when
this behavior is in almost all languages today, including Perl, Ruby,

Don't blame python for a mistake that Microsoft made, that of choosing a
commonly-accepted escape character (long before Python was even though
of!) as their path delimiter.  Fortunately sane operating systems use a
standard slash.  Even Windows APIs accept forward slashes as path
delimiters.

So really your complaint about the backslash is a bit silly.  Are you
going to campaign that C# and Java also "fix" this problem by choosing
another character?
--
http://mail.python.org/mailman/listinfo/python-list


Re: join a samba domain

2008-12-22 Thread Toff
On 22 déc, 17:02, Tim Golden  wrote:
> Toff wrote:
> > hi,
>
> > I 'm trying to write a script to make my computer join a samba.
>
> > domeone have any idea ??
>
> Ummm. It's not clear if you're saying that your code doesn't
> work, or asking for general advice, or what? I'm not in a
> position to have my machine join a domain or workgroup, but
> you seem to have got most things in place already. The only
> thing I would expect to have to change is this last line:
>
> >    import wmi
> >    c = wmi.WMI()
> >    d = c.Win32_ComputerSystem
> >    d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
>
> because the d is only a WMI *class*, not a WMI *instance*,
> so doesn't refer as it should to your computer system but
> to the class of computer systems. Try something like this (untested):
>
> 
> import wmi
>
> c = wmi.WMI ()
> for d in c.Win32_ComputerSystem ():
>   d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
>
> 
>
> TJG
thanks but it doesn't work
I've got this errors

Traceback (most recent call last):
 File "integrdom.py", line 51, in 
   main()
 File "integrdom.py", line 13, in main
   joindom()
 File "integrdom.py", line 44, in joindom
   d.JoinDomainOrWorkGroup(None, 3, "domcd", "adminLocal", r"admin
\domcd")
 File "c:\Python25\Lib\site-packages\wmi.py", line 493, in __getattr__
   handle_com_error (error_info)
 File "c:\Python25\Lib\site-packages\wmi.py", line 189, in
handle_com_error
   raise x_wmi, "\n".join (exception_string)
wmi.x_wmi

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


Re: Python's popularity

2008-12-22 Thread Richard Riley
Marco Mariani  writes:

> walterbyrd wrote:
>
>> I have read that python is the world's 3rd most popular language, and
>> that python has surpassed perl in popularity, but I am not seeing it.
>
>
> In 20 days, you've gone from trying to import a module by using:
>
>> load "test.py"
>
>
> to questioning the popularity of python.
>
> You have many other subject you want to enlighten us about, I suppose?
> Cause I wonder what you'll come up with, next.
>

One does not have to by a language maestro to try and assess its
popularity. While his numbers or his reading of the numbers might be
open to some questions, to suggest that one needs to be totally familiar
with a language to determine its popularity is, frankly, ridiculous.

-- 
 important and urgent problems of the technology of today are no longer the 
satisfactions of the primary needs or of archetypal wishes, but the reparation 
of the evils and damages by the technology of yesterday.  ~Dennis Gabor, 
Innovations:  Scientific, Technological and Social, 1970
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
Istvan Albert  wrote:

> try testing on a large number of candidates that are all (or mostly)
> positive or all (or mostly) negative and you'll see performance
> numbers that are substantially different than the ones you report:
> 
> candidates = range(1000)
> 
> In general the function sign_1() is expected to be the fastest because
> in most cases will detect the sign with the fewest operations, it only
> visits the rest of the comparison when it hits the corner cases. Only
> if you have lots of +/-0.0 cases will it be slower than the rest, due
> to having to call an expensive operation.

You're right.
On a range or a random list sign_1 is the fastest :

with :
candidates=[]
for i in range(1000):
candidates.append(1000.0*random.random()-500.0)

In my first candidate list, the two ZERO (-0.0 and +0.0) make sign_1
less productive because it call atan2().
With random number sign_1 is faster, just a bit faster, except if the
candidates contain some ZERO.

I also make other test, with a range(1000), sign_1 became really faster
: -41% (near twice faster than sign_0). 
I then rewrote a sign_0 version testing first positive, then negative
and ZERO as the last test. I also made tests and return integer.
It make it faster +20% but not as fast as sign_1 for a range.

What is strange is that when testing with "range" list (0 1000) or (-500
+500), sign_1 is twice as fast as with a random generated list.
The only thing a saw is that range generate an int list and random a
float list...
So it seems sign_1 is really fastest with integer, but not with float

Range from -500 to +500
sign_0 : 0.38"
sign_1 : 0.27" (-40%)

Range from 0 to 1000
sign_0 : 0.32"
sign_1 : 0.25" (-22%)

Range from -1000 to 0
sign_0 : 0.46"
sign_1 : 0.30" (-35%)

1000 Random from -500 to +500
sign_0 : 0.37"
sign_1 : 0.42" (+13%)

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"

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


Re: join a samba domain

2008-12-22 Thread Tim Golden

Toff wrote:

On 22 déc, 17:02, Tim Golden  wrote:

Toff wrote:

hi,
I 'm trying to write a script to make my computer join a samba.
domeone have any idea ??

Ummm. It's not clear if you're saying that your code doesn't
work, or asking for general advice, or what? I'm not in a
position to have my machine join a domain or workgroup, but
you seem to have got most things in place already. The only
thing I would expect to have to change is this last line:


   import wmi
   c = wmi.WMI()
   d = c.Win32_ComputerSystem
   d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")

because the d is only a WMI *class*, not a WMI *instance*,
so doesn't refer as it should to your computer system but
to the class of computer systems. Try something like this (untested):


import wmi

c = wmi.WMI ()
for d in c.Win32_ComputerSystem ():
  d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")



TJG

thanks but it doesn't work
I've got this errors

Traceback (most recent call last):
 File "integrdom.py", line 51, in 
   main()
 File "integrdom.py", line 13, in main
   joindom()
 File "integrdom.py", line 44, in joindom
   d.JoinDomainOrWorkGroup(None, 3, "domcd", "adminLocal", r"admin
\domcd")
 File "c:\Python25\Lib\site-packages\wmi.py", line 493, in __getattr__
   handle_com_error (error_info)
 File "c:\Python25\Lib\site-packages\wmi.py", line 189, in
handle_com_error
   raise x_wmi, "\n".join (exception_string)
wmi.x_wmi



Do you not get *anything* after than wmi.x_wmi? Not even
a messy exception string?

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


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Steve Holden
walterbyrd wrote:
> On Dec 21, 12:28 pm, Bruno Desthuilliers
>  wrote:
>> Strange enough,
>> no one seems to complain about PHP or Ruby's performances...
> 
> A few years back, there was a certain amount of chest thumping, when
> python/django easily beat ror in a benchmark test. Now that ruby is
> faster, I guess speed is no big issue.
> 
A fairly limited amount of chest-thumping, as I remember it.

> By the same reasoning, python advocates used to sneer at php because
> php constantly broke backward compatibility. Now that python does it,
> breaking backward compatibility is no big deal. I guess unicode
> support was not that important, until python caught up to perl.
> 
Python advocates shouldn't sneer at other languages. There's no need. If
you like Python, use it because of its merits, not because it's better
than something else.

Having said which, I must say that Python's "breaking backward
incompatibility" is of a somewhat different nature than (say) Visual
Basic's. It was known about for *several years* in advance, even before
Guido went to work for Google and finally had time to get the work
underway. Also it's defined to be a singular event, not a continuous set
of creeping changes. Python 3's updated syntax now constrains the
developers in the same way that Python 2's used to.

I wouldn't say that could remotely be described as "constantly" breaking
backward compatibility.

> I guess, the way it works is: you first assume that python is
> superior, then you figure out why.
> 
That's the way some people operate, but by no means all. Is it the
language or the people that are pissing you off. You sound a little
discontented for a c.l.py reader.

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

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


Re: Python's popularity

2008-12-22 Thread Luis M . González
On Dec 22, 12:11 pm, walterbyrd  wrote:
> I have read that python is the world's 3rd most popular language, and
> that python has surpassed perl in popularity, but I am not seeing it.
>
> From what I have seen:
>
> - in unix/linux sysadmin, perl is far more popular than python,
> windows sysadmins typically don't use either.
> - in web-development, php is far more popular than python - it's not
> even close.
> - when I did a search on dice, I found over 20X more jobs advertised
> for ruby on rails developers, than for python dango developers.
> - application development is dominated by java, c/c++, and maybe a
> little visual basic.
> - as I understand it, fortran is still the most popular language for
> numberical programming.
>
> Of course, these are just observations on my part, nothing scientific
> about it. But, I can't help but wonder how python's popularity was
> determined. I suspect that a lot of people use python as a secondary
> skill. For example, I use ms-word, but I'm not an ms-word
> professional.
>
> Please note: I am not confusing popularity with quality. I am not
> saying that php is better for web-dev, or anything like that. I am
> just wondering how python is rated as being so popular, when python
> does not seem to dominate anything.


Sooner or later, we will remember those good old days where python was
our "secret sauce"...
--
http://mail.python.org/mailman/listinfo/python-list


Re: join a samba domain

2008-12-22 Thread M�ta-MCI (MVP)
Hi! 


If you are under Vista, you must change the LSA parameter.
See: 
   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
LMCompatibilityLevel   
   try with value 1 or  0



And use a Samba not too old.


@-salutations
--
Michel Claveau

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


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Michael Torrie
r wrote:
> Thanks MRAB,
> except the float is not 2 decimal places, but its there
> 
> Come on... They did this for the interpreter not us. It's easer to
> parse this string with positional arguments and a dict of format
> descriptions. Come on pydev, at least be honest about it!

No.  They did this for the *language*.  Come on, R.  Read the PEP on the
new string formatter.  The rationale is very clear.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Steve Holden
walterbyrd wrote:
> I have read that python is the world's 3rd most popular language, and
> that python has surpassed perl in popularity, but I am not seeing it.
[rest of stuff adequately answered by other posters]

The "Python has surpassed Perl" myth came from one month's results on
the TIOBE index, which does not claim to use a scientifically
justifiable methodology.

Python *is* becoming very popular. Training demand is certainly going
up. It's a great language for people whose primary career isn't
programming but who need to do some programming - for example, there are
about 40 scientists and engineers supporting the Mars Lander project
using Python code, because it's a great way to put systems together that
other engineers can understand.

I try to discourage people from getting into language pissing contests,
because they are rarely productive. The short answer is that nobody
really knows how popular the various languages are, there are simply
estimates with higher or lower credibility.

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

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


Re: Python's popularity

2008-12-22 Thread Marco Mariani

Richard Riley wrote:


One does not have to by a language maestro to try and assess its
popularity. While his numbers or his reading of the numbers might be
open to some questions, to suggest that one needs to be totally familiar
with a language to determine its popularity is, frankly, ridiculous.


I was not judging his competency. But when I am naive on a subject, I 
don't usually show off like that.
The polemic intents in his previous messages are quite clear (python is 
slow, py3k is an utter failure because it doesn't solve the whitespace 
issue, etc), and this thread is not different. It seems like a rehash of 
issues that have been dragged around here by generations of trolls for 
the last 10 years.


Sorry for adding noise to the signal :-/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread r
I think when Python was first brought to this dark world by a genius
named Guido van Rossum, it had complete dominance in it's niche,
actually Python created a niche where none existed before. Since the
advent of Ruby(Python closet competitor), Python's hold on this niche
is slipping. A lot of Ruby noobies don't even realize that most of
Ruby is an out-right plagiarism of Python. But I guess that's OK,
because Python has borrowed from other languages itself.. just not in
such a -sell your soul- kind of way as Ruby!.

Now since Python *is not* the only language on it's block, we have to
compete with our main nemesis(Ruby) for survival(I wonder if mats
would have been so revolutionary to introduce indention if Guido had
not done it first??, it seems to me he is a braces fanboy ;)

Now more than ever we must stick to the Zen and clean up Python's
warts to keep the dream alive and regain our right full crown. Python
is better than Ruby, I have no doubt in my mind, but if we let ruby
become -faster- than Python, people will gravitate away from Python.
Speed IS important even in high level languages. We must never forget
that! The war is not over just because we have Google, Nasa, and ILM.
On the Contrary, it has just begun. I believe mats is not going to
accept Ruby as 2nd best to Python, he will wage war on Pythonia. And
if we fail to preempt this attack, we shall be like the burning ships
of pearl harbor! Maybe Guido has a secret weapon up his sleeve(big
boy), but 3.0 was defiantly not the bomb!

Mats will now take advantage of the weaknesses in Py3000 and run with
them. Whispering in everyones ear how much faster Ruby is to Python.
And weather you like to hear it or not, this ROR thing is exploding,
we must counter attack this vile disgrace to Pythonia. Do not sit back
and say "well we are the best and we don't need to try any harder".
For you will be left in the evolutionary dust of Ruby. And next year,
left wanting...

We need to sound the battle cries and gather the legions. Then we
shall march across Rubonia and *raise* their cities to the ground. We
shall encompass thy house O' Ruby -- and lay waste to it! After we
slay thee, we shall breed with thy women and convert thy children. We
shall rule with an iron fist!, crushing all resistance to Python's
absolute power. Like the great kings of olde, monuments will be
erected so all generations shall be witness of our power, and glory.
""" O' Python, for the sound of thy chariots will be so fear full no
army could stand against thee!""" We shall avenge the atrocities and
hypocrocies you have brought upon this world Ruby! And then you shall
know that we are the Lord of this world, when our vengeance is cast
upon you!

I will be monitoring comp.lang.python and over the next 6 months I
will conduct a census of the users of this group. So far I have only
seen maybe 20 regulars here. I had hoped they numbered several
thousand, but i am starting to think more in the hundreds or even
less :(. I will post my findings to this group. It shall be a wake up
call for those of you who think the war is over. Get off your bums you
lazy-coach-potatos, the fight is not over yet. Do not let your eye's
become "wide shut"!!!

Truth shall be the judge...
--
http://mail.python.org/mailman/listinfo/python-list


Re: join a samba domain

2008-12-22 Thread Toff
On 22 déc, 17:57, Tim Golden  wrote:
> Toff wrote:
> > On 22 déc, 17:02, Tim Golden  wrote:
> >> Toff wrote:
> >>> hi,
> >>> I 'm trying to write a script to make my computer join a samba.
> >>> domeone have any idea ??
> >> Ummm. It's not clear if you're saying that your code doesn't
> >> work, or asking for general advice, or what? I'm not in a
> >> position to have my machine join a domain or workgroup, but
> >> you seem to have got most things in place already. The only
> >> thing I would expect to have to change is this last line:
>
> >>>    import wmi
> >>>    c = wmi.WMI()
> >>>    d = c.Win32_ComputerSystem
> >>>    d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
> >> because the d is only a WMI *class*, not a WMI *instance*,
> >> so doesn't refer as it should to your computer system but
> >> to the class of computer systems. Try something like this (untested):
>
> >> 
> >> import wmi
>
> >> c = wmi.WMI ()
> >> for d in c.Win32_ComputerSystem ():
> >>   d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
>
> >> 
>
> >> TJG
> > thanks but it doesn't work
> > I've got this errors
>
> > Traceback (most recent call last):
> >  File "integrdom.py", line 51, in 
> >    main()
> >  File "integrdom.py", line 13, in main
> >    joindom()
> >  File "integrdom.py", line 44, in joindom
> >    d.JoinDomainOrWorkGroup(None, 3, "domcd", "adminLocal", r"admin
> > \domcd")
> >  File "c:\Python25\Lib\site-packages\wmi.py", line 493, in __getattr__
> >    handle_com_error (error_info)
> >  File "c:\Python25\Lib\site-packages\wmi.py", line 189, in
> > handle_com_error
> >    raise x_wmi, "\n".join (exception_string)
> > wmi.x_wmi
>
> Do you not get *anything* after than wmi.x_wmi? Not even
> a messy exception string?
>
> TJG

no pessy string

something strange:

import wmi
c = wmi.WMI()
os = c.Win32_ComputerSystem
for method_name in os.methods:
  method = getattr(os, method_name)
  print method

it doesn't give the same parameter order for JoinDomainOrWorkGroup
than MSDN doc
--
http://mail.python.org/mailman/listinfo/python-list


Re: stable algorithm with complexity O(n)

2008-12-22 Thread denisbz
On Dec 15, 10:00 pm, "[email protected]"
 wrote:
> It can be proven that you cannot sort an arbitrarily large set of
> numbers, given no extra information, faster than O(n log n).

Cormen Leiserson and Rivest, "Algorithms", have a short clear chapter
on
"Sorting in linear time":
" ... counting sort, radix sort and bucket sort ... use operations
other than comparisons.
Consequently, the Omega( n lg n ) lower bound does not apply to
them."

Some of the book is in books.google.com; enjoy
--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread MRAB

Michael Torrie wrote:

r wrote:

Steven,
Would you like to elaborate on -why- escaped backslashes are needed in
strings... i waiting???


Some character was needed.  It just happens that backslashes have been
used in this manner for composing nonprintable sequences, codes, etc.
It's only in use because someone arbitrarily picked it about 40 years
ago.  Any character could have been used; any such character would still
be have to escaped.


BCPL used '*', but C, which was developed from BCPL, uses '\'.


Kind of funny that you are complaining about Python in particular when
this behavior is in almost all languages today, including Perl, Ruby,

Don't blame python for a mistake that Microsoft made, that of choosing a
commonly-accepted escape character (long before Python was even though
of!) as their path delimiter.  Fortunately sane operating systems use a
standard slash.  Even Windows APIs accept forward slashes as path
delimiters.

So really your complaint about the backslash is a bit silly.  Are you
going to campaign that C# and Java also "fix" this problem by choosing
another character?



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


Re: stable algorithm with complexity O(n)

2008-12-22 Thread Dan Upton
On Mon, Dec 22, 2008 at 12:29 PM,   wrote:
> On Dec 15, 10:00 pm, "[email protected]"
>  wrote:
>> It can be proven that you cannot sort an arbitrarily large set of
>> numbers, given no extra information, faster than O(n log n).
>
> Cormen Leiserson and Rivest, "Algorithms", have a short clear chapter
> on
> "Sorting in linear time":
>" ... counting sort, radix sort and bucket sort ... use operations
> other than comparisons.
>Consequently, the Omega( n lg n ) lower bound does not apply to
> them."
>

But the key here is "given no extra information."  Your examples of
non-comparison sorts require extra information, such as knowledge
about the possible range the numbers can take on.
--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread r
On Dec 22, 8:58 am, walterbyrd  wrote:
> On Dec 21, 12:28 pm, Bruno Desthuilliers
>
>  wrote:
> > Strange enough,
> > no one seems to complain about PHP or Ruby's performances...
>
> A few years back, there was a certain amount of chest thumping, when
> python/django easily beat ror in a benchmark test. Now that ruby is
> faster, I guess speed is no big issue.
>
> By the same reasoning, python advocates used to sneer at php because
> php constantly broke backward compatibility. Now that python does it,
> breaking backward compatibility is no big deal. I guess unicode
> support was not that important, until python caught up to perl.
>
> I guess, the way it works is: you first assume that python is
> superior, then you figure out why.

I think what walter is saying is the loyalty is gone.

community:
"""If python makes great, if it doesn't, why should "i" care if it
goes down the toilet?  i just move to ruby"""

Were is your loyalty pyfans?, Has the fight left you???
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread walterbyrd
On Dec 22, 10:13 am, r  wrote:
> Since the
> advent of Ruby(Python closet competitor), Python's hold on this niche
> is slipping.

About the only place I ever hear of ruby being used is web development
with RoR. When it comes to web development, it seems to me that ruby
(because of rails) is far more popular than python. It seems to me
that ruby is the niche player, and python (with fairly new frameworks)
is trying to catch up to ruby in that niche. It seems to me that the
python web framework that best competes with rails, is Django, and
Django 1.0 just came out a few months back.

> A lot of Ruby noobies don't even realize that most of
> Ruby is an out-right plagiarism of Python.

Maybe. But the rails framework seems to have a different philosophy
than the django, turbogears, or pylons, frameworks. RoR values
convention over configuration, and has a lot of "magic" whereas the
python frameworks seem to have the opposite philosophy - in those
regards. I see pros and cons to both approaches. I wonder what the
market with think?

> Now since Python *is not* the only language on it's block, we have to
> compete with our main nemesis(Ruby) for survival

I think both python and ruby will "survive." I think python is also
competing with perl in the sysadmin space - although I see perl as
being much more popular there.
--
http://mail.python.org/mailman/listinfo/python-list


I always wonder ...

2008-12-22 Thread skip
... shouldn't people who spend all their time trolling be doing something
else: studying, working, writing patches which solve the problems they
perceive to exist in the troll subject?  Is there some online troll game
running where the players earn points for generating responses to their
posts?

-- 
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Steve Holden
r wrote:
> I think when Python was first brought to this dark world by a genius
> named Guido van Rossum, it had complete dominance in it's niche,
> actually Python created a niche where none existed before. Since the
> advent of Ruby(Python closet competitor), Python's hold on this niche
> is slipping. A lot of Ruby noobies don't even realize that most of
> Ruby is an out-right plagiarism of Python. But I guess that's OK,
> because Python has borrowed from other languages itself.. just not in
> such a -sell your soul- kind of way as Ruby!.
> 
> Now since Python *is not* the only language on it's block, we have to
> compete with our main nemesis(Ruby) for survival(I wonder if mats
> would have been so revolutionary to introduce indention if Guido had
> not done it first??, it seems to me he is a braces fanboy ;)
> 
What makes you assume this is a zero-sum game, and that Python won't
survive if any other language becomes popular. Every language borrows
from those that came before it. Terms like "outright plagiarism" don't
encourage rational debate, and make you seem like a troll who is more
interested in stirring up controversy than actually doing things to help
promote the language.

> Now more than ever we must stick to the Zen and clean up Python's
> warts to keep the dream alive and regain our right full crown. Python
> is better than Ruby, I have no doubt in my mind, but if we let ruby
> become -faster- than Python, people will gravitate away from Python.
> Speed IS important even in high level languages. We must never forget
> that! The war is not over just because we have Google, Nasa, and ILM.
> On the Contrary, it has just begun. I believe mats is not going to
> accept Ruby as 2nd best to Python, he will wage war on Pythonia. And
> if we fail to preempt this attack, we shall be like the burning ships
> of pearl harbor! Maybe Guido has a secret weapon up his sleeve(big
> boy), but 3.0 was defiantly not the bomb!
> 
I have an article about the Zen coming up in "Python Magazine" so I
won't steal its thunder. Suffice it to say that people take the Zen far
too seriously. Anyone who does so undermines their own credibility as a
Python commentator. This isn't a war. Stop being childish.

> Mats will now take advantage of the weaknesses in Py3000 and run with
> them. Whispering in everyones ear how much faster Ruby is to Python.
> And weather you like to hear it or not, this ROR thing is exploding,
> we must counter attack this vile disgrace to Pythonia. Do not sit back
> and say "well we are the best and we don't need to try any harder".
> For you will be left in the evolutionary dust of Ruby. And next year,
> left wanting...
> 
If all you want from a language is speed, go use C. I would avoid
assembly language though, since a modern optimizing C compiler will
often beat an assembly language programmer for execution speed, and the
programming time will definitely be shorter. But to make speed the
be-all and end-all is a witless approach. Speed is definitely not why
dynamic languages' popularity is increasing. Speed *is* still relevant
in certain areas, and completely irrelevant in others.

> We need to sound the battle cries and gather the legions. Then we
> shall march across Rubonia and *raise* their cities to the ground. We
> shall encompass thy house O' Ruby -- and lay waste to it! After we
> slay thee, we shall breed with thy women and convert thy children. We
> shall rule with an iron fist!, crushing all resistance to Python's
> absolute power. Like the great kings of olde, monuments will be
> erected so all generations shall be witness of our power, and glory.
> """ O' Python, for the sound of thy chariots will be so fear full no
> army could stand against thee!""" We shall avenge the atrocities and
> hypocrocies you have brought upon this world Ruby! And then you shall
> know that we are the Lord of this world, when our vengeance is cast
> upon you!
> 
> I will be monitoring comp.lang.python and over the next 6 months I
> will conduct a census of the users of this group. So far I have only
> seen maybe 20 regulars here. I had hoped they numbered several
> thousand, but i am starting to think more in the hundreds or even
> less :(. I will post my findings to this group. It shall be a wake up
> call for those of you who think the war is over. Get off your bums you
> lazy-coach-potatos, the fight is not over yet. Do not let your eye's
> become "wide shut"!!!
> 
> Truth shall be the judge...

Much more of this kind of tripe and nobody will read what you write
anyway. You will hear the plonking of a hundred thousand newsreaders
every time you post.

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

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


64-bit / 128-bit data element type for array?

2008-12-22 Thread akineko
Hello everyone,

I need to handle binary files that contain 64-bit (or 128-bit in the
furture) unsigned int data.
Python's array seems not supporting unsigned int type beyond 32-bit
('L').
I would like to use Python array as I need to make my program work on
both big-endian machines as well as on little-endian machines.

What is the best way to deal with 64-bit / 128-bit data elements in
Python (must support byteswap())?
(must be machine-independent)

Any idea, any hints, comments would be greatly appreciated.

Thank you!
Aki Niimura
--
http://mail.python.org/mailman/listinfo/python-list


Re: join a samba domain

2008-12-22 Thread Jens Henrik Leonhard Jensen

Toff wrote:

d = c.Win32_ComputerSystem
d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")

Shouldn't r"admin\\mydom" be "admin\\mydom" or r"admin\mydom".
Or maybe just "admin"

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


Re: Python's popularity

2008-12-22 Thread Tommy Grav


On Dec 22, 2008, at 12:48 PM, walterbyrd wrote:

Now since Python *is not* the only language on it's block, we have to
compete with our main nemesis(Ruby) for survival


I think both python and ruby will "survive." I think python is also
competing with perl in the sysadmin space - although I see perl as
being much more popular there.


Python is making great headway in the physical sciences. Especially
in astronomy Python has become a real player as not only a tool for
quick and dirty calculations, but more serious number crunching using
the great numpy and scipy libraries. With Cython, I, think it will  
even start

taking over some of the speed critical niche from C and Fortran.

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


Re: Python's popularity

2008-12-22 Thread r
Walter,
I just look at the stats for comp.lang.python, and i am 9th place for
most post this month. That makes me completely sad. With just 50 post
so far, i am showing up on the high count. Sad, very sad. Now i have
much reason to believe that only 100 or so people follow this list :(.
Python is slipping. We must try harder, or all of Guido's work will be
for nothing!

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


Re: I always wonder ...

2008-12-22 Thread Martin P. Hellwig

[email protected] wrote:

Is there some online troll game
running where the players earn points for generating responses to their
posts?


You just got 10 points ;-)

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


Re: Python's popularity

2008-12-22 Thread Francesco Guerrieri
On Mon, Dec 22, 2008 at 7:01 PM, r  wrote:

> Walter,
> I just look at the stats for comp.lang.python, and i am 9th place for
> most post this month. That makes me completely sad. With just 50 post
> so far, i am showing up on the high count. Sad, very sad. Now i have
> much reason to believe that only 100 or so people follow this list :(.
> Python is slipping. We must try harder, or all of Guido's work will be
> for nothing!



Just wanted to remember you that Python is an open source project initiated
and led by Guido Van Rossum and kept alive
(and in good health) by the work of *many* people. It if were only Guido's
work it would be different from what it is now.

Furthermore, choosing to code in a language or in another is not a matter of
religion or of war. If someone likes Ruby, or Perl, or VBA...
 and is productive (according to her needs) with it, why in the world should
a Python programmer consider her an "enemy"???

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


Re: Python's popularity

2008-12-22 Thread Krishnakant
hello hackers.
Python is best at high level calculations and as an indication, Please
note that I am leading a team on developing an accounting software which
will be modular and would suit the economic conditions of developed and
almost developed countries like India.
I find that number crunching and heavy calculations is shear programming
bliss in python.
At the front end we are using pygtk and find it very light and zippy.
And we are going to use twisted for middle layer and reportlab for
reporting.
And the development so far is pritty smooth and our programmres who
learned python for the first time are just amaised about the fact that
how easily python can do a certain thing.
So i don't know what others think but python is not just a good
scripting language (not that being a good scripting language is some
thing bad ) but also a complete enterprise ready language with given
frameworks like twisted.
happy hacking.
Krishnakant.
On Mon, 2008-12-22 at 12:59 -0500, Tommy Grav wrote:
> On Dec 22, 2008, at 12:48 PM, walterbyrd wrote:
> >> Now since Python *is not* the only language on it's block, we have to
> >> compete with our main nemesis(Ruby) for survival
> >
> > I think both python and ruby will "survive." I think python is also
> > competing with perl in the sysadmin space - although I see perl as
> > being much more popular there.
> 
> Python is making great headway in the physical sciences. Especially
> in astronomy Python has become a real player as not only a tool for
> quick and dirty calculations, but more serious number crunching using
> the great numpy and scipy libraries. With Cython, I, think it will  
> even start
> taking over some of the speed critical niche from C and Fortran.
> 
> Cheers
>Tommy
> --
> http://mail.python.org/mailman/listinfo/python-list

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


Re: join a samba domain

2008-12-22 Thread Toff
On 22 déc, 18:59, Jens Henrik Leonhard Jensen
 wrote:
> Toff wrote:
> >    d = c.Win32_ComputerSystem
> >    d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
>
> Shouldn't r"admin\\mydom" be "admin\\mydom" or r"admin\mydom".
> Or maybe just "admin"
>
> /Jens Henrik

you are right but i've got the same error.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 63, Issue 420

2008-12-22 Thread wblusk1

Sent from my Verizon Wireless BlackBerry

-Original Message-
From: [email protected]

Date: Mon, 22 Dec 2008 19:01:06 
To: 
Subject: Python-list Digest, Vol 63, Issue 420


Send Python-list mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-list digest..."

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


Re: Python is slow

2008-12-22 Thread cm_gui
On Dec 22, 6:51 am, Lou Pecora  wrote:
> In article ,
>  "James Mills"  wrote:
>
> > In case anyone is not aware, Python is
> > also used for heavy scientific computational
> > problems, games such as Civilisation and
> > others, and I believe (correct me if I"m wrong)
> > it's also used by NASA.
>
> > --JamesMills
>

i am referring mainly to Python for web applications.

Python is slow.

> Python has become very popular in scientific computation.  You'll find
> it in use lots of places (universities, national labs, defense labs).  I
> use it for solving partial differential equations for quantum chaos
> calculations and went to C for speed up where needed using ctypes which
> is very straightforward and plays nice with numpy array/matrix
> libraries.  I've been doing scientific programming for 30 years.  Python
> with C extensions and libraries is the best approach I've ever used.  
> Calculation speed is not a problem and the code can be "tweaked" to
> increase it easily.  Programming speed is incredible.  I can get
> substantial object oriented code up and running much faster than
> anything I've ever used.
>
> --
> -- Lou Pecora

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


Re: Python's popularity

2008-12-22 Thread r
Steve Holden
> What makes you assume this is a zero-sum game, and that Python won't
> survive if any other language becomes popular. Every language borrows
> from those that came before it. Terms like "outright plagiarism" don't
> encourage rational debate, and make you seem like a troll who is more
> interested in stirring up controversy than actually doing things to help
> promote the language.

This is a war Steve, and i will explain why. Python does not need to
compete with perl, lisp, C, basic, etc, etc. WHY, well because python
is SO radically different than those languages. Ruby on the other
hand, took most from python, the only difference is Ruby's full OO
integration.(12.method()). Since Ruby is so similar to python we must
consider that some people who would have found only python in this
niche now could go to Ruby. I am for choices, but this is out and out
robbery!
Of course we must stand on the shoulders of greater minds than our own
to get ahead, but using someone's knowledge against them is wrong. If
Ruby want's to incorporate so many Pythonian ideas into their
language, at least put a note in the tutorial giving credit to Guido
for his wisdom. Don't use our ideas and then bash python in the next
breath!

> I have an article about the Zen coming up in "Python Magazine" so I
> won't steal its thunder. Suffice it to say that people take the Zen far
> too seriously. Anyone who does so undermines their own credibility as a
> Python commentator. This isn't a war. Stop being childish.

I was speaking to the loyalty of Pythonista's. Of course we are not
really going to slay mats, come on Steve, get real!

> If all you want from a language is speed, go use C. I would avoid
> assembly language though, since a modern optimizing C compiler will
> often beat an assembly language programmer for execution speed, and the
> programming time will definitely be shorter. But to make speed the
> be-all and end-all is a witless approach. Speed is definitely not why
> dynamic languages' popularity is increasing. Speed *is* still relevant
> in certain areas, and completely irrelevant in others.

Come on Steve, i am NOT saying speed is the only thing that matters
here! But it is very important. I never compared Python to C, that is
madness. But it must be better, faster, smarter than it's direct
competition(ruby)... you agree??

> Much more of this kind of tripe and nobody will read what you write
> anyway. You will hear the plonking of a hundred thousand newsreaders
> every time you post.

Oh Steve... Listen, my words are ment as a wake-up-call to all who
still love Python, and i believe you are one of them. Maybe old age
has slowed your hand, that's OK, Us "youngsters" will take the helm.
And be serious, do you really think this group is read by "hundreds-of-
thousands of news readers? I wish it were, but I highly doubt it.


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


Re: Python's popularity

2008-12-22 Thread Richard Riley
Marco Mariani  writes:

> Richard Riley wrote:
>
>> One does not have to by a language maestro to try and assess its
>> popularity. While his numbers or his reading of the numbers might be
>> open to some questions, to suggest that one needs to be totally familiar
>> with a language to determine its popularity is, frankly, ridiculous.
>
> I was not judging his competency. But when I am naive on a subject, I
> don't usually show off like that.

I do not see what is showing off about judging a languages
popularity. In many cases a languages popularity can be a useful metric
in picking a language to do a job.

> The polemic intents in his previous messages are quite clear (python
> is slow, py3k is an utter failure because it doesn't solve the
> whitespace issue, etc), and this thread is not different. It seems
> like a rehash of issues that have been dragged around here by
> generations of trolls for the last 10 years.

I find it difficult myself to accept certain criticisms of certain
things when I am close to them. This does not, however, make the
criticisms unfair or untrue or even unimportant.

>
> Sorry for adding noise to the signal :-/

-- 
 important and urgent problems of the technology of today are no longer the 
satisfactions of the primary needs or of archetypal wishes, but the reparation 
of the evils and damages by the technology of yesterday.  ~Dennis Gabor, 
Innovations:  Scientific, Technological and Social, 1970
--
http://mail.python.org/mailman/listinfo/python-list


RE: Python's popularity

2008-12-22 Thread Ellinghaus, Lance
> I just look at the stats for comp.lang.python, and i am 9th place for
> most post this month. That makes me completely sad. With just 50 post
> so far, i am showing up on the high count. Sad, very sad. Now i have
> much reason to believe that only 100 or so people follow this list :(.
> Python is slipping. We must try harder, or all of Guido's work will be
> for nothing!

Maybe most of us are doing real things with Python and not spending our
time on the list posting. (I normally do not post on here, but I felt I
had to now).

I have used Python since 0.9.x and have brought it into every
project/contract that I have worked on. The current project I am on
tried to get rid of it and move to Perl for all of my code.. All of
those people are gone and I am still here and so is Python. As a matter
of fact, Python use has grown greatly and we rely on it for so many of
our day to day operations, monitoring, data collection, etc.

Python is not going away just because people are not posting here. Wake
up!

BEA and IBM have converted all of their custom script language support
for WebLogic and WebSphere over to Jython because they felt Python
(interfacing with Java) was the best solution to their script language
issues. Everyone on the project I am on that works with WebLogic and
WebSphere are learning Python so they can work with it. So far, no real
complaints.

People are moving away from Perl to Python for much of their scripting,
but it will take a long time to complete. There is a lot of training,
re-coding, and trying to figure out what the original Perl code did
(ever try to go back and look at Perl code that is 2-3 years old!!!).

Yes, Ruby has taken some of the popularity out of Python, but they are
also hitting different markets. I have also read in a couple of magazine
articles that RoR is losing momentum. From what I have read, RoR is
great to create your first version, but if you need to maintain a large
codebase, it is not as easy as they thought it would be and the reuse
numbers are much lower than Python. But hey, what do I know Google,
Yahoo!, YouTube... I know.. tiny little tinker-toy web applications..
right?

Lance Ellinghaus



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


Re: I always wonder ...

2008-12-22 Thread Grant Edwards
On 2008-12-22, [email protected]  wrote:

> ... shouldn't people who spend all their time trolling be
> doing something else: studying, working, writing patches which
> solve the problems they perceive to exist in the troll
> subject?

I think you misunderstand the point of trolling.  The author of
a troll post doesn't actually care about the "problems" (and
may not even genuinely perceive them as problems).

> Is there some online troll game running where the players earn
> points for generating responses to their posts?

Yup. It's called Usenet.

I'm sure we all have our, um, "non-productive" hobbies and
forms of entertainment.  A well done troll [which, I admit, is
somewhat rare] is a bit of an art, and can be rather
entertaining to watch.  

Of course there's the other, much larger, category of posters
(sometimes confused with trollers): the lazy, ignorant
whingers.  Apart from being much more common, they're also much
less entertaining to everybody except the ranting flamer.

As you can see, Usenet is a rather complex eco-system with a
lot of niches...

-- 
Grant Edwards   grante Yow! What PROGRAM are they
  at   watching?
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: I always wonder ...

2008-12-22 Thread Grant Edwards
On 2008-12-22, Martin P. Hellwig  wrote:
> [email protected] wrote:

>> Is there some online troll game running where the players earn
>> points for generating responses to their posts?
>
> You just got 10 points ;-)

We'll have to ask for an instant replay for the judges on that
one.  If his question was genuine, then it doesn't officially
count as a troll.

-- 
Grant Edwards   grante Yow! Are we laid back yet?
  at   
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Calling ImageMagick's convert

2008-12-22 Thread Андрей Парамонов
2008/12/22 Chris Rebert :
> I think this needs to be:
>
> subprocess.call(['convert', 'in.png', '-resize', '640x480', 'out.png'])
>
> Otherwise, it gets '-resize 640x480' as a single escaped option when
> it's really 2 options, which is the error message you're getting.
> You have to split the arguments up just like the shell would, which
> basically means at whitespace unless quoting is used, which is not the
> case here.
>
> Cheers,
> Chris

It worked, many thanks!

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


Re: I always wonder ...

2008-12-22 Thread Christian Heimes
[email protected] schrieb:
>  shouldn't people who spend all their time trolling be doing something
> else: studying, working, writing patches which solve the problems they
> perceive to exist in the troll subject?  Is there some online troll game
> running where the players earn points for generating responses to their
> posts?

Don't worry about the trolling, Skip. I'd be more worried if nobody
trolls about Python. It would mean Python loses popularity and our work
is all in vain.

Prepare yourself for the worst, Christmas holidays are near! The fading
day light usually increased the amount of troll posts.

Christian

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


Re: I always wonder ...

2008-12-22 Thread r
> You just got 10 points ;-)

Fighting trolls begets a troll. Skip not you, i have so much respect
for you :)

What really is a troll?
Someone who does not agree with you?
Someone you don't like?
Someone you do like?

All good questions. I think this whole troll calling business has
gotten out of hand. Some people may antagonize you, but who is
ultimately to blame for that? I guess we could have this set up were
certain people could be banned, would you like that. Or maybe you
should just ignore that which bothers you. If someone came to this
group and said

""" Ruby rules! Python sucks eggs!"""

I would not even bother to reply. But do not let yourself be closed
minded and think your ways are alway right. I have learned a lot from
people here and have disagreed with a lot of opinions here. Troll
calling is childish. be more open minded than that.
--
http://mail.python.org/mailman/listinfo/python-list


Re: I always wonder ...

2008-12-22 Thread r
On Dec 22, 1:02 pm, Christian Heimes  wrote:
> Don't worry about the trolling, Skip. I'd be more worried if nobody
> trolls about Python. It would mean Python loses popularity and our work
> is all in vain.

Christain,
you are truly an open minded, intelligent Human being. Thanks for
blessing use with your wisdom here. We need more like you. Every
thought, action, fact, must always be questioned, that is what makes
us human!

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


Re: Python's popularity

2008-12-22 Thread MRAB

r wrote:

Steve Holden

What makes you assume this is a zero-sum game, and that Python won't
survive if any other language becomes popular. Every language borrows
from those that came before it. Terms like "outright plagiarism" don't
encourage rational debate, and make you seem like a troll who is more
interested in stirring up controversy than actually doing things to help
promote the language.


This is a war Steve, and i will explain why. Python does not need to
compete with perl, lisp, C, basic, etc, etc. WHY, well because python
is SO radically different than those languages. Ruby on the other
hand, took most from python, the only difference is Ruby's full OO
integration.(12.method()). Since Ruby is so similar to python we must
consider that some people who would have found only python in this
niche now could go to Ruby. I am for choices, but this is out and out
robbery!
Of course we must stand on the shoulders of greater minds than our own
to get ahead, but using someone's knowledge against them is wrong. If
Ruby want's to incorporate so many Pythonian ideas into their
language, at least put a note in the tutorial giving credit to Guido
for his wisdom. Don't use our ideas and then bash python in the next
breath!


[snip]
"Pythonian"? A real Pythonista would know it's "Pythonic"! A real 
Pythonista would be called "p", not "r", which sounds very Rubish(?) to 
me...


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


Re: 64-bit / 128-bit data element type for array?

2008-12-22 Thread bearophileHUGS
akineko:
> I need to handle binary files that contain 64-bit (or 128-bit in the
> furture) unsigned int data.
> Python's array seems not supporting unsigned int type beyond 32-bit
> ('L').

I agree that it can be useful for the built-in array module to grow
signed/unsigned 64 bit numbers.

Numpy supports signed/unsigned 64 bit numbers too, so that may be
enough for you:
http://docs.scipy.org/doc/numpy/user/basics.types.html

Regarding 128-bit numbers you may have to support them manually, with
pairs of uint64, with numpy. They aren't much common yet.
(D language will have cent/ucent 128 bit integral numbers, but it's
not a common thing).

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list


Re: 64-bit / 128-bit data element type for array?

2008-12-22 Thread Robert Kern

akineko wrote:

Hello everyone,

I need to handle binary files that contain 64-bit (or 128-bit in the
furture) unsigned int data.
Python's array seems not supporting unsigned int type beyond 32-bit
('L').
I would like to use Python array as I need to make my program work on
both big-endian machines as well as on little-endian machines.

What is the best way to deal with 64-bit / 128-bit data elements in
Python (must support byteswap())?
(must be machine-independent)


You might give numpy a try. We support uint64 data even on 32-bit machines 
provided that your C compiler does. I haven't seen uint128 in the wild, though.


http://numpy.scipy.org/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: Python's popularity

2008-12-22 Thread walterbyrd
On Dec 22, 11:42 am, "Ellinghaus, Lance" 
wrote:

> Yes, Ruby has taken some of the popularity out of Python, but they are
> also hitting different markets.

Do you mean different markets within web development, or do you mean
ruby is used mostly for web-dev, while python is used for other stuff?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Check file is

2008-12-22 Thread Colin J. Williams

gardsted wrote:

Harish wrote:

Hi Friends
Is there any utility in python which will help me to read any pdf
files?

Regards
Harish


Not sure, what you're after exactly, but I tried googling 'python read pdf'
and found this, so maybe 'reportlab' is what you're looking for:

Re: Reading PDF files
  #2
Dec 20th, 2006
To read and manage Portable Document Files you can use the open source 
ReportLab toolkit (written in Python) from:

http://www.reportlab.org/rl_toolkit.html

kind regards jorgen


The ReportLab toolkit appears to be 
concerned with building Portable
Document Files.  I would be interested 
in any utility which will read
any pdf - for example, to convert pdf -> 
html


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


Re: Python's popularity

2008-12-22 Thread r
On Dec 22, 1:10 pm, MRAB  wrote:
> r wrote:
> > Steve Holden
> >> What makes you assume this is a zero-sum game, and that Python won't
> >> survive if any other language becomes popular. Every language borrows
> >> from those that came before it. Terms like "outright plagiarism" don't
> >> encourage rational debate, and make you seem like a troll who is more
> >> interested in stirring up controversy than actually doing things to help
> >> promote the language.
>
> > This is a war Steve, and i will explain why. Python does not need to
> > compete with perl, lisp, C, basic, etc, etc. WHY, well because python
> > is SO radically different than those languages. Ruby on the other
> > hand, took most from python, the only difference is Ruby's full OO
> > integration.(12.method()). Since Ruby is so similar to python we must
> > consider that some people who would have found only python in this
> > niche now could go to Ruby. I am for choices, but this is out and out
> > robbery!
> > Of course we must stand on the shoulders of greater minds than our own
> > to get ahead, but using someone's knowledge against them is wrong. If
> > Ruby want's to incorporate so many Pythonian ideas into their
> > language, at least put a note in the tutorial giving credit to Guido
> > for his wisdom. Don't use our ideas and then bash python in the next
> > breath!
>
> [snip]
> "Pythonian"? A real Pythonista would know it's "Pythonic"! A real
> Pythonista would be called "p", not "r", which sounds very Rubish(?) to
> me...

MRAB -> '%sMuchRubyAndBasic' %'Too'
MRAB -> Method.Ruby(AttractsBraindead)
MRAB -> MyRubyAintBad
MRAB -> MuchoRubyAndBasic

Pythonian is more acceptable in the context of my sentence...

""" If Ruby want's to incorporate so many Pythonian ideas into their
language, at least put a note in the tutorial giving credit to Guido
for his wisdom."""

Pythonian.translate() -> in the domain if Python... ownership
Pythonic.translate() -> in a python style... (way of)

two radically different meaning, of course if you vocabulary reaches
that far??


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


Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Bruno Desthuilliers

walterbyrd a écrit :

On Dec 21, 12:28 pm, Bruno Desthuilliers
 wrote:

Strange enough,
no one seems to complain about PHP or Ruby's performances...


A few years back, there was a certain amount of chest thumping, when
python/django easily beat ror in a benchmark test.


I don't remember it, and honestly, I just don't give a damn.


Now that ruby is
faster,


"faster" than what ? Than Python ? or than it's previous version ?


I guess speed is no big issue.


Please use your google-fu (if you have any). As far as I'm concerned, my 
position didn't change these 7+ past years: Python is (and has always 
been) fast enough for most of what I use it for (and when it isn't, 
neither PHP nor Ruby are going to be solution anyway).


Now improvements are always welcomes, and if you compare 1.5.2 with 
2.5.1, you'll find out that the core developpers did improve Python's 
perfs.


Now do you have any serious argument, or are you just trolling ?


By the same reasoning, python advocates used to sneer at php because
php constantly broke backward compatibility. Now that python does it,
breaking backward compatibility is no big deal.


There's a lot 1.5.2 days code still running *unmodified* on 2.6.x. 
You'll have hard time finding (non-trivial, and even then) PHP3 code 
running unmodified on PHP5.



I guess unicode
support was not that important, until python caught up to perl.

I guess, the way it works is: you first assume that python is
superior, then you figure out why.


Whoever said Python was "superior" (except your good friend 'r') ?

As far as I'm concerned, I don't think Python is "superior" (OMG), I 
think it's a good language that happens to fit my brain *and* solve more 
than 80% of my programmer's needs. If you're not happy with Python's 
perfs, please contribute, you are welcome.

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


Re: Python's popularity

2008-12-22 Thread Bruno Desthuilliers

walterbyrd a écrit :

On Dec 22, 10:13 am, r  wrote:

Since the
advent of Ruby(Python closet competitor), Python's hold on this niche
is slipping.


About the only place I ever hear of ruby being used is web development
with RoR. When it comes to web development, it seems to me that ruby
(because of rails) is far more popular


s/popular/hyped/

But being (perhaps over ?) hyped too soon is not necessarily the best 
move...



than python. It seems to me
that ruby is the niche player, and python (with fairly new frameworks)
is trying to catch up to ruby in that niche. It seems to me that the
python web framework that best competes with rails, is Django, and
Django 1.0 just came out a few months back.


Fooled by version numbers ? Heck, Python 3.0 just came out a couple 
weeks ago, and PHP is already at 6.x !-)


FWIW, I wrote my first django app years ago (and it's still in production).



A lot of Ruby noobies don't even realize that most of
Ruby is an out-right plagiarism of Python.


I don't know who asserted such a stupid thing, but he manages to be 
equally clueless wrt/ both languages.



Maybe. But the rails framework seems to have a different philosophy
than the django, turbogears, or pylons, frameworks. RoR values
convention over configuration, and has a lot of "magic" whereas the
python frameworks seem to have the opposite philosophy - in those
regards. I see pros and cons to both approaches. I wonder what the
market with think?


My actual CTO is a big Ruby/Rails fan, yet he settled on Python/Django 
for our current 'big' project. Wonder why ?


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


Re: I always wonder ...

2008-12-22 Thread Christian Heimes
> you are truly an open minded, intelligent Human being. Thanks for
> blessing use with your wisdom here. We need more like you. Every
> thought, action, fact, must always be questioned, that is what makes
> us human!

*plonk*

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


Re: Python's popularity

2008-12-22 Thread Luis M . González
On Dec 22, 3:44 pm, r  wrote:
> Steve Holden
>
> > What makes you assume this is a zero-sum game, and that Python won't
> > survive if any other language becomes popular. Every language borrows
> > from those that came before it. Terms like "outright plagiarism" don't
> > encourage rational debate, and make you seem like a troll who is more
> > interested in stirring up controversy than actually doing things to help
> > promote the language.
>
> This is a war Steve, and i will explain why. Python does not need to
> compete with perl, lisp, C, basic, etc, etc. WHY, well because python
> is SO radically different than those languages. Ruby on the other
> hand, took most from python, the only difference is Ruby's full OO
> integration.(12.method()). Since Ruby is so similar to python we must
> consider that some people who would have found only python in this
> niche now could go to Ruby. I am for choices, but this is out and out
> robbery!
> Of course we must stand on the shoulders of greater minds than our own
> to get ahead, but using someone's knowledge against them is wrong. If
> Ruby want's to incorporate so many Pythonian ideas into their
> language, at least put a note in the tutorial giving credit to Guido
> for his wisdom. Don't use our ideas and then bash python in the next
> breath!
>
> > I have an article about the Zen coming up in "Python Magazine" so I
> > won't steal its thunder. Suffice it to say that people take the Zen far
> > too seriously. Anyone who does so undermines their own credibility as a
> > Python commentator. This isn't a war. Stop being childish.
>
> I was speaking to the loyalty of Pythonista's. Of course we are not
> really going to slay mats, come on Steve, get real!
>
> > If all you want from a language is speed, go use C. I would avoid
> > assembly language though, since a modern optimizing C compiler will
> > often beat an assembly language programmer for execution speed, and the
> > programming time will definitely be shorter. But to make speed the
> > be-all and end-all is a witless approach. Speed is definitely not why
> > dynamic languages' popularity is increasing. Speed *is* still relevant
> > in certain areas, and completely irrelevant in others.
>
> Come on Steve, i am NOT saying speed is the only thing that matters
> here! But it is very important. I never compared Python to C, that is
> madness. But it must be better, faster, smarter than it's direct
> competition(ruby)... you agree??
>
> > Much more of this kind of tripe and nobody will read what you write
> > anyway. You will hear the plonking of a hundred thousand newsreaders
> > every time you post.
>
> Oh Steve... Listen, my words are ment as a wake-up-call to all who
> still love Python, and i believe you are one of them. Maybe old age
> has slowed your hand, that's OK, Us "youngsters" will take the helm.
> And be serious, do you really think this group is read by "hundreds-of-
> thousands of news readers? I wish it were, but I highly doubt it.

Dude, calm down... There is no war here.
Please turn off your computer, go take a walk for awhile, experience
some real life in the outer world, and then think about this again.
Python is cool language, Ruby too. We are all happy and competition is
good.
Nobody will win this "war" and the loser won't be annihilated. I hope
there will be some healthy cross-pollination.
There is actually, for example python borrowed list-comprehensions
from haskell and I've never heard any haskell fan calling for jihad.

Did you know that people are looking forward to use pypy to create a
fast ruby implementation?
Pypy is being developed by python developers and they will be happy to
see a ruby, perl, logo or whatever language implemented with pypy. We
are talking about tools, not religions.
Those who use them to create useful, real life applications know it.

Soon, we will be able to use python libraries from ruby and the other
way around. the differences will be just a matter of taste, different
syntax to achieve the same tasks.

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


Re: Python's popularity

2008-12-22 Thread r
OK je.s.t... whatever,
We see where you stand. And also see that by removing your comments
from the archive in 5 days, how small your acorns really are.

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


Re: Python's popularity

2008-12-22 Thread r
On Dec 22, 1:50 pm, Luis M. González  wrote:
> On Dec 22, 3:44 pm, r  wrote:
>
>
>
> > Steve Holden
>
> > > What makes you assume this is a zero-sum game, and that Python won't
> > > survive if any other language becomes popular. Every language borrows
> > > from those that came before it. Terms like "outright plagiarism" don't
> > > encourage rational debate, and make you seem like a troll who is more
> > > interested in stirring up controversy than actually doing things to help
> > > promote the language.
>
> > This is a war Steve, and i will explain why. Python does not need to
> > compete with perl, lisp, C, basic, etc, etc. WHY, well because python
> > is SO radically different than those languages. Ruby on the other
> > hand, took most from python, the only difference is Ruby's full OO
> > integration.(12.method()). Since Ruby is so similar to python we must
> > consider that some people who would have found only python in this
> > niche now could go to Ruby. I am for choices, but this is out and out
> > robbery!
> > Of course we must stand on the shoulders of greater minds than our own
> > to get ahead, but using someone's knowledge against them is wrong. If
> > Ruby want's to incorporate so many Pythonian ideas into their
> > language, at least put a note in the tutorial giving credit to Guido
> > for his wisdom. Don't use our ideas and then bash python in the next
> > breath!
>
> > > I have an article about the Zen coming up in "Python Magazine" so I
> > > won't steal its thunder. Suffice it to say that people take the Zen far
> > > too seriously. Anyone who does so undermines their own credibility as a
> > > Python commentator. This isn't a war. Stop being childish.
>
> > I was speaking to the loyalty of Pythonista's. Of course we are not
> > really going to slay mats, come on Steve, get real!
>
> > > If all you want from a language is speed, go use C. I would avoid
> > > assembly language though, since a modern optimizing C compiler will
> > > often beat an assembly language programmer for execution speed, and the
> > > programming time will definitely be shorter. But to make speed the
> > > be-all and end-all is a witless approach. Speed is definitely not why
> > > dynamic languages' popularity is increasing. Speed *is* still relevant
> > > in certain areas, and completely irrelevant in others.
>
> > Come on Steve, i am NOT saying speed is the only thing that matters
> > here! But it is very important. I never compared Python to C, that is
> > madness. But it must be better, faster, smarter than it's direct
> > competition(ruby)... you agree??
>
> > > Much more of this kind of tripe and nobody will read what you write
> > > anyway. You will hear the plonking of a hundred thousand newsreaders
> > > every time you post.
>
> > Oh Steve... Listen, my words are ment as a wake-up-call to all who
> > still love Python, and i believe you are one of them. Maybe old age
> > has slowed your hand, that's OK, Us "youngsters" will take the helm.
> > And be serious, do you really think this group is read by "hundreds-of-
> > thousands of news readers? I wish it were, but I highly doubt it.
>
> Dude, calm down... There is no war here.
> Please turn off your computer, go take a walk for awhile, experience
> some real life in the outer world, and then think about this again.
> Python is cool language, Ruby too. We are all happy and competition is
> good.
> Nobody will win this "war" and the loser won't be annihilated. I hope
> there will be some healthy cross-pollination.
> There is actually, for example python borrowed list-comprehensions
> from haskell and I've never heard any haskell fan calling for jihad.
>
> Did you know that people are looking forward to use pypy to create a
> fast ruby implementation?
> Pypy is being developed by python developers and they will be happy to
> see a ruby, perl, logo or whatever language implemented with pypy. We
> are talking about tools, not religions.
> Those who use them to create useful, real life applications know it.
>
> Soon, we will be able to use python libraries from ruby and the other
> way around. the differences will be just a matter of taste, different
> syntax to achieve the same tasks.
>
> Luis

Your right, Python needs Ruby, and do you know why??? The same reason
MS needs, Mac & Linux. So they do not fall asleep at the wheel! This
keeps MS on there toes(although still no explanation for their piss-
poor product).

Python needs Ruby so we don't fall asleep. Ruby may be the best thing
that happened to Python. Wake Up people! The writing is on the Wall!
--
http://mail.python.org/mailman/listinfo/python-list


Re: I always wonder ...

2008-12-22 Thread r
On Dec 22, 1:54 pm, Christian Heimes  wrote:
> > you are truly an open minded, intelligent Human being. Thanks for
> > blessing use with your wisdom here. We need more like you. Every
> > thought, action, fact, must always be questioned, that is what makes
> > us human!
>
> *plonk*

so i was wrong about you ;)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-22 Thread Luis M . González
On Dec 22, 3:42 pm, cm_gui  wrote:
> Python is slow.

Haven't you said that already?
Well, you did it so many times that you convinced me...

I'll tell the Google folks that they are a bunch of ignorant fools for
choosing python.
That's why their business is doing that bad. They will surely go to
hell.
This Google search engine and that silly site "youtube"... they won't
work.
THEY ARE SLOW!

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


Re: I always wonder ...

2008-12-22 Thread Carl Banks
On Dec 22, 11:53 am, [email protected] wrote:
> ... shouldn't people who spend all their time trolling be doing something
> else: studying, working, writing patches which solve the problems they
> perceive to exist in the troll subject?  Is there some online troll game
> running where the players earn points for generating responses to their
> posts?

...shouldn't poeple who spend all their time following up to trolls,
or starting new threads about trolls, being doing something else?

Seriously, I participated briefly in the that thread when r still had
benefit of the doubt over whether he had any credibility, but now
there is no doubt that he none at all, so he's not worth replying to,
so I don't.  I suggest everyone else does likewise and ignores the
fool.

If you have to followup, at least keep your reply to something short
and witty, like, "Go away, troll".


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


Re: I always wonder ...

2008-12-22 Thread Alvin ONeal
>
> What really is a troll?
>
*troll* /v.,n./

[From the Usenet group *alt.folklore.urban *] To
utter a posting on
Usenetdesigned to
attract predictable responses or
flame s. Derives from the
phrase "trolling for
newbies"
which in turn comes from mainstream "trolling", a style of fishing in which
one trails bait through a likely spot hoping for a bite. The
well-constructed troll is a post that induces lots of newbies and flamers to
make themselves look even more clueless than they already do, while subtly
conveying to the more savvy and experienced that it is in fact a deliberate
troll. If you don't fall for the joke, you get to be in on it.

Some people claim that the troll is properly a narrower category than flame
bait , that a troll is
categorized by containing some assertion that is wrong but not overtly
controversial.
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >