Re: Is there a unique method in python to unique a list?

2012-09-09 Thread John H. Li
Thanks again. What you explain is reasonable. I try to the second method to
unique the list. It does turn out that python just works and works without
result. Maybe because it do iterate a long list in my example and slow.

>>> def average_polysemy(pos):
synset_list = list(wn.all_synsets(pos))
sense_number = 0
lemma_list = []
for synset in synset_list:
lemma_list.extend(synset.lemma_names)
unique_lemma_list = []
for w in lemma_list:
if not w in unique_lemma_list:
unique_lemma_list.append(w)
return unique_lemma_list
for lemma in unique_lemma_list:
sense_number_new = len(wn.synsets(lemma, pos))
sense_number = sense_number + sense_number_new
return sense_number/len(unique_lemma_list)

>>> average_polysemy('n')

On Sun, Sep 9, 2012 at 2:36 PM, Donald Stufft wrote:

>  For a short list the difference is going to be negligible.
>
> For a long list the difference is that checking if an item in a list
> requires iterating over the list internally to find it but checking if an
> item is inside of a set uses a faster method that doesn't require iterating
> over the list. This doesn't matter if you have 20 or 30 items, but imagine
> if instead you have 50 million items. Your going to be iterating over the
> list a lot and that can introduce significant slow dow.
>
> On the other hand using a set is faster in that case, but because you are
> storing an additional copy of the data you are using more memory to store
> extra copies of everything.
>
> On Sunday, September 9, 2012 at 2:31 AM, John H. Li wrote:
>
> Thanks first, I could understand the second approach easily. The first
> approach is  a bit puzzling. Why are  seen=set() and seen.add(x)  still
> necessary there if we can use unique.append(x) alone? Thanks for your
> enlightenment.
>
> On Sun, Sep 9, 2012 at 1:59 PM, Donald Stufft wrote:
>
>  seen = set()
> uniqued = []
> for x in original:
> if not x in seen:
> seen.add(x)
> uniqued.append(x)
>
> or
>
> uniqued = []
> for x in oriignal:
> if not x in uniqued:
> uniqued.append(x)
>
> The difference between is option #1 is more efficient speed wise, but uses
> more memory (extraneous set hanging around), whereas the second is slower
> (``in`` is slower in lists than in sets) but uses less memory.
>
> On Sunday, September 9, 2012 at 1:56 AM, John H. Li wrote:
>
> Many thanks. If I want keep the order, how can I deal with it?
> or we can list(set([1, 1, 2, 3, 4])) = [1,2,3,4]
>
>
> On Sun, Sep 9, 2012 at 1:47 PM, Donald Stufft wrote:
>
>  If you don't need to retain order you can just use a set,
>
> set([1, 1, 2, 3, 4]) = set([1, 2, 3, 4])
>
> But set's don't retain order.
>
> On Sunday, September 9, 2012 at 1:43 AM, Token Type wrote:
>
> Is there a unique method in python to unique a list? thanks
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
>
>
>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread John H. Li
One more test result to add, if I use your first method to unique:

seen = set()
uniqued = []
for x in original:
if not x in seen:
seen.add(x)
uniqued.append(x)

The results pops up in a few seconds. It makes a dramatic difference.
Thanks. See the following fasted codes:
>>> import nltk
>>> from nltk.corpus import wordnet as wn
>>> def average_polysemy(pos):
synset_list = list(wn.all_synsets(pos))
sense_number = 0
lemma_list = []
for synset in synset_list:
lemma_list.extend(synset.lemma_names)
unique_lemma_list = []
seen = set()
for w in lemma_list:
if not w in seen:
seen.add(w)
unique_lemma_list.append(w)
for lemma in unique_lemma_list:
sense_number_new = len(wn.synsets(lemma, pos))
sense_number = sense_number + sense_number_new
return sense_number/len(unique_lemma_list)

>>> average_polysemy('n')
1

On Sun, Sep 9, 2012 at 3:18 PM, John H. Li  wrote:

> Thanks again. What you explain is reasonable. I try to the second method
> to unique the list. It does turn out that python just works and works
> without result. Maybe because it do iterate a long list in my example and
> slow.
>
> >>> def average_polysemy(pos):
> synset_list = list(wn.all_synsets(pos))
> sense_number = 0
>  lemma_list = []
> for synset in synset_list:
> lemma_list.extend(synset.lemma_names)
>  unique_lemma_list = []
> for w in lemma_list:
>  if not w in unique_lemma_list:
> unique_lemma_list.append(w)
>  return unique_lemma_list
> for lemma in unique_lemma_list:
>  sense_number_new = len(wn.synsets(lemma, pos))
> sense_number = sense_number + sense_number_new
>  return sense_number/len(unique_lemma_list)
>
> >>> average_polysemy('n')
>
> On Sun, Sep 9, 2012 at 2:36 PM, Donald Stufft wrote:
>
>>  For a short list the difference is going to be negligible.
>>
>> For a long list the difference is that checking if an item in a list
>> requires iterating over the list internally to find it but checking if an
>> item is inside of a set uses a faster method that doesn't require iterating
>> over the list. This doesn't matter if you have 20 or 30 items, but imagine
>> if instead you have 50 million items. Your going to be iterating over the
>> list a lot and that can introduce significant slow dow.
>>
>> On the other hand using a set is faster in that case, but because you are
>> storing an additional copy of the data you are using more memory to store
>> extra copies of everything.
>>
>> On Sunday, September 9, 2012 at 2:31 AM, John H. Li wrote:
>>
>> Thanks first, I could understand the second approach easily. The first
>> approach is  a bit puzzling. Why are  seen=set() and seen.add(x)  still
>> necessary there if we can use unique.append(x) alone? Thanks for your
>> enlightenment.
>>
>> On Sun, Sep 9, 2012 at 1:59 PM, Donald Stufft wrote:
>>
>>  seen = set()
>> uniqued = []
>> for x in original:
>> if not x in seen:
>> seen.add(x)
>> uniqued.append(x)
>>
>> or
>>
>> uniqued = []
>> for x in oriignal:
>> if not x in uniqued:
>> uniqued.append(x)
>>
>> The difference between is option #1 is more efficient speed wise, but
>> uses more memory (extraneous set hanging around), whereas the second is
>> slower (``in`` is slower in lists than in sets) but uses less memory.
>>
>> On Sunday, September 9, 2012 at 1:56 AM, John H. Li wrote:
>>
>> Many thanks. If I want keep the order, how can I deal with it?
>> or we can list(set([1, 1, 2, 3, 4])) = [1,2,3,4]
>>
>>
>> On Sun, Sep 9, 2012 at 1:47 PM, Donald Stufft wrote:
>>
>>  If you don't need to retain order you can just use a set,
>>
>> set([1, 1, 2, 3, 4]) = set([1, 2, 3, 4])
>>
>> But set's don't retain order.
>>
>> On Sunday, September 9, 2012 at 1:43 AM, Token Type wrote:
>>
>> Is there a unique method in python to unique a list? thanks
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>>
>>
>>
>>
>>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread Serhiy Storchaka

