Re: new extension generator for C++

2010-05-04 Thread Stefan Behnel
Rouslan Korneychuk, 03.05.2010 22:44: The only issue is it will not use keyword arguments for overloaded functions (I don't know if that can even be done reliably *and* efficiently. I would need to give it more thought). You should look at the argument unpacking code that Cython generates. It

How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Barak, Ron
Hi, I'm parsing XML files using ElementTree from xml.etree (see code below (and attached xml_parse_example.py)). However, I'm coming across input XML files (attached an example: tmp.xml) which include invalid characters, that produce the following traceback: $ python xml_parse_example.py Trace

Re: new extension generator for C++

2010-05-04 Thread Samuel Williams
Dear Rouslan, It looks interesting. I say go for it. You will learn something and might make some improvements on existing ideas. I recommend putting the code on www.github.com Kind regards, Samuel On 4/05/2010, at 8:44 AM, Rouslan Korneychuk wrote: > Hi, I'm new here. I'm working on a progra

Next Melbourne PUG meeting 6:30pm Monday 10th of May @ Horse Bazaar

2010-05-04 Thread Richard Jones
Meeting details, location and talks list are at: http://wiki.python.org/moin/MelbournePUG It looks like we've got a few cool talks lined up: 15 minute talks - None yet... suggest one! 5 minute talks - Load-balancing xmlrpclib/jsonrpclib for robust distributed applications (Andreux Fort) ... pl

Re: How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Stefan Behnel
Barak, Ron, 04.05.2010 09:01: I'm parsing XML files using ElementTree from xml.etree (see code below (and attached xml_parse_example.py)). However, I'm coming across input XML files (attached an example: tmp.xml) which include invalid characters, that produce the following traceback: $ python

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 8:37 am, "Martin v. Loewis" wrote: > > Do you know of recent improvements on the PyPI side about docs > > hosting? > > Yes; go to your package's pkg_edit page, i.e. > > http://pypi.python.org/pypi?%3Aaction=pkg_edit&name=decorator > > and provide a zip file at Upload Documentation. > > R

Re: Django as exemplary design

2010-05-04 Thread Bruno Desthuilliers
TomF a écrit : I'm interested in improving my python design by studying a large, well-designed codebase. Someone (not a python programmer) suggested Django. I realize that Django is popular, but can someone comment on whether its code is well-designed and worth studying? Carl makes some v

Re: design question

2010-05-04 Thread Bruno Desthuilliers
Alf P. Steinbach a écrit : (snip) Re efficiency it seems to be a complete non-issue, but correctness is much more important: is there any way that the config details can be (inadvertently) changed while the build is going on? +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] strange interaction between open and cwd

2010-05-04 Thread Gregory Ewing
Charles wrote: In the OP's case, references to the directory have been removed from the file system, but his process still has the current working directory reference to it, so it has not actually been deleted. When he opens "../abc.txt", the OS searches the current directory for ".." and fin

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 5:27 PM, Michele Simionato wrote: > Cool, that's good to know. I am still accepting recommendations for > non-Python projects ;) bitbucket (1) also provide static file hosting through the wiki. From what I understand (tested) you simply clone the wiki repository (which is i

Re: strange interaction between open and cwd

2010-05-04 Thread Gregory Ewing
Grant Edwards wrote: except that Python objects can form a generalized graph, and Unix filesystems are constrained to be a tree. Actually I believe that root is allowed to create arbitrary hard links to directories in Unix, so it's possible to turn the file system in to a general graph. It's h

Re: strange interaction between open and cwd

2010-05-04 Thread Gregory Ewing
Grant Edwards wrote: In your example, it's simply not possible to determine the file's absolute path within the filesystem given the relative path you provided. Actually, I think it *is* theoretically possible to find an absolute path for the file in this case. I suspect that what realpath()

[PATCH] add functional matrix-returning methods to Pycairo

