Re: [Tutor] Regular expression oddity

2008-11-22 Thread bob gailer
Emmanuel Ruellan wrote: Hi tutors! While trying to write a regular expression that would split a string the way I want, I noticed a behaviour I didn't expect. re.findall('.?', 'some text') ['s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't', ''] Where does the last string, the empty one

[Tutor] Regular expression oddity

2008-11-22 Thread Emmanuel Ruellan
Hi tutors! While trying to write a regular expression that would split a string the way I want, I noticed a behaviour I didn't expect. >>> re.findall('.?', 'some text') ['s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't', ''] Where does the last string, the empty one, come from? I find this behaviour r

Re: [Tutor] python question

2008-11-22 Thread Kent Johnson
On Sat, Nov 22, 2008 at 2:39 PM, spir <[EMAIL PROTECTED]> wrote: > -1- Give each of your texts a name (Qn,An,...). Use these names to program > the logic. Associate a value to all of these names, creating 'constants', at > e.g. the head of your programm. > -2- Do the same, but in a separate file,

Re: [Tutor] the sense of brackets

2008-11-22 Thread Kent Johnson
On Sat, Nov 22, 2008 at 10:42 AM, spir <[EMAIL PROTECTED]> wrote: > I have long thought "[]" /simply/ is a list constructor syntax. list(x) and [x] are not equivalent, as you have discovered. list(x) requires that x is a sequence - something that can be iterated - and it makes a new list out of t

Re: [Tutor] the sense of brackets

2008-11-22 Thread spir
W W a écrit : > On Sat, Nov 22, 2008 at 9:42 AM, spir <[EMAIL PROTECTED]> wrote: > >> I have long thought "[]" /simply/ is a list constructor syntax. >> What do you think of the following? >> >> t = "aze" >> print t, list(t), [t] >> print list(list(t)), list([t]), [list(t)], [[t]] >> ==> >> aze ['

Re: [Tutor] python question

2008-11-22 Thread spir
Some comments on your code, after David & Kent: * repetition You have probably noticed that your programm repeats over and over the same pattern, that could be called "process of a question". One major point of programming is precisely to cope with such a repetitive task (this was true even be

Re: [Tutor] the sense of brackets

2008-11-22 Thread W W
On Sat, Nov 22, 2008 at 9:42 AM, spir <[EMAIL PROTECTED]> wrote: > I have long thought "[]" /simply/ is a list constructor syntax. > What do you think of the following? > > t = "aze" > print t, list(t), [t] > print list(list(t)), list([t]), [list(t)], [[t]] > ==> > aze ['a', 'z', 'e'] ['aze'] > ['

Re: [Tutor] extend my re

2008-11-22 Thread Mark Tolonen
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I've got a half working re but I can't find a way to give it the final touch. Let's say I have (it would actually be source code file) : import re MyString = """Algo ... Start ... otro ... comment ...

Re: [Tutor] Size of Python Console

2008-11-22 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote is there a way I can begin with something other than the default? It's an inconvenience to the user to do this every time. Create a shortcut that specifies the window parameters. (use properties and adjust the font and layout tab settings) Distrib

Re: [Tutor] extend my re

2008-11-22 Thread Ricardo Aráoz
Marco Catunda wrote: > Ricardo, > > Try this pattern > > MyPattern = > re.compile(r'(.*?Start.*?)((^.*?comment.*?)*)(^.*?comment)(.*?end)', > re.S | re.M ) > > Almost did it. But if there was something after and in the same line of the "comment" I want commented it wouldnt be taken. from :

Re: [Tutor] Size of Python Console

2008-11-22 Thread Wayne Watson
Title: Signature.html Very good, but is there a way I can begin with something other than the default? It's an inconvenience to the user to do this every time. As I recall distantly in XWin days they had something one could put in the command line that would specify the size. Kent Johnson wrot

[Tutor] the sense of brackets

2008-11-22 Thread spir
I have long thought "[]" /simply/ is a list constructor syntax. What do you think of the following? t = "aze" print t, list(t), [t] print list(list(t)), list([t]), [list(t)], [[t]] ==> aze ['a', 'z', 'e'] ['aze'] ['a', 'z', 'e'] ['aze'] [['a', 'z', 'e']] [['aze']]

Re: [Tutor] Size of Python Console

2008-11-22 Thread Kent Johnson
On Sat, Nov 22, 2008 at 9:43 AM, Wayne Watson <[EMAIL PROTECTED]> wrote: > How do I make the console window bigger? On Windows click on the window icon (top left) and pick Properties. There are lots of goodies in there including window size and buffer size (how much the window will scroll). Kent

Re: [Tutor] pylab Failure

2008-11-22 Thread Wayne Watson
Title: Signature.html Pylab runs fine under 2.5, and I've since moved there. Wayne Watson wrote: I copied the following code from a matplotlib tutorial, and it fails. I'm using python 2.4 on Win XP. It's matplotlib-0.98.3.win32-py2.4exe. With or without the finish function it fails in IDLE wit

Re: [Tutor] Size of Python Console

2008-11-22 Thread Wayne Watson
Title: Signature.html Correct. Now that we are engaged in a, perhaps dialectic, dialog I'm using Win XP with Python 2.5, and am using IDLE. Further, I would like to know how to do this with a Python program that I've distributed to users who know nothing about IDLE.  That is, they simply click

[Tutor] Size of Python Console

2008-11-22 Thread Wayne Watson
Title: Signature.html How do I make the console window bigger? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) 'That's one small step for a man; one giant leap for man

[Tutor] extend my re

2008-11-22 Thread Ricardo Aráoz
Hi, I've got a half working re but I can't find a way to give it the final touch. Let's say I have (it would actually be source code file) : >>> import re >>> MyString = """Algo ... Start ... otro ... comment ... otro ... comment ... comment ... otro ... end ... """ >>>

Re: [Tutor] python question

2008-11-22 Thread Kent Johnson
On Fri, Nov 21, 2008 at 1:31 PM, Daniel J Kramer <[EMAIL PROTECTED]> wrote: > Hi > > I have just joined this list. I need some help working on a Python > application I am working on. I am working on a quiz game where the users > gain points when the answer questions correctly. I have written the

Re: [Tutor] python reverse engineering tools

2008-11-22 Thread Paul McGuire
It's not free, but I have had good success with Enterprise Architect from Sparx Systems (http://www.sparxsystems.com.au/). It will generate class diagrams from Python, C/C++, C#, Java. It also supports the full complement of UML diagrams - sequence diagrams are a special treat when you just drag