On 09.09.12 08:47, Donald Stufft wrote:

If you don't need to retain order you can just use a set,


Only if elements are hashable.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread Paul Rubin
Token Type  writes:
 def average_polysemy(pos):
>   synset_list = list(wn.all_synsets(pos))
>   sense_number = 0
>   lemma_list = []
>   for synset in synset_list:
>   lemma_list.extend(synset.lemma_names)   
>   for lemma in list(set(lemma_list)):
>   sense_number_new = len(wn.synsets(lemma, pos))
>   sense_number = sense_number + sense_number_new
>   return sense_number/len(set(lemma_list))

I think you mean (untested):

 synsets = wn.all_synsets(pos)
 sense_number = 0
 lemma_set = set()
 for synset in synsets:
 lemma_set.add(synset.lemma_names)
 for lemma in lemma_set:
 sense_number += len(wn.synsets(lemma,pos))
 return sense_number / len(lemma_set)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread Paul Rubin
Paul Rubin  writes:
> I think you mean (untested):
>
>  synsets = wn.all_synsets(pos)
>  sense_number = 0
>  lemma_set = set()
>  for synset in synsets:
>  lemma_set.add(synset.lemma_names)
>  for lemma in lemma_set:
>  sense_number += len(wn.synsets(lemma,pos))
>  return sense_number / len(lemma_set)

Or even:

  lemma_set = set(synset for synset in wn.all_synsets(pos))
  sense_number = sum(len(wn.synsets(lemma, pos)) for lemma in lemma_set)
  return sense_number / len(lemma_set)
-- 
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.3.0 release candidate 2

2012-09-09 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On behalf of the Python development team, I'm delighted to announce the
second release candidate of Python 3.3.0.

This is a preview release, and its use is not recommended in
production settings.

Python 3.3 includes a range of improvements of the 3.x series, as well
as easier porting between 2.x and 3.x.  Major new features and changes
in the 3.3 release series are:

* PEP 380, syntax for delegating to a subgenerator ("yield from")
* PEP 393, flexible string representation (doing away with the
distinction between "wide" and "narrow" Unicode builds)
* A C implementation of the "decimal" module, with up to 80x speedup
for decimal-heavy applications
* The import system (__import__) now based on importlib by default
* The new "lzma" module with LZMA/XZ support
* PEP 397, a Python launcher for Windows
* PEP 405, virtual environment support in core
* PEP 420, namespace package support
* PEP 3151, reworking the OS and IO exception hierarchy
* PEP 3155, qualified name for classes and functions
* PEP 409, suppressing exception context
* PEP 414, explicit Unicode literals to help with porting
* PEP 418, extended platform-independent clocks in the "time" module
* PEP 412, a new key-sharing dictionary implementation that
significantly saves memory for object-oriented code
* PEP 362, the function-signature object
* The new "faulthandler" module that helps diagnosing crashes
* The new "unittest.mock" module
* The new "ipaddress" module
* The "sys.implementation" attribute
* A policy framework for the email package, with a provisional (see
PEP 411) policy that adds much improved unicode support for email
header parsing
* A "collections.ChainMap" class for linking mappings to a single unit
* Wrappers for many more POSIX functions in the "os" and "signal"
modules, as well as other useful functions such as "sendfile()"
* Hash randomization, introduced in earlier bugfix releases, is now
switched on by default

In total, almost 500 API items are new or improved in Python 3.3.
For a more extensive list of changes in 3.3.0, see

  http://docs.python.org/3.3/whatsnew/3.3.html

To download Python 3.3.0 visit:

  http://www.python.org/download/releases/3.3.0/

Please consider trying Python 3.3.0 with your code and reporting any bugs
you may notice to:

  http://bugs.python.org/


Enjoy!

- -- 
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.3's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEARECAAYFAlBMYJMACgkQN9GcIYhpnLCc5ACfcufn57tkNBPFU7qCpZ74GzjW
msMAn3sIwWHLdqixypnnyMBOw1ijILjo
=+e0e
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Roy Smith
In article , John Nagle  
wrote:

> This really should be handled in the standard library, instead of
> everybody rolling their own, badly.

+1
-- 
http://mail.python.org/mailman/listinfo/python-list


Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread StarPilgrim
Hi all,
Brand new to python. I was wondering what the __ underscore means?
For example, there is a line of code:

__name__=='__main__'


and I don't know what the double underscore is used for.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Mark Lawrence

On 09/09/2012 11:15, Roy Smith wrote:

In article , John Nagle 
wrote:


This really should be handled in the standard library, instead of
everybody rolling their own, badly.


+1



I'll second that given "There should be one-- and preferably only one 
--obvious way to do it".


--
Cheers.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Mark Lawrence

On 09/09/2012 12:03, StarPilgrim wrote:

Hi all,
Brand new to python. I was wondering what the __ underscore means?
For example, there is a line of code:

__name__=='__main__'


and I don't know what the double underscore is used for.



Start here http://docs.python.org/reference/datamodel.html#specialnames

--
Cheers.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Roy Smith
In article ,
 Thomas Jollans  wrote:

> The ISO date/time format is dead simple and well-defined.

Well defined, perhaps.  But nobody who has read the standard could call 
it "dead simple".  ISO-8601-2004(E) is 40 pages long.

Of course, that fact that it's complicated enough to generate 40 pages 
worth of standards document just argues that much more strongly for it 
being in the standard lib (so there can be one canonical, well-tested, 
way to do it).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Dave Angel
See the identical thread you posted on tutor, where it was a better match.
 


-- 

DaveA
-- 
http://mail.python.org/mailman/listinfo/python-list


Does os.getcwd() and os.curdir have the same effect ?

2012-09-09 Thread iMath
Does os.getcwd() and os.curdir have the same effect ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-09 Thread iMath
在 2012年3月26日星期一UTC+8下午7时45分26秒,iMath写道:
> I know the print statement produces the same result when both of these two 
> instructions are executed ,I just want to know Is there any difference 
> between print 3 and print '3' in Python ?

thx everyone
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What’s the differences between these two pieces of code ?

2012-09-09 Thread iMath
在 2012年7月7日星期六UTC+8下午12时56分35秒,iMath写道:
> What’s the differences between these two  pieces of code ?
> 
> (1)
> 
> for i in range(1, 7):
> 
> print(2 * i, end='   ')
> 
> 
> 
> thx everyone
> 
> (2)
> 
> for i in range(1, 7):
> 
> print(2 * i, end='   ')
> 
> print()
> 
> 
> 
> 
> 
> when executed both  respectively in Python shell ,I  get  the same effect . 
> Who can tell me why  ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Does os.getcwd() and os.curdir have the same effect ?

2012-09-09 Thread Thomas Jollans
On 09/09/2012 03:22 PM, iMath wrote:
> Does os.getcwd() and os.curdir have the same effect ?
> 

Python 3.2.3 (default, May  3 2012, 15:51:42)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'/home/tjol'
>>> os.curdir
'.'
>>>


No.


Both refer to the current directory, but os.curdir is not an absolute
path, so you can't chdir() to it later and expect to land it the
original directory.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Does os.getcwd() and os.curdir have the same effect ?

2012-09-09 Thread Steven D'Aprano
On Sun, 09 Sep 2012 06:22:09 -0700, iMath wrote:

> Does os.getcwd() and os.curdir have the same effect ?

You could answer that yourself with two seconds experimentation at the 
interactive prompt.


py> os.getcwd()
'/home/steve'
py> os.curdir
'.'

For more information, you can try reading the Fine Manual:

http://docs.python.org/library/os.html#os.getcwd

http://docs.python.org/library/os.html#os.curdir


In case it isn't obvious: no, they are completely different. os.getcwd is 
a function which returns the path of the current working directory. 
os.curdir is a string which the operating system will understand to mean 
"this directory".



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread Token Type
Thanks. I try to use set() suggested by you. However, not successful. Please 
see:
>>> synsets = list(wn.all_synsets('n'))
>>> synsets[:5]
[Synset('entity.n.01'), Synset('physical_entity.n.01'), 
Synset('abstraction.n.06'), Synset('thing.n.12'), Synset('object.n.01')]
>>> lemma_set = set()
>>> for synset in synsets:
lemma_set.add(synset.lemma_names)


Traceback (most recent call last):
  File "", line 2, in 
lemma_set.add(synset.lemma_names)
TypeError: unhashable type: 'list'
>>> for synset in synsets:
lemma_set.add(set(synset.lemma_names))

Traceback (most recent call last):
  File "", line 2, in 
lemma_set.add(set(synset.lemma_names))
TypeError: unhashable type: 'set'


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type
Thanks very much for all of your tips. Take noun as an example. First, I need 
find all the lemma_names in all the synsets whose pos is 'n'. Second, for each 
lemma_name, I will check all their sense number. 

1)  Surely,we can know the number of synset whose pos is noun by 
>>> len([synset for synset in wn.all_synsets('n')])
82115

However, confusingly it is unsuccessful to get a list of lemma names of these 
synsets by 
>>> lemma_list = [synset.lemma_names for synset in wn.all_synsets('n')]
>>> lemma_list[:20]
[['entity'], ['physical_entity'], ['abstraction', 'abstract_entity'], 
['thing'], ['object', 'physical_object'], ['whole', 'unit'], ['congener'], 
['living_thing', 'animate_thing'], ['organism', 'being'], ['benthos'], 
['dwarf'], ['heterotroph'], ['parent'], ['life'], ['biont'], ['cell'], 
['causal_agent', 'cause', 'causal_agency'], ['person', 'individual', 'someone', 
'somebody', 'mortal', 'soul'], ['animal', 'animate_being', 'beast', 'brute', 
'creature', 'fauna'], ['plant', 'flora', 'plant_life']]
>>> type(lemma_list)


