[Pythonmac-SIG] Using Python with Terminal
bob at redivi.com
Wed Mar 9 23:11:23 CET 2005
On Mar 9, 2005, at 4:13 PM, Nick Matsakis wrote:
> Is there a simple way to use python with the Mac Terminal so that the
> arrow keys will allow you to execute previously executed statements?
> I'm using python 2.3.0 on 10.3.
install readline, pyrep, or the like.. I'll have a readline installer
up at http://pythonmac.org/packages/ later today.
After installing readline, you may want to take a look at IPython to
further enhance the experience.
> Also, a random Python question. I'd like to get an arbitrary element
> a sets.Set _without_ mutating the sets. The most concise way I could
> is this:
> for item in someset: break
> Which will assign item to an arbitrary element in someset. This
> expression really annoys me, though. Is there a better way?
item = iter(someset).next() has the same semantics as the above
statement, except for empty sets it will raise a StopIteration right
away, instead of a NameError when you try and use "item" :)
More information about the Pythonmac-SIG