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

2011-12-20 Thread Ned Deily
In article , Franck Ditter wrote: > In article , > Ned Deily wrote: > > 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

Re: Please explain this for me

2011-12-20 Thread Emeka
Noah, Calvin Thanks so much! Regards, Emeka On Wed, Dec 21, 2011 at 6:57 AM, Noah Hall wrote: > On Wed, Dec 21, 2011 at 4:39 AM, Emeka wrote: > > > > Hello All, > > > v = [] > > > > def add_to_list(plist): > > u = plist.append(90) > > return u > > > > add_to_list(v) # This function c

Re: Please explain this for me

2011-12-20 Thread Noah Hall
On Wed, Dec 21, 2011 at 4:39 AM, Emeka wrote: > > Hello All, > v = [] > > def add_to_list(plist): >     u = plist.append(90) >     return u > > add_to_list(v)  # This function call returns nothing > Could someone explain why this function call will return nothing? It's because add_to_list return

Re: Please explain this for me

2011-12-20 Thread Calvin Spealman
On Dec 20, 2011 11:41 PM, "Emeka" wrote: > > > Hello All, > > v = [] > > def add_to_list(plist): > u = plist.append(90) > return u > > add_to_list(v) # This function call returns nothing > Could someone explain why this function call will return nothing? > > v = [90] # Object values are p

Please explain this for me

2011-12-20 Thread Emeka
Hello All, v = [] def add_to_list(plist): u = plist.append(90) return u add_to_list(v) # This function call returns nothing Could someone explain why this function call will return nothing? v = [90] # Object values are passed by reference This one is clear to me add_to_list([]) This o

Re: [Python-ideas] 回复: Columnize in module "cmd"

2011-12-20 Thread MRAB
On 21/12/2011 03:28, Tom Zhou wrote: Thanks a lot for your reply! I've reservations, maybe code looks like: """ colwidth = max(map(len, list)) ncols = displaywidth/(colwidth+2)+1 nrows = size/ncols+1 for nrows for ncols texts = list[...] output texts """ is clear, and jus

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread alex23
On Dec 21, 10:24 am, Nathan Rice wrote: > The idea is to provide a syntax that lets you do very complex things > on collections in a more readable manner, without having 5 or 6 lines > of generator expressions. Have you seen PyLINQ? It has a similar approach to operating on collections, returning

Re: Learning Python 2.4

2011-12-20 Thread Chris Angelico
On Wed, Dec 21, 2011 at 1:50 PM, Rick Johnson wrote: > I currently have Python 2.7 and Python 3.2.2 installed on my machine. > I don't use Python 2.7 because i am a member of some secret "Python > Historical Commission" Shun 3.2.2, it's way too old. The ONLY version of Python worth using is the b

Re: Learning Python 2.4

2011-12-20 Thread Rick Johnson
On Dec 20, 8:13 pm, Ashton Fagg wrote: > On 21 December 2011 10:31, Rick Johnson wrote: > I got the impression the OP was learning programming in general (i.e. > from scratch) and not merely "learning Python". If this is the case it > shouldn't matter if they're merely learning the concepts as y

Re: Python education survey

2011-12-20 Thread Chris Angelico
On Wed, Dec 21, 2011 at 1:34 PM, Roy Smith wrote: > As for line numbers, for working alone, I don't see much point.  But for > any kind of interaction with other people, it's essential.  It's just SO > much easier to say, "line 417" as opposed to "OK, scroll up a couple > more lines, no, no, not t

Re: Python education survey

2011-12-20 Thread Roy Smith
In article , Ashton Fagg wrote: > As long as the text editor has line numbers and syntax highlighting > it's sufficient in my book. I agree with the syntax highlighting. I resisted for many years, then somebody turned me on to it a few years ago and I've been addicted ever since. As for li

Re: Learning Python 2.4

2011-12-20 Thread Ashton Fagg
On 21 December 2011 10:31, Rick Johnson wrote: > Kimma, don't listen to either of these guys. Anything before Python > 3.0 is now obsolete. We are currently at 3.2.2 for a stable release. > If a tutorial writer is too lazy to update his tutorial to AT LEAST > Python 3.0, THEN he is a fool and shou

