Re: Run Python script from JS

2011-06-17 Thread Hansmeet Singh
for xhtml wouldnt the syntax be

Re: break in a module

2011-06-17 Thread Erik Max Francis
Steven D'Aprano wrote: On Thu, 16 Jun 2011 22:20:50 -0700, Erik Max Francis wrote: [...] Yes, which could be rephrased as the fact that `break` and `continue` are restricted to looping control structures, so reusing `break` in this context would be a bad idea. You know, kind of like the exact

Missing python27.dll on Win 7 64-bit

2011-06-17 Thread David Aldrich
Hi I am building a 32-bit C++ application using Visual C++ Express 2008 on 64-bit Windows 7. The application links to Python, so I installed 32-bit Python 2.7.2 by running python-2.7.2.msi. When I run my app, I get error: ... python27.dll is missing from your computer ... and, indeed, it is

Re: How do you copy files from one location to another?

2011-06-17 Thread Gregory Ewing
John Salerno wrote: I want it to copy a set of files/directories from a location on my C:\ drive to another directory on my E:\ drive. I don't want to rename or delete the originals, It sounds like shutil.copy() is what you want, or one of the other related functions in the shutil module. -- G

Re: Run Python script from JS

2011-06-17 Thread Daniel Kluev
On Fri, Jun 17, 2011 at 9:11 AM, Gnarlodious wrote: > Is there any way to call a Py script from Javascript in a webpage? You can use Pyjamas [1], Emscripten [2] or skulpt [3] for that. [1] http://pyjs.org/ [2] http://syntensity.com/static/python.html [3] http://www.skulpt.org/ -- With best reg

Re: How do you copy files from one location to another?

2011-06-17 Thread Tim Golden
On 17/06/2011 06:06, John Salerno wrote: Based on what I've read, it seems os.rename is the proper function to use, but I'm a little confused about the syntax. Basically I just want to write a simple script that will back up my saved game files when I run it. So I want it to copy a set of files/d

Re: HTTPConncetion - HEAD request

