Re: how to print the GREEK CAPITAL LETTER delta under utf-8 encoding

2007-05-28 Thread 人言落日是天涯,望极天涯不见家
On 5月29日, 下午1时34分, "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote: > 人言落日是天涯,望极天涯不见家 schrieb: > > > I lookup the utf-8 form of delta from the link. > >http://www.fileformat.info/info/unicode/char/0394/index.htm > > > and then I want to print it in the python ( I work under windows) > > > #!/usr/bin/p

Re: itertools.groupby

2007-05-28 Thread Raymond Hettinger
On May 28, 8:36 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote: > And while > we're at it, it probably should be keyfunc(value), not key(value). No dice. The itertools.groupby() function is typically used in conjunction with sorted(). It would be a mistake to call it keyfunc in one place and not

Periodic tasks.

2007-05-28 Thread Ramashish Baranwal
Hi, I am trying to execute some tasks periodically, those familiar with unix can think of it as equivalent to cron jobs. I have tried looking around, but couldn't find a way. Would appreciate any pointers or clues.. Thanks, -Ram -- http://mail.python.org/mailman/listinfo/python-list

Re: gui application on cross platform

2007-05-28 Thread Etienne Hilson
> > james_027 wrote: > > > Hi, > > > > > > I am using delphi to develop gui application, and wish to make a shift > > > to python. here are some of my question/concern... > > > > > > 1. is python develop gui application a cross platform? just like java > > > swing? My first programming language wa

3D libraries (was The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations)