Re: Python education survey

2011-12-20 Thread Ashton Fagg
On 20 December 2011 13:51, Raymond Hettinger wrote: > 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 of Python etc

Re: Learning Python 2.4

2011-12-20 Thread Maverick JS
I'd recommend starting with http://learnpythonthehardway.org/book/ by "Zed Shaw" or Beginning Python Using Python 2.6 and Python 3.1 by "James Payne" I'd say learning Python 2.6 would be better than 2.4, since it's really old. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python education survey

2011-12-20 Thread Fernando Perez
On Mon, 19 Dec 2011 19:51:00 -0800, Raymond Hettinger wrote: > Do you use IDLE when teaching Python? If not, what is the tool of > choice? I'm obviously biased (I started IPython years ago), but I've done a lot of teaching and I still do like the combination of IPython plus an editor. Sometime

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Joshua Landau
On 21 December 2011 00:24, Nathan Rice wrote: > efoo_res = ((efoo2.capitalize() + " little indian").split(" > ").apply(reversed) * 2).apply("_".join) # note that you could do > reversed(...) instead, I just like to read left to right > efoo_res.parent.parent.parent # same as ((efoo2.capitalize() +

Re: Upgraded Ubuntu -> 11.10, Python -> 2.7.2. Now psyco doesn't work?

