Re: Doc for extended call syntax; was: Re: unzip array of arrays?

2009-01-25 Thread Mark Wooding
Steve Holden writes: > No, you aren't mistaken. Looking at the "*" symbol in the 2.6 > documentation index it lists only two references. The first is the > language manual's explanation of its use in the def statement, the > second is a transitory reference to its use in function calls, but > tha

Re: Byte oriented data types in python

2009-01-25 Thread Grant Edwards
On 2009-01-25, Martin v. Löwis wrote: > Take a look at the struct and ctypes modules. >>> struct is really not the choice. it returns an expanded string of the >>> data and this means larger latency over bluetooth. >> >> I don't know what you mean by "returns an expanded string of >> the dat

Re: Monitor a FTP site for arrival of new/updated files

2009-01-25 Thread Steve Holden
pyt...@bdurham.com wrote: > Any suggestions on a best practice way to monitor a remote FTP site for > the arrival of new/updated files? I don't need specific code, just some > coaching on technique based on your real-world experience including > suggestions for a utility vs. code based solution. >

Re: Newby: how to transform text into lines of text

2009-01-25 Thread John Machin
On Jan 26, 12:54 am, Tim Chase wrote: > One other caveat here, "line" contains the newline at the end, so > you might have > >   print line.rstrip('\r\n') > > to remove them. I don't understand the presence of the '\r' there. Any '\x0d' that remains after reading the file in text mode and is rem

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Russ P.
On Jan 25, 10:04 am, Mark Wooding wrote: > > But what if I want an automatic check to verify that I am using it as > > the author intended? Is that unreasonable? > > You mean that you can't /tell/ whether you typed mumble._seekrit? > You're very strange.  It's kind of hard to do by accident. But

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Mark Wooding
Steven D'Aprano writes: > On Fri, 23 Jan 2009 21:36:59 -0500, Luis Zarrabeitia wrote: >> It makes sense... if the original author is an egotist who believes he >> must control how I use that library. > > Then I guess Guido must be such an egotist, because there's plenty of > internals in Python

Re: Byte oriented data types in python

2009-01-25 Thread Martin v. Löwis
>>> Take a look at the struct and ctypes modules. >> struct is really not the choice. it returns an expanded string of the >> data and this means larger latency over bluetooth. > > I don't know what you mean by "returns an expanded string of > the data". > > I do know that struct does exactly wh

Re: Byte oriented data types in python

2009-01-25 Thread Stephen Hansen
On Sun, Jan 25, 2009 at 7:27 AM, Ravi wrote: > > > Take a look at the struct and ctypes modules. > > struct is really not the choice. it returns an expanded string of the > data and this means larger latency over bluetooth. Noo... struct really IS the choice; that is the explicit purpose of the

Re: Efficient multi-slicing technique?

2009-01-25 Thread MRAB
pyt...@bdurham.com wrote: Is there an efficient way to multi-slice a fixed with string into individual fields that's logically equivalent to the way one would slice a delimited string using .split()? Background: I'm parsing some very large, fixed line-width text files that have weekly columns

Monitor a FTP site for arrival of new/updated files

2009-01-25 Thread python
Any suggestions on a best practice way to monitor a remote FTP site for the arrival of new/updated files? I don't need specific code, just some coaching on technique based on your real-world experience including suggestions for a utility vs. code based solution. My goal is to maintain a local colle

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Russ P.
On Jan 25, 10:04 am, Mark Wooding wrote: > "Russ P." writes: > > Calling a one-word change a "fork" is quite a stretch, I'd say. > > I wouldn't.  I've forked a project P if I've made a different version of > it which isn't going to be reflected upstream.  Now I've got to maintain > my fork, mergi

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Rhamphoryncus
d1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Mark Wooding
"Russ P." writes: > Imagine a person who repairs computers. He is really annoyed that he > constantly has to remove the cover to get at the guts of the computer. > So he insists that computers cases should be made without covers. Poor analogy. He gets fed up that the computers he's meant to be

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Mark Wooding
"Russ P." writes: > Calling a one-word change a "fork" is quite a stretch, I'd say. I wouldn't. I've forked a project P if I've made a different version of it which isn't going to be reflected upstream. Now I've got to maintain my fork, merging in changes from upstream as they happen, and upgr

Re: Counting number of objects

