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

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

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 bein

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 loca

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

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.

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

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

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' >

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 --

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 dicti

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

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 o

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 i

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

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://m

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. Yo

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 us

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 ex

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. > I

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 fo

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