2011-06-17 Thread gervaz
On 17 Giu, 01:00, Ian Kelly wrote: > On Thu, Jun 16, 2011 at 4:43 PM, gervaz wrote: > > Hi all, can someone tell me why the read() function in the following > > py3 code returns b''? > > h = http.client.HTTPConnection("www.twitter.com") > h.connect() > h.request("HEAD", "/", "HTTP

Re: HTTPConncetion - HEAD request

2011-06-17 Thread Chris Angelico
On Fri, Jun 17, 2011 at 6:19 PM, gervaz wrote: > The fact is that I have a list of urls and I wanted to retrieve the > minimum necessary information in order to understand if the link is a > valid html page or e.g. a picture or something else. As far as I > understood here http://www.w3.org/Protoc

Re: Embedding Python in a shell script

2011-06-17 Thread mg
rusi wrote: > On Jun 17, 6:05 am, Chris Angelico wrote: > >> > Python call becomes.  I'd prefer something like: >> >> #!/bin/bash >> for i in 1 2 3 4; do >>   python -c "if True: > # comfortably indented python code > > Thanks. Nice! You can use bash here document feature, <<-, that strips hea

Re: HTTPConncetion - HEAD request

2011-06-17 Thread Adam Tauno Williams
On Thu, 2011-06-16 at 15:43 -0700, gervaz wrote: > Hi all, can someone tell me why the read() function in the following > py3 code returns b'' > >>> h = http.client.HTTPConnection("www.twitter.com") > >>> h.connect() > >>> h.request("HEAD", "/", "HTTP 1.0") > >>> r = h.getresponse() > >>> r.read()

Re: How to avoid "()" when writing a decorator accepting optional arguments?

2011-06-17 Thread bruno.desthuilli...@gmail.com
On Jun 11, 10:28 pm, Ian Kelly wrote: > > Since there is no way to distinguish the two cases by the arguments, def deprecated(func=None, replacement=None): if replacement: # handle the case where a replacement has been given elif func: # handle the case where no replacement

Re: Composing regex from a list

2011-06-17 Thread TheSaint
Steven D'Aprano wrote: > def compile_alternatives(*args): Thank you all, for these good points. For my eyes seem that explicit or implicit it will take some looping to concatenate the list elements into a string. I will see pypy later. -- goto /dev/null -- http://mail.python.org/mailman/lis

Re: integer to binary 0-padded

2011-06-17 Thread John S
On Jun 15, 9:33 am, Olivier LEMAIRE wrote: > You're right, I use Python 2.6.6 This works great in 2.6.5 and later (and probably earlier). You just have to number your placeholders. The first set of braces formats i (your value), the second set specifies the field with (i.e., 8): >>> for i in xra

Re: How to avoid "()" when writing a decorator accepting optional arguments?

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 4:27 AM, bruno.desthuilli...@gmail.com wrote: > On Jun 11, 10:28 pm, Ian Kelly wrote: >> >> Since there is no way to distinguish the two cases by the arguments, > > def deprecated(func=None, replacement=None): >    if replacement: >       # handle the case where a replacem

Python and Lisp : car and cdr

2011-06-17 Thread Franck Ditter
Hi, I'm just wondering about the complexity of some Python operations to mimic Lisp car and cdr in Python... def length(L) : if not L : return 0 return 1 + length(L[1:]) Should I think of the slice L[1:] as (cdr L) ? I mean, is the slice a copy of a segment of L, or do I actually get a point

Re: Missing python27.dll on Win 7 64-bit

2011-06-17 Thread Miki Tebeka
I don't have Windows at hand, by I *guess* that the Python DLL is somewhere near the python executable. You need to make sure the Python DLL is in PATH, either copy it next to your executable or edit the PATH environment variable. -- http://mail.python.org/mailman/listinfo/python-list

SQL Server 2008R2 databases via Python 2.7 and Windows XP and higher

2011-06-17 Thread python
Looking for some real-world advice on what is the best way to access MS SQL Server 2008R2 databases via Python 2.7 running under Windows XP, Vista, and Windows 7 and Windows Server 2005 and 2008. Based on my research, here's my list of choices: mxODBC [1]http://www.egenix.com/products/python/mxOD

Reconstituting f2py Multi-dimensional character array

2011-06-17 Thread Helmut Fritz
Hello all, I've normally only had to build a list of words from a f2py fortran character array. For this I found the transpose method to work fine. However I have had difficulty finding a way of getting a 3d array of words from Fortran to python. (I.e. 4d in python) I've attached 2 files that ar

Re: How to avoid "()" when writing a decorator accepting optional arguments?

2011-06-17 Thread bruno.desthuilli...@gmail.com
On Jun 17, 3:53 pm, Ian Kelly wrote: > > That works, but I would be concerned about forgetting to specify the > argument by keyword (snip funny side effect description) >  Also, as in my suggestion, it doesn't seem > like a big improvement to have to type out "replacement=" when you > need the r

Re: SQL Server 2008R2 databases via Python 2.7 and Windows XP and higher

2011-06-17 Thread Tim Golden
On 17/06/2011 16:01, pyt...@bdurham.com wrote: Looking for some real-world advice on what is the best way to access MS SQL Server 2008R2 databases via Python 2.7 running under Windows XP, Vista, and Windows 7 and Windows Server 2005 and 2008. Based on my research, here's my list of choices: mxODB

Re: SQL Server 2008R2 databases via Python 2.7 and Windows XP and higher

2011-06-17 Thread Ethan Furman
pyt...@bdurham.com wrote: Looking for some real-world advice on what is the best way to access MS SQL Server 2008R2 databases via Python 2.7 running under Windows XP, Vista, and Windows 7 and Windows Server 2005 and 2008. Based on my research, here's my list of choices: mxODBC http://www.

Re: Python and Lisp : car and cdr

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 8:45 AM, Franck Ditter wrote: > Hi, I'm just wondering about the complexity of some Python operations > to mimic Lisp car and cdr in Python... > > def length(L) : >  if not L : return 0 >  return 1 + length(L[1:]) > > Should I think of the slice L[1:] as (cdr L) ? I mean, i

Re: SQL Server 2008R2 databases via Python 2.7 and Windows XP and higher

2011-06-17 Thread Michiel Overtoom
On Jun 17, 2011, at 17:01, pyt...@bdurham.com wrote: > Looking for some real-world advice on what is the best way to access MS SQL > Server 2008R2 databases via Python 2.7 running under Windows XP, Vista, and > Windows 7 and Windows Server 2005 and 2008. I use the COM interface to ADO, for a f

Fun and games with lambda

2011-06-17 Thread Steven D'Aprano
If you've ever wondered what lambda and reduce are good for, run this one- liner and wonder no more... (Be patient, it may take a few seconds to return.) # Python 2 version: print((lambda f:((lambda p:p[0]+'.'+p[1:])(str((lambda Q:2*Q[0]*Q[0]//Q [3])((lambda F:(lambda S:f(lambda T,_:((T[0]+T[1])

Re: How do you copy files from one location to another?

2011-06-17 Thread John Salerno
On Jun 17, 2:25 am, Gregory Ewing wrote: > John Salerno wrote: > > I want it to copy a set of files/directories from a > > location on my C:\ drive to another directory on my E:\ drive. I don't > > want to rename or delete the originals, > > It sounds like shutil.copy() is what you want, or one of

Re: How do you copy files from one location to another?

2011-06-17 Thread Heather Brown
On 01/-10/-28163 02:59 PM, John Salerno wrote: Based on what I've read, it seems os.rename is the proper function to use, but I'm a little confused about the syntax. Basically I just want to write a simple script that will back up my saved game files when I run it. So I want it to copy a set of f

Re: Fun and games with lambda

2011-06-17 Thread Wolfgang Rohdewald
On Freitag 17 Juni 2011, Steven D'Aprano wrote: > run this one- > liner and wonder no more... looks like something dangerous to me. What does it do? rm -rf ? -- Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid "()" when writing a decorator accepting optional arguments?

2011-06-17 Thread Ethan Furman
Giampaolo Rodolà wrote: I've written this decorator to deprecate a function and (optionally) provide a callable as replacement I can see providing the replacement function so that you can say, for example, "you are calling a deprecated function -- is the replacement". If your replacement f

ANN: PyGUI 2.5

2011-06-17 Thread Greg Ewing
PyGUI 2.5 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Lots of new stuff in this version. Highlights include: - Improved facilities for customising the standard menus. - Functions for creating PyGUI Images from PIL images and numpy arrays. - ListButton - a pop

Re: Run Python script from JS

2011-06-17 Thread Tim Roberts
Hansmeet Singh wrote: > for xhtml wouldnt the syntax be

Re: Fun and games with lambda

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 10:56 AM, Wolfgang Rohdewald wrote: > On Freitag 17 Juni 2011, Steven D'Aprano wrote: >> run this one- >> liner and wonder no more... > > looks like something dangerous to me. What does > it do? rm -rf ? The thread at the link discusses what it does in great detail. -- ht

import from environment path

2011-06-17 Thread Guillaume Martel-Genest
Hi, Here's my situation : I got a script a.py that need to call b.py. The 2 scripts can't be in a same package. Script a.py knows the path of b.py relative to an environment variable B_PATH, let's say B_PATH/foo/ b.py. The solution I found is to do the flowwing : b_dir = os.path.join(os.environ['

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-17 Thread Xah Lee
On Jun 14, 7:50 am, Dotan Cohen wrote: > On Mon, Jun 13, 2011 at 10:21, Elena wrote: > > On 13 Giu, 06:30, Tim Roberts wrote: > >> Studies have shown that even a > >> strictly alphabetical layout works perfectly well, once the typist is > >> acclimated. > > > Once the user is acclimated to move

Re: Embedding Python in a shell script

2011-06-17 Thread Timo Lindemann
On Fri, 17 Jun 2011 00:57:25 +, Jason Friedman said: > > but for various reasons I want a single script. Any alternatives? you can use a here document like this: #! /bin/bash /usr/bin/python2 << EOPYTHON def hello(): print("Hello, World"); if __name__ == "__main__": hel

Re: HTTPConncetion - HEAD request

2011-06-17 Thread gervaz
On 17 Giu, 12:14, Adam Tauno Williams wrote: > On Thu, 2011-06-16 at 15:43 -0700, gervaz wrote: > > Hi all, can someone tell me why the read() function in the following > > py3 code returns b'' > > >>> h = http.client.HTTPConnection("www.twitter.com") > > >>> h.connect() > > >>> h.request("HEAD",

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-17 Thread Xah Lee
On Jun 15, 5:43 am, rusi wrote: > On Jun 15, 5:32 pm, Dotan Cohen wrote: > > > Thanks. From testing small movements with my fingers I see that the > > fourth finger is in fact a bit weaker than the last finger, but more > > importantly, it is much less dexterous. Good to know! > > Most of the pia

bug in large file writes, 2.x and 3.x

2011-06-17 Thread Ethan Furman
Windows platform (XP Pro, SP2). This works fine on local drives, but on network (both 2003 Server, and Samba running on FreeBSD) the following produces an error: --> data = '?' * 119757831 # use b'?' if on 3.x --> test = open(r's:\junk.tst', 'wb') --> test.write(data) Traceback (most recent c

Re: bug in large file writes, 2.x and 3.x

2011-06-17 Thread Ethan Furman
Ethan Furman wrote: Windows platform (XP Pro, SP2). This works fine on local drives, but on network (both 2003 Server, and Samba running on FreeBSD) the following produces an error: --> data = '?' * 119757831 # use b'?' if on 3.x --> test = open(r's:\junk.tst', 'wb') --> test.write(data) Tra

Re: bug in large file writes, 2.x and 3.x

2011-06-17 Thread Terry Reedy
On 6/17/2011 3:03 PM, Ethan Furman wrote: Windows platform (XP Pro, SP2). This works fine on local drives, but on network (both 2003 Server, and Samba running on FreeBSD) the following produces an error: --> data = '?' * 119757831 # use b'?' if on 3.x --> test = open(r's:\junk.tst', 'wb') --> t

Re: Fun and games with lambda

2011-06-17 Thread Mark Dickinson
On Jun 17, 5:10 pm, Steven D'Aprano wrote: > > print((lambda f:((lambda p:p[0]+'.'+p[1:])(str((lambda Q:2*Q[0]*Q[0]//Q > [3])((lambda F:(lambda S:f(lambda T,_:((T[0]+T[1])//2,S((T[0]*T[1])// > F),2*T[2],(T[3]-(T[2]*(((T[0]+T[1])//2)**2-(S((T[0]*T[1])//F))**2))//F)), > [0]*13,(F,(F*F)//S(2*F),2,F//

Re: bug in large file writes, 2.x and 3.x

2011-06-17 Thread MRAB
On 17/06/2011 20:15, Ethan Furman wrote: Ethan Furman wrote: Windows platform (XP Pro, SP2). This works fine on local drives, but on network (both 2003 Server, and Samba running on FreeBSD) the following produces an error: --> data = '?' * 119757831 # use b'?' if on 3.x --> test = open(r's:\ju

Re: ANN: PyGUI 2.5

2011-06-17 Thread Terry Reedy
On 6/16/2011 11:18 PM, Greg Ewing wrote: PyGUI 2.5 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Lots of new stuff in this version. Highlights include: Greg left out the most important to me: "Now works with Python 3 on MacOSX and Windows!" -- Terry Jan Reedy -- http

Re: How do you copy files from one location to another?

2011-06-17 Thread Terry Reedy
On 6/17/2011 12:17 PM, John Salerno wrote: On Jun 17, 2:25 am, Gregory Ewing wrote: It sounds like shutil.copy() is what you want, or one of the other related functions in the shutil module. This looks promising! But can src be a directory, or does it have to be a file? For my purposes (co

Re: ANN: PyGUI 2.5

2011-06-17 Thread Wolfgang Keller
> Lots of new stuff in this version. Highlights include: >- GridView - a user-defined view consisting of a regular grid of > cells. > >- PaletteView - a GridView specialised for implementing tool > palettes. Any chance to see a hierarchical multi-column TreeListView anytime soon? Sincer

Re: bug in large file writes, 2.x and 3.x

2011-06-17 Thread Ethan Furman
MRAB wrote: On 17/06/2011 20:15, Ethan Furman wrote: Ethan Furman wrote: Windows platform (XP Pro, SP2). This works fine on local drives, but on network (both 2003 Server, and Samba running on FreeBSD) the following produces an error: --> data = '?' * 119757831 # use b'?' if on 3.x --> test =

installing NLTK

2011-06-17 Thread Nige Danton
Mac OSX python 2.6.1: I'm trying to install the natural language toolkit and following the instructions here www.NLTK.org/download I've downloaded the PyYAML package and in a terminal window tried to install it. However terminal asks for my password - I've tried both my user password and admin pass

Re: Embedding Python in a shell script

2011-06-17 Thread Hans Mulder
On 17/06/11 19:47:50, Timo Lindemann wrote: On Fri, 17 Jun 2011 00:57:25 +, Jason Friedman said: but for various reasons I want a single script. Any alternatives? you can use a here document like this: #! /bin/bash /usr/bin/python2<< EOPYTHON def hello(): print("Hello, Worl

Re: installing NLTK

2011-06-17 Thread Hans Mulder
On 17/06/11 21:58:53, Nige Danton wrote: Mac OSX python 2.6.1: I'm trying to install the natural language toolkit and following the instructions here www.NLTK.org/download I've downloaded the PyYAML package and in a terminal window tried to install it. However terminal asks for my password - I've

Re: Embedding Python in a shell script

2011-06-17 Thread Timo Lindemann
On Fri, 17 Jun 2011 22:15:57 +0200, Hans Mulder said: > On 17/06/11 19:47:50, Timo Lindemann wrote: >> On Fri, 17 Jun 2011 00:57:25 +, Jason Friedman said: >> >> >> >>> but for various reasons I want a single script. Any alternatives? >> >> you can use a here document like this: > That does n

Best way to insert sorted in a list

2011-06-17 Thread SherjilOzair
There are basically two ways to go about this. One is, to append the new value, and then sort the list. Another is to traverse the list, and insert the new value at the appropriate position. The second one's complexity is O(N), while the first one's is O(N * log N). Still, the second one works mu

Re: installing NLTK

2011-06-17 Thread Nige Danton
Hans Mulder wrote: > On 17/06/11 21:58:53, Nige Danton wrote: >> Mac OSX python 2.6.1: I'm trying to install the natural language toolkit >> and following the instructions here www.NLTK.org/download I've downloaded >> the PyYAML package and in a terminal window tried to install it. However > You'

Re: Best way to insert sorted in a list

2011-06-17 Thread Shashank Singh
On Sat, Jun 18, 2011 at 2:23 AM, SherjilOzair wrote: > There are basically two ways to go about this. > One is, to append the new value, and then sort the list. > Another is to traverse the list, and insert the new value at the > appropriate position. > > The second one's complexity is O(N), while

Re: Best way to insert sorted in a list

2011-06-17 Thread Ethan Furman
SherjilOzair wrote: What has the community to say about this ? What is the best (fastest) way to insert sorted in a list ? Check out the bisect module. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to insert sorted in a list

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 3:02 PM, Shashank Singh wrote: > Correct me if I am wrong here but isn't the second one is O(log N)? > Binary search? > That is when you have an already sorted list from somewhere and you > are inserting just one new value. Finding the position to insert is O(log n), but t

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-17 Thread Dotan Cohen
On Fri, Jun 17, 2011 at 20:43, Xah Lee wrote: > u r aware that there are already tens of layouts, each created by > programer, thinking that they can create the best layout? > Yes. Mine is better :) Had Stallman not heard of VI when he set out to write Emacs? > if not, check > 〈Computer Keyboar

Re: How do you copy files from one location to another?

2011-06-17 Thread John Salerno
On Jun 17, 2:23 pm, Terry Reedy wrote: > If you follow the second part of Greg's suggestion 'or one of the other > related function in the shutil module', you will find copytree() > "Recursively copy an entire directory tree rooted at src. " Yeah, but shutil.copytree says: "The destination dire

Re: installing NLTK

2011-06-17 Thread Hans Mulder
On 17/06/11 22:57:41, Nige Danton wrote: Hans Mulder wrote: On 17/06/11 21:58:53, Nige Danton wrote: Mac OSX python 2.6.1: I'm trying to install the natural language toolkit and following the instructions here www.NLTK.org/download I've downloaded the PyYAML package and in a terminal window tr

Re: Best way to insert sorted in a list

2011-06-17 Thread Chris Torek
In article SherjilOzair wrote: >There are basically two ways to go about this. >One is, to append the new value, and then sort the list. >Another is to traverse the list, and insert the new value at the >appropriate position. > >The second one's complexity is O(N), while the first one's is O(N *

Re: How do you copy files from one location to another?

2011-06-17 Thread Ethan Furman
John Salerno wrote: On Jun 17, 2:23 pm, Terry Reedy wrote: If you follow the second part of Greg's suggestion 'or one of the other related function in the shutil module', you will find copytree() "Recursively copy an entire directory tree rooted at src. " Yeah, but shutil.copytree says: "Th

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-17 Thread Xah Lee
On Jun 17, 2:26 pm, Dotan Cohen wrote: > On Fri, Jun 17, 2011 at 20:43, Xah Lee wrote: > > u r aware that there are already tens of layouts, each created by > > programer, thinking that they can create the best layout? > > Yes. Mine is better :) > Had Stallman not heard of VI when he set out to

Re: Best way to insert sorted in a list

2011-06-17 Thread Ethan Furman
Chris Torek wrote: Appending to the list is much faster, and if you are going to dump a set of new items in, you can do that with: # wrong way: # for item in large_list: #a.append(item) # right way, but fundamentally still the same cost (constant # factor is much smaller

Re: Missing python27.dll on Win 7 64-bit

2011-06-17 Thread Thomas L. Shinnick
At 02:13 AM 6/17/2011, David Aldrich wrote: Hi I am building a 32-bit C++ application using Visual C++ Express 2008 on 64-bit Windows 7. The application links to Python, so I installed 32-bit Python 2.7.2 by running python-2.7.2.msi. When I run my app, I get error: ... python27.dll is miss

Re: How do you copy files from one location to another?

2011-06-17 Thread John Salerno
On Jun 17, 5:15 pm, Ethan Furman wrote: > John Salerno wrote: > > On Jun 17, 2:23 pm, Terry Reedy wrote: > > >> If you follow the second part of Greg's suggestion 'or one of the other > >> related function in the shutil module', you will find copytree() > >> "Recursively copy an entire directory

Re: Best way to insert sorted in a list

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 3:48 PM, Chris Torek wrote: > If len(large_list) is m, this is O(m).  Inserting each item in > the "right place" would be O(m log (n + m)).  But we still > have to sort: > >    a.sort() > > This is O(log (n + m)), hence likely better than repeatedly inserting > in the corre

Re: ANN: PyGUI 2.5

2011-06-17 Thread rzed
Terry Reedy wrote in news:mailman.88.1308338170.1164.python-l...@python.org: > On 6/16/2011 11:18 PM, Greg Ewing wrote: >> PyGUI 2.5 is available: >> >> http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ >> >> Lots of new stuff in this version. Highlights include: > > Greg left out the mos

Re: Fun and games with lambda

2011-06-17 Thread Chris Angelico
On Sat, Jun 18, 2011 at 2:10 AM, Steven D'Aprano wrote: > If you've ever wondered what lambda and reduce are good for, run this one- > liner and wonder no more... > > (Be patient, it may take a few seconds to return.) I have a decent CPU so it's not too bad. And the precision produced is notewort

Re: Best way to insert sorted in a list

2011-06-17 Thread Chris Torek
In article I wrote, in part: >>Appending to the list is much faster, and if you are going to >>dump a set of new items in, you can do that with: [...] In article Ethan Furman wrote: >> a.append(large_list) > ^- should be a.extend(large_list) Er, right. Posted in haste (had to get

Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-17 Thread python
Just installed the 32-bit version Python 2.7.2 for Windows via the python-2.7.2.msi download. When I start Python via python.exe or Idle, the version info is reported as 2.7.0 vs. 2.7.2. Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright",

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-17 Thread Benjamin Kaplan
On Fri, Jun 17, 2011 at 5:55 PM, wrote: > Just installed the 32-bit version Python 2.7.2 for Windows via the > python-2.7.2.msi download. > > When I start Python via python.exe or Idle, the version info is reported as > 2.7.0 vs. 2.7.2. > > Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.150

Re: installing NLTK

2011-06-17 Thread Benjamin Kaplan
On Fri, Jun 17, 2011 at 1:57 PM, Nige Danton wrote: > Hans Mulder wrote: >> On 17/06/11 21:58:53, Nige Danton wrote: >>> Mac OSX python 2.6.1: I'm trying to install the natural language toolkit >>> and following the instructions here www.NLTK.org/download I've downloaded >>> the PyYAML package an

Re: Best way to insert sorted in a list

2011-06-17 Thread Steven D'Aprano
On Fri, 17 Jun 2011 13:53:10 -0700, SherjilOzair wrote: > What has the community to say about this ? What is the best (fastest) > way to insert sorted in a list ? if you're doing repeated insertions into an already sorted list, there's no question that the bisect module is the right way to do it

Re: break in a module

2011-06-17 Thread Cameron Simpson
On 17Jun2011 06:00, Steven D'Aprano wrote: | If we were to have a "exit this module early, but without exiting Python | altogether" statement, I'd consider "exit" to be the most descriptive | name, although it would clash with existing uses of the word, e.g. | sys.exit(). Overloading "break" s

Re: installing NLTK

2011-06-17 Thread Nige Danton
Hans Mulder wrote: should make you a member of the "admin" group. All sorted now - thanks for your help. -- Nige Danton - Replace the obvious with g.m.a.i.l -- http://mail.python.org/mailman/listinfo/python-list

Re: Fun and games with lambda

2011-06-17 Thread Lalitha Prasad K
I would rate it as a great example of human ingenuity Lalit On Fri, Jun 17, 2011 at 9:40 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > If you've ever wondered what lambda and reduce are good for, run this one- > liner and wonder no more... > > (Be patient, it may take a fe

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-17 Thread python
Hi Benjamin, > The file info is seems correct but I just checked the MSI and it's reporting that it's 2.7.2. How exactly are you running python.exe and IDLE- are you calling the full path, just calling "python" and using whichever python version is first on your path, or are you using an entry in

Re: break in a module

2011-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2011 12:36:42 +1000, Cameron Simpson wrote: > On 17Jun2011 06:00, Steven D'Aprano > wrote: | If we were to have a > "exit this module early, but without exiting Python | altogether" > statement, I'd consider "exit" to be the most descriptive | name, > although it would clash with e

New member intro and question

2011-06-17 Thread Anthony Papillion
Hi Everyone, I'm a new list member from the United States. Long time programmer, fairly new to Python and absolutely loving it so far! I'm 36, live in Oklahoma, and own a small Linux software development and consulting firm. Python has made my life a *lot* easier and, the more I learn, the easier

What's the best way to write this base class?

2011-06-17 Thread John Salerno
Let's say I'm writing a game (really I'm just practicing OOP) and I want to create a "Character" base class, which more specific classes will subclass, such as Warrior, Wizard, etc. Which of the following ways is better, or is there another way? Note: I have in mind that when a specific subclass (

Re: break in a module

2011-06-17 Thread Chris Angelico
On Sat, Jun 18, 2011 at 1:50 PM, Steven D'Aprano wrote: > I don't think the use-case for this is convincing enough to need it, but > it's an interesting concept. I once played around with a mini-language > for config files that included a "STOP" command, so that: > > key = value > STOP > everythin

Re: break in a module

2011-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2011 14:31:51 +1000, Chris Angelico wrote: > On Sat, Jun 18, 2011 at 1:50 PM, Steven D'Aprano > wrote: >> I don't think the use-case for this is convincing enough to need it, >> but it's an interesting concept. I once played around with a >> mini-language for config files that incl

Re: What's the best way to write this base class?

2011-06-17 Thread Chris Angelico
On Sat, Jun 18, 2011 at 2:17 PM, John Salerno wrote: > 1) > class Character: > >    def __init__(self, name, base_health=50, base_resource=10): >        self.name = name >        self.health = base_health >        self.resource = base_resource If you expect to override the health/resource, I'd us

Re: break in a module

2011-06-17 Thread Chris Angelico
On Sat, Jun 18, 2011 at 2:49 PM, Steven D'Aprano wrote: > Not quite. In my config language, "ignored" means ignored. There was no > way of accessing the rest of the file, short of guessing the file name, > opening it and reading it as text. > > In Perl, the __END__ and __DATA__ keywords mark the e

Re: Embedding Python in a shell script

2011-06-17 Thread Jason Friedman
Thank you, everyone, for your suggestions. I'll try them all and decide which I like best. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: PyGUI 2.5

2011-06-17 Thread Gregory Ewing
Wolfgang Keller wrote: Any chance to see a hierarchical multi-column TreeListView anytime soon? There may be a table view, but I can't promise anything about a tree view, sorry. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: PyGUI 2.5

2011-06-17 Thread Gregory Ewing
Terry Reedy wrote: Greg left out the most important to me: "Now works with Python 3 on MacOSX and Windows!" I'm not making too much of that at the moment, because it *doesn't* work on Linux yet, and I've no idea how long it will be before it does. The issue is that there will apparently not b

Re: integer to binary 0-padded

2011-06-17 Thread jmfauth
>>> '{:+#0{}b}'.format(255, 1 + 2 + 16) +0b >>> '{:+#0{}b}'.format(-255, 1 + 2 + 16) -0b >>> >>> eval('{:+#0{}b}'.format(255, 1 + 2 + 16)) 255 >>> eval('{:+#0{}b}'.format(-255, 1 + 2 + 16)) -255 >>> jmf -- http://mail.python.org/mailman/listinfo/python-list

Re: New member intro and question

2011-06-17 Thread Kushal Kumaran
Hi Anthony, Welcome to the python users mailing list. On Sat, Jun 18, 2011 at 9:32 AM, Anthony Papillion wrote: > Hi Everyone, > > > I'm a new list member from the United States. Long time programmer, > fairly new to Python and absolutely loving it so far! I'm 36, live in > Oklahoma, and own a