Re: PyPI bdist_wininst upload failing

2007-05-27 Thread John Machin
On May 27, 4:20 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > I just tried to upload new versions of the argparse module to PyPI, but > > it seems like I can no longer upload Windows installers: [snip] > That seems a little weird to me. Are the bdist_wininst exe files re

Re: Color Segmentation w/ PIL?

2007-05-27 Thread way4thesub
I don't know of any in Python, but an open source image processing package in Java has been developed at Stanford University - http://www.gemident.net GemIdent . GemIdent was originally designed to segment cells from miscroscopic images and, more generally, can identify objects of interest and do

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread OKB (not okblacke)
Paul McGuire wrote: > I was under the impression that lower_case_with_underscores was a > dated recommendation, and that recent practice is more inclusive of > mixedCase style identifiers. On the contrary, Steven Bethard > straightened me out, saying that PEP-8 used to accept either style, > but

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Paul McGuire
On May 27, 1:25 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Stefan Sonnenberg-Carstens wrote: > > Paul McGuire schrieb: > >> I'm starting a new thread for this topic, so as not to hijack the one > >> started by Steve Howell's excellent post titled "ten small Python > >> programs". > > >> In tha

Re: Color Segmentation w/ PIL?

2007-05-27 Thread jelle feringa
You might be interested in the ndimage module of scipy: http://www.scipy.org/SciPyPackages/Ndimage If you need a very serious image processing framework, ITK is might be very interesting: http://www.itk.org/ If so, have a look at the more Pythonic interface developed for it: www.insight-journal.or

