Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Wed, 05 May 2010 02:41:09 +0100, Baz Walter wrote: > i think the algorithm also can't guarantee the intended result when > crossing filesystem boundaries. IIUC, a stat() call on the root directory > of a mounted filesystem will give the same inode number as its parent. Nope; it will have the s

Re: Fast Efficient way to transfer an object to another list

2010-05-04 Thread Gabriel Genellina
En Fri, 30 Apr 2010 23:16:04 -0300, Jimbo escribió: Hello I have a relatively simple thing to do; move an object from one to list into another. But I think my solution maybe inefficient & slow. Is there a faster better way to move my stock object from one list to another? (IE, without having to

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 3:35 PM, Michele Simionato wrote: > I am sure it has, but I was talking about just putting in the > repository an index.html file and have it published, the wayI hear  it > works in BitBucket and GitHub. I'm pretty sure Google Code Hosting doesn't support rendering text/htm

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 5, 6:39 am, James Mills wrote: > On Wed, May 5, 2010 at 2:08 PM, Michele Simionato > > wrote: > > Interesting. I tried to see if the same was true for the Wiki in > > Google code but apparently it does not work. Does anybody here know if > > it is possible to publish raw html in the Google

Re: CGI python 3 write RAW BINARY

2010-05-04 Thread Gabriel Genellina
En Sat, 01 May 2010 07:52:01 -0300, Dodo escribió: Le 30/04/2010 17:52, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 23:37:32 +0200, Dodo a écrit : I don't get a thing. Now with the fix : All browsers shows a different thing, but not the image! http://ddclermont.homeip.net/misc/python/

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 2:08 PM, Michele Simionato wrote: > Interesting. I tried to see if the same was true for the Wiki in > Google code but apparently it does not work. Does anybody here know if > it is possible to publish raw html in the Google Code wiki and how > does it work? I may be wrong,

Re: Sharing a program I wrote

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 9:16 PM, Lie Ryan wrote: > On 05/05/10 13:25, Scott wrote: >> I would like to post it to >> comp.lang.python but the main file is 169 lines long and the file for >> functions is 316 lines long. I'm thinking that is a little long for >> this format. Maybe I can put them up on

Re: Sharing a program I wrote

2010-05-04 Thread Lie Ryan
On 05/05/10 13:25, Scott wrote: > James, > > Thanks for the comprehensive reply. I would like to post it to > comp.lang.python but the main file is 169 lines long and the file for > functions is 316 lines long. I'm thinking that is a little long for > this format. Maybe I can put them up on a basi

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 9:48 am, James Mills wrote: > 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 (te

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread John Nagle
Philip Semanchuk wrote: On May 4, 2010, at 5:37 PM, pyt...@bdurham.com wrote: Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? If you can use SQLite to store the data, it will deal with your locking problems. The pain of getting

Re: Sharing a program I wrote

2010-05-04 Thread Scott
James, Thanks for the comprehensive reply. I would like to post it to comp.lang.python but the main file is 169 lines long and the file for functions is 316 lines long. I'm thinking that is a little long for this format. Maybe I can put them up on a basic web page or file sharing site and just pos

A python interface to google-sparsehash?

2010-05-04 Thread dmtr
Anybody knows if a python sparsehash module is there in the wild? -- http://mail.python.org/mailman/listinfo/python-list

Re: strange interaction between open and cwd

2010-05-04 Thread Baz Walter
On 05/05/10 00:44, Nobody wrote: On Tue, 04 May 2010 14:36:06 +0100, Baz Walter wrote: this will work so long as the file is in a part of the filesystem that can be traversed from the current directory to the root. what i'm not sure about is whether it's possible to cross filesystem boundaries

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

2010-05-04 Thread John Machin
On May 5, 3:43 am, Terry Reedy wrote: > 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 in

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith wrote: > Knuth wanted the generated source to be unreadable, so people would not be > tempted to edit the generated code. This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an erro

Re: Generating nested code with context managers

2010-05-04 Thread alex23
On May 5, 6:36 am, Terry Reedy wrote: > The relatively new with statement and associated context managers are > designed, among other things, for this situation, where one needs to > alter and restore a global context. So here is my updated (3.1) > proof-of-concept version. This is what I love ab

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

2010-05-04 Thread John Machin
On May 5, 12:11 am, "Barak, Ron" wrote: > > -Original Message- > > From: Stefan Behnel [mailto:stefan...@behnel.de] > > Sent: Tuesday, May 04, 2010 10:24 AM > > To: python-l...@python.org > > Subject: Re: How to get xml.etree.ElementTree not bomb on > > invalid characters in XML file ? > >

Re: Sharing a program I wrote

2010-05-04 Thread James Harris
On 4 May, 22:40, Scott wrote: > I'm looking for suggestions on what to do (and how to do it) if I want > to share a program that I wrote in Python. There seem to be quite a > few places to post code and I don't know how to choose. Perhaps look at the options and then select whichever suits your n

Re: strange interaction between open and cwd

2010-05-04 Thread Cameron Simpson
On 04May2010 14:48, Baz Walter wrote: | 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 lin

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Nobody
On May 4, 2010, at 5:37 PM, pyt...@bdurham.com wrote: > Is there a way to exclusively lock a file to prevent other processes > from reading it while we have it open? > My environment is Python 2.6.4 (32-bit) under Windows, but I'm looking > for a cross-platform solution if that's possible. Some

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 14:36:06 +0100, Baz Walter wrote: > this will work so long as the file is in a part of the filesystem that can > be traversed from the current directory to the root. what i'm not sure > about is whether it's possible to cross filesystem boundaries using this > kind of technique

Re: Sharing a program I wrote

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Scott wrote: > From: Scott > Subject: Sharing a program I wrote > To: python-list@python.org > Date: Tuesday, May 4, 2010, 5:40 PM > I'm looking for suggestions on what > to do (and how to do it) if I want > to share a program that I wrote in Python. There seem to be > quite

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Christian Heimes
pyt...@bdurham.com wrote: Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? I need to cache some overflow data to disk in a temp file and I want to make sure no other processes can read the contents of this file while I'm using it. I tri

Re: Django as exemplary design

2010-05-04 Thread TomF
Thanks to everyone for their comments. On 2010-05-04 07:11:08 -0700, alex23 said: 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 commen

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

2010-05-04 Thread Chris Withers
News123 wrote: Hi Chris, Chris Withers wrote: News123 wrote: from xlrd import open_workbook from xlutils.copy import copy rb = open_workbook('doc1.xls') open_workbook('doc1.xls',formatting_info=True) I'll try, but the doc mentioned explicitely, that formulas will be lost. I'll keep you u

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

2010-05-04 Thread News123
Hi Chris, Chris Withers wrote: > News123 wrote: >> >> from xlrd import open_workbook >> from xlutils.copy import copy >> >> rb = open_workbook('doc1.xls') > > open_workbook('doc1.xls',formatting_info=True) I'll try, but the doc mentioned explicitely, that formulas will be lost. I'll keep you u

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 2:37 PM, wrote: > Is there a way to exclusively lock a file to prevent other processes from > reading it while we have it open? > > I need to cache some overflow data to disk in a temp file and I want to make > sure no other processes can read the contents of this file whil

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Philip Semanchuk
On May 4, 2010, at 5:37 PM, pyt...@bdurham.com wrote: Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? I need to cache some overflow data to disk in a temp file and I want to make sure no other processes can read the contents of this f

Sharing a program I wrote

2010-05-04 Thread Scott
I'm looking for suggestions on what to do (and how to do it) if I want to share a program that I wrote in Python. There seem to be quite a few places to post code and I don't know how to choose. I wrote a program (script?) that takes a text file containing the output of the "show access-list" com

Re: Generating nested code with context managers

2010-05-04 Thread python
Terry, > So here is my updated (3.1) proof-of-concept version. Very clever! An excellent example of how to use the 'with' statement with something besides the traditional file open example. Not the original OP, but thank you anyway. Malcolm -- http://mail.python.org/mailman/listinfo/python-li

Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread python
Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? I need to cache some overflow data to disk in a temp file and I want to make sure no other processes can read the contents of this file while I'm using it. I tried the following using an 'a

Re: py3 tkinter acceps bytes. why?

2010-05-04 Thread Martin v. Loewis
> 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/e2aff9ddd62d210c?lnk=raot) > I asked what kinds of bytes are accepted as tkinter parameters. > I still wonder why they are

Re: Django as exemplary design

2010-05-04 Thread Carl Banks
On May 4, 12:37 am, Bruno Desthuilliers wrote: > 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

Re: Recursive functions not returning lists as expected

2010-05-04 Thread Terry Reedy
On 5/4/2010 4:10 PM, rickhg12hs wrote: On May 4, 1:32 pm, Terry Reedy wrote: On 5/4/2010 1:45 AM, rickhg12hs wrote: [snip] [To bad there's no tail recursion optimization.] 8-( This is prinarily a space optimization to conserve stack frame space. The speedup would be minimal. Using while o

Generating nested code with context managers

2010-05-04 Thread Terry Reedy
In a current thread, people have claimed that generating properly indented nested blocks is a pain because of the need to keep track of indent levels. Someone countered with the now rather ancient http://effbot.org/zone/python-code-generator.htm The usage example c = CodeGeneratorBackend() c.

Re: Recursive functions not returning lists as expected

2010-05-04 Thread rickhg12hs
On May 4, 1:32 pm, Terry Reedy wrote: > On 5/4/2010 1:45 AM, rickhg12hs wrote: [snip] > > [To bad there's no tail recursion optimization.]  8-( > > That issue is much more complicated than you probably imagine. [snip] No imagination is necessary - functional languages (e.g., Erlang) do it quite w

Re: str.count algorithm

2010-05-04 Thread Peter Otten
Raymond Hettinger wrote: > On May 4, 12:12 pm, Hellnar wrote: >> Hello, >> I am trying to find what algorithm Python uses for the built-in >> str.count function, if it has a name. > > Roughly the same as: > >sum(1 for c in s if c == tgt) That would be list.count(), I think. OP, the source

Re: str.count algorithm

2010-05-04 Thread Raymond Hettinger
On May 4, 12:12 pm, Hellnar wrote: > Hello, > I am trying to find what algorithm Python uses for the built-in > str.count function, if it has a name. Roughly the same as: sum(1 for c in s if c == tgt) Raymond -- http://mail.python.org/mailman/listinfo/python-list

str.count algorithm

2010-05-04 Thread Hellnar
Hello, I am trying to find what algorithm Python uses for the built-in str.count function, if it has a name. Thanks -- 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: python-list@python.org > Date: Tuesday, May 4, 2010, 11:52 AM > Ed Keith, 04.05.2010 17:43: > > The PITA is having to keep track of the indentation of > each embedded > > chunk and summing it

Re: Teaching Programming

2010-05-04 Thread Benjamin Kaplan
On Tue, May 4, 2010 at 2:16 PM, superpollo wrote: > 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:

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: 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 2

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

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: 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
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: 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: 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: 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: 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.

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: 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

Re: long int computations

2010-05-04 Thread Mensanator
On May 3, 10:17 am, s...@sig.for.address (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: 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: 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: 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 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 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 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 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 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 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 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 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 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 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 Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: Teaching Programming > To: python-list@python.org > 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: 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 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: 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 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: 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 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 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: 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: [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: 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: 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 Ed Keith
--- On Tue, 5/4/10, alex23 wrote: > From: alex23 > Subject: Re: Teaching Programming > To: python-list@python.org > 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

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: 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

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: 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:stefan...@behnel.de] > Sent: Tuesday, May 04, 2010 10:24 AM > To: python-list@python.org > 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: 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: 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: 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: 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 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: 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: [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 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: 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: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: Teaching Programming > To: python-list@python.org > 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 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: [OT] strange interaction between open and cwd

2010-05-04 Thread Charles
"Gregory Ewing" wrote in message news:84a1mcffn...@mid.individual.net... > 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: 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: 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: 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: 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: 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

  1   2   >