Though the lemma_list is a list in the above codes, it contains so many 
unnecessary [ and ]. How come it is like this? But what we desire and expect is 
a list without this brackets. Confused, I am really curious to know why.

2)  Then I have to use a loop and extend to get all the lemma_names from synset:
>>> synset_list = list(wn.all_synsets('n'))
>>> lemma_list = []
>>> for synset in synset_list:
lemma_list.extend(synset.lemma_names)
>>> lemma_list[:20]
['entity', 'physical_entity', 'abstraction', 'abstract_entity', 'thing', 
'object', 'physical_object', 'whole', 'unit', 'congener', 'living_thing', 
'animate_thing', 'organism', 'being', 'benthos', 'dwarf', 'heterotroph', 
'parent', 'life', 'biont']

3) In this case, I have to use loop to get all the lemma_names instead of 
[synset.lemma_names for synset in wn.all_synsets('n')]. The following is a 
working solution:

>>> def average_polysemy(pos):
 synset_list = list(wn.all_synsets(pos))
 sense_number = 0
 lemma_list = []
 for synset in synset_list:
  lemma_list.extend(synset.lemma_names)
 for lemma in lemma_list:
  sense_number_new = len(wn.synsets(lemma, pos))
  sense_number = sense_number + sense_number_new
 return sense_number/len(synset_list)

>>> average_polysemy('n')
3

Thanks again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type

> In fact, I'm guessing that's your problem.  I think you're ending up 
> 
> with a list of lists of strings, when you think you're getting a list of 
> 
> strings.
> 
Thanks. You guess right. It turns out that lemma_list is a list of list, as I 
tested in the previous post.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a unique method in python to unique a list?

2012-09-09 Thread Chris Angelico
On Sun, Sep 9, 2012 at 11:44 PM, Token Type  wrote:
>   lemma_set.add(synset.lemma_names)

That tries to add the whole list as a single object, which doesn't
work because lists can't go into sets. There are two solutions,
depending on what you want to do.

1) If you want each addition to remain discrete, make a tuple instead:
lemma_set.add(tuple(synset.lemma_names))

2) If you want to add the elements of that list individually into the
set, use update:
lemma_set.update(synset.lemma_names)

I'm thinking you probably want option 2 here.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type

> structures are simple, just plain print will work, but for more 
> 
> complicated structures, pprint.pprint() is a life saver.
> 

I did try . However, 

>>> pprint.pprint(lemma_list)

Traceback (most recent call last):
  File "", line 1, in 
pprint.pprint(lemma_list)
NameError: name 'pprint' is not defined
>>> pprint.pprint(synset_list)

Traceback (most recent call last):
  File "", line 1, in 
pprint.pprint(synset_list)
NameError: name 'pprint' is not defined
>>> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Newbie: where's the new python gone?

2012-09-09 Thread BobAalsma
I think I've installed Python 2.7.3 according to the instructions in the 
README, and now want to use that version. 
However, when typing "python" in Terminal, I get "Python 2.6.4 (r264:75821M, 
Oct 27 2009, 19:48:32) ".
So:
(1) I can't seem to find where the new software has gone and 
(2) can't seem to find how to point to this new versoin.
I've searched Python.org and with Google but :(
[I'm on Mac OS X 10.7.4]

Please help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Roy Smith
In article <[email protected]>,
 Token Type  wrote:

> Thanks very much for all of your tips. Take noun as an example. First, I need 
> find all the lemma_names in all the synsets whose pos is 'n'. Second, for 
> each lemma_name, I will check all their sense number. 
> 
> 1)  Surely,we can know the number of synset whose pos is noun by 
> >>> len([synset for synset in wn.all_synsets('n')])
> 82115
> 
> However, confusingly it is unsuccessful to get a list of lemma names of these 
> synsets by 
> >>> lemma_list = [synset.lemma_names for synset in wn.all_synsets('n')]
> >>> lemma_list[:20]
> [['entity'], ['physical_entity'], ['abstraction', 'abstract_entity'], 
> ['thing'], ['object', 'physical_object'], ['whole', 'unit'], ['congener'], 
> ['living_thing', 'animate_thing'], ['organism', 'being'], ['benthos'], 
> ['dwarf'], ['heterotroph'], ['parent'], ['life'], ['biont'], ['cell'], 
> ['causal_agent', 'cause', 'causal_agency'], ['person', 'individual', 
> 'someone', 'somebody', 'mortal', 'soul'], ['animal', 'animate_being', 
> 'beast', 'brute', 'creature', 'fauna'], ['plant', 'flora', 'plant_life']]
> >>> type(lemma_list)
> 
> 


> Though the lemma_list is a list in the above codes, it contains so many 
> unnecessary [ and ]. How come it is like this? But what we desire and expect 
> is a list without this brackets. Confused, I am really curious to know why.

It looks like synset.lemma_names gets you a list.  And then you're 
taking all those lists and forming them into a list of lists:

>>> lemma_list = [synset.lemma_names for synset in wn.all_synsets('n')]

I think what you want to study is the difference between list.append() 
and list.extend().  When you use the list builder syntax, you're 
essentially writing a loop which does append operations.  The above is 
the same as if you wrote:

lemma_list = list()
for synset in wn.all_synsets('n'):
lemma_list.append(synset.lemma_names)

and I think what you're looking for is:

lemma_list = list()
for synset in wn.all_synsets('n'):
lemma_list.extend(synset.lemma_names)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Roy Smith
In article ,
 Token Type  wrote:

> > structures are simple, just plain print will work, but for more 
> > 
> > complicated structures, pprint.pprint() is a life saver.
> > 
> 
> I did try . However, 
> 
> >>> pprint.pprint(lemma_list)
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> pprint.pprint(lemma_list)
> NameError: name 'pprint' is not defined
> >>> pprint.pprint(synset_list)
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> pprint.pprint(synset_list)
> NameError: name 'pprint' is not defined
> >>> 

OK, I can see how this can be confusing.  In "pprint.pprint()", the two 
"pprint"s mean different things.  The first one is the name of a module.  
The second one is the name of a function in that module.  In general, I 
dislike this style of naming since it just leads to this kind of 
confusion.

In any case, you need to do one of two things.

Style 1:

import pprint
pprint.pprint(foo)

Style 2:

from pprint import pprint
pprint(foo)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-09 Thread Ian Foote

On 09/09/12 14:23, iMath wrote:

在 2012年3月26日星期一UTC+8下午7时45分26秒,iMath写道:

I know the print statement produces the same result when both of these two 
instructions are executed ,I just want to know Is there any difference between 
print 3 and print '3' in Python ?

thx everyone


The difference is that 3 is an integer whereas '3' is a string. The 
print statement (function in python 3) converts any object to a string 
before displaying it on the screen, so print 3 and print '3' both 
display the same result.


Ian F
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Steven D'Aprano
On Sun, 09 Sep 2012 07:28:55 -0700, BobAalsma wrote:

> I think I've installed Python 2.7.3 according to the instructions in the
> README, and now want to use that version. However, when typing "python"
> in Terminal, I get "Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) ".

Did you run "make altinstall"? You should, because it is a bad idea to 
replace the system Python with a newer (or worse, older) version. You can 
break things.


> So:
> (1) I can't seem to find where the new software has gone

Just enter "python2.7" instead of "python" and it should work perfectly.


> and (2) can't
> seem to find how to point to this new versoin. I've searched Python.org

You won't find it there *wink*

At the terminal, enter:

which python2.7

which should return the full path to the executable, e.g.:

[steve@ando ~]$ which python2.7
/usr/local/bin/python2.7

My system uses Python 2.4 as the system Python, but I prefer to use 
Python 2.7 as my default. So I have this command in my .bashrc file:

alias python='python2.7'

which means that *for me*, "python" launches Python 2.7, but when system 
tools call "python" they still see the version they are expecting.

If your shell is something other than bash, you may need to use a 
different rc file.

Did any of this make sense to you? If anything was unclear, please don't 
hesitate to ask.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread BobAalsma
Op zondag 9 september 2012 16:28:55 UTC+2 schreef BobAalsma het volgende:
> I think I've installed Python 2.7.3 according to the instructions in the 
> README, and now want to use that version. 
> 
> However, when typing "python" in Terminal, I get "Python 2.6.4 (r264:75821M, 
> Oct 27 2009, 19:48:32) ".
> 
> So:
> 
> (1) I can't seem to find where the new software has gone and 
> 
> (2) can't seem to find how to point to this new versoin.
> 
> I've searched Python.org and with Google but :(
> 
> [I'm on Mac OS X 10.7.4]
> 
> 
> 
> Please help.

Thanks Steven!

Most of what you wrote made very good sense, yes.

Umm, I didn't usa altinstall - should I (and can I) go back? [In hindsight I do 
like your solution to the versopns a lot more, yes]

Umm2, as said, I think I've installed (at least downloaded) 2.7.3 (note the 
three there) and with "python2.7" I now see "Python 2.7.1 (r271:86832, Jun 16 
2011, 16:59:05)"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Ben Finney
BobAalsma  writes:

> I think I've installed Python 2.7.3 according to the instructions in
> the README, and now want to use that version.

> However, when typing "python" in Terminal, I get "Python 2.6.4
> (r264:75821M, Oct 27 2009, 19:48:32) ".

I think you might have made a mistake.

Without more detail about what you did – detail which you perhaps can't
provide, since it's like asking “where did you last see the thing you
lost” – there's not much more we can do but guess.

You could try following the install instructions again, paying careful
attention to what might go wrong. Either something will go wrong, and
you'll be paying close enough attention to report it; or nothing will go
wrong, and you'll be able to use the version you want.

Good hunting.