2010-05-04 Thread Lawrence D'Oliveiro
I find the matrix methods in Pycairo to be an annoying hodge-podge of ones that overwrite the Matrix object in-place (init_rotate, invert) versus ones that concatenate additional transformations (rotate, scale, translate) versus ones that return new matrices without modifying the originals (multipl

Re: win32 - catch events(wmi?)

2010-05-04 Thread Tim Golden
On 03/05/2010 23:53, Giampaolo Rodolà wrote: Just out of curiosity, is WMI able to list the TCP and UDP connections opened by a process or by the OS? We'll have to do this for psutil (http://code.google.com/p/psutil) and we guess it's not gonna be easy. Not as far as I know. WMI doesn't tend to

Re: Teaching Programming

2010-05-04 Thread Jean-Michel Pichavant
André wrote: To Samuel Williams:(and other interested ;-) If you want to consider Python in education, I would encourage you have a look at http://www.python.org/community/sigs/current/edu-sig/ I think you will find that there are quite a few resources available - perhaps more than you are

Re: Teaching Programming

2010-05-04 Thread Samuel Williams
I personally like indentation. I just wonder whether it is an issue that some people will dislike. But anyway, I updated the language comparison to remove this critique. Kind regards, Samuel On 4/05/2010, at 9:22 PM, Jean-Michel Pichavant wrote: > André wrote: >> To Samuel Williams:(and ot

itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
Hi, I ran into a bit of an unexpected issue here with itertools, and I need to say that I discovered itertools only recently, so maybe my way of approaching the problem is "not what I want to do". Anyway, the problem is the following: I have a list of dictionaries, something like [ { "a": 1, "b"

Re: print executed query

2010-05-04 Thread someone
On 4 Mai, 07:01, Fred C wrote: > On Apr 29, 2010, at 9:49 AM, Philip Semanchuk wrote: > > > > > > > On Apr 29, 2010, at 12:01 PM, someone wrote: > > >> Hello! > > >> Is there a way to print a query for logging purpose as it was or will > >> be sent to database, if I don't escape values of query by

Re: Teaching Programming

2010-05-04 Thread superpollo
Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. t

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line template. There are a couple

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Ulrich Eckhardt
Nico Schlömer wrote: > I ran into a bit of an unexpected issue here with itertools, and I > need to say that I discovered itertools only recently, so maybe my way > of approaching the problem is "not what I want to do". > > Anyway, the problem is the following: > I have a list of dictionaries, som

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Jon Clements
On 4 May, 11:10, Nico Schlömer wrote: > Hi, > > I ran into a bit of an unexpected issue here with itertools, and I > need to say that I discovered itertools only recently, so maybe my way > of approaching the problem is "not what I want to do". > > Anyway, the problem is the following: > I have a

Re: modifying open office spreadsheet (with OO installed)

2010-05-04 Thread Chris Withers
Jim Byrnes wrote: News123 wrote: Mumbling to myself, perhaps somebody else is interested. Yes I am. News123 wrote: Hi, I wanted to know who can recommend a good module/library, that allows to modify an Open Office spreadsheet. One can assume, that Open Office is installed on the host.

Re: ooolib, reading writing a spread sheet and keep formatting

2010-05-04 Thread Chris Withers
News123 wrote: from xlrd import open_workbook from xlutils.copy import copy rb = open_workbook('doc1.xls') open_workbook('doc1.xls',formatting_info=True) print "WB with %d sheets" % rb.nsheets wb = copy(rb) wb.save("doc2.xls") # file is created, but ALL formattng is lost and formulas are n

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line tem

Re: Teaching Programming

2010-05-04 Thread Martin P. Hellwig
On 05/04/10 11:28, superpollo wrote: Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. there might be problems if for example you generate code from a one-line template. Well a one-line template code generator are

python gui

2010-05-04 Thread a
where's the best online resource for teaching about GUI building? Thanks Paul C -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
> Does this example help at all? Thanks, that clarified things a lot! To make it easier, let's just look at 'a' and 'b': > my_list.sort( key=itemgetter('a','b','c') ) > for a, a_iter in groupby(my_list, itemgetter('a')): >print 'New A', a >for b, b_iter in groupby(a_iter, itemgetter('b'

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
> I'd try to avoid copying the list and instead just iterate over it: > > >def iterate_by_key(l, key): >for d in l: >try: >yield l[key] >except: >continue Hm, that won't work for me b/c I don't know all the keys beforehand. I coul

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it.

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Jon Clements
On 4 May, 12:36, Nico Schlömer wrote: > > Does this example help at all? > > Thanks, that clarified things a lot! > > To make it easier, let's just look at 'a' and 'b': > > > my_list.sort( key=itemgetter('a','b','c') ) > > for a, a_iter in groupby(my_list, itemgetter('a')): > >    print 'New A', a

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't ru

Re: Teaching Programming

2010-05-04 Thread superpollo
Martin P. Hellwig ha scritto: On 05/04/10 11:28, superpollo wrote: Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. there might be problems if for example you generate code from a one-line template. Well a one-l

Re: Ann: Validating Emails and HTTP URLs in Python

2010-05-04 Thread livibetter
First, it's good to see a library has URL and email validator. But I found there might be a problem in your validator, the problems I found are these URLs: http://example.com/path http://example.com/path) http://example.com/path] http://example.com/path} By my understanding from RFCs, on

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:43 PM, Stefan Behnel wrote: >> Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) >> [GCC 4.3.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>  >>> A,B=2,3 >>  >>> if A>B: >> ... print A+B >> ... else: >> ... print A**B-B**2 >> ... >>

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: > of course! *but* if i must generate on-the-fly python code that defines a > function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type "help", "copyright", "cr

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Ulrich Eckhardt
Nico Schlömer wrote: > So when I go like > > for item in list: > item[1].sort() > > I actually modify *list*? I didn't realize that; I thought it'd just > be a copy of it. No, I misunderstood your code there. Modifying the objects inside the list is fine, but I don't thing you do that, provi

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: Teaching Programming > To: [email protected] > Date: Tuesday, May 4, 2010, 7:43 AM > superpollo, 04.05.2010 13:23: > > Stefan Behnel ha scritto: > >> the main reason why this problem doesn't hurt much > in Python

Re: Teaching Programming

2010-05-04 Thread Benjamin Kaplan
On Tue, May 4, 2010 at 7:23 AM, superpollo wrote: > Stefan Behnel ha scritto: >> >> superpollo, 04.05.2010 12:28: >>> >>> i think there is an issue if you -- say -- produce python code, from >>> within another programming environment, to be executed on the fly, at >>> least in some instances. ther

Re: python gui

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:26 PM, a wrote: > where's the best online resource for teaching about GUI building? There are many many resources available on the topic. If you simply Google (tm) some of the keywords in your post you'll be presented with a whole smorgasbord of useful resources. --james

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
superpollo, 04.05.2010 13:56: Stefan Behnel ha scritto: The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a function [...] Well, could you provi

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
> Are you basically after this, then? > > for a, a_iter in groupby(my_list, itemgetter('a')): >print 'New A', a >for b, b_iter in groupby(a_iter, itemgetter('b')): >b_list = list(b_iter) >for p in ['first', 'second']: >for b_data in b_list: >#what

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
Ed Keith, 04.05.2010 14:15: I wrote AsciiLitProg (http://asciilitprog.berlios.de/) in Python. It is a literate programming tool. It generates code from a document. It can generate code in any language the author wants. It would have been a LOT easier to write if it did not generate Python code.

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:56: Stefan Behnel ha scritto: The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a function [.

Re: strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 04/05/10 02:12, Ben Finney wrote: Baz Walter writes: On 03/05/10 18:41, Grant Edwards wrote: Firstly, a file may have any number of paths (including 0). yes, of course. i forgot about hard links Rather, you forgot that *every* entry that references a file is a hard link. i'm not a fr

Re: strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 04/05/10 03:19, Grant Edwards wrote: On 2010-05-03, Baz Walter wrote: On 03/05/10 19:12, Grant Edwards wrote: Even though the user provided a legal and openable path? that sounds like an operational definition to me: what's the difference between "legal" and "openable"? Legal as in meet

Re: [OT] strange interaction between open and cwd

2010-05-04 Thread Charles
"Gregory Ewing" wrote in message news:[email protected]... > Charles wrote: > >> In the OP's case, references to the directory have been removed >> from the file system, but his process still has the current working >> directory reference to it, so it has not actually been deleted.

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: Teaching Programming > To: [email protected] > Date: Tuesday, May 4, 2010, 8:40 AM > Ed Keith, 04.05.2010 14:15: > > I wrote AsciiLitProg (http://asciilitprog.berlios.de/) in Python. It is > > a literate programmi

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok, since you asked for it, prepare yourse

Re: strange interaction between open and cwd

2010-05-04 Thread Ben Finney
Baz Walter writes: > On 04/05/10 02:12, Ben Finney wrote: > > Baz Walter writes: > >> yes, of course. i forgot about hard links > > > > Rather, you forgot that *every* entry that references a file is a > > hard link. > > i'm not a frequent poster on this list, but i'm aware of it's > reputation

Re: [OT] strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 23:02:29 +1000, Charles wrote: > I am by no means an expert in this area, but what I think happens (and I > may well be wrong) is that the directory is deleted on the file system. > The link from the parent is removed, and the parent's link count is > decremented, as you observ

Re: strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 04/05/10 09:23, Gregory Ewing wrote: Grant Edwards wrote: In your example, it's simply not possible to determine the file's absolute path within the filesystem given the relative path you provided. Actually, I think it *is* theoretically possible to find an absolute path for the file in th

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 20:08:36 +1200, Gregory Ewing wrote: >> except that Python objects can form a generalized graph, and Unix >> filesystems are constrained to be a tree. > > Actually I believe that root is allowed to create arbitrary hard links to > directories in Unix, so it's possible to turn

Re: design question

2010-05-04 Thread Tim Arnold
On May 4, 3:39 am, Bruno Desthuilliers wrote: > Alf P. Steinbach a écrit : > (snip) > > > Re efficiency it seems to be a complete non-issue, but correctness is > > much more important: is there any way that the config details can be > > (inadvertently) changed while the build is going on? > > +1

Re: strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 04/05/10 09:08, Gregory Ewing wrote: Grant Edwards wrote: except that Python objects can form a generalized graph, and Unix filesystems are constrained to be a tree. Actually I believe that root is allowed to create arbitrary hard links to directories in Unix, so it's possible to turn the

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Mon, 03 May 2010 06:18:55 -0700, Chris Rebert wrote: >> but how can python determine the >> parent directory of a directory that no longer exists? > > Whether or not /home/baz/tmp/xxx/ exists, we know from the very structure > and properties of directory paths that its parent directory is, *by

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith wrote: > For more information on Literate Programming in general see the following > links. None of which address the question of what you found problematic about generating Python code. Was it issues with indentation? -- http://mail.python.org/mailman/listinfo/python-list

RE: How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Barak, Ron
> -Original Message- > From: Stefan Behnel [mailto:[email protected]] > Sent: Tuesday, May 04, 2010 10:24 AM > To: [email protected] > Subject: Re: How to get xml.etree.ElementTree not bomb on > invalid characters in XML file ? > > Barak, Ron, 04.05.2010 09:01: > > I'm parsing

Re: Django as exemplary design

2010-05-04 Thread alex23
TomF wrote: > I'm interested in improving my python design by studying a large, > well-designed codebase.  Someone (not a python programmer) suggested > Django.  I realize that Django is popular, but can someone comment on > whether its code is well-designed and worth studying? Here's a viewpoint

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Peter Otten
Nico Schlömer wrote: > Hi, > > I ran into a bit of an unexpected issue here with itertools, and I > need to say that I discovered itertools only recently, so maybe my way > of approaching the problem is "not what I want to do". > > Anyway, the problem is the following: > I have a list of diction

py3 tkinter acceps bytes. why?

2010-05-04 Thread Matthias Kievernagel
From: Matthias Kievernagel Subject: py3 tkinter acceps bytes. why? Newsgroups: comp.lang.python Summary: Keywords: In a recent thread named "py3 tkinter Text accepts what bytes?" (google groups link: http://groups.google.com/group/comp.lang.python/browse_thread/thread/b75ed69f4e81b202/e2aff9ddd

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, alex23 wrote: > From: alex23 > Subject: Re: Teaching Programming > To: [email protected] > Date: Tuesday, May 4, 2010, 10:06 AM > Ed Keith > wrote: > > For more information on Literate Programming in > general see the following links. > > None of which address the ques

RE: Django as exemplary design

2010-05-04 Thread Michael . Coll-Barth
> From: alex23 > (I also think there's value to be gained in studying _bad_ code, > too...) Oh, very true. And not just true for python. But, only if an 'expoert' points out why it is bad and provides an alternative. And saying things like, "it isn't pyhonic" or that such and such is a more "

Re: Teaching Programming

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: > To deal with indentation I had to > >   1) keep track of indentation of all chunks of code embedded in the >      document and indent inserted chunks to the sum of all the >      indentation of the enclosing chunks. In my experience of non-indent

Re: [OT] strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 04/05/10 03:25, Grant Edwards wrote: On 2010-05-04, Charles wrote: I don't see how it's inelegant at all. Perhaps it's counter-intuitive if you don't understand how a Unix filesystem works, but the underlying filesystem model is very simple, regular, and elegant. but probably makes some

Re: strange interaction between open and cwd

2010-05-04 Thread Grant Edwards
On 2010-05-04, Gregory Ewing wrote: > Grant Edwards wrote: > >> except that Python objects can form a generalized graph, and Unix >> filesystems are constrained to be a tree. > > Actually I believe that root is allowed to create arbitrary > hard links to directories in Unix, I know that used to b

Re: Teaching Programming

2010-05-04 Thread Andre Engels
On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: > On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: >> To deal with indentation I had to >> >>   1) keep track of indentation of all chunks of code embedded in the >>      document and indent inserted chunks to the sum of all the >>      indentati

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, James Mills wrote: > From: James Mills > Subject: Re: Teaching Programming > To: "python list" > Date: Tuesday, May 4, 2010, 10:35 AM > On Wed, May 5, 2010 at 12:21 AM, Ed > Keith > wrote: > > To deal with indentation I had to > > > >   1) keep track of indentation of all c

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Andre Engels wrote: > From: Andre Engels > Subject: Re: Teaching Programming > To: "James Mills" > Cc: "python list" > Date: Tuesday, May 4, 2010, 11:00 AM > On Tue, May 4, 2010 at 4:35 PM, James > Mills > > wrote: > > On Wed, May 5, 2010 at 12:21 AM, Ed Keith > wrote: >

Re: Teaching Programming

2010-05-04 Thread Ethan Furman
Andre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the i

Re: HTTP server + SQLite?

2010-05-04 Thread Gilles Ganault
On Mon, 3 May 2010 23:07:08 -0700 (PDT), Bryan wrote: >I love SQLite because it solves problems I actually have. For the vast >majority of code I write, "lite" is a good thing, and lite as it is, >SQLite can handle several transactions per second. I give SQLite a >file path and in a split second I

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
Ed Keith, 04.05.2010 15:19: --- On Tue, 5/4/10, Stefan Behnel wrote: Ed Keith, 04.05.2010 14:15: Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! Interesting. Could you elaborate a bit? Could you give a short

Re: How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Stefan Behnel
Barak, Ron, 04.05.2010 16:11: I'm parsing XML files using ElementTree from xml.etree (see code below (and attached xml_parse_example.py)). However, I'm coming across input XML files (attached an example: tmp.xml) which include invalid characters, that produce the following traceback: $ python

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: Teaching Programming > To: [email protected] > Date: Tuesday, May 4, 2010, 11:33 AM > Ed Keith, 04.05.2010 15:19: > > --- On Tue, 5/4/10, Stefan Behnel wrote: > >> Ed Keith, 04.05.2010 14:15: > >>> Python is a gre

Re: Teaching Programming

2010-05-04 Thread D'Arcy J.M. Cain
On Wed, 5 May 2010 00:35:18 +1000 James Mills wrote: > In my experience of non-indentation sensitive languages > such as C-class (curly braces) it's just as hard to keep track > of opening and closing braces. Harder. That was the big "Aha!" for me with Python. My first programming language was

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith wrote: > Tabs are always a problem when writing Python. I get > around this problem by setting my text editor to expand > all tabs with spaces when editing Python, but I have had > problems when coworkers have not done this. It's best not to trust others to do the right thing. I do trust

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
Ed Keith, 04.05.2010 17:43: The PITA is having to keep track of the indentation of each embedded chunk and summing it for each level of indentation. This requires a fair amount of bookkeeping that would not otherwise be necessary. The original prototype simply replaced each embedded chunk with t

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok, since you ask

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
On 5/3/2010 7:46 PM, cjw wrote: Nobody likes indentation at first, Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great advancements of Fortran77 over FortranIV. Coming from C, I was immediately gla

Re: Teaching Programming

2010-05-04 Thread D'Arcy J.M. Cain
On Tue, 4 May 2010 17:00:11 +0200 Andre Engels wrote: > Although I have little or no experience with this, I still dare to say > that I don't agree. The difference is that in C you do not _need_ to > know where in the braces-defined hierarchy you are. You just embed or > change a piece of code at

Re: Teaching Programming

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 8:49 AM, D'Arcy J.M. Cain wrote: > On Wed, 5 May 2010 00:35:18 +1000 > James Mills wrote: >> In my experience of non-indentation sensitive languages >> such as C-class (curly braces) it's just as hard to keep track >> of opening and closing braces. > > Harder.  That was the

Re: Teaching Programming

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 8:52 AM, Stefan Behnel wrote: > Ed Keith, 04.05.2010 17:43: >> The PITA is having to keep track of the indentation of each embedded >> chunk and summing it for each level of indentation. This requires a fair >> amount of bookkeeping that would not otherwise be necessary. >>

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
On 5/4/2010 8:46 AM, superpollo wrote: but i do not think i can use it myself, since my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I think we can agree that Python (unlike C, for instance) is not good for writing non-humanly-readable one-un

Re: Teaching Programming

2010-05-04 Thread Dave Angel
Ethan Furman wrote: Andre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the

Re: Teaching Programming

2010-05-04 Thread Gary Herron
Terry Reedy wrote: On 5/3/2010 7:46 PM, cjw wrote: Nobody likes indentation at first, Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great advancements of Fortran77 over FortranIV. Coming from C, I

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
superpollo, 04.05.2010 17:55: since i have some kind of computer literacy (as opposed to most of my colleagues), some years ago i was kindly asked to try and solve a "simple" particular problem, that is to write a program that generates math exercises (q+a) from an example taken from the textbook

Re: HTTP server + SQLite?

2010-05-04 Thread Terry Reedy
On 5/4/2010 2:07 AM, Bryan wrote: The SQLite developers state the situation brilliantly at http://www.sqlite.org/whentouse.html: For future reference, that link does not work with Thunderbird. This one does. http://www.sqlite.org/whentouse.html When posting links, best to put them on a lin

Re: long int computations

2010-05-04 Thread Mensanator
On May 3, 10:17 am, [email protected] (Victor Eijkhout) wrote: > I have two long ints, both too long to convert to float, but their ratio > is something reasonable. How can I compute that? The obvious "(1.*x)/y" > does not work. You could try using the gmpy module. It supports arbitrary precisi

Re: Recursive functions not returning lists as expected

2010-05-04 Thread Terry Reedy
On 5/4/2010 1:45 AM, rickhg12hs wrote: On May 4, 1:34 am, Cameron Simpson wrote: On 03May2010 22:02, rickhg12hs wrote: | Would a kind soul explain something basic to a python noob? | | Why doesn't this function always return a list? | | def recur_trace(x,y): | print x,y | if not x: | r

scrolledtext download location

2010-05-04 Thread Robin
Does anyone know where I can download the ScrolledText tkintewr widget, looked all over for it and had no luck, Thanks, -Robin -- http://mail.python.org/mailman/listinfo/python-list

Re: long int computations

2010-05-04 Thread Victor Eijkhout
Mensanator wrote: > You could try using the gmpy module. It supports arbitrary precision > floats, so converting long to float is no problem. I fear I may actually have to go symbolic. I'm now having to use the 12th root of 2, and I would like the twelfth power of that to be exactly 2. Victor.

Re: How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Terry Reedy
On 5/4/2010 11:37 AM, Stefan Behnel wrote: Barak, Ron, 04.05.2010 16:11: The XML file seems to be valid XML (all XML viewers I tried were able to read it). From Internet Explorer: The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and the

Re: new extension generator for C++

2010-05-04 Thread Rouslan Korneychuk
On 05/04/2010 03:06 AM, Samuel Williams wrote: Dear Rouslan, It looks interesting. I say go for it. You will learn something and might make some improvements on existing ideas. I recommend putting the code on www.github.com Kind regards, Samuel Thanks for the suggestion. I think I'll do jus

Re: scrolledtext download location

2010-05-04 Thread Terry Reedy
On 5/4/2010 1:32 PM, Robin wrote: Does anyone know where I can download the ScrolledText tkintewr widget, looked all over for it and had no luck, Since this is a module included with tkinter which is included with Python, (at least on Windows) I am puzzled. Perhaps you need to supply more inf

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type

Re: py3 tkinter acceps bytes. why?

2010-05-04 Thread Terry Reedy
On 5/4/2010 10:17 AM, Matthias Kievernagel wrote: From: Matthias Kievernagel Subject: py3 tkinter acceps bytes. why? Newsgroups: comp.lang.python Summary: Keywords: In a recent thread named "py3 tkinter Text accepts what bytes?" (google groups link: http://groups.google.com/group/comp.lang.pytho

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
On 5/4/2010 1:44 PM, Dennis Lee Bieber wrote: On Tue, 04 May 2010 12:06:10 -0400, Terry Reedy declaimed the following in gmane.comp.python.general: Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great a

  1   2   >