Re: Problem of Readability of Python

2007-10-10 Thread Joe Riopel
On 10/10/07, Kevin [EMAIL PROTECTED] wrote: Am I missing something, or am I the only one who explicitly declares structs in python? For example: FileObject = { filename : None, path : None, } fobj = FileObject.copy() fobj[filename] = passwd fobj[path] = /etc/ I am pretty

Re: Fwd: NUCULAR fielded text searchable indexing

2007-10-10 Thread George Sakkis
On Oct 10, 11:08 am, [EMAIL PROTECTED] wrote: Why apologize? If someone doesn't like the name given to a piece of software by its author(s), screw them. If I find the software useful, I'll use it. Even if its called 'bouncingBetty'. Or 'BeautifulSoup' for that matter ;-) George --

Re: Problem with argument parsing

2007-10-10 Thread Steven Bethard
Diez B. Roggisch wrote: lgwe wrote: On 9 Okt, 17:18, Diez B. Roggisch [EMAIL PROTECTED] wrote: lgwe wrote: I have a python-script: myscript, used to start a program on another computer and I use OptionParser in optpars. I use it like this: myscript -H host arg1 -x -y zzz I would like

Re: Building Binary Packages

2007-10-10 Thread kyosohma
On Oct 10, 11:53 am, Jim B. Wilson [EMAIL PROTECTED] wrote: On Wed, 10 Oct 2007 14:35:35 +, kyosohma wrote: I am trying to figure out how to build binaries for Python packages and I've done it with MinGW. Apparently, you still can:http://tinyurl.com/yb4bps That's a wealth of

www.yedil.com best hindi entertainment site

2007-10-10 Thread diprat7
www.yedil.com best hindi entertainment site with vidoes,photo sharing,photo rating features its really gona rock you www.yedil.com -- http://mail.python.org/mailman/listinfo/python-list

Plugins / Modularity

