Re: [Tutor] regex grouping/capturing

2013-06-14 Thread Albert-Jan Roskam
- Original Message - From: Andreas Perstinger andiper...@gmail.com To: tutor@python.org Cc: Sent: Thursday, June 13, 2013 8:09 PM Subject: Re: [Tutor] regex grouping/capturing On 13.06.2013 17:09, Albert-Jan Roskam wrote: I have a string of the form required optional3 optional2

Re: [Tutor] regex grouping/capturing

2013-06-14 Thread Andreas Perstinger
On 14.06.2013 10:48, Albert-Jan Roskam wrote: I am trying to create a pygments regex lexer. Well, writing a lexer is a little bit more complex than your original example suggested. Here's a simplfied example of the 'set' command that I would like to parse. s = 'set workspace = 6148

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
i am trying to figure a way to to use a list to log/print my data: # tmplist = [time, 'nac', 'tgid', 'source', 'dest', 'algid'] is what we want tmplist = [] tmplist.append((str(strftime(%Y-%m-%d %H:%M:%S, localtime( tmplist.append(field_values[nac])

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values[nac]) Thats where the error is but i dont see too many brackets? On 06/14/2013 08:56 AM, Flynn, Stephen (L P - IT) wrote: Not enough closing brackets on the previous line... or actually too

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Don Jennings
On Jun 14, 2013, at 9:27 AM, Matt D wrote: im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values[nac]) Thats where the error is but i dont see too many brackets? Please don't top post. The error is not on this line, but on the previous one.

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Steven D'Aprano
On 14/06/13 22:45, Matt D wrote: tmplist = [] tmplist.append((str(strftime(%Y-%m-%d %H:%M:%S, localtime( tmplist.append(field_values[nac]) [...] When i run the code program dies like this: tmplist.append(field_values[nac]) ^ SyntaxError:

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Alan Gauld
On 14/06/13 14:27, Matt D wrote: im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values[nac]) Thats where the error is No, that's where Python *detected* that an error existed. The actual error is on the previous line. This is quite common,

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 10:27 AM, Alan Gauld wrote: On 14/06/13 14:27, Matt D wrote: im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values[nac]) Thats where the error is No, that's where Python *detected* that an error existed. The actual error is on the

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time #self.logfile.write('%s,'%(str(strftime(%Y-%m-%d %H:%M:%S, gmtime()

[Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Dotan Cohen
What are these two string-formatting styles called? '%.3f' % x '{0:.3f}'.format(x) Where in the fine manual is their names shown? Thanks! -- Dotan Cohen http://gibberish.co.il http://what-is-what.com ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Alan Gauld
On 14/06/13 15:37, Matt D wrote: There is a difference between where an error *occurs* and where an error is *detected*. got it. the error can be in the previous line. Yeah, or more. I've seen errors that originated 3 or 4 lines back from the reported location. So just remember that if you

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Steven D'Aprano
On 15/06/13 01:23, Dotan Cohen wrote: What are these two string-formatting styles called? '%.3f' % x '{0:.3f}'.format(x) String formatting, and string formatting *wink* Sometimes the first is called string interpolation. Sometimes it is called printf-style formatting, after the C function.

Re: [Tutor] sound implementation problems

2013-06-14 Thread eryksun
On Thu, Jun 13, 2013 at 11:55 PM, Jim Mooney cybervigila...@gmail.com wrote: My IDE startup script has been changed to also go to the proper working directory. BUT - Py 3.3 at the command prompt uses my 3.3 working directory, and Py 2.7 ALSO uses the 3.3 working directory, which is not what I

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
On 14 June 2013 08:23, Dotan Cohen dotanco...@gmail.com wrote: What are these two string-formatting styles called? '%.3f' % x '{0:.3f}'.format(x) The first one is a string Expression, using % as the overloaded operator The second one is a string method, with .format() as the method for a

Re: [Tutor] sound implementation problems

2013-06-14 Thread Jim Mooney
On 14 June 2013 08:49, eryksun eryk...@gmail.com wrote: C:\doskey calc=c:\python33\python -c from cmath import *;print($*) C:\calc e**(1j*pi/3) (0.5001+0.8660254037844386j) Cool. I totally forgot about doskey macros. Still could be useful, and it looks like they're

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread eryksun
On Fri, Jun 14, 2013 at 12:01 PM, Jim Mooney cybervigila...@gmail.com wrote: On 14 June 2013 08:23, Dotan Cohen dotanco...@gmail.com wrote: What are these two string-formatting styles called? '%.3f' % x '{0:.3f}'.format(x) The first one is a string Expression, using % as the overloaded

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
On 14 June 2013 09:40, eryksun eryk...@gmail.com wrote: or with built-in format(): format(Decimal(1).exp(), '.27f') '2.718281828459045235360287471' I didn't know .format() also had a builtin. Are there many methods that are dual like that? On the one hand, it's more memorizing,

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Steven D'Aprano
On 15/06/13 03:32, Jim Mooney wrote: Now you're going to tell me there's a programmer's keyboard ;') http://en.wikipedia.org/wiki/Space-cadet_keyboard http://upload.wikimedia.org/wikipedia/commons/4/47/Space-cadet.jpg http://ageinghacker.net/hacks/apl-keyboard/apl-keyboard-2.jpg

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
On 14 June 2013 10:56, Steven D'Aprano st...@pearwood.info wrote: On 15/06/13 03:32, Jim Mooney wrote: Now you're going to tell me there's a programmer's keyboard ;') http://en.wikipedia.org/wiki/**Space-cadet_keyboardhttp://en.wikipedia.org/wiki/Space-cadet_keyboard

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread student Tyler Northrip
In response to your points, voice command using visuals, this idea has been explored before. In the book containment by Christian Cantrell they use methods such as this. The main character places a helmet on his head, and writes code using his mind. Voice command was also used as well. Will

[Tutor] Fwd: What are these two string-formatting styles called?

2013-06-14 Thread student Tyler Northrip
In response to your points, voice command using visuals, this idea has been explored before. In the book containment by Christian Cantrell they use methods such as this. The main character places a helmet on his head, and writes code using his mind. Voice command was also used as well. Will

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
14 June 2013 11:59, student Tyler Northrip northri...@s.dcsdk12.orgwrote: In response to your points, voice command using visuals, this idea has been explored before. In the book containment by Christian Cantrell theyuse methods such as this. The main character places a helmet on his head,

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Dave Angel
On 06/14/2013 10:48 AM, Matt D wrote: Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 03:14 PM, Dave Angel wrote: On 06/14/2013 10:48 AM, Matt D wrote: Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Dave Angel
On 06/14/2013 03:59 PM, Matt D wrote: On 06/14/2013 03:14 PM, Dave Angel wrote: On 06/14/2013 10:48 AM, Matt D wrote: Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and

Re: [Tutor] sound implementation problems

2013-06-14 Thread Dave Angel
On 06/14/2013 11:43 AM, Jim Mooney wrote: On 13 June 2013 21:53, Dave Angel da...@davea.name wrote: On 06/13/2013 11:55 PM, Jim Mooney wrote: Alan Gauld alan.ga...@btinternet.com This is for my own convenience on my own machine. As a former webmaster I'm of course used to idiot-proofing

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Dave Angel
On 06/14/2013 03:09 PM, Jim Mooney wrote: SNIP Of course, the real consideration, for those thinking of programming as a career path, is whether programmers will be as obsolete at gaslighters in twenty years - or will they be doing some sort of weird meta-programming? You mean you don't

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
On 14 June 2013 13:47, Dave Angel da...@davea.name wrote: On 06/14/2013 03:09 PM, Jim Mooney wrote: You mean you don't write your own microcode in hex? New fangled computers get between us and the hardware. Give me instructions that directly manipulate voltages, and I'll be happy again.

Re: [Tutor] sound implementation problems

2013-06-14 Thread Jim Mooney
On 14 June 2013 13:35, Dave Angel da...@davea.name wrote: MS batch file py27.bat python2.7 -i -c import os;os.chdir('c:/python27/**jimprogs');del(os) That seems rather silly. Why not --py27.bat--- c: cd \python27\jimprogs python2.7 %$ - That's certainly

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Alan Gauld
On 14/06/13 19:34, Jim Mooney wrote: I'm probably going to hear that's already been done, too ;') Not in 3D to my knowledge but visual programming for sure. One example was ObjectVision from Borland on the PC. It lacked a loop construct because it was event driven but otherwise was a

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Alan Gauld
On 14/06/13 20:09, Jim Mooney wrote: Of course, the real consideration, for those thinking of programming as a career path, is whether programmers will be as obsolete at gaslighters in twenty years - or will they be doing some sort of weird meta-programming? COBOL - COmmon Business Oriented

Re: [Tutor] sound implementation problems

2013-06-14 Thread Jim Mooney
On 14 June 2013 08:49, eryksun eryk...@gmail.com wrote: On Thu, Jun 13, 2013 at 11:55 PM, Jim Mooney cybervigila...@gmail.com wrote: C:\python -i -c import os; os.chdir('C:/Python33') Well, that didn't work anyway. Got me the right directory and the interpeter, but I couldn't run a py

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Mark Lawrence
On 14/06/2013 22:46, Alan Gauld wrote: COBOL - COmmon Business Oriented Language. Designed in the 1950s to enable 'ordinary business users' to write their own programs and thus render programmers obsolete So what COBOL couldn't achieve is now being done with Applescript. -- Steve is

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Dave Angel
On 06/14/2013 05:43 PM, Alan Gauld wrote: On 14/06/13 19:34, Jim Mooney wrote: I'm probably going to hear that's already been done, too ;') Not in 3D to my knowledge but visual programming for sure. One example was ObjectVision from Borland on the PC. It lacked a loop construct because it

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread Jim Mooney
On 14 June 2013 18:09, Dave Angel da...@davea.name wrote: On 06/14/2013 05:43 PM, Alan Gauld wrote: Another one, currently popular on the RaspberryPi micro computer is Scratch: