Re: Python education survey

2011-12-19 Thread Devin Jeanpierre
My university (University of Toronto) helped design Wing 101, and uses it exclusively in introductory courses. Overall, the only major sticking points that I saw (as a TA who helped with the code labs and setup) were installation issues on OS X (relating to X11) and some confusion on when the embe

Re: Python education survey

2011-12-19 Thread Luka Dornhecker
On Tuesday, December 20, 2011 4:51:00 AM UTC+1, Raymond Hettinger wrote: > Do you use IDLE when teaching Python? > If not, what is the tool of choice? > > Students may not be experienced with the command-line and may be > running Windows, Linux, or Macs. Ideally, the tool or IDE will be > easy to

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread alex23
Steven D'Aprano wrote: > Nevertheless, I think the suggested syntax "@list args" is awful. Yep, and it's the least awful part of the entire proposal. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python education survey

2011-12-19 Thread Alec Taylor
Two suggestions: - Editra (free): Requires a little bit of fiddling around and enabling Shelf, installing plugins but then it is great - Recently I was introduced to Sublime Text 2 which has an über streamlined layout. On Tue, Dec 20, 2011 at 2:51 PM, Raymond Hettinger wrote: > Do you use IDLE w

Re: IPython 0.12 is out!

2011-12-19 Thread Fernando Perez
On Mon, 19 Dec 2011 20:00:03 -0800, alex23 wrote: > You read the installation instructions and did a 'python setup.py > install' as it states, yes? > > Installed that way for Python 2.7.2 under Win64 with no issues > whatsoever. Glad to hear that. Obviously since I announced it here I'll try to

Re: JOKE OF THE YEAR

2011-12-19 Thread Steven D'Aprano
On Mon, 19 Dec 2011 23:32:47 -0600, krok wrote: > a microsoft python IDE I don't get it. Are you saying that Microsoft doesn't support Python? They funded IronPython for many years. http://ironpython.net/ Or that Microsoft doesn't do IDEs? http://en.wikipedia.org/wiki/Microsoft_Visual_Studio

回复: Columnize in module "cmd"

2011-12-19 Thread Tom Zhou
Thanks for your reply! But i think using "for@for@for" to find out the appropriate column size is also another waste, on the other hand, the length of the list's single string is similar with each other usually, so the maximum maybe is the mode of the list. 发件人

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Steven D'Aprano
On Mon, 19 Dec 2011 19:35:20 -0800, alex23 wrote: > Eelco wrote: >> Having two seperate symbols seperated by whitespace, as in @list args >> strikes me as a terrible break of normal python lexical rules. > > You mean like 'is not'? And the upcoming 'yield from'? Also "not in". Space-delimited

Re: Need help with really elementary pexpect fragment

2011-12-19 Thread Nick Dokos
Saqib Ali wrote: > > I want to write a pexpect script that simply cd's into a directory ("~/ > install") and then runs a command from there. It should be so easy. > But even my cd command is failing. Can't figure out what the problem > is. The command line prompt is "[my machine name here] % " >

Need help with really elementary pexpect fragment

2011-12-19 Thread Saqib Ali
I want to write a pexpect script that simply cd's into a directory ("~/ install") and then runs a command from there. It should be so easy. But even my cd command is failing. Can't figure out what the problem is. The command line prompt is "[my machine name here] % " Here is the code fragment:

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Chris Angelico
On Tue, Dec 20, 2011 at 2:31 PM, alex23 wrote: > On Dec 19, 2:35 pm, Chris Angelico wrote: >> Point to note: >> >> list,set = set,list  # Request a death sentence from the next maintainer >> >> is perfectly legal code. Now, what does your "args=" line do? >> >> ChrisA > > Why are you directing th

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/19/2011 9:38 PM, alex23 wrote: > Do you mean directly editing the source code on a production machine? > Because that's pretty much the only scenario I can come up with where > that's plausible. You'd have to ask Steven D'Aprano; it was his scenario. -- CPython 3.2.2 | Windows NT 6.1.7601.1

Re: IPython 0.12 is out!

2011-12-19 Thread alex23
On Dec 20, 4:07 am, Wanderer wrote: > The windows installer didn't work but installing from the tar file > did. But installing from the tar file doesn't install Ipython in the > site-packages directory. It installs it wherever you untar the tar > file. I don't remember ever having to deal with thi

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread alex23
On Dec 19, 2:35 pm, Chris Angelico wrote: > Point to note: > > list,set = set,list  # Request a death sentence from the next maintainer > > is perfectly legal code. Now, what does your "args=" line do? > > ChrisA Why are you directing this at my mocking of the OPs idea when the same issue is pres

Re: Transform two tuples item by item

2011-12-19 Thread Gnarlodious
Wow, that is so elegant. Python is awesome. -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Question: Obtain element from list of tuples

2011-12-19 Thread alex23
On Dec 19, 4:46 pm, "Frank Millman" wrote: > Am I missing something? No, I seem to be. I have _no_ idea how I got that original syntax to work :| My apologies, DevPlayer's suggestion is much more sensible, although slices are still handy when dealing with groups of values. -- http://mail.pytho

Python education survey

2011-12-19 Thread Raymond Hettinger
Do you use IDLE when teaching Python? If not, what is the tool of choice? Students may not be experienced with the command-line and may be running Windows, Linux, or Macs. Ideally, the tool or IDE will be easy to install and configure (startup directory, path, associated with a particular version

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread alex23
On Dec 20, 7:57 am, Andrew Berg wrote: > But what about the example he gave about being logged into a customer's > machine with only ed available? I suppose such fools would not be worthy > of your business. Do you mean directly editing the source code on a production machine? Because that's pret

Re: Grammar for classes

2011-12-19 Thread Ian Kelly
On Mon, Dec 19, 2011 at 6:34 PM, Joshua Landau wrote: > In reading thorough the syntax defined in the reference, the class statement > has surprised me. > > It says that the inheritance part of the class can accept comprehensions. > What does this mean? > I've tried: > "class A(x for x in ()): pas

Re: Transform two tuples item by item

2011-12-19 Thread Steven D'Aprano
On Mon, 19 Dec 2011 18:04:15 -0800, Gnarlodious wrote: > What is the best way to operate on a tuple of values transforming them > against a tuple of operations? Result can be a list or tuple: Create a list of functions: ops = [lambda obj: obj, "{}".format, bool, bool,

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread alex23
Eelco wrote: > Having two seperate symbols seperated by whitespace, as in @list args > strikes me as a terrible break of normal python lexical rules. You mean like 'is not'? And the upcoming 'yield from'? -- http://mail.python.org/mailman/listinfo/python-list

Re: Columnize in module "cmd"

2011-12-19 Thread Ian Kelly
On Mon, Dec 19, 2011 at 7:53 PM, Tom Zhou wrote: > Hi~ alls > recently, i focus on the module "cmd", and find some confused things-- the > function named "columnize". Why we need a multiloop as > "for nrows .. > for col .. >for row.." > ?? i think we can make a easier m

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread alex23
On Dec 19, 8:15 pm, Eelco wrote: > What does that have to do with collection packing/unpacking? It's mocking your insistance that collection unpacking is a type constraint. -- http://mail.python.org/mailman/listinfo/python-list

Re: the slash & Windows paths

2011-12-19 Thread Steven D'Aprano
On Mon, 19 Dec 2011 15:02:50 -0700, Juan Declet-Barreto wrote: > xmlns:o="urn:schemas-microsoft-com:office:office" > xmlns:w="urn:schemas-microsoft-com:office:word" > xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"; > xmlns="http://www.w3.org/TR/REC-html40";> http-equiv=Content-Type co

Re: The ever-expanding bubble of GREED

2011-12-19 Thread Ian Kelly
On Mon, Dec 19, 2011 at 8:15 PM, Rick Johnson wrote: > I just read an article[1] reporting that Apple has won a court case > against Andoid (and others) over a patent infringement. Before i was > able to see what all the hub-bub was about my mind started to wonder > what "advanced technology" Goog

The ever-expanding bubble of GREED

2011-12-19 Thread Rick Johnson
I just read an article[1] reporting that Apple has won a court case against Andoid (and others) over a patent infringement. Before i was able to see what all the hub-bub was about my mind started to wonder what "advanced technology" Google has stolen from Apple. To my great UNSURPRISE the so-calle

About pysvn for x64 system

2011-12-19 Thread 1011_wxy
Hi: I want to use svn to backup my oracle db object daily,so i want to use pysvn module. server: windows server 2008 64bit python:Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32 I have downloaded pysvn from "http://pysvn.tigris.org/files/documents/1233/4

Re: re.sub(): replace longest match instead of leftmost match?

2011-12-19 Thread Ian Kelly
On Mon, Dec 19, 2011 at 4:15 PM, wrote: > On Dec 16, 11:49 am, John Gordon wrote: >> I'm working with IPv6 CIDR strings, and I want to replace the longest >> match of "(:|$)+" with ":".  But when I use re.sub() it replaces >> the leftmost match, even if there is a longer match later in t

Columnize in module "cmd"

2011-12-19 Thread Tom Zhou
Hi~ alls recently, i focus on the module "cmd", and find some confused things-- the function named "columnize". Why we need a multiloop as "for nrows ..         for col ..                    for row.." ?? i think we can make a easier method, for example, first, find out the maxlen str in list, an

Re: Transform two tuples item by item

2011-12-19 Thread Tim Chase
On 12/19/11 20:04, Gnarlodious wrote: What is the best way to operate on a tuple of values transforming them against a tuple of operations? Result can be a list or tuple: tup=(35, '34', 0, 1, 31, 0, '既濟') from cgi import escape [tup[0], " class='H'>{}".format(tup[1]), bool(tup[2]), bool(tup[3])

Transform two tuples item by item

2011-12-19 Thread Gnarlodious
What is the best way to operate on a tuple of values transforming them against a tuple of operations? Result can be a list or tuple: tup=(35, '34', 0, 1, 31, 0, '既濟') from cgi import escape [tup[0], "{}".format(tup[1]), bool(tup[2]), bool(tup[3]), tup[4], bool(tup[5]), escape(tup[6])] -> [35,

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/19/2011 7:18 PM, Roy Smith wrote: > Sorry, I wasn't meaning to imply support for the syntax proposal. Just > reacting to the (seemingly unrelated) comment that a customer with > foolish access policies would not be worthy of your business. It was directed at Rick, and by "your", I was refer

Grammar for classes

2011-12-19 Thread Joshua Landau
In reading thorough the syntax defined in the reference, the class statement has surprised me. It says that the inheritance part of the class can accept comprehensions. What does this mean? I've tried: "class A(x for x in

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Joshua Landau
On 20 December 2011 01:18, Roy Smith wrote: > Sorry, I wasn't meaning to imply support for the syntax proposal. Just > reacting to the (seemingly unrelated) comment that a customer with foolish > access policies would not be worthy of your business. Only because I've > been in the situation of

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Roy Smith
Sorry, I wasn't meaning to imply support for the syntax proposal. Just reacting to the (seemingly unrelated) comment that a customer with foolish access policies would not be worthy of your business. Only because I've been in the situation of having to provide remote support to major customers

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Joshua Landau
On 20 December 2011 00:30, Roy Smith wrote: > In article , > Andrew Berg wrote: > > > But what about the example he gave about being logged into a customer's > > machine with only ed available? I suppose such fools would not be worthy > > of your business. > > The customer is always right. Esp

Re: Newbie Question: Obtain element from list of tuples

2011-12-19 Thread HoneyMonster
On Mon, 19 Dec 2011 10:40:06 +1100, Chris Angelico wrote: > On Mon, Dec 19, 2011 at 9:55 AM, HoneyMonster > wrote: >> When the user selects a row and clicks a button, I am using: >> pos = self.grid_1.GetGridCursorRow() to establish which tuple in recs >> is involved, and then pid = recs[pos][4] t

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Roy Smith
In article , Andrew Berg wrote: > But what about the example he gave about being logged into a customer's > machine with only ed available? I suppose such fools would not be worthy > of your business. The customer is always right. Especially when the support contract is big enough to make or

Re: the slash & Windows paths

2011-12-19 Thread Dave Angel
On 12/19/2011 05:02 PM, Juan Declet-Barreto wrote: All, I have a Windows-style path that I need to modify so Python functions can find it. For example, the path "C:\Projects\Population_Pyramids\charts\test.xls" is being interpreted as pointing to a file called "est.xls" since the "t" is being

Re: Make a small function thread safe

2011-12-19 Thread ting
On Dec 16, 8:21 am, Brad Tilley wrote: > A thread locks the function on entrance and then releases it on exit. > What is the equivalent way to do this in Python? I'm not sure if this applies in your case, but much of the time, you can use thread local storage, rather thread locking, in order to m

Threading issue (using alsaaudio)

2011-12-19 Thread Jérôme
Hi all. I am currently learning python (and pyGTK) and I'm having a hard time understanding some threading stuff. I'm writing here hoping I can get - pointers to some documentation that could help me - a lead concerning the specific problem described in the message - a hint about which librar

Re: re.sub(): replace longest match instead of leftmost match?

2011-12-19 Thread ting
On Dec 16, 11:49 am, John Gordon wrote: > I'm working with IPv6 CIDR strings, and I want to replace the longest > match of "(:|$)+" with ":".  But when I use re.sub() it replaces > the leftmost match, even if there is a longer match later in the string. Typically this means that your regu

Re: Parsing stream of JSON objects incrementally

2011-12-19 Thread Miki Tebeka
You probably need to accumulate a buffer and try to decode it, when succeeded return the object and read more. See example below (note that for sockets select might be a better option for reading data). import json from time import sleep def json_decoder(fo): buff = '' decode = json.JSO

Re: the slash & Windows paths

2011-12-19 Thread Andrew Berg
On 12/19/2011 4:02 PM, Juan Declet-Barreto wrote: > I have a Windows-style path that I need to modify so Python functions > can find it. For example, the path > “C:\Projects\Population_Pyramids\charts\test.xls” is being interpreted > as pointing to a file called “est.xls” since the “t” is being esc

Re: the slash & Windows paths

2011-12-19 Thread Brian Curtin
On Mon, Dec 19, 2011 at 16:02, Juan Declet-Barreto < juan.declet-barr...@mesaaz.gov> wrote: > All, > > ** ** > > I have a Windows-style path that I need to modify so Python functions can > find it. For example, the path > “C:\Projects\Population_Pyramids\charts\test.xls” is being interpreted a

the slash & Windows paths

2011-12-19 Thread Juan Declet-Barreto
All, I have a Windows-style path that I need to modify so Python functions can find it. For example, the path "C:\Projects\Population_Pyramids\charts\test.xls" is being interpreted as pointing to a file called "est.xls" since the "t" is being escaped by the preceding slash as a tab. I know thi

Re: Getting a patch accepted

2011-12-19 Thread Andrew Berg
On 12/19/2011 3:24 PM, Rick Johnson wrote: > ... > I want to see him mingling with > the masses and manning the trenches. I want to see him shaking hands > and kissing babies! I prefer these over-the-top responses over the more subtle ones. Much more entertaining IMO. -- CPython 3.2.2 | Windows N

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/18/2011 8:16 PM, Rick Johnson wrote: > On Dec 18, 7:26 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Not everybody uses editors more advanced than Notepad. > And they have no excuse for NOT using a better one. Well, except for a > "foolish consistency" that is! But what abou

Re: Getting a patch accepted

2011-12-19 Thread Brian Curtin
On 19-12-11 18:13, Tycho Andersen wrote: > > Hi all, > > A couple months ago I found a bug in a corner of the curses library > (http://bugs.python.org/issue13051) and filed it. Unfortunately, there > was nobody listed to cc on the noisy list, so it probably got lost in > the shuffle. (There is even

Re: Getting a patch accepted

2011-12-19 Thread Rick Johnson
On Dec 19, 11:13 am, Tycho Andersen wrote: > Hi all, > > A couple months ago I found a bug in a corner of the curses library > (http://bugs.python.org/issue13051) and filed it. Unfortunately, there > was nobody listed to cc on the noisy list, so it probably got lost in > the shuffle. (There is eve

Re: Getting a patch accepted

2011-12-19 Thread Irmen de Jong
On 19-12-11 18:13, Tycho Andersen wrote: Hi all, A couple months ago I found a bug in a corner of the curses library (http://bugs.python.org/issue13051) and filed it. Unfortunately, there was nobody listed to cc on the noisy list, so it probably got lost in the shuffle. (There is even previous m

Re: Can't get tilde character with IDLE 3.2.2 on French Mac Lion

2011-12-19 Thread Ned Deily
In article , Franck Ditter wrote: > All is in the subject. I'm starting to use Python with Idle 3.2.2 > on MacOS-X Lion (French). I can't get "Option-N space" to provide > the ~ char. > I tried to go into the Keys preferences but I can't find "Option-N space" > to modify its meaning. Its actual

Re: IPython 0.12 is out!

2011-12-19 Thread becky_lewis
Thanks and congratulations! Installed via pip --upgrade and everything seems to be working just fine (python 2.7.0+ on Linux) I look forward to investigating all of the new features! Becky Lewis On Dec 19, 9:49 am, Fernando Perez wrote: > Hi all, > > on behalf of the IPython development team,

Re: IPython 0.12 is out!

2011-12-19 Thread Wanderer
On Dec 19, 12:12 pm, Wanderer wrote: > On Dec 19, 4:49 am, Fernando Perez wrote: > > > > > > > > > > > Hi all, > > > on behalf of the IPython development team, I'm thrilled to announce, after > > an intense 4 1/2 months of work, the official release of IPython 0.12. > > > This is a very important

Re: IPython 0.12 is out!

2011-12-19 Thread Wanderer
On Dec 19, 4:49 am, Fernando Perez wrote: > Hi all, > > on behalf of the IPython development team, I'm thrilled to announce, after > an intense 4 1/2 months of work, the official release of IPython 0.12. > > This is a very important release for IPython, for several reasons. First > and foremost, w

Getting a patch accepted

2011-12-19 Thread Tycho Andersen
Hi all, A couple months ago I found a bug in a corner of the curses library (http://bugs.python.org/issue13051) and filed it. Unfortunately, there was nobody listed to cc on the noisy list, so it probably got lost in the shuffle. (There is even previous mention of this bug elsewhere on the tracker

Re: Making the case for "typed" lists/iterators in python

2011-12-19 Thread Nathan Rice
> I think there are two aspects to your idea: > 1. collections that share a single type > 2. accessing multiple elements via a common interface You are correct, and I now regret posing them in a coupled manner. > Both are things that should be considered and I think both are useful in > some cont

Re: re.sub(): replace longest match instead of leftmost match?

2011-12-19 Thread Duncan Booth
MRAB wrote: > On 16/12/2011 21:04, John Gordon wrote: >> In Devin >> Jeanpierre writes: >> >>> You could use re.finditer to find the longest match, and then >>> replace it manually by hand (via string slicing). >> >>> (a match is the longest if (m.end() - m.start()) is the largest -- >>> s

Re: Newbie Question: Obtain element from list of tuples

2011-12-19 Thread DevPlayer
On Dec 19, 1:46 am, "Frank Millman" wrote: > "Steven D'Aprano" wrote in message > > news:4eeea8eb$0$11091$c3e8...@news.astraweb.com... > > > On Sun, 18 Dec 2011 18:35:47 -0800, alex23 wrote: > > >> Pre-namedtuple, I used to like using named slices for this: > > >>     cPID = slice(19) > >>     pi

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Duncan Booth
Evan Driscoll wrote: >> I'm not an expert on Google's syntax, but if you search for "python, >> optionally with function", isn't that the same as just searching for >> "python" since it will return hits either with or without "function"? > Chris Angelico's interpretation is correct: I did four

Pycrypto AES CTR

2011-12-19 Thread Overo
Hello, I am writing an application that will decrypt an AES file with a counter attached at the beginning offset. I see that in the CTR mode. Pycrypto Seems to use the top 16-bytes as random data and perpends zero's at the bottom end. For the sake of more security, I would like to provide a count

Re: Making the case for "typed" lists/iterators in python

2011-12-19 Thread Ulrich Eckhardt
Am 16.12.2011 18:48, schrieb Nathan Rice: I realize this has been discussed in the past, I hope that I am presenting a slightly different take on the subject that will prove interesting. This is primarily motivated by my annoyance with using comprehensions in certain circumstances. [...] Havin

Re: how to run python-script from the python promt? [absolute newbie]

2011-12-19 Thread Lie Ryan
On 12/19/2011 12:16 AM, nukeymusic wrote: On 18 dec, 13:39, Lie Ryan wrote: On 12/18/2011 10:00 PM, nukeymusic wrote: How can I load a python-script after starting python in the interactive mode? I tried with load 'myscript.py' myscript.py myscript but none of these works, so the

[ANNOUNCE] greenlet 0.3.2

2011-12-19 Thread Ralf Schmitt
Hi, I have uploaded greenlet 0.3.2 to PyPI: http://pypi.python.org/pypi/greenlet What is it? --- The greenlet module provides coroutines for python. coroutines allow suspending and resuming execution at certain locations. concurrence[1], eventlet[2] and gevent[3] use the greenlet module

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Eelco
On Dec 19, 1:59 am, Rick Johnson wrote: > On Dec 17, 11:33 pm, Evan Driscoll wrote: > > > On 12/17/2011 22:52, buck wrote:> Try these on for size. > > > >      head, @tuple tail = sequence > > >      def foo(@list args, @dict kwargs): pass > > >      foo(@args, @kwargs) > > > > For backward compa

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Eelco
On Dec 19, 3:23 am, alex23 wrote: > Evan Driscoll wrote: > > My problem with it is that it in some sense is forcing me to make a > > decision I don't care about. Yes, what we have now is less flexible, but > > I have *never* said "man, I wish this *args parameter were a list > > instead of a tupl

[ANN] IPython 0.12 is out!

2011-12-19 Thread Fernando Perez
Hi all, on behalf of the IPython development team, I'm thrilled to announce, after an intense 4 1/2 months of work, the official release of IPython 0.12. This is a very important release for IPython, for several reasons. First and foremost, we have a major new feature, our interactive web-based

Can't get tilde character with IDLE 3.2.2 on French Mac Lion

2011-12-19 Thread Franck Ditter
Hi ! All is in the subject. I'm starting to use Python with Idle 3.2.2 on MacOS-X Lion (French). I can't get "Option-N space" to provide the ~ char. I tried to go into the Keys preferences but I can't find "Option-N space" to modify its meaning. Its actual behavior is to merge lines of a paragrap

Re: Debugging a difficult refcount issue.

2011-12-19 Thread buck
This is what I came up with: https://gist.github.com/1496028 We'll see if it helps, tomorrow. On Sunday, December 18, 2011 6:01:50 PM UTC-8, buck wrote: > Thanks Jack. I think printf is what it will come down to. I plan to put a > little code into PyDict_New to print the id and the line at whic