2011-12-20 Thread John Ladasky
On Dec 20, 4:08 pm, Jerry Hill wrote: > From the psyco homepage (http://psyco.sourceforge.net/) "Python 2.7 > is unsupported so far. Anyone interested in porting Psyco to it is > welcome. I started the work in a branch but it needs finishing." > That's the most recent news item on the home page,

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Ian Kelly
On Tue, Dec 20, 2011 at 12:45 PM, Nathan Rice wrote: > Get it: > >    PyPi: http://pypi.python.org/pypi/elementwise/0.111220 >    GitHub: https://github.com/nathan-rice/Elementwise > > This was developed as a proof of concept for expanding the role of > element-wise syntax in python, and to that e

Re: Learning Python 2.4

2011-12-20 Thread Rick Johnson
On Dec 20, 12:31 pm, kimma wrote: > Hi there, > > I am about to learn python with "how to think like a computer > scientist". This book is just available for python 2.4. Does it matter > for programming? > > Greetz Kimma, don't listen to either of these guys. Anything before Python 3.0 is now obs

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Nathan Rice
> efoo2 = ElementwiseProxy(["one", "two", "three", "four"]) > > efoo_res = ((efoo2.capitalize() + " little indian").split(" > ").apply(reversed) * 2).apply("_".join) # note that you could do > reversed(...) instead, I just like to read left to right > efoo_res.parent.parent.parent # same as ((efoo2

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 16:20:37 -0500, Nathan Rice wrote: >> Well, that's one opinion. Another opinion is that nobody cares what >> specific day you release a new version, and that versions 0.191231 and >> 0.200101 probably aren't that big a difference. > > Nobody cares about version numbers in gene

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Nathan Rice
On Tue, Dec 20, 2011 at 7:03 PM, Ian Kelly wrote: > On Tue, Dec 20, 2011 at 12:45 PM, Nathan Rice > wrote: >> There are still some issues with proper support of things like bool() >> and int(), which refuse to return things that are not of the correct >> type. > > And that's a good thing.  As typ

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 13:08:09 -0800, Paul Rubin wrote: > Steven D'Aprano writes: >> Not any date code I'm familiar with. 0.111220 doesn't look anything >> like a date to me. > > 0 is the major version number. 111220 (the minor version number) is the > date code, 2011-12-20 being today. Not here

Re: Upgraded Ubuntu -> 11.10, Python -> 2.7.2. Now psyco doesn't work?

2011-12-20 Thread Jerry Hill
On Tue, Dec 20, 2011 at 5:43 PM, John Ladasky wrote: > I was running Ubuntu Linux 10.10, on which Python 2.6.6 was the > standard distribution.  I succeeded in doing an "alternate install" of > Python 2.7.2, over Ubuntu 10.10.  But I use so many packages in my > code.  Dealing with the package dep

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Ian Kelly
On Tue, Dec 20, 2011 at 12:45 PM, Nathan Rice wrote: > There are still some issues with proper support of things like bool() > and int(), which refuse to return things that are not of the correct > type. And that's a good thing. As type conversion functions, bool(x) and int(x) should *always* re

Re: Text Processing

2011-12-20 Thread Alexander Kapps
On 20.12.2011 22:04, Nick Dokos wrote: I have a text file containing such data ; ABC --- -2.0100e-018.000e-028.000e-05 -2.e-010.000e+00 4.800e-04 -1.9900e-014.000e-021.600e-04

Upgraded Ubuntu -> 11.10, Python -> 2.7.2. Now psyco doesn't work?

2011-12-20 Thread John Ladasky
I'm chasing down a bug that I think may be in my own code. But a fellow Pythoneer suspected that I might actually be looking at a bug in Python itself. http://groups.google.com/group/comp.lang.python/browse_thread/thread/f4b5843e2b06d1a6 Because I was using Python 2.6.6, and I was told that only

Cross compiling Python 3.2 for PPC (MPC 8641D)

2011-12-20 Thread abhishek bhat
I am trying to compile Python 3.2 to a PPC platform running a lesser known OS called OSE (by ENEA). The problem is that there is no shell which can be used to run the configure script which means that I need to manually port the pyconfig.h and the makefile for the given platform. Any suggestions

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

2011-12-20 Thread Joshua Landau
On 20 December 2011 20:51, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Languages shouldn't depend on advanced editor > features or special keyboards -- that way leads to ColorForth and APL. > True, but dependency on a tool is not the same as being crafted to work best on the

Re: Text Processing

2011-12-20 Thread Nick Dokos
Jérôme wrote: > Tue, 20 Dec 2011 11:17:15 -0800 (PST) > Yigit Turgut a écrit: > > > Hi all, > > > > I have a text file containing such data ; > > > > ABC > > --- > > -2.0100e-018.000e-028.000e-0

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Nathan Rice
On Tue, Dec 20, 2011 at 4:00 PM, Steven D'Aprano wrote: > On Tue, 20 Dec 2011 15:45:07 -0500, Nathan Rice wrote: > >> If you take a moment and examine the version number, you will notice >> that it is a date code. > > Not any date code I'm familiar with. 0.111220 doesn't look anything like > a dat

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Chris Angelico
On Wed, Dec 21, 2011 at 7:47 AM, MRAB wrote: > It looks like it's based on the date. I do something similar with the > regex module, except that _my_ version number is Y2K compliant. :-) The eight-digit date is a recognized entity. The truncated six-digit form, much less so. But either is better

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Paul Rubin
Grant Edwards writes: > Unfortunately, I had to muck about with the original library's code to > change a couple things from "private" to "protected" to allow me to > extend the class to do what needed to be done. Every time I have to > do anything with C++ (once every handfull of years) it feels

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Paul Rubin
Steven D'Aprano writes: > Not any date code I'm familiar with. 0.111220 doesn't look anything like > a date to me. 0 is the major version number. 111220 (the minor version number) is the date code, 2011-12-20 being today. -- http://mail.python.org/mailman/listinfo/python-list

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 15:45:07 -0500, Nathan Rice wrote: > If you take a moment and examine the version number, you will notice > that it is a date code. Not any date code I'm familiar with. 0.111220 doesn't look anything like a date to me. Possibly if the last release was two thousand years ago.

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Paul Rubin
Grant Edwards writes: > Oops. I should have mentioned this is for embedded systems programming > so templates in general (and STL in particular) are probably off the > table. Templates are how C++ does generics and I'd expect them to appear in be used in embedded programming as well as elsewhere.

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

2011-12-20 Thread Steven D'Aprano
On Mon, 19 Dec 2011 19:38:52 -0800, alex23 wrote: > 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

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

2011-12-20 Thread kimma
Am 18.12.2011 12:00, schrieb nukeymusic: 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 only way I could work further until now was copy/paste line per line of my python-script t

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Grant Edwards
On 2011-12-20, Grant Edwards wrote: > Would anybody care to recommend online C++ resources for a long time C > and Python user? (I'm also familiar with Smalltalk, Scheme, FORTRAN, > bash, Javascript, and a variety of assembly languages.) > > I have a C++ library to which I need to add a couple m

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread MRAB
On 20/12/2011 20:29, Steven D'Aprano wrote: On Tue, 20 Dec 2011 14:45:06 -0500, Nathan Rice wrote: PyPi: http://pypi.python.org/pypi/elementwise/0.111220 Version 0.111220? What do you do, bump the version number after every keystroke? It looks like it's based on the date. I do somethin

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Benjamin Kaplan
On Dec 20, 2011 3:32 PM, "Steven D'Aprano" < steve+comp.lang.pyt...@pearwood.info> wrote: > > On Tue, 20 Dec 2011 14:45:06 -0500, Nathan Rice wrote: > > > PyPi: http://pypi.python.org/pypi/elementwise/0.111220 > > Version 0.111220? What do you do, bump the version number after every > keystroke

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Nathan Rice
If you take a moment and examine the version number, you will notice that it is a date code. In my opinion that is far more informative than an arbitrary number. I use the major version number to signify... Wait for it... Major changes :) -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Grant Edwards
On 2011-12-20, Neil Cerutti wrote: > On 2011-12-20, Grant Edwards wrote: >> Would anybody care to recommend online C++ resources for a long >> time C and Python user? (I'm also familiar with Smalltalk, >> Scheme, FORTRAN, bash, Javascript, and a variety of assembly >> languages.) > > The best b

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 14:45:06 -0500, Nathan Rice wrote: > PyPi: http://pypi.python.org/pypi/elementwise/0.111220 Version 0.111220? What do you do, bump the version number after every keystroke? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python 2.4

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 19:31:56 +0100, kimma wrote: > Hi there, > > I am about to learn python with "how to think like a computer > scientist". This book is just available for python 2.4. Does it matter > for programming? Python 2.4 is pretty old, and missing a lot of really cool features that cam

Re: Text Processing

2011-12-20 Thread Jérôme
Tue, 20 Dec 2011 11:17:15 -0800 (PST) Yigit Turgut a écrit: > Hi all, > > I have a text file containing such data ; > > ABC > --- > -2.0100e-018.000e-028.000e-05 > -2.e-010.000e+00 4.800

Re: Text Processing

2011-12-20 Thread Dave Angel
On 12/20/2011 02:17 PM, Yigit Turgut wrote: Hi all, I have a text file containing such data ; ABC --- -2.0100e-018.000e-028.000e-05 -2.e-010.000e+00 4.800e-04 -1.9900e-014.000e-02

Re: check for a certain Python version

2011-12-20 Thread Steven D'Aprano
On Tue, 20 Dec 2011 14:33:37 +0100, Ulrich Eckhardt wrote: > Hi! > > I'd like to give my users a meaningful error message when they are using > obsolete Python versions. Is there some kind of best practice or recipe > for that? Specifically, the case is a bunch of unittests that use > features ne

Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Nathan Rice
Elementwise provides a proxy object for iterables which supports chained method calls, as well as elementwise expressions and some built-in functions. Example: class ExampleList(ElementwiseProxyMixin, list): def __new__(cls, iterable): return list.__new__(cls, iterable)

Re: Learning Python 2.4

2011-12-20 Thread Ian Kelly
On Tue, Dec 20, 2011 at 11:31 AM, kimma wrote: > Hi there, > > I am about to learn python with "how to think like a computer scientist". > This book is just available for python 2.4. Does it matter for programming? > > Greetz Python 2.4 is pretty old at this point. A lot has been added to the la

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Paul Rubin
Grant Edwards writes: > Would anybody care to recommend online C++ resources for a long time C > and Python user? (I'm also familiar with Smalltalk, Scheme, FORTRAN, > bash, Javascript, and a variety of assembly languages.) Stroustrup's web site has lots of good stuff on it. I also like his C++

Text Processing

2011-12-20 Thread Yigit Turgut
Hi all, I have a text file containing such data ; ABC --- -2.0100e-018.000e-028.000e-05 -2.e-010.000e+00 4.800e-04 -1.9900e-014.000e-021.600e-04 But I only need Section B, and I

Re: nesting context managers

2011-12-20 Thread Ian Kelly
On Tue, Dec 20, 2011 at 11:46 AM, Ian Kelly wrote: > On Tue, Dec 20, 2011 at 9:56 AM, Ulrich Eckhardt > wrote: >> Am 20.12.2011 15:15, schrieb Ulrich Eckhardt: >> >>> Let us assume I had a class HTTPClient that has a socket for HTTP and a >>> logfile for filing logs. I want to make this HTTPClien

Re: nesting context managers

2011-12-20 Thread Ethan Furman
Rami Chowdhury wrote: On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt wrote: To be extra safe or in more complicated scenarios, I could wrap this in a try-except and explicitly close those that were already created, but normally I'd expect the garbage collector to do that for me ... or am I then

Re: nesting context managers

2011-12-20 Thread Ian Kelly
On Tue, Dec 20, 2011 at 9:56 AM, Ulrich Eckhardt wrote: > Am 20.12.2011 15:15, schrieb Ulrich Eckhardt: > >> Let us assume I had a class HTTPClient that has a socket for HTTP and a >> logfile for filing logs. I want to make this HTTPClient a context >> manager, so that I can write >> >> with HTTPC

Re: [OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Neil Cerutti
On 2011-12-20, Grant Edwards wrote: > Would anybody care to recommend online C++ resources for a long > time C and Python user? (I'm also familiar with Smalltalk, > Scheme, FORTRAN, bash, Javascript, and a variety of assembly > languages.) The best book I know of to get you writing useful C++ qu

Learning Python 2.4

2011-12-20 Thread kimma
Hi there, I am about to learn python with "how to think like a computer scientist". This book is just available for python 2.4. Does it matter for programming? Greetz -- http://mail.python.org/mailman/listinfo/python-list

Test plans and "refined test plans"

2011-12-20 Thread DZantow
First, a disclaimer. I know this group is not the appropriate venue for the question I have. However, I am hoping some of you with experience can point me in the right direction, either by addressing the question or by suggesting a more appropriate group. The question is: A contract we are biddin

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

2011-12-20 Thread Admin
Am 18.12.2011 12:00, schrieb nukeymusic: 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 only way I could work further until now was copy/paste line per line of my python-script t

Re: Python education survey

2011-12-20 Thread Miki Tebeka
I've tried several things. So far vim (with line numbers) to show the code and then ipython to run it works great. Another option I tried once was Aptana, since most people in my company know eclipse this was good for them. It has most (all?) of the features you mentioned above. -- http://mail

Re: nesting context managers

2011-12-20 Thread Rami Chowdhury
On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt wrote: > To be extra safe or in more complicated scenarios, I could wrap this in a > try-except and explicitly close those that were already created, but > normally I'd expect the garbage collector to do that for me ... or am I then > implicitly assum

[OT] Quick intro to C++ for a Python and C user?

2011-12-20 Thread Grant Edwards
Would anybody care to recommend online C++ resources for a long time C and Python user? (I'm also familiar with Smalltalk, Scheme, FORTRAN, bash, Javascript, and a variety of assembly languages.) I have a C++ library to which I need to add a couple minor wrappers/extensions. I've already done the

Re: Grammar for classes

2011-12-20 Thread Robert Kern
On 12/20/11 5:05 PM, Joshua Landau wrote: On 20 December 2011 10:55, Robert Kern mailto:robert.k...@gmail.com>> wrote: On 12/20/11 1:34 AM, Joshua Landau wrote: In reading thorough the syntax defined in the reference

Re: nesting context managers

2011-12-20 Thread Ulrich Eckhardt
Am 20.12.2011 15:15, schrieb Ulrich Eckhardt: Let us assume I had a class HTTPClient that has a socket for HTTP and a logfile for filing logs. I want to make this HTTPClient a context manager, so that I can write with HTTPClient(url) as client: pass Actually, I overestimated the task: c

Re: Grammar for classes

2011-12-20 Thread Joshua Landau
On 20 December 2011 10:55, Robert Kern wrote: > On 12/20/11 1:34 AM, Joshua Landau wrote: > >> In reading thorough the syntax defined in the reference >> > class-definitions

Re: Performing a number of substitutions on a unicode string

2011-12-20 Thread Arnaud Delobelle
On 20 December 2011 15:35, Peter Otten <__pete...@web.de> wrote: escape_map = { > ...     u'\n': u'\\n', > ...     u'\t': u'\\t', > ...     u'\r': u'\\r', > ...     u'\f': u'\\f', > ...     u'\\': u'' > ... } escape_map = dict((ord(k), v) for k, v in escape_map.items()) print u"

Re: nesting context managers

2011-12-20 Thread Rami Chowdhury
On Tue, Dec 20, 2011 at 14:15, Ulrich Eckhardt wrote: > Hi! > > Let us assume I had a class HTTPClient that has a socket for HTTP and a > logfile for filing logs. I want to make this HTTPClient a context manager, > so that I can write > >  with HTTPClient(url) as client: >      pass > > and reliab

Re: IPython 0.12 is out!

2011-12-20 Thread Wanderer
On Dec 19, 11:00 pm, alex23 wrote: > 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 > > fil

Re: Python education survey

2011-12-20 Thread Chris Angelico
On Wed, Dec 21, 2011 at 1:45 AM, Rick Johnson wrote: > Heck for most things, > considering you have at least basic programming experience, the help > function is all you need to learn the language. I know I shouldn't feed the troll, but this is more general. You cannot learn the _language_ from

Re: Set initial size in TKinter

2011-12-20 Thread Rick Johnson
On Dec 20, 9:20 am, Eric Brunel wrote: > Where did you find an example code looking like this? This looks like > veery old conventions for Tkinter programsŠ >[...] > And you should avoid creating only an instance of Frame. This actually > creates a window, but it's a side-effect. Two major p

Re: Performing a number of substitutions on a unicode string

2011-12-20 Thread Peter Otten
Arnaud Delobelle wrote: > I've got to escape some unicode text according to the following map: > > escape_map = { > u'\n': u'\\n', > u'\t': u'\\t', > u'\r': u'\\r', > u'\f': u'\\f', > u'\\': u'' > } > > The simplest solution is to use str.replace: > > def escape_text(tex

Re: Set initial size in TKinter

2011-12-20 Thread Eric Brunel
In article , Gabor Urban wrote: > Hi, > > I am quite newbie with Tkinter and I could not find the way to set the > size of the application. (I could find the method to make it > resizeable, though :-)) ) Any ideas, suggestions or links to > references are wellcome. Usually, the best way is to u

nesting context managers

2011-12-20 Thread Ulrich Eckhardt
Hi! Let us assume I had a class HTTPClient that has a socket for HTTP and a logfile for filing logs. I want to make this HTTPClient a context manager, so that I can write with HTTPClient(url) as client: pass and reliably have both the socket and the logfile closed. The easy way is w

Re: Performing a number of substitutions on a unicode string

2011-12-20 Thread Arnaud Delobelle
On 20 December 2011 14:54, Tim Chase wrote: > On 12/20/11 08:02, Arnaud Delobelle wrote: >> >> Hi all, >> >> I've got to escape some unicode text according to the following map: >> >> escape_map = { >>     u'\n': u'\\n', >>     u'\t': u'\\t', >>     u'\r': u'\\r', >>     u'\f': u'\\f', >>     u'\\

Re: Performing a number of substitutions on a unicode string

2011-12-20 Thread Tim Chase
On 12/20/11 08:02, Arnaud Delobelle wrote: Hi all, I've got to escape some unicode text according to the following map: escape_map = { u'\n': u'\\n', u'\t': u'\\t', u'\r': u'\\r', u'\f': u'\\f', u'\\': u'' } The simplest solution is to use str.replace: def escape_

Re: Python education survey

2011-12-20 Thread Rick Johnson
On Dec 20, 2:14 am, Stefan Behnel wrote: > For teaching, I think it's better to come around with something simpler > than a full-blown IDE, so that you can show off interactive development, > help() and other introspection features. IMHO much better than hiding all > that behind an IDE, That is

Re: Set initial size in TKinter

2011-12-20 Thread Rick Johnson
On Dec 20, 5:09 am, Gabor Urban wrote: > Hi, > > I am quite newbie with Tkinter and I could not find the way to set the > size of the application. Probably due to this haphazard coding style; why would you name an object "Application" that is an instance of Tkinter.Frame? That is just going to co

Re: check for a certain Python version

2011-12-20 Thread Roy Smith
In article , Ulrich Eckhardt wrote: > Hi! > > I'd like to give my users a meaningful error message when they are using > obsolete Python versions. Is there some kind of best practice or recipe > for that? Specifically, the case is a bunch of unittests that use > features new to Python 2.7.

check for a certain Python version

2011-12-20 Thread Ulrich Eckhardt
Hi! I'd like to give my users a meaningful error message when they are using obsolete Python versions. Is there some kind of best practice or recipe for that? Specifically, the case is a bunch of unittests that use features new to Python 2.7. Thank you! Uli -- http://mail.python.org/mailman

Performing a number of substitutions on a unicode string

2011-12-20 Thread Arnaud Delobelle
Hi all, I've got to escape some unicode text according to the following map: escape_map = { u'\n': u'\\n', u'\t': u'\\t', u'\r': u'\\r', u'\f': u'\\f', u'\\': u'' } The simplest solution is to use str.replace: def escape_text(text): return text.replace('\\', '').

Re: Need help with really elementary pexpect fragment

2011-12-20 Thread Saqib Ali
Oops! Good call. Thank you. You pointed out my mistake. - Saqib On Tue, Dec 20, 2011 at 12:31 AM, Nick Dokos wrote: > 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. >

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

2011-12-20 Thread Franck Ditter
Nope, "space" followed by "Shift-Option-N" gives a greek iota... I tried other combinations, unsuccessfully. IDLE 3 (French) seems to be unusable as we use many ~ in web applications :-( Should we hope a fix soon, or leave IDLE ? Thanks, franck In article , Ned Deily wrote: > In article ,

Set initial size in TKinter

2011-12-20 Thread Gabor Urban
Hi, I am quite newbie with Tkinter and I could not find the way to set the size of the application. (I could find the method to make it resizeable, though :-)) ) Any ideas, suggestions or links to references are wellcome. Here is my code: from Tkinter import * class Application(Frame): def

Re: Python education survey

2011-12-20 Thread Eelco
I taught a Python class just recently, and thought long and hard about this problem. I settled on PyCharm and was happy with that. My reasons: - available on all main platoforms - not entirely broken code completion (ive tried literally every python editor, and pycharm is the only one that meet

Re: Python education survey

2011-12-20 Thread Andrea Crotti
On 12/20/2011 03:51 AM, 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 install and configure (startup di

Re: Grammar for classes

2011-12-20 Thread Robert Kern
On 12/20/11 1:34 AM, 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 do

profiling code

2011-12-20 Thread Andrea Crotti
I would like to automate some kind of performance profiling, to see if the application (and possibly pieces of it) becomes slower/faster and why. So I did something like this, where the statement passed also called parse_arguments, which is nice because I can run the other script with the norma

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

2011-12-20 Thread Serhiy Storchaka
20.12.11 07:47, Steven D'Aprano написав(ла): Space-delimited tokens are hardly rare in Python, e.g.: import module as name for x in sequence if flag elif condition while condition with obj del name return to_be or not to_be if this is question else None -- http://mail.python.org/mailman/listi

Re: 回复: Columnize in module "cmd"

2011-12-20 Thread Peter Otten
Tom Zhou wrote: > 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. There are usual

Re: Python education survey

2011-12-20 Thread Stefan Behnel
Devin Jeanpierre, 20.12.2011 08:32: Truthfully I'm not sure why it's great for teaching, though. And there were some discussions I overheard about perhaps switching to PyCharm, which at least one professor thought was much better. I recently started using PyCharm personally, but not for my cour

Re: JOKE OF THE YEAR

2011-12-20 Thread Vojtěch Rylko
Dne 20.12.2011 7:00, Steven D'Aprano napsal(a): 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: