Is there something similar to list comprehension in dict?

2009-11-20 Thread Peng Yu
I'm wondering if there is something similar to list comprehension for dict (please see the example code below). d = dict(one=1, two=2) print d def fun(d):#Is there a way similar to list comprehension to change the argument d so that d is changed? d=dict(three=3) fun(d) print d def fun1(d):

Re: New syntax for blocks

2009-11-20 Thread Gregory Ewing
Steven D'Aprano wrote: I don't know what the state of the art on Mac is these days, but in 1984s Macs had a standard keyboard layout that let you enter most available characters via the keyboard, using sensible mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down the Option

Re: python and web pages

2009-11-20 Thread Diez B. Roggisch
Daniel Dalton schrieb: Hi, Here is my situation: I'm using the command line, as in, I'm not starting gnome or kde (I'm on linux.) I have a string of text attached to a variable,. So I need to use one of the browsers on linux, that run under the command line, eg. lynx, elinks, links, links2 and d

Re: convert a string to a regex?

2009-11-20 Thread Diez B. Roggisch
Peng Yu schrieb: On Wed, Nov 18, 2009 at 9:12 PM, Tim Chase wrote: There are many special characters listed on http://docs.python.org/library/re.html I'm wondering if there is a convenient function that can readily convert a string with the special characters to its corresponding regex. For ex

Re: hex

2009-11-20 Thread Diez B. Roggisch
hong zhang schrieb: List, I want to input hex number instead of int number. in type="int" in following, parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int", default=0, help="index of 11n mcs table. Default: 0.") How can I do it? You can't. You can get a string, and convert th

real numbers with infinity precission

2009-11-20 Thread Hans Larsen
I have a READ.me file for real.py, but where could I get that module? I use Python 3.+ I hope that sombody can help me mailto: jo...@mail.dk -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.1 cx_Oracle 5.0.2 "ImportError: DLL load failed: The specified module could not be found."

2009-11-20 Thread Neil Hodgson
André: > Apparently the error is caused by cx_Oracle not being able to find the > Oracle client DLLs (oci.dll and others). The client home path and the > client home path bin directory are in the PATH System Variable and > oci.dll is there. Open the cx_Oracle extension with Dependency Walker (

Re: Where to find pexpect

2009-11-20 Thread yuzhichang
On 10月13日, 下午9时42分, Jean-Michel Pichavant wrote: > Antoon Pardon wrote: > > I have been looking forpexpect. The links I find like > >http://pexpect.sourceforge.netall end up at > >http://www.noah.org/wiki/Pexpectwhich produces a 404 not > > found problem. > > > Does someone know the current locati

Re: Is pexpect unmaintained now?

2009-11-20 Thread yuzhichang
On 11月17日, 上午11时40分, yuzhichang wrote: > Pexpect2.4 is only available at Pypi. Both the homepage > ofpexpect(http://www.noah.org/wiki/Pexpect) and download page > (http://sourceforge.net/projects/pexpect/files/) are outdated. The > repository on Github (http://github.com/noahspurrier/pexpect/) ha

Re: SCGIServer and unusal termination

2009-11-20 Thread Eden Kirin
Diez B. Roggisch wrote: - save a reference to sys.stdout *before* invoking the server - compare to it after interruption. If it has changed, you at least know that somebody messed with it, and can beat him or whatever you see fit. Thanks for the help. Finally, I dropped python-scgi module an

Re: TODO and FIXME tags

2009-11-20 Thread Marco Mariani
Jean-Michel Pichavant wrote: I guess the world is split in two categories, those how come back to fix the TODO, and those how don't. I for myself belong to the second, that is why I never write TODO comments, I either do the stuff or consider this is not important enough to waste time on it. I

Re: python gui builders

2009-11-20 Thread sturlamolden
On 18 Nov, 23:56, Kevin Walzer wrote: > wxWidgets (the C++ library) has support for a lot of things other than > UI bits, as well. wxPython itself is mainly a GUI library because the > additional features of wxWidgets in C++ are redundant in Python. That is true. Nobody uses wxPython for socket

Re: hex

2009-11-20 Thread Peter Otten
hong zhang wrote: > I want to input hex number instead of int number. in type="int" in > following, > > parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int", > default=0, help="index of 11n mcs table. Default: 0.") > > How can I do it? Workaround for the lazy: '0xff' on the comman

Re: Does turtle graphics have the wrong associations?

2009-11-20 Thread Robert Maas, http://tinyurl.com/uh3t
> > Who is your target audience? > From: "Alf P. Steinbach" > Someone intelligent who doesn't know anything or very much about > programming and wants to learn general programming. I think of what a computer *does* as data processing, and then programing is simply telling the computer what data p

Re: break LABEL vs. exceptions + PROPOSAL

2009-11-20 Thread Lo'oris
On Nov 18, 7:13 pm, Terry Reedy wrote: > It amounts to duplicating raise x...exception x as break xcontinue x > in the name of aesthetics and supposed efficiency. There would be no new > functionality nor any abbreviation of code. The semantics of there would be abbreviation: you wouldn't hav

Re: real numbers with infinity precission

2009-11-20 Thread Steven D'Aprano
On Thu, 19 Nov 2009 09:50:44 +0100, Hans Larsen wrote: > I have a READ.me file for real.py, but where could I get that module? I > use Python 3.+ > > I hope that sombody can help me Have you googled for "real.py"? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: python gui builders

2009-11-20 Thread Simon Hibbs
On 18 Nov, 22:11, Stef Mientki wrote: > Simon Hibbs wrote: > > On 18 Nov, 07:51, sturlamolden wrote: > > >> GPL > > > PyQT is GPL for now, but Qt itself is available under the LGPL as is > > PySide. Eventualy PySide, which tracks the PyQT API, will supplant it > > and the issue will be moot. For

Input characters not available on the keyboard (was: New syntax for blocks)

2009-11-20 Thread Ben Finney
Gregory Ewing writes: > Steven D'Aprano wrote: > > I don't know what the state of the art on Mac is these days, but in > > 1984s Macs had a standard keyboard layout that let you enter most > > available characters via the keyboard, using sensible mnemonics. > > E.g. on a US keyboard layout, you c

Re: New syntax for blocks

2009-11-20 Thread Carl Banks
On Nov 19, 12:20 am, Gregory Ewing wrote: > Steven D'Aprano wrote: > > I don't know what the state of the art on Mac is > > these days, but in 1984s Macs had a standard keyboard layout that let you > > enter most available characters via the keyboard, using sensible > > mnemonics. E.g. on a US key

Re: New syntax for blocks

2009-11-20 Thread Ben Finney
Carl Banks writes: > On Nov 19, 12:20 am, Gregory Ewing > wrote: > > They all still seem to work -- presumably generating the appropriate > > unicode characters now instead of MacRoman. > > ³It¹s about time.² I � Unicode. (lrf, gung *vf* qryvorengr, sbe gur uhzbhe-vzcnverq nzbat lbh) -- \

Re: getting properly one subprocess output

2009-11-20 Thread Bas
On Nov 18, 12:25 pm, Jean-Michel Pichavant wrote: > Hi python fellows, > > I'm currently inspecting my Linux process list, trying to parse it in > order to get one particular process (and kill it). > I ran into an annoying issue: > The stdout display is somehow truncated (maybe a terminal length i

Re: SCGIServer and unusal termination

2009-11-20 Thread Дамјан Георгиевски
> everything works just fine, but one thing bothers me. All prints after > try-except block are executed twice after the Ctrl+C is pressed! > > test.py: > #- > from scgi.scgi_server import SCGIServer > > n = 0 > print "Starting server." > > try: > SCGIServer().serve(

Re: Inserting Unicode text with MySQLdb in Python 2.4-2.5?

2009-11-20 Thread Keith Hughitt
Hello, Thanks for the suggestions and information Diez! On Nov 18, 9:38 am, "Diez B. Roggisch" wrote: > > You are aware that the coding-declaration only affects unicode-literals (the > ones like u"i'm unicode")? So the above insert-statement is *not* unicode, > it's a byte-string in whatever enc

Re: getting properly one subprocess output

2009-11-20 Thread Paul Rudin
Jean-Michel Pichavant writes: > Hi python fellows, > > I'm currently inspecting my Linux process list, trying to parse it in > order to get one particular process (and kill it). > I ran into an annoying issue: > The stdout display is somehow truncated (maybe a terminal length > issue, I don't kno

Does Python 3.x support Unicode-named attributes?

2009-11-20 Thread John Nagle
Does Python 3.x support Unicode-named attributes? There are several modules which operate on HTML and try to hammer HTML/XML into Python object attributes. I've had BeautifulSoup and "urllib" blow up at various times when running on non-English HTML/XML. Got this error today: urlli

ANN: PyGUI 2.1.1

2009-11-20 Thread Greg Ewing
PyGUI 2.1.1 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ This is an emergency bugfix release to repair some major breakage in the gtk version. Also corrects some other problems. What is PyGUI? -- PyGUI is a cross-platform GUI toolkit designed to be light

Re: Invitation to connect on LinkedIn

2009-11-20 Thread Aahz
In article , Chris Rebert wrote: > >How the heck someone sets their account email to a mailinglist, I'll >never figure out. This probably is not Jaime's fault. LinkedIn has an expletive b0rken implementation where they randomly pick addresses that have been used in your account when your primar

Re: A "terminators' club" for clp

2009-11-20 Thread Aahz
In article , Terry Reedy wrote: > >Some usenet newsgroups were/are moderated either by a robot, a person, >or a team (as you suggested). But a particular newsgroup has to be set >up that way from the beginning. Last I knew, it wan/is? difficult to >convert an unmoderated group to moderation.

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-20 Thread Aahz
In article , Steve Ferg wrote: > >Does anybody know a language with this kind of syntax for >ifThenElseEndif? Several templating systems, including Cheetah. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Debugging is twice as hard as writing the code in the f

Re: python simply not scaleable enough for google?

2009-11-20 Thread Aahz
In article , Robert P. J. Day wrote: > >http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e?pli=1 > > thoughts? Haven't seen this elsewhere in the thread: http://dalkescientific.com/writings/diary/archive/2009/11/15/10_tasklets.html -- Aahz (a...@pythoncraf

Re: Newsgroup for beginners

2009-11-20 Thread Aahz
In article , Grant Edwards wrote: > >You've really got to try pretty hard to create one. But if you >want to, here's how to do it: > > 1) Start by complaining that your program doesn't work because >of a bug in Python. > > [...] Post of the month! -- Aahz (a...@pythoncraft.com)

Relative versus absolute paths on Windows

2009-11-20 Thread Jason R. Coombs
The current implementation of Python (2.6.4, 3.1.1) treats \bar as a relative path but reports it as an absolute path. >>> ntpath.isabs('\\bar') True >>> ntpath.abspath('\\bar') 'C:\\bar' >>> os.chdir('d:\\') >>> ntpath.abspath('\\bar') 'd:\\bar' >>> os.chdir('server\\share') >>> ntpath.abspat

Re: getting properly one subprocess output

2009-11-20 Thread Nobody
On Thu, 19 Nov 2009 06:21:09 -0800, Bas wrote: > Below is the script I use to automatically kill firefox if it is not > behaving, maybe you are looking for something similar. > lines = os.popen('ps ax|grep firefox').readlines() This isn't robust. It will kill any process with "firefox" anywhere

Re: SCGIServer and unusal termination

2009-11-20 Thread Eden Kirin
Дамјан Георгиевски wrote: SCGIServer().serve() forks, so it seems that there are 2 python processes continuing to run after SCGIServer().serve() I noticed that which makes it unusable to me. Also, it took me almost whole day to realize this. I'm adopting a huge application to work with SCGI

Python/HTML integration: phileas v0.3 released

2009-11-20 Thread papa hippo
The prime goal of 'phileas' is to enable html code to be seamlessly included in python code in a natural looking syntax, without resorting to templatng language. see: http://larry.myerscough.nl/phileas_project/ I intend to submit phileas to the python.announce forum within the next few days. An

Re: Python/HTML integration: phileas v0.3 released

2009-11-20 Thread Steve Howell
On Nov 19, 10:53 am, papa hippo wrote: > The prime goal of 'phileas' is to enable html code to be seamlessly > included in python code in a natural looking syntax, without resorting > to templatng language. > > see: > > http://larry.myerscough.nl/phileas_project/ > > I intend to submit phileas to

Re: Does Python 3.x support Unicode-named attributes?

2009-11-20 Thread Martin v. Löwis
> Does Python 3.x support Unicode-named attributes? Most certainly, yes. All identifiers (and thus all attribute names) are Unicode strings in Python 3.x. > There are several modules which operate on HTML and try to > hammer HTML/XML into Python object attributes. I've had > BeautifulSou

Is an interactive command a block?

2009-11-20 Thread Alf P. Steinbach
The CPython 3.1.1 language reference §4.1 says "Each command typed interactively is a block." It also says "If a name is bound in a block, it is a local variable of that block, unless declared as nonlocal" Even with a non-literal try-for-best-meaning reading I can't get this to mesh wi

Re: Is an interactive command a block?

2009-11-20 Thread Steven D'Aprano
On Thu, 19 Nov 2009 21:37:17 +0100, Alf P. Steinbach wrote: > The CPython 3.1.1 language reference §4.1 says > >"Each command typed interactively is a block." > > It also says > >"If a name is bound in a block, it is a local variable of that block, >unless > declared as nonlocal

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-20 Thread Steven D'Aprano
On Wed, 18 Nov 2009 18:47:34 -0800, Chris Rebert wrote: > On Wed, Nov 18, 2009 at 6:27 PM, Peng Yu wrote: >> http://www.python.org/dev/peps/pep-0008/ >> >> The above webpage states the following naming convention. Such a >> variable can be an internal variable in a class. I'm wondering what is >>

Re: Does turtle graphics have the wrong associations?

2009-11-20 Thread Steven D'Aprano
On Thu, 19 Nov 2009 02:00:58 -0800, Robert Maas, http://tinyurl.com/uh3t wrote: > My proposed no-syntax > IDE *also* gets rid of the need to bother with any programming-language > syntax. I've been proposing it for years, but nobody has shown any > interest I'm interested. No-syntax IDE? How is t

Re: Is an interactive command a block?

2009-11-20 Thread Alf P. Steinbach
* Steven D'Aprano: On Thu, 19 Nov 2009 21:37:17 +0100, Alf P. Steinbach wrote: The CPython 3.1.1 language reference §4.1 says "Each command typed interactively is a block." It also says "If a name is bound in a block, it is a local variable of that block, unless declared as nonl

Re: make two tables having same orders in both column and row names

2009-11-20 Thread Jon Clements
On Nov 18, 8:57 pm, Ping-Hsun Hsieh wrote: > Hi, > > I would like to compare values in two table with same column and row names, > but with different orders in column and row names. > For example, table_A in a file looks like the follows: > AA100   AA109   AA101   AA103   AA102 > BB1     2      

Re: Vim breaks after Python upgrade

2009-11-20 Thread NickC
On Tue, 17 Nov 2009 13:46:25 -0500, Nick Stinemates wrote: > At least with Gentoo, there's a command to recompile all of the plugins > you have installed when upgrading python versions. > > Your issue is probably related to that. I don't think VIM uses hardcoded > locations for scripts at the cor

python bijection

2009-11-20 Thread Joshua Bronson
I couldn't find a library providing a bijective map data structure (allowing for constant-time lookups by value) in the few minutes I looked, so I took a few more minutes to code one up: http://bitbucket.org/jab/toys/src/tip/bijection.py Is this at all worth releasing? Comments and suggestions wel

Re: PyQt4 4.4.4 : a bug with highlightBlock ?

2009-11-20 Thread David Boddie
On Wednesday 18 November 2009 11:47, Snouffy wrote: > I've been trying to do some syntax highlighting using PyQt4. I ported > the example given in the documentation of Qt4 to Python. It works fine > on my computer at work (which has PyQt4 version 4.3.3) but doesn't on > my home computer (which has

Re: python bijection

2009-11-20 Thread Steven D'Aprano
On Thu, 19 Nov 2009 15:24:46 -0800, Joshua Bronson wrote: > I couldn't find a library providing a bijective map data structure > (allowing for constant-time lookups by value) in the few minutes I > looked, so I took a few more minutes to code one up: > http://bitbucket.org/jab/toys/src/tip/bijecti

Re: python gui builders

2009-11-20 Thread David Boddie
On Thursday 19 November 2009 11:50, Simon Hibbs wrote: > I don't think a list like this is a great way to do that. There are > plenty of examples and tutorials available for each option. This site has a selection of tutorials that can be used to compare API and code styles: http://zetcode.com/

Re: python bijection

2009-11-20 Thread Joshua Bronson
On Nov 19, 7:05 pm, Steven D'Aprano wrote: > If I want a mapping a <-> b, I generally just create a dict {a:b, b:a}. > What is the advantages or disadvantages of your code over the simplicity > of the dict approach? Well for one, you don't have to manually update the mapping from b -> a if ever t

Re: Whom Must We Worship

2009-11-20 Thread furlan
On Sun, 15 Nov 2009 00:17:43 -0800, Mary wrote: > Whom Must We Worship > The Decision is yours! Thank you, I got that. I choose Python. Thanks for sharing. ciao, f -- aa #2301 "...The word that separates that which is dead from that which is livingIn the beginning was the word and tha

Re: python bijection

2009-11-20 Thread Carl Banks
On Nov 19, 3:24 pm, Joshua Bronson wrote: > I couldn't find a library providing a bijective map data structure > (allowing for constant-time lookups by value) in the few minutes I > looked, so I took a few more minutes to code one > up:http://bitbucket.org/jab/toys/src/tip/bijection.py > > Is thi

Re: python bijection

2009-11-20 Thread Ben Finney
Carl Banks writes: > On Nov 19, 3:24 pm, Joshua Bronson wrote: > > I couldn't find a library providing a bijective map data structure > > (allowing for constant-time lookups by value) in the few minutes I > > looked, so I took a few more minutes to code one > > up:http://bitbucket.org/jab/toys/s

Re: python bijection

2009-11-20 Thread Joshua Bronson
On Nov 19, 9:17 pm, Carl Banks wrote: > Apart from the GPL what Ben said :) > it seems perfectly fine to release, and looks like > an interesting strategy. I've wanted one of those once in a while, > never enough to bother looking for one or writing one myself. glad to hear it! i'll release it

Re: FYI: ConfigParser, ordered options, PEP 372 and OrderedDict + big thank you

2009-11-20 Thread Scott David Daniels
Jonathan Fine wrote:... A big thanks to Armin Ronacher and Raymond Hettinger for PEP 372: Adding an ordered dictionary to collections ... I prototyped (in about an hour). I then thought - maybe someone has been down this path before So all that I want has been done already, and will be

Re: Inserting Unicode text with MySQLdb in Python 2.4-2.5?

2009-11-20 Thread John Nagle
Keith Hughitt wrote: Hi all, I ran into a problem recently when trying to add support for earlier versions of Python (2.4 and 2.5) to some database related code which uses MySQLdb, and was wondering if anyone has any suggestions. With later versions of Python (2.6), inserting Unicode is very si

Re: Writing a Carriage Return in Unicode

2009-11-20 Thread Scott David Daniels
MRAB wrote: u'\u240D' isn't a carriage return (that's u'\r') but a symbol (a visible "CR" graphic) for carriage return. Windows programs normally expect lines to end with '\r\n'; just use u'\n' in programs and open the text files in text mode ('r' or 'w'). This is the one thing from standards

Re: ANN: Urwid 0.9.9 - Console UI Library

2009-11-20 Thread Tim Roberts
"Michel Claveau - MVP" wrote: > >Hi! > >You forget to write "urwid" do not run under Windows. He also forgot to write "urwid" do not run under CP/M or OS/360. Why did you feel compelled to post this three times? If it supported Windows, it would say so. The fact that it doesn't say so means it

Re: DOM related question and problem

2009-11-20 Thread Stefan Behnel
elca, 18.11.2009 19:04: > these day im making python script related with DOM. > > problem is these day many website structure is very complicate . > [...] > what is best method to check can extract such like following info quickly? This should help: http://blog.ianbicking.org/2008/12/10/lxml-an

Re: Python/HTML integration: phileas v0.3 released

2009-11-20 Thread Stefan Behnel
papa hippo, 19.11.2009 19:53: > The prime goal of 'phileas' is to enable html code to be seamlessly > included in python code in a natural looking syntax, without resorting > to templatng language. I assume you know XIST, ElementTree's ElementMaker, and all those other ways of generating XML/HTML

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Michele Simionato
On Nov 20, 4:18 am, Peng Yu wrote: > I'm wondering if there is something similar to list comprehension for > dict Yes, but only in Python 3: >>> {(i, x) for i, x in enumerate('abc')} {(0, 'a'), (1, 'b'), (2, 'c')} -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Stefan Behnel
Peng Yu, 20.11.2009 04:18: > I'm wondering if there is something similar to list comprehension for > dict (please see the example code below). A list comprehension is an expression that produces a list, e.g. [ i**2 for i in range(10) ] Your example below uses a slice assignment. > def fun(

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Stefan Behnel
Stefan Behnel, 20.11.2009 09:24: > You can use d.update(...) > > It accepts both another dict as well as a generator expression that > produces item tuples, e.g. > > d.update( (i, i**2) for i in range(10) ) This also works, BTW: >>> d = {} >>> d.update(value=5) >>> d {'valu

Re: non-copy slices

2009-11-20 Thread Ajit Kumar
On Thu, Nov 19, 2009 at 8:14 PM, Ethan Furman wrote: >> No I'm well aware that there is no deep copy of the objects and the lists >> only keep references to the objects and in essence they have the same >> objects in there. But this doesn't mean they are the same list. >> Modifications to slices a

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Patrick Sabin
Peng Yu wrote: I'm wondering if there is something similar to list comprehension for dict (please see the example code below). Do you mean something like this: >>> {i:i+1 for i in [1,2,3,4]} {1: 2, 2: 3, 3: 4, 4: 5} This works in python3, but not in python2 - Patrick -- http://mail.python.or

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Paul Rudin
Patrick Sabin writes: > Peng Yu wrote: >> I'm wondering if there is something similar to list comprehension for >> dict (please see the example code below). > > Do you mean something like this: > {i:i+1 for i in [1,2,3,4]} > {1: 2, 2: 3, 3: 4, 4: 5} > > This works in python3, but not in pyth

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Terry Reedy
Peng Yu wrote: I'm wondering if there is something similar to list comprehension for dict (please see the example code below). Python 3 has list, set, and dict comprehensions. Don't know about 2.6/7 -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Andre Engels
On Fri, Nov 20, 2009 at 4:18 AM, Peng Yu wrote: > I'm wondering if there is something similar to list comprehension for > dict (please see the example code below). > > > d = dict(one=1, two=2) > print d > > def fun(d):#Is there a way similar to list comprehension to change the > argument d so that

checking 'type' programmatically

2009-11-20 Thread mk
Disclaimer: this is for exploring and debugging only. Really. I can check type or __class__ in the interactive interpreter: Python 2.6.2 (r262:71600, Jun 16 2009, 16:49:04) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >

Re: python simply not scaleable enough for google?

2009-11-20 Thread Robin Becker
Aahz wrote: In article , Robert P. J. Day wrote: http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e?pli=1 thoughts? Haven't seen this elsewhere in the thread: http://dalkescientific.com/writings/diary/archive/2009/11/15/10_tasklets.html I looked at

Re: Python/HTML integration: phileas v0.3 released

2009-11-20 Thread Daniel Fetchinson
>> The prime goal of 'phileas' is to enable html code to be seamlessly >> included in python code in a natural looking syntax, without resorting >> to templatng language. >> >> see: >> >> http://larry.myerscough.nl/phileas_project/ >> >> I intend to submit phileas to the python.announce forum with

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Tim Golden
Michele Simionato wrote: On Nov 20, 4:18 am, Peng Yu wrote: I'm wondering if there is something similar to list comprehension for dict Yes, but only in Python 3: {(i, x) for i, x in enumerate('abc')} {(0, 'a'), (1, 'b'), (2, 'c')} Although the 2.x syntax is hardly onerous: dict ((i+5, x

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Dave Angel
Peng Yu wrote: I'm wondering if there is something similar to list comprehension for dict (please see the example code below). d = dict(one=1, two=2) print d def fun(d):#Is there a way similar to list comprehension to change the argument d so that d is changed? d=dict(three=3) fun(d) print

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Simon Brunning
2009/11/20 Michele Simionato : > Yes, but only in Python 3: > {(i, x) for i, x in enumerate('abc')} > {(0, 'a'), (1, 'b'), (2, 'c')} In Python 2.x, you can do: >>> dict((i, x) for i, x in enumerate('abc')) {0: 'a', 1: 'b', 2: 'c'} (Works in 2.5 - I can't remember when generator expressions

Regexp and multiple groups (with repeats)

2009-11-20 Thread mk
Hello, >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') >>> r.search(r'c:/tmp/spam/eggs').groups() ('/eggs',) Obviously, I would like to capture all groups: ('/tmp', '/spam', '/eggs') But it seems that re captures only the last group. Is there any way to capture all groups with repeat following

Re: Python Will Not Send Email!!

2009-11-20 Thread Victor Subervi
On Thu, Nov 19, 2009 at 5:01 PM, Kev Dwyer wrote: > On Thu, 19 Nov 2009 11:28:37 -0400, Victor Subervi wrote: > > Hello Victor, > > There are some pages on the internet that suggest that this problem my be > caused by a module named email.py (or email.pyc) in your pythonpath. If > you try import

Re: Is an interactive command a block?

2009-11-20 Thread Benjamin Kaplan
On Thu, Nov 19, 2009 at 4:42 PM, Alf P. Steinbach wrote: > * Steven D'Aprano: >> >> On Thu, 19 Nov 2009 21:37:17 +0100, Alf P. Steinbach wrote: >> >>> The CPython 3.1.1 language reference §4.1 says >>> >>>   "Each command typed interactively is a block." >>> >>> It also says >>> >>>   "If a name i

Book: Programming Python 3 (Second Edition) now available

2009-11-20 Thread Mark Summerfield
Hi, I'm delighted to announce that a new edition of my Python 3 book is now available in the U.S. "Programming in Python 3 (Second Edition): A Complete Introduction to the Python Language" ISBN 0321680561 http://www.qtrac.eu/py3book.html The book has been fully revised and updated and now covers

Re: Does turtle graphics have the wrong associations?

2009-11-20 Thread Robert Maas, http://tinyurl.com/uh3t
> > My proposed no-syntax > > IDE *also* gets rid of the need to bother with any programming-language > > syntax. I've been proposing it for years, but nobody has shown any > > interest > From: Steven D'Aprano > I'm interested. No-syntax IDE? How is this even possible? I guess you missed what I p

Announcement: depikt - the minimalistic python gate to gtk

2009-11-20 Thread DreiJane
Hi all, these days i make depikt, a python C-extension for building apps with gtk. It was a challenge for me and big fun. From its short description on sourceforge.net: "Python-3 wrappers for GTK. A minimalistic approach - just suited for GUI-building of apps, in no way for widget-building. Curre

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread DreiJane
NB: I wondered about about dict(one=1, two=2) - why not d = {one:1, two:2} ? Since you do not write L=list((1, 2)) either. These composed objects as basic building blocks make Python code so dense and beautiful, thus using "{}" means embracing the language's concept. -- http://mail.python.org/mail

Re: Python/HTML integration: phileas v0.3 released

2009-11-20 Thread papa hippo
On 19 nov, 20:18, Steve Howell wrote: > On Nov 19, 10:53 am, papa hippo wrote: > > > The prime goal of 'phileas' is to enable html code to be seamlessly > > included in python code in a natural looking syntax, without resorting > > to templatng language. > > > see: > > >http://larry.myerscough.nl

Re: Python/HTML integration: phileas v0.3 released

2009-11-20 Thread papa hippo
On 20 nov, 09:02, Stefan Behnel wrote: > papa hippo, 19.11.2009 19:53: > > > The prime goal of 'phileas' is to enable html code to be seamlessly > > included in python code in a natural looking syntax, without resorting > > to templatng language. > > I assume you know XIST, ElementTree's ElementMa

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Diez B. Roggisch
DreiJane schrieb: NB: I wondered about about dict(one=1, two=2) - why not d = {one:1, two:2} ? Since you do not write L=list((1, 2)) either. These composed because it's not working. >>> {one : 1} Traceback (most recent call last): File "", line 1, in NameError: name 'one' is not defined Y

Re: Writing a Carriage Return in Unicode

2009-11-20 Thread sturlamolden
On 19 Nov, 01:14, Doug wrote: > Thanks for your help!! A carriage return in unicode is u"\r" how this is written as bytes is dependent on the encoder. Don't try to outsmart the UTF-8 codec, it knows how to translate "\r" to UTF-8. Sturla Molden -- http://mail.python.org/mailman/listinfo

Re: checking 'type' programmatically

2009-11-20 Thread exarkun
On 10:10 am, mrk...@gmail.com wrote: Disclaimer: this is for exploring and debugging only. Really. I can check type or __class__ in the interactive interpreter: Python 2.6.2 (r262:71600, Jun 16 2009, 16:49:04) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits

Re: Python Will Not Send Email!!

2009-11-20 Thread Kev Dwyer
On Fri, 20 Nov 2009 07:58:55 -0500, Victor Subervi wrote: > On Thu, Nov 19, 2009 at 5:01 PM, Kev Dwyer > wrote: > >> On Thu, 19 Nov 2009 11:28:37 -0400, Victor Subervi wrote: >> >> Hello Victor, >> >> There are some pages on the internet that suggest that this problem my >> be caused by a module

RE: checking 'type' programmatically

2009-11-20 Thread Billy Earney
Try looking at the function 'isinstance', so for example if isinstance(obj, str): print "object is a string.." elif isinstance(obj, int): print "object is an integer.." -Original Message- From: python-list-bounces+billy.earney=gmail@python.org [mailto:python-list-boun

Re: Python Will Not Send Email!!

2009-11-20 Thread Carsten Haese
Victor Subervi wrote: > On Thu, Nov 19, 2009 at 5:01 PM, Kev Dwyer > wrote: > > On Thu, 19 Nov 2009 11:28:37 -0400, Victor Subervi wrote: > > Hello Victor, > > There are some pages on the internet that suggest that this problem > my be > cause

Re: Is an interactive command a block?

2009-11-20 Thread Alf P. Steinbach
* Benjamin Kaplan: On Thu, Nov 19, 2009 at 4:42 PM, Alf P. Steinbach wrote: * Steven D'Aprano: I feel that there's still something lacking in my understanding though, like how/where the "really actually just pure local not also global" is defined for function definition, but it's now just a va

Too Many Values To Unpack

2009-11-20 Thread Victor Subervi
Hi; At one point Dennis Lee Bieber helped me with the following slightly modified code: #!/usr/bin/python import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login import re, string def printTree(aTree, level=0): tree = [] for name in sorted(aTree.keys()): tree.ap

Re: Python Will Not Send Email!!

2009-11-20 Thread Victor Subervi
On Fri, Nov 20, 2009 at 11:05 AM, Kev Dwyer wrote: > I ran your script on a CentOS vm (5.2 server 32bit, not quite the same as > yours but also running python 2.4.3). It ran without error. So I > suspect that either you have a rogue email module/package on your machine > or there's something wr

Re: Regexp and multiple groups (with repeats)

2009-11-20 Thread Neil Cerutti
On 2009-11-20, mk wrote: > Hello, > > >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') > > >>> r.search(r'c:/tmp/spam/eggs').groups() > ('/eggs',) > > Obviously, I would like to capture all groups: > ('/tmp', '/spam', '/eggs') You'll have to do something else, for example: >>> s = re.compile(r'(?:[

Re: Python Will Not Send Email!!

2009-11-20 Thread Victor Subervi
On Fri, Nov 20, 2009 at 11:14 AM, Carsten Haese wrote: > Kevin neglected to mention that the new interpreter session must be > started in the same directory as the one you're in when you run your > testMail.py script. Since he didn't mention that, we can't be sure that > that's what you did, so th

Re: Is an interactive command a block?

2009-11-20 Thread Ethan Furman
Alf P. Steinbach wrote: * Benjamin Kaplan: On Thu, Nov 19, 2009 at 4:42 PM, Alf P. Steinbach wrote: >>> I feel that there's still something lacking in my understanding though, like how/where the "really actually just pure local not also global" is defined for function definition, but it's n

Re: Regexp and multiple groups (with repeats)

2009-11-20 Thread Mark Tolonen
"mk" wrote in message news:he60ha$iv...@ger.gmane.org... Hello, >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') >>> r.search(r'c:/tmp/spam/eggs').groups() ('/eggs',) Obviously, I would like to capture all groups: ('/tmp', '/spam', '/eggs') But it seems that re captures only the last group. Is

Re: python gui builders

2009-11-20 Thread sturlamolden
On 18 Nov, 22:18, David Bolen wrote: > With that said, for various reasons I still prefer wxPython to Qt, and > at the moment, find wxFormBuilder the best fit for my own designs > (even before the direct Python support, just using XRC). Personally I prefer wxFormBuilder over QtDesigner for sizer

Split class across multiple files

2009-11-20 Thread eric.frederich
I have a class which holds a connection to a server and a bunch of services. In this class I have methods that need to work with that connection and services. Right now there are about 50 methods some of which can be quite long. >From an organizational standpoint, I'd like to have method implement

Re: Too Many Values To Unpack

2009-11-20 Thread Shashank Singh
On Fri, Nov 20, 2009 at 9:15 PM, Victor Subervi wrote: > Hi; > At one point Dennis Lee Bieber helped me with the following slightly > modified code: > > #!/usr/bin/python > > import sys,os > sys.path.append(os.getcwd()) > import MySQLdb > from login import login > import re, string > > def printTr

Serve Pages Under Different Ownership

2009-11-20 Thread Victor Subervi
Hi; I'm building a new server after many years hiatus. I currently can only serve python pages chown'd to root. How do I change this? TIA, Victor -- http://mail.python.org/mailman/listinfo/python-list

semantics of [:]

2009-11-20 Thread Esmail
Could someone help confirm/clarify the semantics of the [:] operator in Python? a = range(51,55) # 1 ## b = a[:] # b receives a copy of a, but they are independent # The following two are equivalent # 2 ## c = [] c = a[:] # c receives a c

  1   2   >