Ben Finney | 1 Oct 01:06 2008
Picon

Re: Python is slow?

Terry Reedy <tjreedy <at> udel.edu> writes:

> Steven D'Aprano wrote:
> > We agree that the restriction is artificial, and I think
> > irrational (although I'd be interested in hearing the gnuplot
> > developers' reasoning before making a final judgment).
> 
> I believe it is a matter of preserving clarity of authorship, just
> as is the quoting mechanism we take for granted in posts like this.
> If I removed the quote marks above and silently edited what Ben and
> you wrote, I might upset someone and certainly could confuse
> readers.

That, if it were to be prosecuted under law, would be a matter already
covered by laws other than copyright: fraud, libel, etc.

Note that I consider a work free even if it fails to grant “the right
to distribute misrepresentations of the author's words”, because that
act is an exercise of undue power over another person, and so falls
outside the limit imposed by the freedoms of others.

--

-- 
 \         “What is it that makes a complete stranger dive into an icy |
  `\   river to save a solid gold baby? Maybe we'll never know.” —Jack |
_o__)                                                           Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Eric | 1 Oct 01:20 2008
Picon

Wait or not?

I've been wanting to learn Python for a while now but I can't decide
on whether to wait for Python 3's final release and learn it or just
go ahead and learn 2.x. Would it be hard to make the transition being
a noob?
--
http://mail.python.org/mailman/listinfo/python-list

Matimus | 1 Oct 01:26 2008
Picon

Re: Wait or not?

On Sep 30, 4:20 pm, Eric <efl... <at> gmail.com> wrote:
> I've been wanting to learn Python for a while now but I can't decide
> on whether to wait for Python 3's final release and learn it or just
> go ahead and learn 2.x. Would it be hard to make the transition being
> a noob?

It shouldn't be a hard transition. I would recommend learning 2.x
anyway. You are likely to want to use 3rd party modules (or you will
anyway). You won't want to wait for module support to be added in 3.0.
The 2.x series isn't going to go away for quite a while. I think they
are planning to continue to do releases all the way up to 2.9 or so.
Even then, the biggest thing that a new user is going to run into is
`print("stuff")` vs. `print "stuff"`.

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

Michael Torrie | 1 Oct 01:30 2008
Picon

Re: Time.sleep(0.0125) not available within Linux

Lawrence D'Oliveiro wrote:
> In message <__KdneWJPotDx0XVnZ2dnUVZ_gGdnZ2d <at> posted.usinternet>, Grant
> Edwards wrote:
> 
>> On 2008-09-23, Blubaugh, David A. <dblubaugh <at> belcan.com> wrote:
>>
>>> I was wondering if anyone has come across the issue of not being allowed
>>> to have the following within a Python script operating under Linux:
>>>
>>> time.sleep(0.0125)
>> No, I have not.  And I doubt anybody else has.
> 
> Just a thought, your minimum sleep time is probably limited by the
> resolution of the system "HZ" clock. Type
> 
>     less /proc/config.gz
> 
> and search for the value of the "CONFIG_HZ" setting. On the Athlon 64
> machine I'm using to write this, it's 250, which should allow for sleep
> intervals in multiples of 0.004 seconds.

Since most distributions do not create this file in /proc for whatever
reason, and some people are being deliberately obtuse, does anyone know
how to ask the kernel what the timer resolution is?  Is it stored
anywhere else in /proc or /sys?  I kind of think most distros set it to
1000 Hz, but I'm not sure.

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

(Continue reading)

Steven D'Aprano | 1 Oct 01:38 2008
Picon

Re: Python arrays and sting formatting options

On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote:

>>> How would the python equivalent go ?
> 
> You would drag yourself out of the 1960s, install numpy, and then do
> something like this:

I think that was thoughtlessly rude to somebody who is asking a perfectly 
reasonable question.

--

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

Steven D'Aprano | 1 Oct 01:40 2008
Picon

Re: Python arrays and sting formatting options

On Tue, 30 Sep 2008 14:34:31 +0000, Marc 'BlackJack' Rintsch wrote:

> On Tue, 30 Sep 2008 15:42:58 +0200, Ivan Reborin wrote:
> 
>> On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <bj_666 <at> gmx.net>
>> wrote:
>>>=====
>>>from __future__ import with_statement from functools import partial
>>>from itertools import islice
>>>from pprint import pprint
>>>
>>>
>>>def read_group(lines, count):
>>>    return [map(int, s.split()) for s in islice(lines, count)]
>>>
>>>def main():
>>>    with open('test.txt') as lines:
>>>        lines = (line for line in lines if line.strip()) 
>>>        result = list(iter(partial(read_group, lines, 3), list()))
>>>    pprint(result, width=30)
>>>
>>>if __name__ == '__main__':
>>>    main()
>>>=====
>> 
>> I'm afraid I must admit I find the code above totally uncomprehesible
>> (I can't even see where the array here is mentioned - "result"?) and
>> inpractical for any kind of engineering practice I had in mind.
> 
> Learn Python then to understand that code.  ;-)
(Continue reading)

Gabriel Genellina | 1 Oct 01:49 2008
Picon

Re: problem with "ImportError: No module named..." and sockets

En Tue, 30 Sep 2008 19:44:51 -0300, Daniel <daniel.watrous <at> gmail.com>  
escribió:
> On Sep 30, 4:17 pm, "Gabriel Genellina" <gagsl-... <at> yahoo.com.ar>
> wrote:
>> En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <daniel.watr... <at> gmail.com>  
>> escribió:
>>
>>
>>
>> > [BEGIN CODE]
>> > #!/usr/bin/python
>> > import SocketServer
>> > import os, sys
>> > newpath = os.path.normpath( os.path.join( __file__, "../../.." ))
>> > sys.path.insert(0, newpath)
>>
>> > from pop.command.UpdateCommand import *
>> > import cPickle
>>
>> > Traceback (most recent call last):
>> > [...]
>> > ImportError: No module named UpdateCommand
>>
>> > I import the module at the top of the file server.py, but it doesn't
>> > throw the ImportError until it tries to unpickle.
>>
>> Notice that you don't import the UpdateCommand module - you import all  
>> names defined inside it instead. It's not the same thing.
>> Seehttp://effbot.org/zone/import-confusion.htm
>>
(Continue reading)

Steven D'Aprano | 1 Oct 01:54 2008
Picon

Re: Python is slow?

On Wed, 01 Oct 2008 09:06:08 +1000, Ben Finney wrote:

> Terry Reedy <tjreedy <at> udel.edu> writes:
> 
>> Steven D'Aprano wrote:
>> > We agree that the restriction is artificial, and I think irrational
>> > (although I'd be interested in hearing the gnuplot developers'
>> > reasoning before making a final judgment).
>> 
>> I believe it is a matter of preserving clarity of authorship, just as
>> is the quoting mechanism we take for granted in posts like this. If I
>> removed the quote marks above and silently edited what Ben and you
>> wrote, I might upset someone and certainly could confuse readers.
> 
> That, if it were to be prosecuted under law, would be a matter already
> covered by laws other than copyright: fraud, libel, etc.
> 
> Note that I consider a work free even if it fails to grant “the right to
> distribute misrepresentations of the author's words”, because that act
> is an exercise of undue power over another person, and so falls outside
> the limit imposed by the freedoms of others.

But distributing modified source code *does* misrepresent the author's 
words, because you confuse authorship. Given only the modified version of 
the source code, how is the recipient supposed to identify which parts of 
the source code were written by the original authors and which parts 
where written by you?

If that is why the gnuplot people do not allow you to distribute such 
modified documents, then the only "freedom" they fail to grant is exactly 
(Continue reading)

js | 1 Oct 02:18 2008
Picon

Re: How can I customize builtin module search path to prefix/lib to prefix/lib64?

In addition to that, .pth cannot prepend search path.
All thing it can do is appending to it.
In my case, I have to put lib64 before lib/.

On 9/26/08, js <ebgssth <at> gmail.com> wrote:
> For 64bit python, there's no need to look at lib/lib-dynload because
> libraries for 64bit should be in
> lib64/lib-dynload. Having module search path which point to libraries
> the python can not understand
> is, IMHO, wrong.
>
> On Fri, Sep 26, 2008 at 3:03 AM, Mike Driscoll <kyosohma <at> gmail.com> wrote:
>> On Sep 25, 10:41 am, js <ebgs... <at> gmail.com> wrote:
>>> Hi list,
>>>
>>> Is it possible to change module search path (PYTHONPATH) built-in to
>>> Python interpreter?
>>> I thought I can change it with configure --libdir but it didn't work for
>>> me.
>>> I also tried patching around python source tree replacing lib to lib64
>>> but it didn't work either.
>>>
>>> Adjusting sys.path directly or using environ should do the trick but
>>> I'd rather want to make it the default path for my python
>>>
>>> Thanks,
>>
>> Why not just add a custom path file (*.pth)? EasyInstall, wx, PyWin32
>> and others do it. Of course there's always sys.path.append as well.
>>
(Continue reading)

Gabriel Genellina | 1 Oct 02:32 2008
Picon

Re: Python arrays and sting formatting options

En Mon, 29 Sep 2008 19:04:18 -0300, Ivan Reborin  
<ireborin <at> delete.this.gmail.com> escribió:

> 1. Multi dimensional arrays - how do you load them in python
> For example, if I had:
> -------
> 1 2 3
> 4 5 6
> 7 8 9
>
> 10 11 12
> 13 14 15
> 16 17 18
> -------
> with "i" being the row number, "j" the column number, and "k" the ..
> uhmm, well, the "group" number, how would you load this ?

I agree that using NumPy is the way to go if you're going to do lots of  
array calculations. But a plain Python code would look like this (more  
comprehensible than other posted versions, I hope):

--- begin code ---
def read_group(fin, rows_per_group):
     rows = []
     for i in range(rows_per_group):
         line = fin.readline()
         row = [float(x) for x in line.split()]
         rows.append(row)
     fin.readline() # skip blank line
     return rows
(Continue reading)


Gmane