2007-05-28 Thread Ville Oikarinen
On Tue, 29 May 2007, Jon Harrop wrote: > Anyway, are there any libraries to do hardware accelerated vector graphics > in Perl, Python, Lisp, Java or any functional language (except OCaml and F# > and excluding WPF and Silverlight)? I believe there are OpenGL bindings for quite many languages, her

Re: how to print the GREEK CAPITAL LETTER delta under utf-8 encoding

2007-05-28 Thread Martin v. Lo
人言落日是天涯,望极天涯不见家 schrieb: > I lookup the utf-8 form of delta from the link. > http://www.fileformat.info/info/unicode/char/0394/index.htm > > and then I want to print it in the python ( I work under windows) > > #!/usr/bin/python > #coding=utf-8 > > print "\xce\x94" > > but the result is not the

Re: Module listing in order.

2007-05-28 Thread Nick Craig-Wood
Ramashish Baranwal <[EMAIL PROTECTED]> wrote: > > > I want a way to get the contents in the order of their declaration, > > > i.e. [B, A, D]. Does anyone know a way to get it? > > > > My suggestion would be to actually parse the text of the module. "Brute > > force" is what it's called ;). But doin

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-05-28 Thread Jon Harrop
Markus E Leypold wrote: > The answer to your question is very simple: Xah Lee is a troll. In this context, I believe he is marketing/advertising himself as a consultant and some kind of vampiric man-whore according to this page: http://xahlee.org/PageTwo_dir/Personal_dir/xah.html "... I'm tech

Re: DbiDate object

2007-05-28 Thread Frank Millman
On May 29, 12:51 am, revuesbio <[EMAIL PROTECTED]> wrote: > Hi all > > I am using odbc to connect to Microsoft Access DB. When I send a > request with a datetime column from the database, odbc returns > something called a DbiDate object. > ex :>>> x=data[0][2] > > >>> print x > > Fri Apr 20 07:27

RE: gui application on cross platform

2007-05-28 Thread Eiwot
Yes, Python can develop cross platform application. I'm using PyGTK which is a binding between GTK and Python. Check it out at http://pyarticles.blogspot.com Cheers> Date: Mon, 28 May 2007 18:52:08 +1000> From: [EMAIL PROTECTED]> Subject: Re: gui application on cross platform> To: python-list@

how to print the GREEK CAPITAL LETTER delta under utf-8 encoding

2007-05-28 Thread 人言落日是天涯,望极天涯不见家
I lookup the utf-8 form of delta from the link. http://www.fileformat.info/info/unicode/char/0394/index.htm and then I want to print it in the python ( I work under windows) #!/usr/bin/python #coding=utf-8 print "\xce\x94" but the result is not the 'delta' but an unknown character. -- http://

Re: Circular imports

2007-05-28 Thread Carsten Haese
On Mon, 28 May 2007 23:46:00 -0400, Ron Provost wrote > [...] python is not happy about my circular imports [...] A circular import is not a problem in itself. I'm guessing you're running into a situation like this: Module A imports module B and then defines an important class. Module B imports

Storing tracebacks

2007-05-28 Thread George Sakkis
I'm reading the docs on sys.exc_info() but I can't tell for sure whether I'm using it safely to get a snapshot of an exception and reraise it later. The use case is a class which acts like a deferred callable, a callable that will be called at some point in the future (possibly in a different threa

Circular imports

2007-05-28 Thread Ron Provost
Hello, I'm in the process of porting a project from Java to python. The original project is very poorly organized. Nearly each class is depentant upon nearly every other class. Before I go playing around with the logic by moving things around and cleaning up the code, I want to get it workin

Re: itertools.groupby

2007-05-28 Thread Carsten Haese
On Mon, 28 May 2007 23:02:31 -0400, Gordon Airporte wrote > ''' > class groupby(__builtin__.object) > | groupby(iterable[, keyfunc]) -> create an iterator which returns > | (key, sub-iterator) grouped by each value of key(value). > | > ''' > > "Each" seems to imply uniqueness here. Yes, I

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Gordon Airporte <[EMAIL PROTECTED]> writes: > "itertools.groupby_except_the_notion_of_uniqueness_is_limited_to- > _contiguous_runs_of_elements_having_the_same_key()" doesn't have much > of a ring to it. I guess this gets back to documentation problems, > because the help string says nothing about t

Re: Resize image NO PIL!!

2007-05-28 Thread Dave Benjamin
cbmeeks wrote: > I have created an image hosting site and when a user uploads an image, > I want a service to run on the server to create a few thumbnails while > the user does other things. > > My stupid host (pair.com) doesn't have PIL installed and I'm too much > of a stupid newbie to figure ou

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

2007-05-28 Thread Frank Swarbrick
Roy Smith wrote: > I really like lisp's convention of using dashes instead of underscores, > i.e. ip-address and snmp-manager. I think the only reason most languages > don't use that is the parsing ambiguity, but if you required white space > around all operators, then "ip-address" would unambi

Re: itertools.groupby

2007-05-28 Thread Gordon Airporte
Paul Rubin wrote: > It chops up the iterable into a bunch of smaller ones, but the total > size ends up the same. "Telescope", "compact", "collapse" etc. make > it sound like the output is going to end up smaller than the input. Good point... I guess I was thinking in terms of the number of iter

Patch to pydoc (partial) to handle encodings other than ascii

2007-05-28 Thread w . m . gardella . sambeth
Hello Pythonists: I am using SPE as python IDE on Windows, with Python 2.5.1 installed (official distro). As my mother tongue is Spanish, I had documented some modules in it (I now, I should have documented all in English, except if I were 110% sure than nobody else would read my docs, but they are

Resize image NO PIL!!

2007-05-28 Thread cbmeeks
I have created an image hosting site and when a user uploads an image, I want a service to run on the server to create a few thumbnails while the user does other things. My stupid host (pair.com) doesn't have PIL installed and I'm too much of a stupid newbie to figure out how to get it to work wit

Air Jordan Shoes on Sale - $75

2007-05-28 Thread www_ieshoes_com
ieshoes.com shop Jordan 1-21's Bape shoes On Sale Now $75 http://www.ieshoes.com msn:[EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread 人言落日是天涯,望极天涯不见家
I see. Many thanks to you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python command line error

2007-05-28 Thread Mick Duprez
On May 29, 11:33 am, Max Erickson <[EMAIL PROTECTED]> wrote: > Mick Duprez <[EMAIL PROTECTED]> wrote: > > Hi All, > > > I've installed Python 2.5 on a number of machines but on one I'm > > having problems with the CLI. > > If I fire up the 'cmd' dos box and type 'python' I get a line of > > gibberi

Re: Python command line error

2007-05-28 Thread Max Erickson
Mick Duprez <[EMAIL PROTECTED]> wrote: > Hi All, > > I've installed Python 2.5 on a number of machines but on one I'm > having problems with the CLI. > If I fire up the 'cmd' dos box and type 'python' I get a line of > gibberish and it locks up the cli, if I run the 'command' dos box > I get a fe

Re: gui application on cross platform

2007-05-28 Thread Ed Leafe
On May 28, 2007, at 2:01 AM, james_027 wrote: > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... > > 1. is python develop gui application a cross platform? just like java > swing? wxPython is probably the best cros

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

2007-05-28 Thread Eric S. Johansson
Paul McGuire wrote: > At first, Guido seemed ambivalent, and commented on the > contentiousness of the issue, but it seems that the "non-English > speakers can more easily find word breaks marked with underscores" > justification tipped the scale in favor of > lower_case_with_underscores. > > Th

Re: Long double in Python

2007-05-28 Thread Alex Martelli
Charles Vejnar <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks for both suggestions. > > I have indeed tried gmpy. For me, it's not very important to choose between > numpy or gmpy. > > I hope I won't be off topic. But, as I told you before, I have a C library > using "long double" numbers and I wo

Python command line error

2007-05-28 Thread Mick Duprez
Hi All, I've installed Python 2.5 on a number of machines but on one I'm having problems with the CLI. If I fire up the 'cmd' dos box and type 'python' I get a line of gibberish and it locks up the cli, if I run the 'command' dos box I get a few lines of garbage and it crashes/closes the dos box.

Re: Tkinter error

2007-05-28 Thread BartlebyScrivener
On May 28, 4:57 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >>> b1 = Button(win,text="One") > >>> b2 = Button(win,text="Two") That worked. Thank you. Rick -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Paul Rubin writes: > >See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259173 > But that recipe generates the groups in a random order depending on > the dict hashing, Correction, it generates the right order in this case, although it builds up an in-memo

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

2007-05-28 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > There was also Hypercard from Apple in (by memory) 1988. Although case was > not significant, handlers were usually written mouseDown, mouseUp, > openStack, openCard, etc. Apple (*cough*) Xerox PARC (*cough*). I think that style got into the Macintosh

DbiDate object

2007-05-28 Thread revuesbio
Hi all I am using odbc to connect to Microsoft Access DB. When I send a request with a datetime column from the database, odbc returns something called a DbiDate object. ex : >>> x=data[0][2] >>> print x Fri Apr 20 07:27:45 2007 I would like to select columns where datetime ("DbiDate column")

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Raymond Hettinger <[EMAIL PROTECTED]> writes: > I think the OP would have been better-off with plain > vanilla Python such as: > >See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259173 But that recipe generates the groups in a random order depending on the dict hashing, instead of

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

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 14:12:33 -0700, Alex Martelli wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Historically, it's only Java and the Windows world (including non- >> standard Windows-style C++) that use forcedCase significantly (C# >> draws from both). > > I remember meeting that st

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Alex Martelli <[EMAIL PROTECTED]> wrote: > Steve Howell <[EMAIL PROTECTED]> wrote: >... > > for has_chars, frags in itertools.groupby(lines, > > lambda x: len(x) > 0): > > Hmmm, it appears to me that itertools.groupby(lines, > bool) should do > just the same job, just a bit faster and si

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > That's not for everyone, so it isn't a loss if > > > someone sticks > > > with writing plain, clear everyday Python > instead of > > > an itertool. > > > > I know most of the module is fairly advanced, and > that > > average users can mostly

Re: Tkinter error

2007-05-28 Thread Peter Otten
BartlebyScrivener wrote: > Finally started trying to build a simple gui form for inserting text > data into a mysql db of quotations. > > I found this nice Tkinter tutorial, > > http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html > > but midway I'm getting an error. > > from Tkinter import * >

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > > > But that is what groupby does, except its notion of > uniqueness is > limited to contiguous runs of elements having the > same key. It occurred to me that we could also rename the function uniq(), or unique(), after its Unix counterpa

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> > > > I don't know MoinMoin, > but the answer is Yes (although maybe not for your > ten snippets). > First of all I think all programmers keep there own > collection of code snippets, > which much more valuable then "all the code code > snippets from everyone"

Tkinter error

2007-05-28 Thread BartlebyScrivener
Finally started trying to build a simple gui form for inserting text data into a mysql db of quotations. I found this nice Tkinter tutorial, http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html but midway I'm getting an error. from Tkinter import * >>> win = Tk() >>> f = Frame(win) >>> b1 = But

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Gordon Airporte <[EMAIL PROTECTED]> writes: > This is my first exposure to this function, and I see that it does > have some uses in my code. I agree that it is confusing, however. > IMO the confusion could be lessened if the function with the current > behavior were renamed 'telescope' or 'compact

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
Steve Howell wrote: > --- Stef Mientki <[EMAIL PROTECTED]> > wrote: It would even be nicer, if everybody could drop her/his examples in a standard way, so they would be automatically incorporated in something like the wxPython interactive demo. >>> Can you elaborate? >

Re: itertools.groupby

2007-05-28 Thread Gordon Airporte
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: > This is my first exposure to this function, and I see that it does have some uses in

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

2007-05-28 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Historically, it's only Java and the Windows world (including non- > standard Windows-style C++) that use forcedCase significantly (C# > draws from both). I remember meeting that style first in the X Window System (now commonly known as X11, but it w

Re: itertools.groupby

2007-05-28 Thread Alex Martelli
Steve Howell <[EMAIL PROTECTED]> wrote: ... > for has_chars, frags in itertools.groupby(lines, > lambda x: len(x) > 0): Hmmm, it appears to me that itertools.groupby(lines, bool) should do just the same job, just a bit faster and simpler, no? Alex -- http://mail.python.org/mailman/listinfo/p

Re: User input with a default value that can be modified

2007-05-28 Thread half . italian
On May 28, 11:52 am, "Etienne Hilson" <[EMAIL PROTECTED]> wrote: > Hello the list :-) > > I do a little program that permit the user to manage list of sentences. > This program runs into a linux shell. > The user can add, modify and delete the sentences. > > What I want to do is : > > When the user

Re: itertools.groupby

2007-05-28 Thread Raymond Hettinger
> > That's not for everyone, so it isn't a loss if > > someone sticks > > with writing plain, clear everyday Python instead of > > an itertool. > > I know most of the module is fairly advanced, and that > average users can mostly avoid it, but this is a very > common-antipattern that groupby() solv

Re: User input with a default value that can be modified

2007-05-28 Thread half . italian
On May 28, 11:52 am, "Etienne Hilson" <[EMAIL PROTECTED]> wrote: > Hello the list :-) > > I do a little program that permit the user to manage list of sentences. > This program runs into a linux shell. > The user can add, modify and delete the sentences. > > What I want to do is : > > When the user

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> wrote: > > > >> It would even be nicer, if everybody could drop > >> her/his examples > >> in a standard way, so they would be automatically > >> incorporated in > >> something like the wxPython interactive demo. > >> > > > > Can you elaborate? > > Well if y

Re: expat parser

2007-05-28 Thread Stefan Behnel
Sebastian Bassi wrote: > 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.Parser

ANN: IPyKit, the standalone IPython prompt

2007-05-28 Thread Ville Vainio
Some of you might want to play with IPyKit, especially you need a swiss-army-knife Python prompt on a (win32) machine where you don't really want to install anything (python, pyreadline, ipython, PATH settings...). It's basically a py2exe'd "preconfigured" IPython. http://ipython.scipy.org/moin/I

User input with a default value that can be modified

2007-05-28 Thread Etienne Hilson
Hello the list :-) I do a little program that permit the user to manage list of sentences. This program runs into a linux shell. The user can add, modify and delete the sentences. What I want to do is : When the user want to modify one sentence, I would like to do this : Modify your sentence :

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
> >> The wxPython demo program is written as an >> interactive tutorial, >> with a few hundred examples, nicely ordered in >> groups. >> The user can view the demo, the code and the help >> text. >> The user can also change the code and see the >> results right away. >> > > Do you have a link? w

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

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 14:53:57 -0300, Dennis Lee Bieber <[EMAIL PROTECTED]> escribió: > On Sun, 27 May 2007 20:35:28 -0400, Carsten Haese <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> On Sun, 2007-05-27 at 16:39 -0400, [EMAIL PROTECTED] wrote: >> > > sql = ""

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > That's not for everyone, so it isn't a loss if > someone sticks > with writing plain, clear everyday Python instead of > an itertool. > I know most of the module is fairly advanced, and that average users can mostly avoid it, but this is a very

Re: Tix and OS X

2007-05-28 Thread Jeff Reavis
On May 26, 8:51 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: > Jeff Reavis wrote: > > Does python not ship with Tix for OS X? I know there was an issue with > > 2.5.0 and Tix on Windows, and upgrading to 2.5.1 fixed it. > > Unfortunately, I seem to have the same issue with OS X and 2.5.1. The > > er

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Carsten Haese <[EMAIL PROTECTED]> wrote: > On Sun, 2007-05-27 at 18:12 -0700, Steve Howell > wrote: > > [...] there is no way > > that "uniquekeys" is a sensible variable [...] > > That's because the OP didn't heed the advice from > the docs that > "Generally, the iterable needs to already b

Re: itertools.groupby

2007-05-28 Thread Raymond Hettinger
On May 28, 8:34 am, 7stud <[EMAIL PROTECTED]> wrote: > >- there are two more examples on the next page. those two > > examples also give sample inputs and outputs. > > I didn't see those. Ah, there's the rub. The two sections of examples and recipes are there for a reason. This isn't a beginne

Re: speeding things up with C++

2007-05-28 Thread bullockbefriending bard
thanks. i'll definitely look into this. On May 28, 10:48 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On May 26, 11:19 am, bullockbefriending bard <[EMAIL PROTECTED]> > wrote: > > > > > I've done all the requisite profiling and thought fairly deeply about > > the efficiency of my python code, but