Re: Ancient projectiles (was: Muzzle Velocity (was: High resolution sleep(Linux))

2007-05-27 Thread Hendrik van Rooyen
"Cameron Laird" <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > . > . > . > >> Did you know that the first military smokeless powder > >> round was for the French Lebel? - It threw a bronze > >> ball, and could punch through a singl

Re: Muzzle Velocity (was: High resolution sleep (Linux)

2007-05-27 Thread Hendrik van Rooyen
"Cameron Laird" <[EMAIL PROTECTED]> wrote: > . > . > Ha! It's interesting, especially for "computerists", to consider > how some technologies "plateau": steam car speeds, fresco paint- > ing, dry-stone walls, ... > > >From what I remember from my reading, the Stanley Steamer had a reputation

Web archtecture using two layers in Phyton

2007-05-27 Thread wagner
Hello, I need to develop an web applications that meet the following requirements: - 2 layers: the first one is the user interface (browser) and the second one is the interaction with the operacional system of the server. - the second layer must be developed using Python. I'd like to know if

Re: Python and GUI

2007-05-27 Thread Matt van de Werken
brad wrote: > Kevin Walzer wrote: > >> 2. wxPython is big, harder to learn than Tkinter, but looks good on >> Mac, Windows, and *Nix. It will require users to install a lot of >> extra stuff (or you'll have to bundle the extra stuff). > > PyInstaller builds binaries beautifully from raw py sour

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Ben Finney
Paul McGuire <[EMAIL PROTECTED]> writes: > At this point, I realized that I was taking things too far > off-topic, so I decided to start a new thread. So, uh, what's the purpose of this thread? Did you have a specific point to start off with, or a question to ask? -- \ "It seems intuitive

totally lost newbie

2007-05-27 Thread mark
Hi all I posted earlier on this but have changed my approach so here is my latest attempt at solving a problem. I have been working on this for around 12 hours straight and am still struggling with it. Write a program that reads the values for a random list of cards from a file, where each line i

Re: How to get a dot's or pixel's RGB with PIL

2007-05-27 Thread [EMAIL PROTECTED]
I got it. Pass python challenge chapter 7. -- http://mail.python.org/mailman/listinfo/python-list

Re: totally lost newbie

2007-05-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, mark wrote: > Hi all > > I posted earlier on this but have changed my approach so here is my > latest attempt at solving a problem. I have been working on this for > around 12 hours straight and am still struggling with it. > > Write a program that reads the values for a

Re: a bug in python windows service?

2007-05-27 Thread momobear
> No, this is not a bug. You must not call Thread.run(), use Thread.start() > instead - else your code won't run in a different thread of execution. See > http://docs.python.org/lib/thread-objects.htmlon how to use Thread > objects - and note that you should *only* override __init__ and run, if

Re: totally lost newbie

2007-05-27 Thread Kay Schluehr
On May 27, 12:19 pm, mark <[EMAIL PROTECTED]> wrote: > Hi all > > I posted earlier on this but have changed my approach so here is my > latest attempt at solving a problem. I have been working on this for > around 12 hours straight and am still struggling with it. > > Write a program that reads the

Help with PySMS

2007-05-27 Thread DJ Fadereu
Hello - Background: I'm not a coder, but I got a degree in Chem Engg about 7 years ago. I have done some coding in my life, and I'm only beginning to pick up Python. So assume that I'm very stupid when and if you are kind enough to help me out. Problem: I need an SMS server running on my WinXP

Re: totally lost newbie

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 07:19:15 -0300, mark <[EMAIL PROTECTED]> escribió: > I posted earlier on this but have changed my approach so here is my > latest attempt at solving a problem. I have been working on this for > around 12 hours straight and am still struggling with it. Almost done. Just two thi

Re: a bug in python windows service?

2007-05-27 Thread momobear
> Instead of extending join(), write a specific method to signal the > quitEvent or just let the caller signal it. And I don't see in this > example why do you need two different events (one on the thread, another > on the service controller), a single event would suffice. I don't think a single

Re: ten small Python programs

2007-05-27 Thread BartlebyScrivener
On May 26, 1:43 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > -- > parentRabbits, babyRabbits = (1, 1) > while babyRabbits < 100: > print 'This generation has %d rabbits' % > babyRabbits > parentRabbits, babyRabbits = (babyRabbits, > parentRabbits + babyRabbits) > >

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Carsten Haese
On Sun, 2007-05-27 at 07:30 +, OKB (not okblacke) wrote: > Underscores are harder to type than any alphanumeric character. This is a discussion about underscores versus capital letters denoting the word boundaries in identifiers. How is an underscore harder to type than a capital lette

Newbie question - better way to do this?

2007-05-27 Thread Eric
I have some working code, but I realized it is just the way I would write it in C, which means there is probably a better (more pythonic) way of doing it. Here's the section of code: accumulate = firstIsCaps = False accumStart = i = 0 while i < len(words): firstIsCaps = firstI

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Steve Howell
--- Ben Finney <[EMAIL PROTECTED]> wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > > > At this point, I realized that I was taking things > too far > > off-topic, so I decided to start a new thread. > > So, uh, what's the purpose of this thread? Did you > have a specific > point to start off

Re: totally lost newbie

2007-05-27 Thread Steve Howell
--- Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > Maybe it's easier to use a key function instead of a > compare function. A > key function receives an element and must return > something that is then > sorted and the element ends up where the computed > key is in the sorted > list. L

Re: matplotlib, usetex

2007-05-27 Thread Alexander Schmolck
Bill Jackson <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote the following on 05/25/2007 02:33 PM: >> I have no idea whether this will resolve your problem, but you could try >> updating to 0.90 (BTW what happens if you do axis([0,128,0,128])). > > The problem appears to be with a matplotli

Re: totally lost newbie

2007-05-27 Thread Steve Howell
--- mark <[EMAIL PROTECTED]> wrote: > Hi all > > I posted earlier on this but have changed my > approach so here is my > latest attempt at solving a problem. I have been > working on this for > around 12 hours straight and am still struggling > with it. > > Write a program that reads the values

Re: Newbie question - better way to do this?

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 10:44:01 -0300, Eric <[EMAIL PROTECTED]> escribió: > I have some working code, but I realized it is just the way I would > write it in C, which means there is probably a better (more pythonic) > way of doing it. > > Here's the section of code: > > accumulate = firstIsCaps =

Re: Newbie question - better way to do this?

2007-05-27 Thread Steven D'Aprano
On Sun, 27 May 2007 06:44:01 -0700, Eric wrote: > words is a big long array of strings. What I want to do is find > consecutive sequences of words that have the first letter capitalized, > and then call doSomething on them. (And you can ignore the fact that > it won't find a sequence at the very

Re: Newbie question - better way to do this?

2007-05-27 Thread Steve Howell
--- Eric <[EMAIL PROTECTED]> wrote: > I have some working code, but I realized it is just > the way I would > write it in C, which means there is probably a > better (more pythonic) > way of doing it. > > Here's the section of code: > > accumulate = firstIsCaps = False > accumStart = i

Re: totally lost newbie

2007-05-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Steve Howell wrote: >> def key_func(item): >> return (len(item), item) >> >> data = ['viking', 'spam', 'parrot', 'ham', 'eric'] >> data.sort(key=key_func) >> print data >> > > Marc, when did the key feature get introduced, 2.4 or > 2.5? I'm asking on behalf of the n

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 10:20:49 -0300, Carsten Haese <[EMAIL PROTECTED]> escribió: > On Sun, 2007-05-27 at 07:30 +, OKB (not okblacke) wrote: >> Underscores are harder to type than any alphanumeric character. > > This is a discussion about underscores versus capital letters denoting > the

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Steve Howell
--- Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > Underscores are not always easily available on non > us-layout keyboards, > like \ and @ and many other "special" characters. A > language that requires > more symbols than the 26 english letters has to make > room somewhere - > keyboard

Re: File monitoring for all drive

2007-05-27 Thread Tim Golden
[rohit] >>> i want to detect all file change operations(rename,delete,create) >>> on ALL THE DRIVES of the hard disk >>> using the method ReadDirectoryChanges API , i.e program no. 3 in the >>> webpagehttp://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_fo... >>> . >>> Please sugg

Re: Help with PySMS

2007-05-27 Thread Paul Boddie
DJ Fadereu wrote: > > I need an SMS server running on my WinXP PC, as soon as possible. I'm > currently using a Nokia 6300 phone which has the S60 platform. I > downloaded the PySMS by Dave Berkeley from > http://www.wordhord.co.uk/pysms.html and started testing it, but I > haven't been able to get

Re: PyPI bdist_wininst upload failing

2007-05-27 Thread Steven Bethard
John Machin wrote: > On May 27, 4:20 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: >> Steven Bethard wrote: >>> I just tried to upload new versions of the argparse module to PyPI, but >>> it seems like I can no longer upload Windows installers: > [snip] >> That seems a little weird to me. Are the b

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- BartlebyScrivener <[EMAIL PROTECTED]> wrote: > On May 26, 1:43 pm, Steve Howell > <[EMAIL PROTECTED]> wrote: > > -- > > # def defines a method in Python > > def tax(itemCharge, taxRate = 0.05): > > return itemCharge * taxRate > > print '%.2f' % tax(11.35) > > p

Re: a bug in python windows service?

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 09:07:36 -0300, momobear <[EMAIL PROTECTED]> escribió: >> Instead of extending join(), write a specific method to signal the >> quitEvent or just let the caller signal it. And I don't see in this >> example why do you need two different events (one on the thread, another >> on

Re: Why isn't this query working in python?

2007-05-27 Thread erikcw
On May 26, 8:21 pm, John Machin <[EMAIL PROTECTED]> wrote: > On May 27, 5:25 am, erikcw <[EMAIL PROTECTED]> wrote: > > > > > On May 25, 11:28 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > > On Fri, 2007-05-25 at 09:51 -0500, Dave Borne wrote: > > > > > I'm trying to run the following query: >

Re: PyPI bdist_wininst upload failing

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 12:19:03 -0300, Steven Bethard <[EMAIL PROTECTED]> escribió: > Also, I couldn't get the StringIO code from there to work: > > >>> import StringIO > >>> content = open('argparse-0.8.0.win32.exe').read() Use open("...","rb").read() - the "b" is important on Windows. -- Gab

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- BartlebyScrivener <[EMAIL PROTECTED]> wrote: > > For the person new to programming (doesn't come from > C or other > languages), I think you need to add a separate > explanation of string > formatting and how it works, or at least add a > comment that tells them > you are using string format

PHP5 programmer learning Python

2007-05-27 Thread romiro
Hi all, I'm a PHP5 developer looking to "broaden my horizons" so to speak by learning a new language. I emphasize the 5 in PHP since I have fully engrossed myself in the full OOP of version 5 with my own ground-up projects as well as some work with PRADO (http://pradosoft.com) I've dabbled with a

Re: ten small Python programs

2007-05-27 Thread Wildemar Wildenburger
Steve Howell wrote: > # def defines a method in Python > def say_hello(name): > print 'hello', name > say_hello('Jack') > say_hello('Jill') > Doesn't def define methods *xor* functions, depending on the context? And in this example, say_hello (*yuck*, underscores ...) is

Re: PyPI bdist_wininst upload failing

2007-05-27 Thread Steven Bethard
Gabriel Genellina wrote: > En Sun, 27 May 2007 12:19:03 -0300, Steven Bethard > <[EMAIL PROTECTED]> escribió: > >> Also, I couldn't get the StringIO code from there to work: >> >> >>> import StringIO >> >>> content = open('argparse-0.8.0.win32.exe').read() > > Use open("...","rb").read() - the

Re: PHP5 programmer learning Python

2007-05-27 Thread darren kirby
quoth the romiro: > Hi all, ... > Anyway, my first question was if anyone knows of a tutorial that > focuses on PHP -> Python learning, in such that there might be a block > of PHP code alongside an example of how to do the same thing in > Python. One example of something I've already mapped a com

Re: PHP5 programmer learning Python

2007-05-27 Thread Gabriel Genellina
En Sun, 27 May 2007 12:41:36 -0300, romiro <[EMAIL PROTECTED]> escribió: > Anyway, my first question was if anyone knows of a tutorial that > focuses on PHP -> Python learning, in such that there might be a block > of PHP code alongside an example of how to do the same thing in I don't know of a

Re: PHP5 programmer learning Python

2007-05-27 Thread Steve Howell
--- romiro <[EMAIL PROTECTED]> wrote: > > Anyway, my first question was if anyone knows of a > tutorial that > focuses on PHP -> Python learning, in such that > there might be a block > of PHP code alongside an example of how to do the > same thing in > Python. I know exactly what you mean, an

Re: PHP5 programmer learning Python

2007-05-27 Thread 7stud
On May 27, 9:41 am, romiro <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm a PHP5 developer looking to "broaden my horizons" so to speak by > learning a new language. I emphasize the 5 in PHP since I have fully > engrossed myself in the full OOP of version 5 with my own ground-up > projects as well as

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Paul McGuire
On May 27, 3:35 am, Ben Finney <[EMAIL PROTECTED]> wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > > At this point, I realized that I was taking things too far > > off-topic, so I decided to start a new thread. > > So, uh, what's the purpose of this thread? Did you have a specific > point to st

Re: PHP5 programmer learning Python

2007-05-27 Thread Steve Howell
--- romiro <[EMAIL PROTECTED]> wrote: > I've recently tried > C#, a very short > lived re-attempt at C++ and Java, and Ruby. To the extend that you're familiar with C++/Java/Ruby, you may find this link as an interesting way to see how Python looks: http://www.dmh2000.com/cjpr/cmpframe.html

Re: Large Amount of Data

2007-05-27 Thread Jack
John, thanks for your reply. I will then use the files as input to generate an index. So the files are temporary, and provide some attributes in the index. So I do this multiple times to gather different attributes, merge, etc. "John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROT

Re: PyPI bdist_wininst upload failing

2007-05-27 Thread Steven Bethard
Steven Bethard wrote: > Gabriel Genellina wrote: >> En Sun, 27 May 2007 12:19:03 -0300, Steven Bethard >> <[EMAIL PROTECTED]> escribió: >> >>> Also, I couldn't get the StringIO code from there to work: >>> >>> >>> import StringIO >>> >>> content = open('argparse-0.8.0.win32.exe').read() >> >> Us

[ANN] argparse 0.8 - Command-line parsing library

2007-05-27 Thread Steven Bethard
=== Announcing argparse 0.8 === The argparse module is an optparse-inspired command line parser that improves on optparse by supporting: * positional arguments * sub-commands * required options * options with a variable number of args * better usage message

Re: Why isn't this query working in python?

2007-05-27 Thread Steve Howell
--- erikcw <[EMAIL PROTECTED]> wrote: > > > > > ('SELECT payment_id FROM amember_payments WHERE > member_id=%s AND > > > expire_date > NOW() AND completed=1 AND > (product_id >11 AND product_id > > > <21)', (1608L,)) > > > () > > > > Here is a copy of the table schema and the first 2 > rows. >

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > # def defines a method in Python > > def say_hello(name): > > print 'hello', name > > say_hello('Jack') > > say_hello('Jill') > > > Doesn't def define methods *xor* functions, > depending on

Re: PHP5 programmer learning Python

2007-05-27 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >En Sun, 27 May 2007 12:41:36 -0300, romiro <[EMAIL PROTECTED]> escribió: > >> Anyway, my first question was if anyone knows of a tutorial that >> focuses on PHP -> Python learning, in such that there might be a block >> o

Re: ten small Python programs

2007-05-27 Thread Steven Bethard
Steve Howell wrote: > --- Steven Bethard <[EMAIL PROTECTED]> wrote: >> Very cool! Do you mind putting this up on the Wiki >> somewhere so that we >> can link to it more easily? Maybe something like: >> >> http://wiki.python.org/moin/SimplePrograms >> > > Done. I think I would rewrite the cu

itertools.groupby

2007-05-27 Thread 7stud
Bejeezus. The description of groupby in the docs is a poster child for why the docs need user comments. Can someone explain to me in what sense the name 'uniquekeys' is used this example: import itertools mylist = ['a', 1, 'b', 2, 3, 'c'] def isString(x): s = str(x) if s == x:

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- 7stud <[EMAIL PROTECTED]> wrote: > Bejeezus. The description of groupby in the docs is > a poster child > for why the docs need user comments. Can someone > explain to me in > what sense the name 'uniquekeys' is used this > example: [...] > The groupby method has its uses, but it's behavi

Re: itertools.groupby

2007-05-27 Thread 7stud
On May 27, 11:28 am, Steve Howell <[EMAIL PROTECTED]> wrote: > --- 7stud <[EMAIL PROTECTED]> wrote: > > Bejeezus. The description of groupby in the docs is > > a poster child > > for why the docs need user comments. Can someone > > explain to me in > > what sense the name 'uniquekeys' is used thi

What's the best way to iniatilize a function

2007-05-27 Thread Jack
I have a set of functions to wrap a library. For example, mylib_init() mylib_func() mylib_exit() or handle = mylib_init() mylib_func(handle) mylib_exit(handle) In order to call mylib_func(), mylib_init() has to be called once. When it's done, or when program exits, mylib_exit() should be called

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- 7stud <[EMAIL PROTECTED]> wrote: > Bejeezus. The description of groupby in the docs is > a poster child > for why the docs need user comments. I would suggest an example with a little more concreteness than what's currently there. For example, this code... import itertools syslog_messa

Announcing: ACM SIGAPL apl 2007 -- Arrays and Objects

2007-05-27 Thread Mike Kent
The APL 2007 conference, sponsored by ACM SIGAPL, has as its principal theme "Arrays and Objects" and, appropriately, is co-located with OOPSLA 2007, in Montreal this October. APL 2007 starts with a tutorial day on Sunday, October 21, followed by a two-day program on Monday and Tuesday, October

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > I think I would rewrite the current unit-testing > example to use the > standard library unittest module:: > > # Let's write reusable code, and unit test it. > def add_money(amounts): > # do arithmetic in pennies so as not to >

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > > I think I would rewrite the current unit-testing > example to use the > standard library unittest module:: > > # Let's write reusable code, and unit test it. > def add_money(amounts): > # do arithmetic in pennies so as not to

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread [EMAIL PROTECTED]
Stefan Sonnenberg-Carstens wrote: > Paul McGuire schrieb: > > I'm starting a new thread for this topic, so as not to hijack the one > > started by Steve Howell's excellent post titled "ten small Python > > programs". > > > > In that thread, there was a suggestion that these examples should > > conf

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread OKB (not okblacke)
Carsten Haese wrote: > On Sun, 2007-05-27 at 07:30 +, OKB (not okblacke) wrote: >> Underscores are harder to type than any alphanumeric >> character. > > This is a discussion about underscores versus capital letters > denoting the word boundaries in identifiers. How is an

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- 7stud <[EMAIL PROTECTED]> wrote: > > I'd settle for a simple explanation of what it does > in python. > The groupby function prevents you have from having to write awkward (and possibly broken) code like this: group = [] lastKey = None for item in items: newKey = item.k

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- Steve Howell <[EMAIL PROTECTED]> wrote: > > --- 7stud <[EMAIL PROTECTED]> wrote: > > > Bejeezus. The description of groupby in the docs > is > > a poster child > > for why the docs need user comments. > Regarding the pitfalls of groupby in general (even assuming we had better documenta

Re: ten small Python programs

2007-05-27 Thread Steven Bethard
Steve Howell wrote: > --- Steven Bethard <[EMAIL PROTECTED]> wrote: >> I think I would rewrite the current unit-testing >> example to use the >> standard library unittest module:: >> >> # Let's write reusable code, and unit test it. >> def add_money(amounts): >> # do arithmetic

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Ben Finney
"OKB (not okblacke)" <[EMAIL PROTECTED]> writes: > Underscores are harder to type than any alphanumeric character. I know of no keyboard layout in common use where it's more complicated than +, exactly the same as a single uppercase letter. Care to enlighten me? -- \"Conscien

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Ben Finney
Stefan Sonnenberg-Carstens <[EMAIL PROTECTED]> writes: > I prefer mixedCaseStyle, and I think that should be "standard", I dislike it. It's inconsistent, and confusingly similar to TitleCaseStyle used for class names in Python. > as this style is commonly used in all "major" languages , for > ex

Re: ten small Python programs

2007-05-27 Thread Steven Bethard
Steve Howell wrote: > --- Steven Bethard <[EMAIL PROTECTED]> wrote: > >> I think I would rewrite the current unit-testing >> example to use the >> standard library unittest module:: >> >> # Let's write reusable code, and unit test it. >> def add_money(amounts): >> # do arithmet

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > --- Steven Bethard <[EMAIL PROTECTED]> > wrote: > >> I think I would rewrite the current unit-testing > >> example to use the > >> standard library unittest module:: > >> > >> # Let's write reusable code, and unit test

Re: ten small Python programs

2007-05-27 Thread Steven Bethard
Steve Howell wrote: > --- Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Steve Howell wrote: >>> --- Steven Bethard <[EMAIL PROTECTED]> >> wrote: I think I would rewrite the current unit-testing example to use the standard library unittest module:: # Let's write reus

unit testing

2007-05-27 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > Have you tried py.test? > > http://codespeak.net/py/dist/test.html > > I've heard good things about it, but haven't gotten > around to trying it > yet. Here's a two-line test suite from the page > above: > > def test_answer(): >

Re: ten small Python programs

2007-05-27 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > > > > Maybe this is the first good example that > motivates a > > hyperlink to alternatives. Would you accept the > idea > > that we keep my original example on the > SimplePrograms > > page, but we link to a UnitTestingPhilosophies > page, > > and

Re: itertools.groupby

2007-05-27 Thread Carsten Haese
On Sun, 2007-05-27 at 10:17 -0700, 7stud wrote: > Bejeezus. The description of groupby in the docs is a poster child > for why the docs need user comments. Can someone explain to me in > what sense the name 'uniquekeys' is used this example: > > > import itertools > > mylist = ['a', 1, 'b', 2,

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Paul Rubin
Paul McGuire <[EMAIL PROTECTED]> writes: > code about once/year. But it does mean that additions to the external > API to the std lib will contain method calls such as get_files, > send_message, delete_record, etc. I think this just promotes a > perception of Python as "so last century." I think

Re: Why isn't this query working in python?

2007-05-27 Thread Steve Holden
Steve Howell wrote: > --- erikcw <[EMAIL PROTECTED]> wrote: ('SELECT payment_id FROM amember_payments WHERE >> member_id=%s AND expire_date > NOW() AND completed=1 AND >> (product_id >11 AND product_id <21)', (1608L,)) () >> Here is a copy of the table schema and the first 2 >>

Re: itertools.groupby

2007-05-27 Thread paul
Steve Howell schrieb: > --- Steve Howell <[EMAIL PROTECTED]> wrote: > >> --- 7stud <[EMAIL PROTECTED]> wrote: >> >>> Bejeezus. The description of groupby in the docs >> is >>> a poster child >>> for why the docs need user comments. > > Regarding the pitfalls of groupby in general (even > assum

Re: Why isn't this query working in python?

2007-05-27 Thread Steve Holden
erikcw wrote: > On May 26, 8:21 pm, John Machin <[EMAIL PROTECTED]> wrote: >> On May 27, 5:25 am, erikcw <[EMAIL PROTECTED]> wrote: >> >> >> >>> On May 25, 11:28 am, Carsten Haese <[EMAIL PROTECTED]> wrote: On Fri, 2007-05-25 at 09:51 -0500, Dave Borne wrote: >> I'm trying to run the follo

Re: ten small Python programs

2007-05-27 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > I think I would rewrite the current unit-testing example to use the > standard library unittest module:: I think these days we're supposed to like doctest better than unittest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why isn't this query working in python?

2007-05-27 Thread davelist
On May 27, 2007, at 4:01 PM, Steve Holden wrote: > erikcw wrote: >> On May 26, 8:21 pm, John Machin <[EMAIL PROTECTED]> wrote: >>> On May 27, 5:25 am, erikcw <[EMAIL PROTECTED]> wrote: >>> >>> >>> On May 25, 11:28 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-05-25 at 09:51

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Roy Smith
Ben Finney <[EMAIL PROTECTED]> wrote: > Is C no longer a "major" language? The long-standing convention there > is for lower_case_with_underscores. Which dates back to the days of ASR-33's which only had one case (upper case, as a matter of fact). Does nobody else remember C compilers which acc

Can python create a dictionary from a list comprehension?

2007-05-27 Thread erikcw
Hi, I'm trying to turn o list of objects into a dictionary using a list comprehension. Something like entries = {} [entries[int(d.date.strftime('%m'))] = d.id] for d in links] I keep getting errors when I try to do it. Is it possible? Do dictionary objects have a method equivalent to [].appe

Re: Why isn't this query working in python?

2007-05-27 Thread erikcw
On May 27, 4:01 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > erikcw wrote: > > On May 26, 8:21 pm, John Machin <[EMAIL PROTECTED]> wrote: > >> On May 27, 5:25 am, erikcw <[EMAIL PROTECTED]> wrote: > > >>> On May 25, 11:28 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-05-25 at 09

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread half . italian
On May 27, 1:55 pm, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to turn o list of objects into a dictionary using a list > comprehension. > > Something like > > entries = {} > [entries[int(d.date.strftime('%m'))] = d.id] for d in links] > > I keep getting errors when I try to do it. Is

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread Stefan Sonnenberg-Carstens
erikcw schrieb: > Hi, > > I'm trying to turn o list of objects into a dictionary using a list > comprehension. > > Something like > > entries = {} > [entries[int(d.date.strftime('%m'))] = d.id] for d in links] > > I keep getting errors when I try to do it. Is it possible? Do > dictionary objects

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread Pierre Quentel
On 27 mai, 22:55, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to turn o list of objects into a dictionary using a list > comprehension. > > Something like > > entries = {} > [entries[int(d.date.strftime('%m'))] = d.id] for d in links] > > I keep getting errors when I try to do it. Is i

expat parser

2007-05-27 Thread Sebastian Bassi
I have this code: import xml.parsers.expat def start_element(name, attrs): print 'Start element:', name, attrs def end_element(name): print 'End element:', name def char_data(data): print 'Character data:', repr(data) p = xml.parsers.expat.ParserCreate() p.StartElementHandler = start_e

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- paul <[EMAIL PROTECTED]> wrote: > > > > Regarding the pitfalls of groupby in general (even > > assuming we had better documentation), I invite > people > > to view the following posting that I made on > > python-ideas, entitled "SQL-like way to manipulate > > Python data structures": > > >

Re: itertools.groupby

2007-05-27 Thread Steve Howell
--- Carsten Haese <[EMAIL PROTECTED]> wrote: > On Sun, 2007-05-27 at 10:17 -0700, 7stud wrote: > > Bejeezus. The description of groupby in the docs > is a poster child > > for why the docs need user comments. Can someone > explain to me in > > what sense the name 'uniquekeys' is used this > exa

Re: Help with PySMS

2007-05-27 Thread Petr Jakes
Maybe you can try python binding for gammu, which works great for me. HTH Petr Jakes http://cihar.com/gammu/python/ -- http://mail.python.org/mailman/listinfo/python-list

Error in optparse documentation

2007-05-27 Thread Shatadal
In the python documentation section 14.3.2.6 (http://docs.python.org/ lib/optparse-generating-help.html) in the last line it is written "options that have a default value can include %default in the help string--optparse will replace it with str() of the option's default value. If an option has no

Re: Newbie question - better way to do this?

2007-05-27 Thread John Machin
On May 28, 12:46 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 27 May 2007 06:44:01 -0700, Eric wrote: > > words is a big long array of strings. What I want to do is find > > consecutive sequences of words that have the first letter capitalized, > > and then call doSomething on them. (

Re: Newbie question - better way to do this?

2007-05-27 Thread Steve Howell
--- John Machin <[EMAIL PROTECTED]> wrote: (And you can > > > ignore the fact that > > > it won't find a sequence at the very end of > words, that is fine for my > > > purposes). > > [...] > > Bzzzt. Needs the following code at the end: > if accumulator: > doSomething(accumulator) > FWIW th

Re: How to do this in python with regular expressions

2007-05-27 Thread snorble
On May 25, 6:51 am, Jia Lu <[EMAIL PROTECTED]> wrote: > Hi all > > I'm trying to parsing html with re module. > > html = """ > > > > DATA1DATA2DATA3 HT>DATA4 > > > DATA5DATA6DATA7DATA8 > > > """ > > I want to get DATA1-8 from that string.(DATA maybe not english words.) > Can anyone tell me h

Re: Newbie question - better way to do this?

2007-05-27 Thread Steven D'Aprano
On Sun, 27 May 2007 14:55:42 -0700, John Machin wrote: > On May 28, 12:46 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Sun, 27 May 2007 06:44:01 -0700, Eric wrote: >> > words is a big long array of strings. What I want to do is find >> > consecutive sequences of words that have the firs

Re: ten small Python programs

2007-05-27 Thread Adonis Vargas
Steve Howell wrote: > I've always thought that the best way to introduce new > programmers to Python is to show them small code > examples. You could try this wiki page: http://rosettacode.org/wiki/Main_Page It has a fair amount of Python examples as well as many more other languages (doing

Re: Error in optparse documentation

2007-05-27 Thread Steven Bethard
Shatadal wrote: > In the python documentation section 14.3.2.6 (http://docs.python.org/ > lib/optparse-generating-help.html) in the last line it is written > > "options that have a default value can include %default in the help > string--optparse will replace it with str() of the option's default

Re: Newbie question - better way to do this?

2007-05-27 Thread Steve Howell
--- Steven D'Aprano wrote: > On Sun, 27 May 2007 14:55:42 -0700, John Machin > wrote: > > Bzzzt. > Bzzzt! Can we please refrain from buzzer sounds in this mostly civil forum, even if one beep deserves another? __

  1   2   >