2007-10-10 Thread Robin Kåveland
Hi there. I'm basically in the process of writing my first substantial application in Python, and I've made a couple of (I'd like to say) design decisions so it won't just be a jumble. So, I've divided my program into three sub-packages, core, plugins and utilities. The core will be needed for

Pythonic way for handling file errors

2007-10-10 Thread wink
Hello, I would like to know what would be considered the most Pythonic way of handling errors when dealing with files, solutions that seem reasonable using 2.5: --- try: f = open('afile', 'r') content = f.read() error = 200 except Exception: error = 404 finally: if

Re: Plugins / Modularity

2007-10-10 Thread Robin Kåveland
On Oct 10, 8:38 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Oct 10, 12:30 pm, Robin Kåveland [EMAIL PROTECTED] wrote: Hi there. I'm basically in the process of writing my first substantial application in Python, and I've made a couple of (I'd like to say) design decisions so it

how to rerun a function after edit it?

2007-10-10 Thread wang frank
Hi, I am looking for a way to rerun functions after I changed them. This is very critical during the development stage. Currently I have to quit python and restart the python to run the functions. I found the reload function. But it needs the module name. In my case, I import the module

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-10 Thread JernauEmGurgeh
On 10 Oct, 02:05, [EMAIL PROTECTED] wrote: Do not bluntly contradict me in public. 2 + 2 = 5 -- http://mail.python.org/mailman/listinfo/python-list

Re: Plugins / Modularity

2007-10-10 Thread [EMAIL PROTECTED]
On Oct 10, 12:30 pm, Robin Kåveland [EMAIL PROTECTED] wrote: Hi there. I'm basically in the process of writing my first substantial application in Python, and I've made a couple of (I'd like to say) design decisions so it won't just be a jumble. So, I've divided my program into three

How can Python print the value of an attribute but complain it does not exist?

2007-10-10 Thread Emre Sevinc
Hello, I'm a Python newbie and I'm having a strange trouble with the following code: generatefeedvector-debug.py === import feedparser import re def getwordcounts(url): # Parse the feed d = feedparser.parse(url) wc = {}

Re: why did MIT drop scheme for python in intro to computing?

2007-10-10 Thread Grant Edwards
On 2007-10-10, Ashish Hanwadikar [EMAIL PROTECTED] wrote: However, Tk has been largely abandoned in favor of a native GTK+ binding http://www.stklos.org/ I couldn't find any documentation on stklos (other than a few examples) regarding its gtk+ binding. Could you please point me to

Re: matching a street address with regular expressions

2007-10-10 Thread Karthik Gurusamy
On Oct 10, 10:02 am, Shawn Milochik [EMAIL PROTECTED] wrote: On 10/4/07, Ricardo Aráoz [EMAIL PROTECTED] wrote: Christopher Spears wrote: One of the exercises in Core Python Programming is to create a regular expression that will match a street address. Here is one of my attempts.

Re: Yet another comparison of Python Web Frameworks

2007-10-10 Thread Kay Schluehr
On Oct 10, 8:15 pm, Peter Otten [EMAIL PROTECTED] wrote: Kay Schluehr wrote: http://mdp.cti.depaul.edu/examples The delivered sourcecode is syntactically broken. Tabs and whitespaces were mixed and when I open a file like gluon/global.py I find sections like this: class

Re: Plugins / Modularity

2007-10-10 Thread [EMAIL PROTECTED]
On Oct 10, 12:43 pm, Robin Kåveland [EMAIL PROTECTED] wrote: On Oct 10, 8:38 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Oct 10, 12:30 pm, Robin Kåveland [EMAIL PROTECTED] wrote: Hi there. I'm basically in the process of writing my first substantial application in Python, and

Re: Pythonic way for handling file errors

2007-10-10 Thread Paul Hankin
On Oct 10, 7:41 pm, wink [EMAIL PROTECTED] wrote: I would like to know what would be considered the most Pythonic way of handling errors when dealing with files, solutions that seem reasonable using 2.5: The best way to handle errors is to catch the exceptions that are raised by the code that

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-10 Thread Ken Tilton
[EMAIL PROTECTED] wrote: On Oct 8, 7:32 am, Joost Kremers [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Don't both man and those words for measurement come ultimately from words for hand (similarly to words like manual, as in labor)? no. Do not bluntly contradict me in public. I

Re: How can Python print the value of an attribute but complain it does not exist?

2007-10-10 Thread Dan
On Oct 10, 3:03 pm, Emre Sevinc [EMAIL PROTECTED] wrote: Hello, I'm a Python newbie and I'm having a strange trouble with the following code: generatefeedvector-debug.py === import feedparser import re def getwordcounts(url):

Re: How can Python print the value of an attribute but complain it does not exist?

2007-10-10 Thread Karen Tracey
On 10/10/07, Emre Sevinc [EMAIL PROTECTED] wrote: [snip] $ python generatefeedvector-debug.py Signal vs. Noise Traceback (most recent call last): File generatefeedvector-debug.py, line 37, in ? title = getwordcounts(feedurl) File generatefeedvector-debug.py , line 21, in

Multidimensional sort

2007-10-10 Thread termiflyer
How do I sort this: a [['3', ['1', '0']], ['4', ['3', '0'], ['2', '0']]] where the list can be arbitrarily large by the 3rd dimension (i think). E.g.: a [['3', ['1', '0']], ['4', ['2', '0'], ['3', '0']]] Thanks -- http://mail.python.org/mailman/listinfo/python-list

I'm starting to think like a Pythonista

2007-10-10 Thread brad
I was looking at a way to implement Ruby's upto method in python. I came up with the code below... three years ago, I would never have thought of list comprehension, today it seems second nature. This may be totally un-Pythonic, but I thought it was kind of clever. Man, for some reason, I feel

for loop question

2007-10-10 Thread Robert Dailey
Hi, I'm currently writing my own CSV parser since the built in one doesn't support Unicode. I'm wondering if there's a way to iterate over the characters in a unicode string and have access to both the 'current' and the 'next' characters each iteration. For example: test = uHello World for

Re: for loop question

2007-10-10 Thread Rafael Sachetto
Try this: test = uHello World n = range(len(test)) for i in n: cur = test[i] try: next = test[i+1] except: next = print cur, next just On 10/10/07, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I'm currently writing my own CSV parser since the built in one doesn't

Re: for loop question

2007-10-10 Thread Tim Chase
test = uHello World for cur,next in test: print cur,next Ideally, this would output: 'H', 'e' 'e', 'l' 'l', 'l' 'l', 'o' etc... Of course, the for loop above isn't valid at all. I am just giving an example of what I'm trying to accomplish. Anyone know how I can achieve the

Re: for loop question

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 14:56 -0500, Robert Dailey wrote: Hi, I'm currently writing my own CSV parser since the built in one doesn't support Unicode. Why do you think you need a CSV parser that supports unicode? -- Carsten Haese http://informixdb.sourceforge.net --

SVN and Setuptools

2007-10-10 Thread percious
I have been thinking a lot about versioning and release of software and I was wondering if what I came up with exists. What I would like to do is create a daemon that sits and checks an SVN repository for tags. When it finds a new tag, it would create an egg for that tag and upload it to an ftp

Re: for loop question

2007-10-10 Thread Paul Hankin
On Oct 10, 9:12 pm, Tim Chase [EMAIL PROTECTED] wrote: test = uHello World for cur,next in test: print cur,next Ideally, this would output: 'H', 'e' 'e', 'l' 'l', 'l' 'l', 'o' etc... Of course, the for loop above isn't valid at all. I am just giving an example of what

Re: for loop question

2007-10-10 Thread Robert Dailey
All the ideas presented here are workable. I definitely have a lot of solutions to choose from. Thanks everyone for your help. I wasn't sure if there was some sort of language feature to naturally do this, so I had to post on the mailing list to make sure. --

Re: for loop question

2007-10-10 Thread Rafael Sachetto
Very nice solution :) On 10/10/07, Paul Hankin [EMAIL PROTECTED] wrote: On Oct 10, 9:12 pm, Tim Chase [EMAIL PROTECTED] wrote: test = uHello World for cur,next in test: print cur,next Ideally, this would output: 'H', 'e' 'e', 'l' 'l', 'l' 'l', 'o' etc...

if then elif

2007-10-10 Thread Shawn Minisall
I just learned about if, then elif statements and wrote this program. The problem is, it's displaying all of the possibilities even after you enter a 0, or if the fat grams are more then the total number of calories , that is supposed to stop the program instead of continuing on with the

RE: Launch file from Python

2007-10-10 Thread wang frank
I have tried to use os.system to run an application inside python on ms-window. However, the applicaion will grap the python and I could not do anything inside python shell unless I quit the application. Are there any way to avoid this? so I can still type command in python shell. Here is the

Re: for loop question

2007-10-10 Thread Tim Chase
Paul Hankin wrote: On Oct 10, 9:12 pm, Tim Chase [EMAIL PROTECTED] wrote: pairs = (test[i:i+2] for i in xrange(len(test)-1)) for a,b in pairs: ... print a,b for a, b in zip(test, test[1:]): print a, b Very nice! I second this solution as better than my original. The only

howto add a sub-directory to the searchpath / namespace ?

2007-10-10 Thread stef mientki
hello, my program has become a bit large, and now I want to split the files over several subdirectories. So in the example shown below, I just moved the files f1.py and f2.py to a deeper subdirectory. basedirectory\ mainfile.py file1.py file2.py subdir1\ __init__.py

Re: Multidimensional sort

2007-10-10 Thread Paul Hankin
On Oct 10, 8:47 pm, termiflyer [EMAIL PROTECTED] wrote: How do I sort this: a [['3', ['1', '0']], ['4', ['3', '0'], ['2', '0']]] where the list can be arbitrarily large by the 3rd dimension (i think). E.g.: a [['3', ['1', '0']], ['4', ['2', '0'], ['3', '0']]] There's no canonical

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 2:51 PM, brad wrote: I was looking at a way to implement Ruby's upto method in python. I came up with the code below... three years ago, I would never have thought of list comprehension, today it seems second nature. This may be totally un-Pythonic, but I thought it

Re: for loop question

2007-10-10 Thread George Sakkis
On Oct 10, 4:12 pm, Tim Chase [EMAIL PROTECTED] wrote: test = uHello World for cur,next in test: print cur,next Ideally, this would output: 'H', 'e' 'e', 'l' 'l', 'l' 'l', 'o' etc... Of course, the for loop above isn't valid at all. I am just giving an example of

Re: Multidimensional sort

2007-10-10 Thread James Stroud
termiflyer wrote: How do I sort this: a [['3', ['1', '0']], ['4', ['3', '0'], ['2', '0']]] where the list can be arbitrarily large by the 3rd dimension (i think). E.g.: a [['3', ['1', '0']], ['4', ['2', '0'], ['3', '0']]] Thanks Your difficulties come from an ill-defined

Re: for loop question

2007-10-10 Thread Larry Bates
Tim Chase wrote: test = uHello World for cur,next in test: print cur,next Ideally, this would output: 'H', 'e' 'e', 'l' 'l', 'l' 'l', 'o' etc... Of course, the for loop above isn't valid at all. I am just giving an example of what I'm trying to accomplish. Anyone know how I can

Re: if then elif

2007-10-10 Thread Larry Bates
Shawn Minisall wrote: I just learned about if, then elif statements and wrote this program. The problem is, it's displaying all of the possibilities even after you enter a 0, or if the fat grams are more then the total number of calories , that is supposed to stop the program instead of

Re: I'm starting to think like a Pythonista

2007-10-10 Thread brad
Bjoern Schliessmann wrote: brad wrote: low_odds = [1,3,5,7,9] # make a list containing 10 - 98 evens only big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == 0 and x 8] Why use xrange if you convert it to a full list in place? No advantage there. What is the dis-advantage

Re: Problem of Readability of Python

2007-10-10 Thread Bjoern Schliessmann
Kevin wrote: Am I missing something, or am I the only one who explicitly declares structs in python? Yes -- you missed my posting :) Regards, Björn -- BOFH excuse #209: Only people with names beginning with 'A' are getting mail this week (a la Microsoft) --

Re: howto add a sub-directory to the searchpath / namespace ?

2007-10-10 Thread Larry Bates
stef mientki wrote: hello, my program has become a bit large, and now I want to split the files over several subdirectories. So in the example shown below, I just moved the files f1.py and f2.py to a deeper subdirectory. basedirectory\ mainfile.py file1.py file2.py

RMI with Pyro et al

2007-10-10 Thread Sells, Fred
I need a simple client/server architecture with clients on linux and servers on windows. There is no UI in this part, just business rules and access control. Pyro seems pretty cool for this due to it's simplicity. I'm just starting with it and have not been able to get the server side to see

Re: I'm starting to think like a Pythonista

2007-10-10 Thread brad
Erik Jones wrote: big_evens = range(10, 100, 2) big_odds = range(11, 100, 2) Neat, but not as clever or as hard to read as mine... I'll bet it faster though... maybe not. The upto part is here: ok_numbers = low_odds + big_evens + [x for x in low_evens if x = y] --

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Marc 'BlackJack' Rintsch
On Wed, 10 Oct 2007 17:03:41 -0400, brad wrote: Bjoern Schliessmann wrote: brad wrote: low_odds = [1,3,5,7,9] # make a list containing 10 - 98 evens only big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == 0 and x 8] Why use xrange if you convert it to a full list in place?

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Bjoern Schliessmann
brad wrote: low_odds = [1,3,5,7,9] # make a list containing 10 - 98 evens only big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == 0 and x 8] Why use xrange if you convert it to a full list in place? No advantage there. Regards, Björn -- BOFH excuse #300: Digital

Re: if then elif

2007-10-10 Thread brad
Shawn Minisall wrote: I just learned about if, then elif statements and wrote this program. The problem is, it's displaying all of the possibilities even after you enter a 0, or if the fat grams are more then the total number of calories , that is supposed to stop the program instead of

Re: for loop question

2007-10-10 Thread Robert Dailey
I've tried everything to make the original CSV module work. It just doesn't. I've tried UTF-16 encoding (which works fine with codecs.open()) but when I pass in the file object returned from codecs.open() into csv.reader(), the call to reader.next() fails because it says something isnt' in the

Re: unpickle from URL problem

2007-10-10 Thread Hrvoje Niksic
Alan Isaac [EMAIL PROTECTED] writes: Hrvoje Niksic wrote: The first upload breaks the file. You uploaded it in (presumably FTP's) text mode, which changes \n - \r\n. But you download it using http, which specifies no such conversion in the opposite direction. No: I used binary upload both

Re: for loop question

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 16:03 -0500, Robert Dailey wrote: I've tried everything to make the original CSV module work. It just doesn't. I've tried UTF-16 encoding What do you mean, tried? Don't you know what the file is encoded in? (which works fine with codecs.open()) but when I pass in the

Re: Problem of Readability of Python

2007-10-10 Thread Steven Bethard
Bjoern Schliessmann wrote: Kevin wrote: Am I missing something, or am I the only one who explicitly declares structs in python? Yes -- you missed my posting :) Actually, your posting just used dicts normally. Kevin is creating a prototype dict with a certain set of keys, and then copying

Re: for loop question

2007-10-10 Thread Robert Dailey
On 10/10/07, Carsten Haese [EMAIL PROTECTED] wrote: Instead of passing the file object directly to the csv parser, pass in a generator that reads from the file and explicitly encodes the strings into UTF-8, along these lines: def encode_to_utf8(f): for line in f: yield

PYTHONPATH on OS X

2007-10-10 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is a capture of what I did. Note that my newfolder appears nowhere on the list of directories in sys.path.

Re: Pythonic way for handling file errors

2007-10-10 Thread danielx
On Oct 10, 12:28 pm, Paul Hankin [EMAIL PROTECTED] wrote: On Oct 10, 7:41 pm, wink [EMAIL PROTECTED] wrote: I would like to know what would be considered the most Pythonic way of handling errors when dealing with files, solutions that seem reasonable using 2.5: The best way to handle

Re: RMI with Pyro et al

2007-10-10 Thread Diez B. Roggisch
Sells, Fred schrieb: I need a simple client/server architecture with clients on linux and servers on windows. There is no UI in this part, just business rules and access control. Pyro seems pretty cool for this due to it's simplicity. I'm just starting with it and have not been able to

Re: PYTHONPATH on OS X

2007-10-10 Thread Diez B. Roggisch
mhearne808[insert-at-sign-here]gmail[insert-dot-here]com schrieb: I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is a capture of what I did. Note that

Re: if then elif

2007-10-10 Thread chris . monsanto
On Oct 10, 5:03 pm, Larry Bates [EMAIL PROTECTED] wrote: Shawn Minisall wrote: I just learned about if, then elif statements and wrote this program. The problem is, it's displaying all of the possibilities even after you enter a 0, or if the fat grams are more then the total number of

Re: Really basic problem

2007-10-10 Thread Dan Stromberg
On Mon, 08 Oct 2007 12:23:27 +0200, A.T.Hofkamp wrote: On 2007-10-08, Andreas Tawn [EMAIL PROTECTED] wrote: i know this example is stupid and useless, but that's not the answer to my question. here it goes: You've just discovered the joys of floating point number comparisons. Consider

Re: M2Crypto possible intermittent bug

2007-10-10 Thread John Nagle
John Nagle wrote: John Nagle wrote: I just upgraded from M2Crypto 0.17 to M2Crypto 0.18, and I'm running my regression tests. I'm seeing occasional cases where M2Crypto raises the exception SSL.SSLError, and the associated error is (0, 'Error'), which is the bogus error you get if you feed

Re: PYTHONPATH on OS X

2007-10-10 Thread Anthony
On Oct 10, 11:00 pm, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below

Re: PYTHONPATH on OS X

2007-10-10 Thread Graham Dumpleton
On Oct 11, 8:00 am, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is

How to dereference an iterator?

2007-10-10 Thread Robert Dailey
Hi, Suppose I wanted to manually iterate over a container, for example: mylist = [1,2,3,4,5,6] it = iter(mylist) while True: print it it.next() In the example above, the print doesn't print the VALUE that the iterator currently represents, it prints the iterator itself. How can I get

Re: M2Crypto possible intermittent bug

2007-10-10 Thread Heikki Toivonen
John Nagle wrote: Still having trouble reproducing the problem. But somewhere, something raised that bogus no-error exception three times. Anything that returns (0, 'Error') as exception data is a bug. If you can, build python and m2crypto with debug symbols, and place breakpoints in |case

Re: howto add a sub-directory to the searchpath / namespace ?

2007-10-10 Thread stef mientki
Larry Bates wrote: stef mientki wrote: hello, my program has become a bit large, and now I want to split the files over several subdirectories. So in the example shown below, I just moved the files f1.py and f2.py to a deeper subdirectory. basedirectory\ mainfile.py file1.py

Re: Really basic problem

2007-10-10 Thread Ricardo Aráoz
tomamil wrote: i know this example is stupid and useless, but that's not the answer to my question. here it goes: status = 0.0 for i in range(10): status = status + 0.1 if status == 0.1: print status elif status == 0.2: print status elif status == 0.3:

Re: storing meta data on dictionary keys

2007-10-10 Thread Andreas Kraemer
On Oct 9, 9:18 pm, Erik Jones [EMAIL PROTECTED] wrote: So, do you not keep references to your nodes anywhere but the actual graph dict? I kind of agree with Chris here in that two dicts will work. One for the nodes, indexed by their strings. Yes, I guess that's exactly what I want. To keep

Re: if then elif

2007-10-10 Thread thebjorn
On Oct 10, 11:03 pm, Larry Bates [EMAIL PROTECTED] wrote: [...] Boolean problem: if cal or fat = 0 That may be the way you say it or think it but it won't work. 'cal or fat' is evaluated first. Since they both have values this ALWAYS evaluates to 1 which is NEVER less than or equal to 0.

Re: How to dereference an iterator?

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 18:01 -0500, Robert Dailey wrote: Hi, Suppose I wanted to manually iterate over a container, for example: mylist = [1,2,3,4,5,6] it = iter(mylist) while True: print it it.next() In the example above, the print doesn't print the VALUE that the iterator

Problems with struct.pack()

2007-10-10 Thread Robert Dailey
Hi, I have opened a unicode file for writing: import codecs file = codecs.open( somefile.dat, wb, utf-16 ) and I attempt to do this: file.write( struct.pack( I, 5000 ) ) However, this won't work because the encoding of the string returned by pack isn't unicode. I'm a bit confused right now as

hi every one

2007-10-10 Thread kasim
www.agloco.com/r/BBFR6434 http://www.yuwie.com/yuwie.asp?r=102001 Dear __, I recently joined AGLOCO because of a friend recommended it to me. I am now promoting it to you because I like the idea and I want you to share in what I think will be an exciting new Internet concept. AGLOCO's

Keeping track of subclasses and instances?

2007-10-10 Thread Karlo Lozovina
Hi, what's the best way to keep track of user-made subclasses, and instances of those subclasses? I just need a pointer in a right direction... thanks. -- Karlo Lozovina -- Mosor -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with struct.pack()

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 19:00 -0500, Robert Dailey wrote: Hi, I have opened a unicode file for writing: import codecs file = codecs.open( somefile.dat, wb, utf-16 ) and I attempt to do this: file.write( struct.pack ( I, 5000 ) ) However, this won't work because the encoding of the

Re: hi every one

2007-10-10 Thread Dustan
On Oct 10, 7:19 pm, kasim [EMAIL PROTECTED] wrote: Dear __, __.dear() Traceback (most recent call last): File pyshell#0, line 1, in module __.dear() NameError: name '__' is not defined __ = self __.dear() Traceback (most recent call last): File pyshell#1,

Re: Keeping track of subclasses and instances?

2007-10-10 Thread Larry Bates
Karlo Lozovina wrote: Hi, what's the best way to keep track of user-made subclasses, and instances of those subclasses? I just need a pointer in a right direction... thanks. I'm not completely sure I understand the question but here goes. Instances of classes are classes can be stored in

Re: multimethods decorator

2007-10-10 Thread gherzig
Gerardo Herzig a écrit : Hi all. Im reading the Gido's aproach using decorators at http://www.artima.com/weblogs/viewpost.jsp?thread=101605 It looks good to me, but the examples shows the functionality using functions. Now, when i try to give this decorator into a method, if i try the

Re: Keeping track of subclasses and instances?

2007-10-10 Thread Karlo Lozovina
Larry Bates wrote: I'm not completely sure I understand the question but here goes. Instances of classes are classes can be stored in lists or dictionaries. In lists you reference them via their index (or iterate over them) and in dictionaries you can give them a name that is used as a

Re: Python Magazine: Issue 1 Free!

2007-10-10 Thread Daniel Klein
On Fri, 05 Oct 2007 07:44:46 -0400, Steve Holden [EMAIL PROTECTED] wrote: I've just been told by the editors at Python Magazine that the first issue is out. It's all-electronic so anyone can download and read it. The website states that existing subcribers are notified of the availability of

RE: Fwd: NUCULAR fielded text searchable indexing

2007-10-10 Thread Delaney, Timothy (Tim)
[EMAIL PROTECTED] wrote: From: Grant Edwards Anyway, I apologize for my attempt at humor, since it appears to have somehow offended. Why apologize? If someone doesn't like the name given to a piece of software by its author(s), screw them. If I find the software useful, I'll use it.

RE: Problem of Readability of Python

2007-10-10 Thread Delaney, Timothy (Tim)
Licheng Fang wrote: This is enlightening. Surely I shouldn't have worried too much about performance before doing some measurement. And with that statement you have truly achieved enlightenment. Or to put it another way ... performance tuning without profiling is a waste of time. Tim Delaney

Re: Singleton

2007-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2007 17:37:53 +0200, Diez B. Roggisch wrote: Two borgs, or two million, the whole point of using borgs is that it doesn't matter. It does matter where the classes live (module-wise). Which is the problem the OP had, borg or not to borg. Gotcha. Thanks for the demonstration

Re: Singleton

2007-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2007 09:52:26 -0700, Carl Banks wrote: On Oct 10, 11:18 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Of course, if there is some other meaning to the OP's post, then possibly I've completely misunderstood it. Would you mind telling me what you've seen that

Re: Problems with struct.pack()

2007-10-10 Thread Robert Dailey
Hi, Thanks for responding. I apologize about my lack of details, I was in a hurry when I wrote the initial question. I'll provide more details. Basically, I'm attempting to write out unicode strings (16 bits per character) to a file. Before each string, I write out 4 bytes containing the number

Re: Keeping track of subclasses and instances?

2007-10-10 Thread Steven D'Aprano
On Thu, 11 Oct 2007 03:19:07 +0200, Karlo Lozovina wrote: Here is a longer description - I have a function that given input creates a custom class and returns it back. The user is free to subclass that (even more, he should do that), and of course he will make instances of those subclasses.

Re: How to dereference an iterator?

2007-10-10 Thread Robert Dailey
Hi, I suppose my question in general is goofy to native python programmers. I'm originally a C++ programmer and I have a hard time not relating iterators in python to iterators in STL lol. What I was actually trying to accomplish was to iterate over 2 iterators using 1 for loop, however I found

Re: Python Magazine: Issue 1 Free!

2007-10-10 Thread Steve Holden
Daniel Klein wrote: On Fri, 05 Oct 2007 07:44:46 -0400, Steve Holden [EMAIL PROTECTED] wrote: I've just been told by the editors at Python Magazine that the first issue is out. It's all-electronic so anyone can download and read it. The website states that existing subcribers are

Re: if then elif

2007-10-10 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: that's the most incorrect thing i've heard all day! if cal or fat = 0 is parsed as if (cal) or (fat = 0) Which is exactly what he said. He also said that what the poster probably wanted was if cal = 0 or fat =0 --

Re: Keeping track of subclasses and instances?

2007-10-10 Thread George Sakkis
On Oct 10, 9:19 pm, Karlo Lozovina [EMAIL PROTECTED] wrote: Larry Bates wrote: I'm not completely sure I understand the question but here goes. Instances of classes are classes can be stored in lists or dictionaries. In lists you reference them via their index (or iterate over them) and

Re: How to dereference an iterator?

2007-10-10 Thread Steven D'Aprano
The original post seems to have been eaten, so I'm replying via a reply. Sorry for breaking threading. On Wed, 2007-10-10 at 18:01 -0500, Robert Dailey wrote: Hi, Suppose I wanted to manually iterate over a container, for example: mylist = [1,2,3,4,5,6] it = iter(mylist) while True:

Re: if then elif

2007-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2007 20:42:26 -0600, Michael L Torrie wrote: [EMAIL PROTECTED] wrote: that's the most incorrect thing i've heard all day! if cal or fat = 0 is parsed as if (cal) or (fat = 0) Which is exactly what he said. Heh, that was my first thought too, for about 3.2 milliseconds.

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 4:16 PM, Marc 'BlackJack' Rintsch wrote: On Wed, 10 Oct 2007 17:03:41 -0400, brad wrote: Bjoern Schliessmann wrote: brad wrote: low_odds = [1,3,5,7,9] # make a list containing 10 - 98 evens only big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == 0 and x

a good website for softwares,movies and music ,sex etc.

2007-10-10 Thread panguohua
www.space666.com good -- http://mail.python.org/mailman/listinfo/python-list

Re: Version specific or not?

2007-10-10 Thread Scott David Daniels
Steven W. Orr wrote: We have an app and I'm trying to decide where the app ... . /usr/lib/python2.3/site-packages or /usr/lib/site-python The latter would solve a lot of problems for me. Fewer than you suspect If there are multiple versions of python installed on the same machine,

Re: for loop question

2007-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2007 20:25:00 +, Paul Hankin wrote: A works-for-me: pairs = (test[i:i+2] for i in xrange(len(test)-1)) for a,b in pairs: ... print a,b for a, b in zip(test, test[1:]): print a, b May be unfortunately slow if test is half a gigabyte of data, what with

Re: storing meta data on dictionary keys

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 6:40 PM, Andreas Kraemer wrote: On Oct 9, 9:18 pm, Erik Jones [EMAIL PROTECTED] wrote: So, do you not keep references to your nodes anywhere but the actual graph dict? I kind of agree with Chris here in that two dicts will work. One for the nodes, indexed by their

Re: howto add a sub-directory to the searchpath / namespace ?

2007-10-10 Thread [david]
r indicates a 'regular expression' string, normally called a raw string. It means that \ characters are treated using the regex syntax rather than the c syntax. In the regex syntax, \ characters are escape characters only at the end of the string, which allows you to easily use Windows directory

Duck Typing and **kwds

2007-10-10 Thread Luis Zarrabeitia
Hi there. I just tried this test: def f(**kwds): print kwds import UserDict d = UserDict.UserDict(hello=world) f(**d) And it fails with a TypeError exception (f() argument after ** must be a dictionary). I find that weird, as UserDict should support all protocols that dict

Re: How to dereference an iterator?

2007-10-10 Thread Robert Dailey
Thanks! Yellow is my favorite color! On 10/10/07, Pablo Ziliani [EMAIL PROTECTED] wrote: Robert Dailey wrote: (...) What I was actually trying to accomplish was to iterate over 2 iterators using 1 for loop, however I found that the zip() function allows me to do this quite easily:

Re: Keeping track of subclasses and instances?

2007-10-10 Thread Michele Simionato
On Oct 10, 8:17 pm, Karlo Lozovina [EMAIL PROTECTED] wrote: Hi, what's the best way to keep track of user-made subclasses, and instances of those subclasses? I just need a pointer in a right direction... thanks. -- Karlo Lozovina -- Mosor This recipe does what you want, with the intent of

ANN: Chandler 0.7.1

2007-10-10 Thread Heikki Toivonen
The Chandler Project is pleased to announce the 0.7.1 release of Chandler Desktop! Chandler Desktop is an open source, standards-based personal information manager (PIM) built around small group collaboration and a core set of information management workflows modeled on Inbox usage patterns and

<    1   2   3   >