Re: Formal interfaces with Python

2007-05-28 Thread Terry Reedy
"Florian Lindner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | some time ago I've heard about proposals to introduce the concecpt of | interfaces into Python. I found this old and rejected PEP about that: | http://www.python.org/dev/peps/pep-0245/ | | What is the current

Build problems with sqlite on OSX

2007-05-28 Thread Darrin Thompson
I'm attempting to build python 2.5.1 fat binaries on OSX and statically link to a newer sqlite than what ships with OSX. (3.3.17). I'm getting "Bus Error" early when I run my app. If I turn on a lot of malloc debugging options and run under gdb I get this trace: (gdb) info threads * 1 process 189

vte examples and installation

2007-05-28 Thread Fabian Braennstroem
Hi, I am looking for simple vte examples mainly for pygtk. Can anyone point me in the right direction or is there a better terminal emulation for pygtk? It would be nice, if there exist a good howto for installing vte up for the use of python; esp. for an old redhat/scientific linux machine... I a

Re: Good idea to use a class as function with __new__?

2007-05-28 Thread glomde
Gabriel Genellina wrote: > def __call__(self, *args, **kwds): > return self.__TemplateMethod(*args, **kwds) > > x = Template()(prefix="foo") > or perhaps: > x = Template(prefix="foo")() > > I think the extra () improves readability - it's clear that x comes from a > function call, it

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > I've always thought that the best way to introduce > new > > programmers to Python is to show them small code > > examples. > > > This is really a nice piece of missing Python. > Thanks. > The wxPython demo program is wr

Re: Good idea to use a class as function with __new__?

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 09:17:30 -0300, glomde <[EMAIL PROTECTED]> escribió: > I am implementing som code generation and want to to use some variant > of the template method pattern. > > What I came up with is to have a class with the common part > in a method and the subclasses can then override the

Re: speeding things up with C++

2007-05-28 Thread Kay Schluehr
On May 26, 11:19 am, bullockbefriending bard <[EMAIL PROTECTED]> wrote: > I've done all the requisite profiling and thought fairly deeply about > the efficiency of my python code, but am still going to have to speed > up the innermost guts of what I am doing. > > Essentially, I need to pass a list

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

2007-05-28 Thread Sergei Organov
Roy Smith <[EMAIL PROTECTED]> writes: [...] > On the other hand, I'm convinced that words_with_underscores, is easier to > read. This is especially true when abbreviations creep into variable > names. It's certainly easier to parse ip_address as compared to IPAddress. > Same with snmp_manager

Re: Newbie question - better way to do this?

2007-05-28 Thread Steve Howell
--- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > > I disagree that word.istitle is the correct idiom - > from the naming of > the function in the original example, I would guess > "word[0].isupper" > would do the trick. > That would return something like this: You want to add parens: wor

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 09:10:40 -0300, Peter Otten <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: > >> En Mon, 28 May 2007 06:17:39 -0300, ??? >> <[EMAIL PROTECTED]> escribió: >> >>> def __init__(self, name, mode): >>> file.__init__(self, name, mode) >>> se

Re: ten small Python programs