2009-01-25 Thread Andreas Waldenburger
On Sun, 25 Jan 2009 09:23:35 -0800 (PST) Kottiyath wrote: > Hi, > I am creating a class called people - subclasses men, women, children > etc. > I want to count the number of people at any time. > So, I created code like the following: > > class a(object): > counter = 0 > def __new__(cls

Re: Byte oriented data types in python

2009-01-25 Thread Grant Edwards
On 2009-01-25, Ravi wrote: > >> Take a look at the struct and ctypes modules. > > struct is really not the choice. it returns an expanded string of the > data and this means larger latency over bluetooth. I don't know what you mean by "returns an expanded string of the data". I do know that stru

Re: Counting number of objects

2009-01-25 Thread Steve Holden
Kottiyath wrote: > Hi, > I am creating a class called people - subclasses men, women, children > etc. > I want to count the number of people at any time. > So, I created code like the following: > > class a(object): > counter = 0 > def __new__(cls, *args, **kwargs): > a.counter +=

Counting number of objects

2009-01-25 Thread Kottiyath
Hi, I am creating a class called people - subclasses men, women, children etc. I want to count the number of people at any time. So, I created code like the following: class a(object): counter = 0 def __new__(cls, *args, **kwargs): a.counter += 1 return object.__new__(cls,

Re: Byte oriented data types in python

2009-01-25 Thread Steve Holden
Ravi wrote: >> Take a look at the struct and ctypes modules. > > struct is really not the choice. it returns an expanded string of the > data and this means larger latency over bluetooth. > If you read the module documentation more carefully you will see that it "converts" between the various nat

Efficient multi-slicing technique?

2009-01-25 Thread python
Is there an efficient way to multi-slice a fixed with string into individual fields that's logically equivalent to the way one would slice a delimited string using .split()? Background: I'm parsing some very large, fixed line-width text files that have weekly columns of data (52 data columns plus r

Re: Reading the first MB of a binary file

2009-01-25 Thread MRAB
Max Leason wrote: > Hi, > > I'm attempting to read the first MB of a binary file and then do a > md5 hash on it so that i can find the file later despite it being > moved or any file name changes that may have been made to it. These > files are large (350-1400MB) video files and i often located on

Re: progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-25 Thread Ross Ridge
Luke Kenneth Casson Leighton wrote: >this is a progress report on compiling python using entirely free >software tools, no proprietary compilers or operating systems >involved, yet still linking and successfully running with msvcr80 >assemblies. MSVCR80.DLL is part of the Microsoft Visual C++ ru

Reading the first MB of a binary file

2009-01-25 Thread Max Leason
Hi, I'm attempting to read the first MB of a binary file and then do a md5 hash on it so that i can find the file later despite it being moved or any file name changes that may have been made to it. These files are large (350-1400MB) video files and i often located on a different computer and I fi

Re: Logging help

2009-01-25 Thread Aahz
In article , koranthala wrote: > Is it possible somehow to have the logging module rotate the files >every time I start it. If you're on Linux, why not use logrotate? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ Weinberg's Second Law: If builders built bui

Re: [MacOS] Multiple versions of a module

2009-01-25 Thread Diez B. Roggisch
Pierre-Alain Dorange schrieb: How to manage a module with several versions on MacOS X ? All modules are installed in : "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pa ckages/" This is the default path for Mac. But for some modules i need several version (stable 1.8.1 an

Re: progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-25 Thread Luke Kenneth Casson Leighton
> Have you made some benchmarks like pystone? > Cheers, > Cesare Cesare, hi, thanks for responding: unfortunately, there's absolutely no point in making any benchmark figures under an emulated environment which does things like take 2 billion instruction cycles to start up a program named "c:/msy

Re: Byte oriented data types in python

2009-01-25 Thread Ravi
On Jan 25, 12:52 am, "Martin v. Löwis" wrote: > > packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || > > packet_data(variable) > > > How to construct these using python data types, as int and float have > > no limits and their sizes are not well defined. > > In Python 2.x, use the

Re: Byte oriented data types in python

2009-01-25 Thread Ravi
> Take a look at the struct and ctypes modules. struct is really not the choice. it returns an expanded string of the data and this means larger latency over bluetooth. ctypes is basically for the interface with libraries written in C (this I read from the python docs) -- http://mail.python.org

[MacOS] Multiple versions of a module

2009-01-25 Thread Pierre-Alain Dorange
How to manage a module with several versions on MacOS X ? All modules are installed in : "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pa ckages/" This is the default path for Mac. But for some modules i need several version (stable 1.8.1 and test 1.9.0 for example : for p

Re: *.python.org broken?

2009-01-25 Thread Akira Kitada
http://downforeveryoneorjustme.com/ On Sun, Jan 25, 2009 at 10:06 AM, wrote: > Hi all, > > Is anybody else having trouble accessing sites (including www, docs, > wiki) in the python.org tree, or is it just me? (Or just .au?) > > Cheers, > > Tim > -- > http://mail.python.org/mailman/listinfo/pyth

Re: IDLE/Python on Asus EEE PC

2009-01-25 Thread MRAB
Alex van der Spek wrote: Simple Python programs edited and run through IDLE work fine on my Ubuntu Linux system without any editing. However on my Asus EEE PC IDLE complains about incorrect formatting (indentation) or possibly mixing tabs/spaces. The source code is exactly the same. There is

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Alan G Isaac
On 1/16/2009 3:13 PM Alan G Isaac apparently wrote: > It is documented: > http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range But then again, the opposite is also documented, since `range` is a sequence type. Quoting: Sequences also support

Re: *.python.org broken?

2009-01-25 Thread Steve Holden
Cousin Stanley wrote: >> Is anybody else having trouble accessing sites (including www, docs, >> wiki) in the python.org tree, or is it just me? (Or just .au?) > > Yes, connecting to python.org sites has been problematic > for me as well > > I don't remember when the trouble started,

Re: Newby: how to transform text into lines of text

2009-01-25 Thread vsoler
On 25 ene, 14:36, "Diez B. Roggisch" wrote: > vsoler schrieb: > > > Hello, > > > I'va read a text file into variable "a" > > >      a=open('FicheroTexto.txt','r') > >      a.read() > > > "a" contains all the lines of the text separated by '\n' characters. > > No, it doesn't. "a.read()" *returns* t

Re: Newby: how to transform text into lines of text

2009-01-25 Thread Tim Chase
The idiomatic way would be iterating over the file-object itself - which will get you the lines: with open("foo.txt") as inf: for line in inf: print line In versions of Python before the "with" was introduced (as in the 2.4 installations I've got at both home and work), this can

Re: *.python.org broken?

2009-01-25 Thread Cousin Stanley
> Is anybody else having trouble accessing sites (including www, docs, > wiki) in the python.org tree, or is it just me? (Or just .au?) Yes, connecting to python.org sites has been problematic for me as well I don't remember when the trouble started, but it's been problematic for a

ANN: new snapshot of the eric4 Pylons plugin released

2009-01-25 Thread Detlev Offenbach
Hi, this is to inform everybody about the availability of the Pylons plugin for eric4. It adds Pylons support to the eric4 Python IDE. The Plugin is available via the eric4 web site at http://eric-ide.python-projects.org/index.html What is eric4 - eric4 is a Python IDE, that comes wi

Re: Newby: how to transform text into lines of text

2009-01-25 Thread Diez B. Roggisch
vsoler schrieb: Hello, I'va read a text file into variable "a" a=open('FicheroTexto.txt','r') a.read() "a" contains all the lines of the text separated by '\n' characters. No, it doesn't. "a.read()" *returns* the contents, but you don't assign it, so it is discarded. Now, I wan

Newby: how to transform text into lines of text

2009-01-25 Thread vsoler
Hello, I'va read a text file into variable "a" a=open('FicheroTexto.txt','r') a.read() "a" contains all the lines of the text separated by '\n' characters. Now, I want to work with each line separately, without the '\n' character. How can I get variable "b" as a list of such lines?

Re: What is intvar?

2009-01-25 Thread W. eWatson
Steve Holden wrote: W. eWatson wrote: W. eWatson wrote: r wrote: here is a good explanation of control vars: http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html Here are 3 great Tkinter refernces in order: http://infohost.nmt.edu/tcc/help/pubs/tkinter/ http://effbot.org/tkint

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> These are the only two that follow PEP 8; the others don't have > four-space indent levels. In those examples, the following sentence in PEP 8 would be applied. "Make sure to indent the continued line appropriately." > I actually use this style: > >foo = { >0: 'spam', >1: '

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> BTW, there's no need to use such large examples. Three items per dict > would be sufficient to illustrate the styles, using ten items doesn't add > anything useful to the discussion. I worried to be told 'you can make it in a line like {"ham": "jam", "spam": "alot"}' ;) -- http://mail.python.org

Re: Is (-1 ==True) True or False? Neither

2009-01-25 Thread Steven D'Aprano
On Sun, 25 Jan 2009 03:07:04 +0200, Oktay Şafak wrote: > The reason is that when > someone writes (-1 == True) he is clearly, definitely, absolutely asking > for a boolean comparison, not a numerical one. If I wrote (-1 == True), and I'm not sure why I would, I would expect to get the answer Fal

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Steven D'Aprano
On Sun, 25 Jan 2009 17:18:28 +0900, Akira Kitada wrote: > Hi, > > There is more than one way to write a list/tuple/dict in Python, and > actually different styles are used in standard library. As a hobgoblin > of little minds, I rather like to know which style is considered > "Pythonic" > in the

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Ben Finney
Akira Kitada writes: > I collected common layout from existing code and pasted them below. > My vote would go to d1. How about yours? > > If there is consensus on this, that might be worth being included in > PEP 8. > > Thanks, > > """ > d1 = { > 0: "ham", > 1: "jam", > 2: "spam",

Re: Dynamic methods and lambda functions

2009-01-25 Thread Kay Schluehr
On 23 Jan., 13:28, unine...@gmail.com wrote: > Hi, > I want to add some properties dynamically to a class, and then add the > corresponding getter methods. Something resulting in this: > > class Person: > def Getname(self): > return self.__name > > def Getage(self): > return

IDLE/Python on Asus EEE PC

2009-01-25 Thread Alex van der Spek
Simple Python programs edited and run through IDLE work fine on my Ubuntu Linux system without any editing. However on my Asus EEE PC IDLE complains about incorrect formatting (indentation) or possibly mixing tabs/spaces. The source code is exactly the same. There is no incorrect formatting and

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Michael Iatrou
When the date was Sunday 25 January 2009, Akira Kitada wrote: > There is more than one way to write a list/tuple/dict in Python, > and actually different styles are used in standard library. I would vote for d1, but I don't think that this is more "pythonic", I just consider it more "clean", acc

Re: Regex for Python 2.7

2009-01-25 Thread Gabriel Genellina
En Sat, 24 Jan 2009 21:51:31 -0200, MRAB escribió: Gabriel Genellina wrote: > En Sat, 24 Jan 2009 18:23:51 -0200, MRAB > escribió: > >> Some time ago I discovered this difference between regular expressions >> in Python and Perl: >> >> Python >> >> \A matches at start of string

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> Wow! A Python debate over curly brace placement! Imagine that! PEP8 even deals with tabs vs spaces, where to put a blank line, etc :) -- http://mail.python.org/mailman/listinfo/python-list

Re: A different kind of interface

2009-01-25 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Jan 2009 01:02:01 +0100, Дамјан Георгиевски wrote: >>> I don't know what an IBQ is. >> >> +IBQ- seems to be the way your newsreader displays the dashes that >> where in Ben's posting. I see "em dash" characters there: > > I see IBQ too ... also weird is that he has Content-Type: text

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Dan Bishop
On Jan 25, 2:18 am, Akira Kitada wrote: > Hi, > > There is more than one way to write a list/tuple/dict in Python, > and actually different styles are used in standard library. > As a hobgoblin of little minds, I rather like to know which style is > considered "Pythonic" > in the community. > > I

Plugin system, RuntimeWarning: Parent module 'ext_abc' not found while handling absolute import

2009-01-25 Thread Torsten Mohr
Hi, i try to write a plugin system that i want to use to let users extend a module that i write. Within the module there is an extension loader that loads an extension module. This extension module should be able to import modules from my system, which provides some extensions. Basically, this

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Stephen Hansen
> and pasted them below. > My vote would go to d1. How about yours? > > Whatever reads best within the context of the specific code is Pythonic. -- http://mail.python.org/mailman/listinfo/python-list

Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
Hi, There is more than one way to write a list/tuple/dict in Python, and actually different styles are used in standard library. As a hobgoblin of little minds, I rather like to know which style is considered "Pythonic" in the community. I collected common layout from existing code and pasted the

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 24, 9:54 pm, Luis Zarrabeitia wrote: > > Quoting "Russ P." : > > > > It is. For starters, I'd lose the information of "this attribute was > intended to > > be internal and I'm accessing it anyway". > > Not really. When you get a new version of the library and try to

<    1   2