-- 
 \ “The most dangerous man to any government is the man who is |
  `\   able to think things out for himself, without regard to the |
_o__)  prevailing superstitions and taboos.” —Henry L. Mencken |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread hamilton

On 9/9/2012 6:39 AM, Dave Angel wrote:

See the identical thread you posted on tutor, where it was a better match.




Would you please post that link for those of us that did not see that one.

Thanks

--
http://mail.python.org/mailman/listinfo/python-list


Re: simple client data base

2012-09-09 Thread Bryan
Mark R Rivet wrote:
> Well I have to say that this is most discouraging.

Sorry to to be a drag, but the thread needed a bit a realism.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What’s the differences between these two pieces of code ?

2012-09-09 Thread Kwpolska
On Sun, Sep 9, 2012 at 3:27 PM, iMath  wrote:
> 在 2012年7月7日星期六UTC+8下午12时56分35秒,iMath写道:
>> What’s the differences between these two  pieces of code ?
>>
>> (1)
>>
>> for i in range(1, 7):
>>
>> print(2 * i, end='   ')
>>
>>
>>
>> thx everyone
>>
>> (2)
>>
>> for i in range(1, 7):
>>
>> print(2 * i, end='   ')
>>
>> print()
>>
>>
>>
>>
>>
>> when executed both  respectively in Python shell ,I  get  the same effect . 
>> Who can tell me why  ?
>
> --
> http://mail.python.org/mailman/listinfo/python-list

Well, (2) is inserting an additional newline, and (1) isn’t.  The
shell might not show that, but try running this as a standalone
script.

-- 
Kwpolska 
stop html mail  | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
-- 
http://mail.python.org/mailman/listinfo/python-list


Symbolic computations

2012-09-09 Thread Mok-Kong Shen


I heard of names of two systems for Python users to do symbolic
computations: SymPy and Sage. Could someone say a few lines
from experiences about their comparisons? Thanks in advance.

M. K. Shen
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Ned Deily
In article <[email protected]>,
 BobAalsma  wrote:
> Umm2, as said, I think I've installed (at least downloaded) 2.7.3 (note the 
> three there) and with "python2.7" I now see "Python 2.7.1 (r271:86832, Jun 16 
> 2011, 16:59:05)"

Did you use a binary installer from python.org or did you build it 
yourself from source?  In the former case, you should find the newer 
python2.7 at /usr/local/bin/python2.7.  Also, the installer by default 
should have added the framework bin directory to your shell PATH.  Try 
opening a new terminal window and typing python2.7.   In any case, as 
suggested:

   which python

should tell you the path to the python you are invoking.  It doesn't 
appear to be an Apple-supplied one or a python.org one, BTW.

-- 
 Ned Deily,
 [email protected]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Hans Mulder
On 9/09/12 16:28:55, BobAalsma wrote:
> I think I've installed Python 2.7.3 according to the instructions in the 
> README, and now want to use that version. 
> However, when typing "python" in Terminal, I get "Python 2.6.4 (r264:75821M, 
> Oct 27 2009, 19:48:32) ".

Was that a freshly opened Terminal window, or one that was open
before the install?

The installers from python.org by default modify
your .bashrc file to put
/Library/Frameworks/Python.framework/Versions/2.7/bin
at the front of your shell's search path.

However, that only affects windows opened after the install
(unless you use "source ~/.bashrc" to read the new setting
into a pre-existing window).

What happens if you type:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python ?

> So:
> (1) I can't seem to find where the new software has gone and 
> (2) can't seem to find how to point to this new versoin.
> I've searched Python.org and with Google but :(
> [I'm on Mac OS X 10.7.4]

I'm on MacOS 10.5.0, and my default Python is
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

If yours isn't, you could try looking in finder at the
disk you installed Python to, and see if it has a top-level
folder named "Library", containing "Frameworks", etc.

If you find a "Python.framework" under /System/Library
that's the one that ships with MacOS.

Hope this helps,

-- HansM


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simple client data base

2012-09-09 Thread Tim Chase
On 09/08/12 14:47, Mark R Rivet wrote:
> Well I have to say that this is most discouraging. I should give
> up learning to program. I don't have a chance at all. Thanks.

I think the intent is not to deter you from learning to program, but
rather to urge you in a direction less fraught with peril.  Rather
than starting by duplicating existing functionality of a complex
domain, you may find it easier to start by aiming for something in a
less-complex domain, or tackle a project that doesn't already exist
but scratches your personal itch.  As you succeed at smaller
projects, you'll have a better idea of how to tackle larger projects
in the future.

-tkc




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What’s the differences between these two pieces of code ?

2012-09-09 Thread Piet van Oostrum
iMath  writes:

> What’s the differences between these two  pieces of code ?
> (1)
> for i in range(1, 7):
> print(2 * i, end='   ')
>
>
> (2)
> for i in range(1, 7):
> print(2 * i, end='   ')
> print()
>
>
> when executed both  respectively in Python shell ,I  get  the same effect . 
> Who can tell me why  ?

The first one gives a syntax error (IndentationError: expected an indented 
block)
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simple client data base

2012-09-09 Thread Paul Rubin
Tim Chase  writes:
> urge you in a direction less fraught with peril.  Rather than starting
> by duplicating existing functionality of a complex domain

More importantly, as others have mentioned, the main peril comes from
having someone else relying on the success of the program.  If you want
to learn to play the violin, that's great.  Just don't book a recital in
Carnegie Hall until you've practiced for a while in private to get your
skills in order.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for an IPC solution

2012-09-09 Thread Andrew Cooper
On 08/09/2012 16:11, Ramchandra Apte wrote:
> On Friday, 7 September 2012 02:25:15 UTC+5:30, Dave Angel  wrote:
>> On 09/06/2012 04:33 PM, Dennis Lee Bieber wrote:
>>
>>> 
>>
>>
>>
>>> Note that this difference mainly applies to how the processes are
>>
>>> themselves are created... How the library wraps shared data is
>>
>>> possibly different (I've never understood how a "fork" process can
>>
>>> avoid memory conflicts if it has write access to common virtual memory
>>
>>> blocks).
>>
>> Here's an approximate description of fork, at least for the memory
>>
>> aspects.   During a fork, the virtual memory table is copied (that's
>>
>> descriptors for all mapped and allocated memory) but the memory itself
>>
>> is NOT.  All the new descriptors are labeled "COW"  (copy-on-write).  As
>>
>> that process executes, the first time it writes in a particular memory
>>
>> block, the OS gets a memory fault, which it fixes by allocating a block
>>
>> of the same size, copying the memory block to the new one, and labeling
>>
>> it read/write. Subsequent accesses to the same block are normal, with no
>>
>> trace of the fork remaining.
>>
>>
>>
>> Now, there are lots of details that this blurs over, but it turns out
>>
>> that many times the new process doesn't change very much.  For example,
>>
>> all the mappings to the executable and to shared libraries are
>>
>> theoretically readonly.  In fact, they might have also been labeled COW
>>
>> even for the initial execution of the program.  Another place that's
>>
>> blurry is just what the resolution of this table actually is.  There are
>>
>> at least two levels of tables.  The smallest increment on the Pentium
>>
>> family is 4k.
>>
>>
>>
>>
>>
>> -- 
>>
>>
>>
>> DaveA
> 
> From my OS development experience, there are two sizes of pages - 4K and 1 
> byte
> 

No - pages are always 4k (or bigger given superpage support).

You are probably thinking about the granularity bit in descriptor
entries, which is relevant for segmentation.  The granularity bit
changes the limit between 1 byte or 4K chunks, as there are only 20 bits
of limit space in a 32bit {L,G}DT entry.

However, in the modern days of paging, segmentation support is only for
legacy compatibility.

~Andrew
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Symbolic computations

2012-09-09 Thread Steven D'Aprano
On Sun, 09 Sep 2012 19:26:25 +0200, Mok-Kong Shen wrote:

> I heard of names of two systems for Python users to do symbolic
> computations: SymPy and Sage. Could someone say a few lines from
> experiences about their comparisons? Thanks in advance.

Sage includes and is compatible with sympy. See for example:

http://www.sagemath.org/doc/reference/sage/calculus/test_sympy.html



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Dave Angel
On 09/09/2012 12:04 PM, hamilton wrote:
> On 9/9/2012 6:39 AM, Dave Angel wrote:
>> See the identical thread you posted on tutor, where it was a better
>> match.
>>
>>
>>
> Would you please post that link for those of us that did not see that
> one.
>
> Thanks
>
it's a mailing list.  There's no links to the mail in my folder. 

Googling shows me:

http://code.activestate.com/lists/python-tutor/90564/



-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Steven D'Aprano
On Sun, 09 Sep 2012 10:04:18 -0600, hamilton wrote:

> On 9/9/2012 6:39 AM, Dave Angel wrote:
>> See the identical thread you posted on tutor, where it was a better
>> match.
>>
>>
>>
> Would you please post that link for those of us that did not see that
> one.

http://mail.python.org/pipermail/tutor/2012-September/091388.html

You can see the tutor archives, or subscribe to the list, from here:

http://mail.python.org/mailman/listinfo/tutor


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Standard Asynchronous Python

2012-09-09 Thread Dustin J. Mitchell
After seeing David Mertz's talk at PyCon 2012, "Coroutines, event
loops, and the history of Python generators" [1], I got thinking again
about Python's expressive power for asynchronous programming.
Generators, particularly with the addition of 'yield from' and
'return' in PEP 380 [2], allow us to write code that is executed "bit
by bit" but still reads naturally.  There are a number of frameworks
that take advantage of this ability, but each is a little different --
enough so that there's negligible code re-use between these
frameworks.  I think that's a shame.

I proposed a design PEP a while back [3] with the intent of defining a
standard way of writing asynchronous code, with the goal of allowing
code re-use and bringing users of the frameworks closer together.
Ideally, we could have libraries to implement network protocols,
database wrappers, subprocess execution, and so on, that would work in
any of the available asynchronous frameworks.

My proposal met with near-silence, and I didn't pursue it.  Instead, I
did what any self-respecting hacker would do - I wrote up a framework,
uthreads [4], that implemented my idea.  This was initially a simple
trampoline scheduler, but I eventually refactored it to run atop
Twisted, since that's what I use.  To my knowledge, it's never been
used.

I'm considering re-drafting the PEP with the following changes:

 * De-emphasize the thread emulation aspects, and focus on
code-portability issues:
   * callbacks vs. "blocking" calls (e.g., when accepting incoming
connections on a socket, how is my code invoked?)
   * consistent access to primitives, regardless of framework (e.g.,
where's the function I call to branch execution?)
   * nested asynchronous methods
 * Account for PEP 380 (by making the StopIteration workarounds match
PEP 380, and explicitly deprecating them after Python 3.3)
 * Look forward to a world with software transactional memory [5] by
matching that API where appropriate

As I get to work on the PEP, I'd like to hear any initial reactions to the idea.

Dustin

[1] https://us.pycon.org/2012/schedule/presentation/104/
[2] http://www.python.org/dev/peps/pep-0380
[3] http://code.google.com/p/uthreads/source/browse/trunk/microthreading-pep.txt
[4] http://code.google.com/p/uthreads/
[5] https://bitbucket.org/pypy/pypy/raw/stm-thread/pypy/doc/stm.rst
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standard Asynchronous Python

2012-09-09 Thread Steven D'Aprano
On Sun, 09 Sep 2012 20:07:51 -0400, Dustin J. Mitchell wrote:

> After seeing David Mertz's talk at PyCon 2012, "Coroutines, event loops,
> and the history of Python generators" [1], I got thinking again about
> Python's expressive power for asynchronous programming.
[...]
> I'm considering re-drafting the PEP with the following changes:
> 
>  * De-emphasize the thread emulation aspects, and focus on
> code-portability issues:
>* callbacks vs. "blocking" calls (e.g., when accepting incoming
> connections on a socket, how is my code invoked?)
>* consistent access to primitives, regardless of framework (e.g.,
> where's the function I call to branch execution?)
>* nested asynchronous methods
>  * Account for PEP 380 (by making the StopIteration workarounds match
> PEP 380, and explicitly deprecating them after Python 3.3)
>  * Look forward to a world with software transactional memory [5] by
> matching that API where appropriate
> 
> As I get to work on the PEP, I'd like to hear any initial reactions to
> the idea.

My reaction is that until your framework gets some significant real-world 
use, it probably doesn't belong in the standard library. To some degree, 
the standard library is where good code goes to die -- the API should be 
mature and well-tested, not just the code, because we'll be stuck with 
the API (essentially) forever. Code can change, bugs can be fixed, but 
we're stuck with "referer" forever :)

At least, you should be prepared to justified why your library uthreads 
should be considered mature enough for the std lib despite the lack of 
real-world use. 



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standard Asynchronous Python

2012-09-09 Thread Bryan
Dustin J. Mitchell wrote:
> After seeing David Mertz's talk at PyCon 2012, "Coroutines, event
> loops, and the history of Python generators" [1], I got thinking again
> about Python's expressive power for asynchronous programming.

I lament the confusion of generators and coroutines. Generators are no
substitute for threads; they're a substitute for temporary memory-
wasting lists and for those extraneous classes that just implement
another class's __iter__.

[big snip]
> As I get to work on the PEP, I'd like to hear any initial reactions to the 
> idea.

Be warned that I'm frequently chastised for negativity...
Your motivating examples motivate me in the opposite direction.
Computing Fibonacci numbers with a generator? The problem with your
first support app is that threads don't scale?

I'm happy with the direction Python has chosen: real, platform-
provided threads. There are some fine projects taking other courses,
but most of the standard stuff is sequential code with some notion of
thread-safety. In this area Python has benefited for free as the
popular platforms have steadily improved.

Properly exploiting event-drive would be a bigger change than you
propose. Python tends to polymorphize I/O via "file like" objects,
who's requirements have traditionally been under-specified and have
never included event-driven behavior. Also, while Python is proudly
cross-platform, Microsoft Windows has the edge on asynchronous
facilities but Python treats Windows like a Unix wanna-be.

-Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Bryan
StarPilgrim wrote:
> Brand new to python. I was wondering what the __ underscore means?
> For example, there is a line of code:
>
> __name__=='__main__'
>
> and I don't know what the double underscore is used for.

Ah, tricky. That's not just double underscore; it's double ended
double underscore. Double ended double underscore means that it
invokes special behavior in the Python language. It means fair
warning. Look this up.

Never name your own variables with double ended double underscore. The
one exception is if you are proposing a change to the Python language
and seeking the blessing of our BDFL. Such names are reserved for the
Python language.

Leading double underscore without trailing double underscore means
that the programmer knows and loves some other object-oriented
language, and this other language has a notion of trying to enforce
that this member variable is "private", and Python is meeting him half
way. The programmer of the class advises you not to manipulate this
member variable directly and Python has bowed to convention and done
some name mangling. It's often useful, usually naive, fundamentally
insecure, and tangential to the zen Python.

A lesser known Python convention is the double ended single
underscore. Whether it even rates as convention might be arguable, but
it's there in the critical _fields_ member of the Structure and Union
base classes in the standard ctypes module. It means special within
the particular class. To the Python language it's just another name,
but the authors of the class have coded it to look up that name and do
something interesting with the associated value.

-Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Dwight Hutto
I have several installations on my windows, so I use
c:\python27_64\python.exe module_file.py

or

c:\python26\python.exe module_file.py

in the command line.


Not to show that this shouldn't be a discussion, but usually it's
searching. Here's search term a link, and some python docs:

install python windows command line

or click:

https://www.google.com/search?q=install+python+windows+command+line&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-ahere's

and one of the better results:

http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows


-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-09 Thread Dwight Hutto
On Sun, Sep 9, 2012 at 10:41 AM, Ian Foote  wrote:

> On 09/09/12 14:23, iMath wrote:
>
>> 在 2012年3月26日星期一UTC+8下午7时45分26秒,**iMath写道:
>>
>>> I know the print statement produces the same result when both of these
>>> two instructions are executed ,I just want to know Is there any difference
>>> between print 3 and print '3' in Python ?
>>>
>> thx everyone
>>
>
>
Here's a future import though I used,so I can use the planned 3 with a 2x
python version in the command line interpreter:

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\david>c:\python26\python.exe
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\david>c:\python27_64\python.exe
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import __future__
>>> x = 3
>>> y = '3'
>>> print(x)
3
>>> print(y)
3
>>>
>>> type(x)

>>> type(y)


>>> z = '%i' % (3)
>>> type(z)

>>>

In other words type(value), and find out the difference.
-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: where's the new python gone?

2012-09-09 Thread Mark Lawrence

On 10/09/2012 07:10, Dwight Hutto wrote:

I have several installations on my windows, so I use
c:\python27_64\python.exe module_file.py

or

c:\python26\python.exe module_file.py

in the command line.


Not to show that this shouldn't be a discussion, but usually it's
searching. Here's search term a link, and some python docs:

install python windows command line

or click:

https://www.google.com/search?q=install+python+windows+command+line&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-ahere's

and one of the better results:

http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows






Why have you posted this seeing that the OP stated that they're on Mac OS X?

The windows faq is outdated wrt PEP397.  An up to date version is 
available here http://docs.python.org/dev/using/windows.html


--
Cheers.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list