2007-05-28 Thread Kay Schluehr
Just for the amusement of the audience. The following is a reusable testscript: >>> def add_money(amounts): ... pennies = sum([round(int(amount * 100)) for amount in amounts]) ... return float(pennies / 100.0) ... >>> add_money([0.13, 0.02]) == 0.15 0.14999 >>> add_money([0.13,

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
Steve Howell wrote: > I've always thought that the best way to introduce new > programmers to Python is to show them small code > examples. > This is really a nice piece of missing Python. Sorry I didn't follow this thread accurately, but have you considered to produce an example environment li

Re: itertools.groupby

2007-05-28 Thread 7stud
On May 27, 6:50 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On May 27, 2:59 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > > > These docs need work. Please do not defend them; > > please suggest improvements. > > FWIW, I wrote those docs. Suggested improvements are > welcome; however, I thi

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

2007-05-28 Thread Steve Howell
--- Roy Smith <[EMAIL PROTECTED]> wrote: > It's certainly easier to parse ip_address as > compared to IPAddress. > Same with snmp_manager vs SNMPManager. > Somebody earlier was actually advocating something called proper_case, in which you can capitalize certain letters for clarity, like test

Re: Newbie question - better way to do this?

2007-05-28 Thread Nis Jørgensen
Steve Howell skrev: > --- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > >> Steve Howell skrev: >> >>> def firstIsCapitalized(word): >>> return 'A' <= word[0] <= 'Z' >> For someone who is worried about the impact of >> non-ascii identifiers, >> you are making surprising assumptions about the >> co

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > [...] > Here's yet another example that came up in something > I was working on: > you are indexing a book and you want to print a list > of page numbers > for pages that refer to George Washington. If > Washington occurs on > several conse

gettext backwards

2007-05-28 Thread SPE - Stani's Python Editor
I am developping an international application for which I use gettext. An user can fill in certain fields with variable names which are also localized, eg: filename _('filename') = 'bestandsnaam' #for dutch As an english user might save this configuration, I want that eg a Dutch user can open thi

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

2007-05-28 Thread Roy Smith
In article <[EMAIL PROTECTED]>, 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".

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > + The operation of \function{groupby()} is similar > to the \code{uniq} > filter > + in \UNIX{}. [...] Thanks! The comparison of groupby() to "uniq" really clicks with me. To the extent that others like the Unix command line analogy for u

Re: Can string be callable as a method ?

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 06:45:47 -0700, Jia Lu wrote: > Hi all > I tried to scan a directory and __import__ all modules , > > imported module: help > imported module: __init__ > imported module: hi > imported module: thanks > > and I scaned all methods in them, and put them to a list like: > > [['

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

2007-05-28 Thread Steven Bethard
John J. Lee wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > [...] >> http://mail.python.org/pipermail/python-dev/2005-December/058750.html >> >> At first, Guido seemed ambivalent, and commented on the >> contentiousness of the issue, but it seems that the "non-English >> speakers can more easil

Re: gui application on cross platform

2007-05-28 Thread johnf
james_027 wrote: > Hi, > > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... > > 1. is python develop gui application a cross platform? just like java > swing? > 2. delphi makes things easy for me like coding for a specifi

Re: a bug in python windows service?

2007-05-28 Thread momobear
On May 27, 11:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > 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 > >> ex

Can string be callable as a method ?

2007-05-28 Thread Jia Lu
Hi all I tried to scan a directory and __import__ all modules , imported module: help imported module: __init__ imported module: hi imported module: thanks and I scaned all methods in them, and put them to a list like: [['f_chelp', 'f_help'], [], ['f_exclaim', 'f_hi', 'random'], ['f_thanks', 'r

Re: itertools.groupby

2007-05-28 Thread Carsten Haese
On Sun, 2007-05-27 at 20:28 -0700, Paul Rubin wrote: >fst = operator.itemgetter(0) >snd = operator.itemgetter(1) > >def bates(fd): > # generate tuples (n,d) of lines from file fd, > # where n is the record number. Just iterate through all lines > # of the file, stamping

Re: Newbie question - better way to do this?

2007-05-28 Thread Steve Howell
--- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Steve Howell skrev: > > > def firstIsCapitalized(word): > > return 'A' <= word[0] <= 'Z' > > For someone who is worried about the impact of > non-ascii identifiers, > you are making surprising assumptions about the > contents of data. > The f

Re: Error in optparse documentation

2007-05-28 Thread Shatadal
On May 28, 2:19 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Shatadal > wrote: > > > I think the documentation should be modified so that it is made clear > > that %default in the help string behaves as is claimed only in version > > 2.4 and higher. > > Maybe so

Re: What's the best way to iniatilize a function

2007-05-28 Thread Laurent Pointal
Jack wrote: >>> 2. what's the right way to call mylib_exit()? I put it in __del__(self) >>> but it is not being called in my simple test. >> >> instance.__del__ is only called when there are no references to the >> instance. > > I didn't call del explicitly. I'm expecting Python to call it when >

Re: What's the best way to iniatilize a function

2007-05-28 Thread Steven D'Aprano
On Sun, 27 May 2007 23:20:49 -0700, Jack wrote: > Thanks Steven, for the reply. Very helpful. I've got a lot to learn in > Python :) > > Some questions: > >> (1) Python can automatically free most data structures and close open >> files, but if your needs are more sophisticated, this approach m

Re: itertools.groupby

2007-05-28 Thread Carsten Haese
On Sun, 2007-05-27 at 18:12 -0700, Steve Howell wrote: > [...] there is no way > that "uniquekeys" is a sensible variable [...] That's because the OP didn't heed the advice from the docs that "Generally, the iterable needs to already be sorted on the same key function." > http://informixdb.blogsp

Python-URL! - weekly Python news and links (May 28)

2007-05-28 Thread Gabriel Genellina
QOTW: "Good God! Is there *anything* that python does not already do? I hardly feel the need to write programs anymore ... Its really 80% like of the questions that are asked here get answered along the lines of: import some_fancy_module solution = some_fancy_module.exactly_the_right_func

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

2007-05-28 Thread John J. Lee
Roy Smith <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Cameron Laird) > wrote: > > > Hmmm; now you've got me curious. What *were* the first > > composite projectiles? > > Fetchez la Vache! :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to iniatilize a function

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 11:01:26 +0200, Gregor Horvath wrote: > Jack schrieb: > >> I didn't call del explicitly. I'm expecting Python to call it when >> the program exits. I put a logging line in __del__() but I never >> see that line printed. It seems that __del__() is not being called >> even when

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

2007-05-28 Thread John J. Lee
Paul McGuire <[EMAIL PROTECTED]> writes: [...] > http://mail.python.org/pipermail/python-dev/2005-December/058750.html > > At first, Guido seemed ambivalent, and commented on the > contentiousness of the issue, but it seems that the "non-English > speakers can more easily find word breaks marked w

Re: Flags of the world

2007-05-28 Thread Ben Finney
Tim Churches <[EMAIL PROTECTED]> writes: > http://shaheeilyas.com/flags/ > > Scroll to the bottom to see why this is not entirely off-topic. I fail to see what it has to do with the thread you're replyiing to, which is a discussion of creating a dictionary from a list comprehension. If you want

Good idea to use a class as function with __new__?

2007-05-28 Thread glomde
Hi, I am implementing som code generation and want to to use some variant of the template method pattern. What I came up with is to have a class with the common part in a method and the subclasses can then override the Customize methods to do their own special part. Now to the question I use the

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Peter Otten
Gabriel Genellina wrote: > En Mon, 28 May 2007 06:17:39 -0300, ??? > <[EMAIL PROTECTED]> escribió: > >> I wanna print the log to both the screen and file, so I simulatered a >> 'tee' >> >> class Tee(file): >> >> def __init__(self, name, mode): >> file.__init__(self, name,

pyAntTasks

2007-05-28 Thread kilnhead
I am trying to use pyAntTasks in Eclipse. I have followed the example in the ibm doc, but I get the following error: [taskdef] Could not load definitions from resource pyAntTasks.properties. It could not be found. I have added pyAntTasks to my classpath and AntHome directory. Anybody have any i

Re: speeding things up with C++

2007-05-28 Thread bullockbefriending bard
I wonder if Jython might be the answer? Java is going to be faster than Python for the time-critical part of my program. Does anybody have experience getting data structures like nested lists / tuples into a java routine from a running jython program (and then back again)? -- http://mail.python.o

FTP not Returning (Python on Series 60 Nokia)

2007-05-28 Thread Eisl Thomas
Hi! Do you already have found a solution for the FTP.storbinary hang-up-problem? I am writing a program who connects himself a lot of times to a FTP-Server, but in about 1 of 100 cases, it gets stuck in the storbinary command although the connection seems to work. I have already tried to set a

  1   2   >