Re: Slicing iterables in sub-generators without loosing elements

2012-10-01 Thread Mark Lawrence

On 01/10/2012 01:58, 8 Dihedral wrote:


Your question seems vague to me. If you know you are storing
only immutable tuples in a list, then the way to iterate is simple.



Does Python have a magic method that let's me use mutable tuples?  I'd 
also like immutable lists.  Is it worth raising a feature request on the 
bug tracker?


--
Cheers.

Mark Lawrence.

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


How write a IGMP V3 request

2012-10-01 Thread pedr0
Hello,

I wrote this piece of code but I am not able to modify it in order to use 
IGMPV3 
and use the source feature of IGMPV3, how can I add a membership for a group on 
an interface for specified source ?

Something like this piece of code (C under Linux):

setsockopt(fd,SOL_IP,MCAST_JOIN_SOURCE_GROUP, &group_source_req,
sizeof(group_source_req));



import socket
import fcntl
import struct
import sys

def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915,  # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])

if len(sys.argv) < 3:
print 'Usage : [MCAST_ADDR] [PORT] [IFNAME]'
sys.exit(1)

MCAST_GRP = sys.argv[1]
MCAST_PORT = int(sys.argv[2])
IF = sys.argv[3]

ip_if = get_ip_address(IF)
packet = 0
print("Capturing from "+IF+"("+ip_if+") group "+MCAST_GRP+":"+str(MCAST_PORT))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(('', MCAST_PORT))
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, 
socket.inet_aton(MCAST_GRP)+socket.inet_aton(ip_if))

while True:
try:
sock.recv(1024)
print '1K received'
packet = packet +1
except:
print 'Received '+str(packet*1024)+' bytes'
sock.setsockopt(socket.IPPROTO_IP, socket.IP_DROP_MEMBERSHIP, 
socket.inet_aton(MCAST_GRP)+socket.inet_aton(ip_if))
sys.exit(0)

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


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread Mark Lawrence

On 01/10/2012 04:06, Edward Diener wrote:

On 9/30/2012 3:38 PM, Andrew Berg wrote:

Unix-based OSes should already obey the shebang line, and on Windows,
there's py.exe in 3.3 that will launch the intended version based on
that shebang line.


The problem with that is that one has to already being using 3.3 to use
this facility. I was hoping for a solution which was backwards
compatible with Python 2.x.



You don't need 3.3 to get py.exe.  I've been running it for months, it's 
available here https://bitbucket.org/vinay.sajip/pylauncher/downloads


--
Cheers.

Mark Lawrence.

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


Re: Can't import modules

2012-10-01 Thread Mark Lawrence

On 01/10/2012 02:25, Steven D'Aprano wrote:

On Sun, 30 Sep 2012 17:35:02 -0700, Peter Farrell wrote:


Thanks for trying to help, everybody. Sorry I didn't post the whole
error message. Now my problem is I just installed VPython and I'm trying
to run the very first example, bounce.py which I located. I opened it
and ran it in Idle. I got this message:


In general, any time you get unexpected or unusual errors in IDLE, you




In Windows, I *think* that if you run "python" (or perhaps "python32")
from the Start Menu, it will open an interactive prompt similar to IDLE.


Just python.  With the arrival of pylauncher 
http://www.python.org/dev/peps/pep-0397/ you can also type py [options].


--
Cheers.

Mark Lawrence.

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


Re: parse an environment file

2012-10-01 Thread Ulrich Eckhardt

Am 01.10.2012 02:11, schrieb Jason Friedman:

$ crontab -l
* * * * * env

This produces mail with the following contents:


[...]

SHELL=/bin/sh

^^^
[...]


On the other hand

$ env

produces about 100 entries, most of which are provided by my .bashrc;


bash != sh

Instead of running a script in default POSIX shell, you might be able to 
run it in bash, which will then read your ~/.bashrc (verify that from 
the docs, I'm not 100% sure). Maybe it is as easy as changing the first 
line to '#!/bin/bash'.



I want my python 3.2.2 script, called via cron, to know what those
additional variables are.


To be honest, I would reconsider the approach. You could patch the cron 
invokation, but that still won't fix any other invokations like starting 
it from a non-bash shell, filemanager, atd etc. You could instead set 
these variables in a different place that is considered by more 
applications. I wonder if maybe ~/.profile would be such a place.


Alternatively, assuming these environment variables are just for your 
Python program, you could store these settings in a separate 
configuration file instead. Environment variables are always a bit like 
using globals instead of function parameters.



Good luck!

Uli

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


Re: parse an environment file

2012-10-01 Thread Alain Ketterlin
Jason Friedman  writes:

[...]
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are.  How?

This is not a python question. Have a look at the crontab(5) man page,
it's all explained there.

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


Re: parse an environment file

2012-10-01 Thread Jason Friedman
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are.  How?

Thank you for the feedback.  A crontab line of

* * * * * . /path/to/export_file && /path/to/script.py

does indeed work, but for various reasons this approach will not
always be available to me.

Let me restate my question.  I have a file that looks like this:
export VAR1=foo
export VAR2=bar
# Comment
export VAR3=${VAR1}${VAR2}

I want this:
my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'}

I can roll my own, but I'm thinking there is a module or existing code
that does this.  I looked at the os and sys and configparse modules
but did not see it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to apply the user's HTML environment in a Python programme?

2012-10-01 Thread BobAalsma
Op vrijdag 21 september 2012 16:15:30 UTC+2 schreef Joel Goldstick het volgende:
> On Fri, Sep 21, 2012 at 9:58 AM, BobAalsma wrote:
> 
> > Op vrijdag 21 september 2012 15:36:11 UTC+2 schreef Jerry Hill het volgende:
> 
> >> On Fri, Sep 21, 2012 at 9:31 AM, BobAalsma wrote:
> 
> >>
> 
> >> > Thanks, Joel, yes, but as far as I'm aware these would all require the 
> >> > Python programme to have the user's username and password (or 
> >> > "credentials"), which I wanted to avoid.
> 
> >>
> 
> >>
> 
> >>
> 
> >> No matter what you do, your web service is going to have to
> 
> >>
> 
> >> authenticate with the remote web site.  The details of that
> 
> >>
> 
> >> authentication are going to vary with each remote web site you want to
> 
> >>
> 
> >> connect to.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Jerry
> 
> >
> 
> > Hmm, from the previous posts I get the impression that I could best solve 
> > this by asking the user for the specific combination of username, password 
> > and URL + promising not to keep any of that...
> 
> >
> 
> > OK, that does sound doable - thank you all
> 
> 
> 
> 
> 
> I recommend that you write your program to read pages that are not
> 
> protected.  Once you get that working, you can go back and figure out
> 
> how you want to get the username/password from your 'friends' and add
> 
> that in.  Also look up Beautiful Soup (version 4) for a great library
> 
> to parse the pages that you retrieve
> 
> >
> 
> > Bob
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Joel Goldstick

Joel, 

I've spent some time with this but don't really understand my results - some 
help would be appreciated.
I've built a tester that will read my LinkedIn home page, which is password 
protected.
When I use that method for reading other people's pages, the program is 
redirected to the LinkedIn login page.
When I paste the URLs for the other people's pages in any browser, the 
requested pages are shown.

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


Re: parse an environment file

2012-10-01 Thread Chris Angelico
On Tue, Oct 2, 2012 at 12:12 AM, Jason Friedman  wrote:
> Let me restate my question.  I have a file that looks like this:
> export VAR1=foo
> export VAR2=bar
> # Comment
> export VAR3=${VAR1}${VAR2}
>
> I want this:
> my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'}
>
> I can roll my own, but I'm thinking there is a module or existing code
> that does this.  I looked at the os and sys and configparse modules
> but did not see it.

Is there a reason to use that format, rather than using Python
notation? I've at times made config files that simply get imported.
Instead of a dictionary, you'd have a module object:


# config.py
VAR1='foo'
VAR2='bar'
VAR3=VAR1+VAR2

# main file
import config as my_dict

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


Re: parse an environment file

2012-10-01 Thread Chris Angelico
On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman  wrote:
>> Is there a reason to use that format, rather than using Python
>> notation? I've at times made config files that simply get imported.
>> Instead of a dictionary, you'd have a module object:
>>
>>
>> # config.py
>> VAR1='foo'
>> VAR2='bar'
>> VAR3=VAR1+VAR2
>>
> There is a reason:  /path/to/export_file exists for Bash scripts, too,
> and I do not think I could get Bash to read config.py in the format
> stated above.  I want to maintain only one file.

(Responding on-list and hoping it was merely oversight that had that
email come to me personally)

Ah, fair enough. Well, since you're using the full range of bash
functionality, the only viable way to parse it is with bash itself.
I'd recommend going with the version you have above:

> * * * * * . /path/to/export_file && /path/to/script.py

Under what circumstances is this not an option? That'd be the next
thing to consider.

Alternatively, you may want to consider making your own config file
format. If you consciously restrict yourself to a severe subset of
bash functionality, you could easily parse it in Python - for
instance, always look for "export %s=%s" with simple strings for the
variable name and value.

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


RE: Fastest template engine

2012-10-01 Thread Andriy Kornatskyy

1. Added benchmarks for python 3.3
2. Captured total numbers of calls made by corresponding template engine and 
number of unique functions used.

http://mindref.blogspot.com/2012/07/python-fastest-template.html

Comments or suggestions are welcome.

Andriy



> From: andriy.kornats...@live.com
> To: python-list@python.org
> Subject: Fastest template engine
> Date: Sun, 23 Sep 2012 12:24:36 +0300
>
>
> I have run recently a benchmark of a trivial 'big table' example for various 
> python template engines (jinja2, mako, tenjin, tornado and wheezy.template) 
> run on cpython2.7 and pypy1.9.. you might find it interesting:
>
> http://mindref.blogspot.com/2012/07/python-fastest-template.html
>
> Comments or suggestions are welcome.
>
> Thanks.
>
> Andriy Kornatskyy
> --
> http://mail.python.org/mailman/listinfo/python-list
  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parse an environment file

2012-10-01 Thread 88888 Dihedral
On Monday, October 1, 2012 10:42:02 PM UTC+8, Chris Angelico wrote:
> On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman  wrote:
> 
> >> Is there a reason to use that format, rather than using Python
> 
> >> notation? I've at times made config files that simply get imported.
> 
> >> Instead of a dictionary, you'd have a module object:
> 
> >>
> 
> >>
> 
> >> # config.py
> 
> >> VAR1='foo'
> 
> >> VAR2='bar'
> 
> >> VAR3=VAR1+VAR2
> 
> >>
> 
> > There is a reason:  /path/to/export_file exists for Bash scripts, too,
> 
> > and I do not think I could get Bash to read config.py in the format
> 
> > stated above.  I want to maintain only one file.
> 
> 
> 
> (Responding on-list and hoping it was merely oversight that had that
> 
> email come to me personally)
> 
> 
> 
> Ah, fair enough. Well, since you're using the full range of bash
> 
> functionality, the only viable way to parse it is with bash itself.
> 
> I'd recommend going with the version you have above:
> 
> 
> 
> > * * * * * . /path/to/export_file && /path/to/script.py
> 
> 
> 
> Under what circumstances is this not an option? That'd be the next
> 
> thing to consider.
> 
> 
> 
> Alternatively, you may want to consider making your own config file
> 
> format. If you consciously restrict yourself to a severe subset of
> 
> bash functionality, you could easily parse it in Python - for
> 
> instance, always look for "export %s=%s" with simple strings for the
> 
> variable name and value.
> 
> 
> 
> ChrisA

I think one can ues some decorators to wrap OS  or platform 
dependent functions.

I am sure someone did that long time ago as the iron python
wrapped dot-net.
-- 
http://mail.python.org/mailman/listinfo/python-list


where to view range([start], stop[, step])'s C implementation source code ?

2012-10-01 Thread iMath
where to view range([start], stop[, step])'s C implementation source code ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parse an environment file

2012-10-01 Thread Hans Mulder
On 1/10/12 16:12:50, Jason Friedman wrote:
>> I want my python 3.2.2 script, called via cron, to know what those
>> additional variables are.  How?
> 
> Thank you for the feedback.  A crontab line of
> 
> * * * * * . /path/to/export_file && /path/to/script.py
> 
> does indeed work, but for various reasons this approach will not
> always be available to me.
> 
> Let me restate my question.  I have a file that looks like this:
> export VAR1=foo
> export VAR2=bar
> # Comment
> export VAR3=${VAR1}${VAR2}
> 
> I want this:
> my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'}
> 
> I can roll my own, but I'm thinking there is a module or existing code
> that does this.  I looked at the os and sys and configparse modules
> but did not see it.

One tactic is to write a wrapper script in shellese that sets the
variables and then runs your script.  Something like:

#/bin/bash
export VAR1=foo
export VAR2=bar
# Comment
export VAR3=${VAR1}${VAR2}

# Read some more settings from a file
. /path/to/file/with/more/exports

# Drum roll .
/path/to/your/script.py


This allows you to copy-and-paste all sorts of weird and wonderful
shell syntax into your wrapper script.

AFAIK, there is no Python module that can read shell syntax.
You could translate all that shell syntax manually to Python,
but that may not be worth the effort.

Hope this helps,

-- HansM

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


Re: where to view range([start], stop[, step])'s C implementation source code ?

2012-10-01 Thread Ian Kelly
On Mon, Oct 1, 2012 at 9:28 AM, iMath  wrote:
> where to view range([start], stop[, step])'s C implementation source code ?

http://hg.python.org/cpython/file/3f739f42be51/Objects/rangeobject.c
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread Alister
On Sun, 30 Sep 2012 15:14:17 -0400, Edward Diener wrote:

> Has there been any official software that allows both the Python 2.x and
> 3.x releases to coexist on the same OS so that the end-user can easily
> switch between them when invoking Python scripts after each has been
> installed to their own directories/folders ?
> 
> I know of some unoffical solutions, but they require lots of tweaks.
> Given the vagaries of the different OSs on which Python can run I am
> hoping for some offical solution which will work on any of the most
> popular OSs ( Windows, Linux, Mac ).
> 
> The situation is so confusing on Windows, where the file associations,
> registry entries, and other internal software which allows a given
> Python release to work properly when invoking Python is so complicated,
> that I have given up on trying to install more than one Python release
> and finding a relaible, foolproof way of switching between them. So
> although I would like to use the latest 3.x series on Windows I have
> decide to stick with the latest 2.x series instead because much software
> using Python does not support 3.x yet.

on my fedora system it was a simple matter of:-
#> yum install python3

to use python 3 i specify it in my shebang line

#!/usr/bun/env python3

Simple

Not sure about Windoze though (Although from memory the install asks 
where to install so should not be a major issue)



-- 
Immortality consists largely of boredom.
-- Zefrem Cochrane, "Metamorphosis", stardate 3219.8
-- 
http://mail.python.org/mailman/listinfo/python-list


get google scholar using python

2012-10-01 Thread রুদ্র ব্যাণার্জী
If I am trying to access a google scholar search result using python, I
get the following error(403):
$ python
Python 2.7.3 (default, Jul 24 2012, 10:05:38) 
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from HTMLParser import HTMLParser
>>> import urllib2
response = urllib2.urlopen('http://scholar.google.co.uk/scholar?q=albert
+einstein%2B1905&btnG=&hl=en&as_sdt=0%2C5&as_sdtp=')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
  File "/usr/lib64/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python2.7/urllib2.py", line 444, in error
return self._call_chain(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 527, in
http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
>>> 

Will you kindly explain me the way to get rid of this?

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


RE: get google scholar using python

2012-10-01 Thread Nick Cash
> urllib2.urlopen('http://scholar.google.co.uk/scholar?q=albert
>...
> urllib2.HTTPError: HTTP Error 403: Forbidden
> >>>
> 
> Will you kindly explain me the way to get rid of this?

Looks like Google blocks non-browser user agents from retrieving this query. 
You *could* work around it by setting the User-Agent header to something fake 
that looks browser-ish, but you're almost certainly breaking Google's TOS if 
you do so.

Should you really really want to, urllib2 makes it easy:
urllib2.urlopen(urllib2.Request("http://scholar.google.co.uk/scholar?q=albert+einstein%2B1905&btnG=&hl=en&as_sdt=0%2C5&as_sdtp=";,
 headers={"User-Agent":"Mozilla/5.0 Cheater/1.0"}))

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


Re: print or write on a text file ?

2012-10-01 Thread nn
On Sep 28, 2:42 pm, Franck Ditter  wrote:
> Hi !
> Here is Python 3.3
> Is it better in any way to use print(x,x,x,file='out')
> or out.write(x) ? Any reason to prefer any of them ?
> There should be a printlines, like readlines ?
> Thanks,
>
>     franck

There is

out.writelines(lst)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: get google scholar using python

2012-10-01 Thread Grant Edwards
On 2012-10-01, Nick Cash  wrote:
>> urllib2.urlopen('http://scholar.google.co.uk/scholar?q=albert
>>...
>> urllib2.HTTPError: HTTP Error 403: Forbidden
>> 
>> Will you kindly explain me the way to get rid of this?
>
> Looks like Google blocks non-browser user agents from retrieving this
> query. You *could* work around it by setting the User-Agent header to
> something fake that looks browser-ish, but you're almost certainly
> breaking Google's TOS if you do so.

I don't know about that particular Google service, but Google often
provides an API that's intended for use by non-browser programs. 
Those interfaces are usually both easier to use for the programmer and
impose less load on the servers.

-- 
Grant Edwards   grant.b.edwardsYow! I am deeply CONCERNED
  at   and I want something GOOD
  gmail.comfor BREAKFAST!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: get google scholar using python

2012-10-01 Thread রুদ্র ব্যাণার্জী
I know one more python app that do the same thing
http://www.icir.org/christian/downloads/scholar.py

and few other app(Mendeley desktop) for which I found an explanation:
(from
http://academia.stackexchange.com/questions/2567/api-eula-and-scraping-for-google-scholar
 )
that:
"I know how Mendley uses it: they require you to click a button for each
individual search of Google Scholar. If they automatically did the
Google Scholar meta-data search for each paper when you import a
folder-full then they would violate the old Scholar EULA. That is why
they make you click for each query: if each query is accompanied by a
click and not part of some script or loop then it is in compliance with
the old EULA."

So, If I manage to use the User-Agent as shown by you, will I still
violating the google EULA?

This is my first try of scrapping HTML. So please help

On Mon, 2012-10-01 at 16:51 +, Nick Cash wrote:
> > urllib2.urlopen('http://scholar.google.co.uk/scholar?q=albert
> >...
> > urllib2.HTTPError: HTTP Error 403: Forbidden
> > >>>
> > 
> > Will you kindly explain me the way to get rid of this?
> 
> Looks like Google blocks non-browser user agents from retrieving this query. 
> You *could* work around it by setting the User-Agent header to something fake 
> that looks browser-ish, but you're almost certainly breaking Google's TOS if 
> you do so.
> 
> Should you really really want to, urllib2 makes it easy:
> urllib2.urlopen(urllib2.Request("http://scholar.google.co.uk/scholar?q=albert+einstein%2B1905&btnG=&hl=en&as_sdt=0%2C5&as_sdtp=";,
>  headers={"User-Agent":"Mozilla/5.0 Cheater/1.0"}))
> 
> -Nick Cash


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


Re: get google scholar using python

2012-10-01 Thread Jerry Hill
On Mon, Oct 1, 2012 at 1:28 PM, রুদ্র ব্যাণার্জী  wrote:
> So, If I manage to use the User-Agent as shown by you, will I still
> violating the google EULA?

Very likely, yes.  The overall Google Terms of Services
(http://www.google.com/intl/en/policies/terms/) say "Don’t misuse our
Services. For example, don’t interfere with our Services or try to
access them using a method other than the interface and the
instructions that we provide."

The only method that Google appears to allow for accessing Scholar is
via the web interface, and they explicitly block web scraping through
that interface, as you discovered.  It's true that you can get around
their block, but I believe that doing so violates the terms of
service.

Google does not appear to offer an API to access Scholar
programatically, nor do I see a more specific EULA or TOS for the
Scholar service beyond that general TOS document.

That said, I am not a lawyer.  If you want legal advice, you'll need
to pay a lawyer for that advice.

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


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread David Robinow
On Sun, Sep 30, 2012 at 11:55 PM, Dave Angel  wrote:
>> The problem with that is that one has to already being using 3.3 to
>> use this facility. I was hoping for a solution which was backwards
>> compatible with Python 2.x.
>>...
>> That does not solve the problem for Python 2.x distributions.
> If you read the Pep, it says the launcher will work for both 2.x and 3.x
> http://www.python.org/dev/peps/pep-0397/
> 
>
> I've read that elsewhere, but I can't see just where you would get the
> necessary modules to run it with 2.x   Possibly you'd have to build it
> from sources, as there are Windows binaries that get installed to the
> C:\Windows directory.
I'm not sure what you're getting at here. The solution is to install
Python 3.3, which provides the launcher. It works with Python 2.x. Is
there some reason not to install 3.3?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread Mark Lawrence

On 01/10/2012 20:36, David Robinow wrote:

On Sun, Sep 30, 2012 at 11:55 PM, Dave Angel  wrote:

The problem with that is that one has to already being using 3.3 to
use this facility. I was hoping for a solution which was backwards
compatible with Python 2.x.
...
That does not solve the problem for Python 2.x distributions.

If you read the Pep, it says the launcher will work for both 2.x and 3.x
 http://www.python.org/dev/peps/pep-0397/


I've read that elsewhere, but I can't see just where you would get the
necessary modules to run it with 2.x   Possibly you'd have to build it
from sources, as there are Windows binaries that get installed to the
C:\Windows directory.

I'm not sure what you're getting at here. The solution is to install
Python 3.3, which provides the launcher. It works with Python 2.x. Is
there some reason not to install 3.3?



Fo those who missed it earlier you can download the launcher here 
https://bitbucket.org/vinay.sajip/pylauncher/downloads , you don't need 
Python 3.3.


--
Cheers.

Mark Lawrence.

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


Re: Slicing iterables in sub-generators without loosing elements

2012-10-01 Thread Joshua Landau
On 1 October 2012 09:19, Mark Lawrence  wrote:

> On 01/10/2012 01:58, 8 Dihedral wrote:
>
>>
>> Your question seems vague to me. If you know you are storing
>> only immutable tuples in a list, then the way to iterate is simple.
>>
>>
> Does Python have a magic method that let's me use mutable tuples?  I'd
> also like immutable lists.  Is it worth raising a feature request on the
> bug tracker?


Whilst your question is valid, 8 Dihedral is a bot.

[Lazy] Answers to your questions: no and no.

Python's tuples are immutable, except from C. They are made this way so
program with that in mind, I guess.

That said, an immutable list *is* a tuple and vice-versa, effectively.
-- 
http://mail.python.org/mailman/listinfo/python-list