From sridhar.ratna at gmail.com Fri Jul 2 01:17:27 2010 From: sridhar.ratna at gmail.com (srid) Date: Thu, 1 Jul 2010 16:17:27 -0700 Subject: [BangPypers] designing programs In-Reply-To: <201006251523.40586.lawgon@au-kbc.org> References: <201006250822.27014.lawgon@au-kbc.org> <201006251251.47445.lawgon@au-kbc.org> <201006251523.40586.lawgon@au-kbc.org> Message-ID: On Fri, Jun 25, 2010 at 2:53 AM, Kenneth Gonsalves wrote: > anyway I suddenly remembered back in 1980s I had a pen and notebook and used > to write large amounts of pseudocode in it - I remember spending a week in a > farm with no electricity and writing enormous amounts of code. So I have > bought a nice notebook and a gel pen. I am too lazy to sharpen a pencil and > also sharpeners are not allowed in hand baggage on planes. So I am good to go. Great - pen & paper is what I use as well. No practical technology that I know of can be as free flowing as pen & paper. It is very flexible; I can draw flow charts, tables, crude class diagrams ... and however else I want to model the information that I need to think over. For UI design, Blasmiq is pretty good even for us programmers. -srid From abpillai at gmail.com Fri Jul 2 06:20:08 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Fri, 2 Jul 2010 09:50:08 +0530 Subject: [BangPypers] Know more about the PSF Message-ID: New blog entry on "getting to know PSF". Gripes can be entered in comments. http://pyfound.blogspot.com/2010/07/what-do-you-want-to-know-about-psf.html Regards, -- --Anand From mbaiju at zeomega.com Fri Jul 2 07:42:06 2010 From: mbaiju at zeomega.com (Baiju M) Date: Fri, 2 Jul 2010 11:12:06 +0530 Subject: [BangPypers] designing programs In-Reply-To: References: <201006250822.27014.lawgon@au-kbc.org> <201006251251.47445.lawgon@au-kbc.org> <201006251523.40586.lawgon@au-kbc.org> Message-ID: CRC Cards might be useful: http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card Regards, Baiju M From gopalakrishnan.subramani at gmail.com Fri Jul 2 10:38:48 2010 From: gopalakrishnan.subramani at gmail.com (Gopalakrishnan Subramani) Date: Fri, 2 Jul 2010 14:08:48 +0530 Subject: [BangPypers] Review of PyCon 2010 Invitation Message-ID: Hi Pypers, I had great Python meet up in June at IIMB and met *Noufal Ibrahim and other python guys.* *Noufal Ibrahim asked us to spread the word.. Here is message I have written for our developers (40+) and I will be sending this to 100s of my other friends and ask them to forward to many others. Can you review the content, tell me if anything I missed out?* or point me where I can get introduction message with personnel touch :-) Dear Team, Indian Python developers community is organizing the Pycon India 2010, a large Python developers meet-up exclusively about Python language by Python developers on Sept 25, Sept 26 (Saturday & Sunday) in Bangalore at MS Ramaiah Institute of Technology, Bangalore. For details visit http://in.pycon.org/2010/. There would be various topics presented to audiences who are from Python beginners to expert developers. The hall would be full of geeks and nerds talking Python. You can get opportunity to meet people with different application domains. If you have experience in Python and interested in presenting paper, you can submit your proposal here http://in.pycon.org/2010/cfp. Call for proposal is open till July 31.. You can see my proposal here http://in.pycon.org/2010/talks/12-Building-High-Performance-websites-using-Python-and-Redis(Awaiting for review!!!). You can find more talks here.. http://in.pycon.org/2010/talks. Python has been used with almost all the operating systems, Java environment, .NET, Embeded and Mobile devices. Whatever technology you are using or mastered, you should know at least one nice scripting language like Python or Ruby to solve your own problems. You can write 10 or 20 lines of code in 5 minutes and it can save you a day or week (that depends on your manual work complexity). Python would be useful for writing small throw away scripts to large enterprise applications. I strongly recommend you to get participate in the Pycon India meeting. Thanks & Regards, Gopalakrishnan From abpillai at gmail.com Fri Jul 2 10:49:00 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Fri, 2 Jul 2010 14:19:00 +0530 Subject: [BangPypers] Review of PyCon 2010 Invitation In-Reply-To: References: Message-ID: Hi Subramani, Thanks for spreading the word. This message is perfect. Btw, your talk URL can be shortened to http://in.pycon.org/2010/talks/12 . Best Regards, Anand On Fri, Jul 2, 2010 at 2:08 PM, Gopalakrishnan Subramani < gopalakrishnan.subramani at gmail.com> wrote: > Hi Pypers, > > I had great Python meet up in June at IIMB and met *Noufal Ibrahim and > other > python guys.* *Noufal Ibrahim asked us to spread the word.. Here is message > I have written for our developers (40+) and I will be sending this to 100s > of my other friends and ask them to forward to many others. Can you review > the content, tell me if anything I missed out?* or point me where I can get > introduction message with personnel touch :-) > > > Dear Team, > > Indian Python developers community is organizing the Pycon India 2010, a > large Python developers meet-up exclusively about Python language by Python > developers on Sept 25, Sept 26 (Saturday & Sunday) in Bangalore at MS > Ramaiah Institute of Technology, Bangalore. For details visit > http://in.pycon.org/2010/. There would be various topics presented to > audiences who are from Python beginners to expert developers. The hall > would > be full of geeks and nerds talking Python. You can get opportunity to meet > people with different application domains. > > If you have experience in Python and interested in presenting paper, you > can > submit your proposal here http://in.pycon.org/2010/cfp. Call for proposal > is > open till July 31.. You can see my proposal here > > http://in.pycon.org/2010/talks/12-Building-High-Performance-websites-using-Python-and-Redis(Awaiting > for review!!!). You can find more talks here.. > http://in.pycon.org/2010/talks. > > Python has been used with almost all the operating systems, Java > environment, .NET, Embeded and Mobile devices. > > Whatever technology you are using or mastered, you should know at least one > nice scripting language like Python or Ruby to solve your own problems. You > can write 10 or 20 lines of code in 5 minutes and it can save you a day or > week (that depends on your manual work complexity). Python would be useful > for writing small throw away scripts to large enterprise applications. I > strongly recommend you to get participate in the Pycon India meeting. > > Thanks & Regards, > > Gopalakrishnan > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From orsenthil at gmail.com Fri Jul 2 10:54:00 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Fri, 2 Jul 2010 14:24:00 +0530 Subject: [BangPypers] Review of PyCon 2010 Invitation In-Reply-To: References: Message-ID: <20100702085400.GA11538@remy> Hi Gopalakrishnan, The email is pretty good. On Fri, Jul 02, 2010 at 02:08:48PM +0530, Gopalakrishnan Subramani wrote: > Whatever technology you are using or mastered, you should know at least one > nice scripting language like Python or Ruby to solve your own problems. You Python is a general purpose programming language. People have some reduced view of any language which is termed as scripting language, which is sad and gives on oblique view of the language. So, use the term 'general purpose programming language' which suits it better. Also, point to www.python.org for more information in the email. -- Senthil The man on tops walks a lonely street; the "chain" of command is often a noose. From noufal at gmail.com Fri Jul 2 11:36:57 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Fri, 02 Jul 2010 15:06:57 +0530 Subject: [BangPypers] Review of PyCon 2010 Invitation In-Reply-To: (Gopalakrishnan Subramani's message of "Fri, 2 Jul 2010 14:08:48 +0530") References: Message-ID: <878w5uusw6.fsf@gmail.com> Gopalakrishnan Subramani writes: > Hi Pypers, > > I had great Python meet up in June at IIMB and met *Noufal Ibrahim and > other python guys.* *Noufal Ibrahim asked us to spread the word.. Here > is message I have written for our developers (40+) and I will be > sending this to 100s of my other friends and ask them to forward to > many others. Can you review the content, tell me if anything I missed > out?* or point me where I can get introduction message with personnel > touch :-) [...] Swell email. Thanks! I think a little note at the bottom mentioning the twitter account etc. would be useful. The site has that but putting it in the email is always nice. Thanks again. -- From flowerslab at gmail.com Fri Jul 2 12:29:44 2010 From: flowerslab at gmail.com (sathish kumar) Date: Fri, 2 Jul 2010 15:59:44 +0530 Subject: [BangPypers] Review of PyCon 2010 Invitation In-Reply-To: References: Message-ID: Hi I am new to python and to bangpyers, and I am just starting out my career with embedded systems and python. Please I may not sure, but wish to add some comments to this mail. In last para changing the first few lines to "Whatever technology you are using or mastered, you will find something in python. And you can save your work of day or week with few lines of python code with five to ten minutes." may sounds good I hope. Thanks Sathishkumar On Fri, Jul 2, 2010 at 2:08 PM, Gopalakrishnan Subramani < gopalakrishnan.subramani at gmail.com> wrote: > Hi Pypers, > > I had great Python meet up in June at IIMB and met *Noufal Ibrahim and > other > python guys.* *Noufal Ibrahim asked us to spread the word.. Here is message > I have written for our developers (40+) and I will be sending this to 100s > of my other friends and ask them to forward to many others. Can you review > the content, tell me if anything I missed out?* or point me where I can get > introduction message with personnel touch :-) > > > Dear Team, > > Indian Python developers community is organizing the Pycon India 2010, a > large Python developers meet-up exclusively about Python language by Python > developers on Sept 25, Sept 26 (Saturday & Sunday) in Bangalore at MS > Ramaiah Institute of Technology, Bangalore. For details visit > http://in.pycon.org/2010/. There would be various topics presented to > audiences who are from Python beginners to expert developers. The hall > would > be full of geeks and nerds talking Python. You can get opportunity to meet > people with different application domains. > > If you have experience in Python and interested in presenting paper, you > can > submit your proposal here http://in.pycon.org/2010/cfp. Call for proposal > is > open till July 31.. You can see my proposal here > > http://in.pycon.org/2010/talks/12-Building-High-Performance-websites-using-Python-and-Redis(Awaiting > for review!!!). You can find more talks here.. > http://in.pycon.org/2010/talks. > > Python has been used with almost all the operating systems, Java > environment, .NET, Embeded and Mobile devices. > > Whatever technology you are using or mastered, you should know at least one > nice scripting language like Python or Ruby to solve your own problems. You > can write 10 or 20 lines of code in 5 minutes and it can save you a day or > week (that depends on your manual work complexity). Python would be useful > for writing small throw away scripts to large enterprise applications. I > strongly recommend you to get participate in the Pycon India meeting. > > Thanks & Regards, > > Gopalakrishnan > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From noufal at gmail.com Sat Jul 3 10:22:40 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Sat, 03 Jul 2010 13:52:40 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker Message-ID: <87eiflj7ov.fsf@gmail.com> Here's something that the community here can look forward to. Please help spread the word as well. Thanks -------------- next part -------------- -- From santrajan at gmail.com Sat Jul 3 10:50:02 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Sat, 3 Jul 2010 14:20:02 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: <87eiflj7ov.fsf@gmail.com> References: <87eiflj7ov.fsf@gmail.com> Message-ID: Hi Everybody, This is my first post here. What a coincidence. I was just reading David Goodgers Code like a pythonista: Idiomatic python According to his website his name is pronounced "like Badger but Good!". So please remember that when introducing him. He will be a great keynote speaker. Also I just released an Open Source frame work for App Engine Python, which you can see here. Eezee MVC . Look forward to participating in this forum fruitfully, and hope to meet all you guys at PyCon India 2010. Thanks -- http://hi.im/santosh From orsenthil at gmail.com Sat Jul 3 11:14:57 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Sat, 3 Jul 2010 14:44:57 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: <87eiflj7ov.fsf@gmail.com> References: <87eiflj7ov.fsf@gmail.com> Message-ID: On Sat, Jul 3, 2010 at 1:52 PM, Noufal Ibrahim wrote: > > Here's something that the community here can look forward to. Please That's a very good news. He will bring in a lot of interesting things to share. -- Senthil From srinivas_thatiparthy at akebonosoft.com Sat Jul 3 10:25:48 2010 From: srinivas_thatiparthy at akebonosoft.com (Srinivas Reddy Thatiparthy) Date: Sat, 3 Jul 2010 13:55:48 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker References: <87eiflj7ov.fsf@gmail.com> Message-ID: <4EF2BF691B890546B2694C99A2852F0C01D83428@astserver3.akebonosoft.com> Wow!! gr8.. Regards, Srini T. From noufal at gmail.com Sat Jul 3 11:18:37 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Sat, 03 Jul 2010 14:48:37 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: (Senthil Kumaran's message of "Sat, 3 Jul 2010 14:44:57 +0530") References: <87eiflj7ov.fsf@gmail.com> Message-ID: <87zky8rkia.fsf@gmail.com> Senthil Kumaran writes: > On Sat, Jul 3, 2010 at 1:52 PM, Noufal Ibrahim wrote: >> >> Here's something that the community here can look forward to. Please > > That's a very good news. He will bring in a lot of interesting things > to share. Yeah. Please let people know and spread the word. Thanks -- From noufal at gmail.com Sat Jul 3 11:15:37 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Sat, 03 Jul 2010 14:45:37 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: (Santosh Rajan's message of "Sat, 3 Jul 2010 14:20:02 +0530") References: <87eiflj7ov.fsf@gmail.com> Message-ID: <87630xrkna.fsf@gmail.com> Santosh Rajan writes: [...] > Also I just released an Open Source frame work for App Engine Python, which > you can see here. Eezee MVC . [...] Hi Santosh, You should submit a talk proposal (http://in.pycon.org/2010/talks/submit ) on your framework. It sounds interesting. Thanks. -- From orsenthil at gmail.com Sat Jul 3 11:50:19 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Sat, 3 Jul 2010 15:20:19 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: <87zky8rkia.fsf@gmail.com> References: <87eiflj7ov.fsf@gmail.com> <87zky8rkia.fsf@gmail.com> Message-ID: <20100703095019.GA3733@remy> On Sat, Jul 03, 2010 at 02:48:37PM +0530, Noufal Ibrahim wrote: > Yeah. Please let people know and spread the word. Sure, I shall definitely. Thanks to you Noufal for having the idea and following with David. And yeah, in general, we shall spread the word about in.pycon.org -- Senthil It's gonna be alright, It's almost midnight, And I've got two more bottles of wine. From santrajan at gmail.com Sat Jul 3 12:02:13 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Sat, 3 Jul 2010 15:32:13 +0530 Subject: [BangPypers] [OT] David Goodger is our keynote speaker In-Reply-To: <87630xrkna.fsf@gmail.com> References: <87eiflj7ov.fsf@gmail.com> <87630xrkna.fsf@gmail.com> Message-ID: Hi Noufal, Thanks. I most probably will. I just need to figure out what I am going to speak for half an hour (the minimum time requirement). :-) On Sat, Jul 3, 2010 at 2:45 PM, Noufal Ibrahim wrote: > Santosh Rajan writes: > > > [...] > > > Also I just released an Open Source frame work for App Engine Python, > which > > you can see here. Eezee MVC . > > [...] > > Hi Santosh, > You should submit a talk proposal > (http://in.pycon.org/2010/talks/submit ) on your framework. It sounds > interesting. > > Thanks. > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From manusajith at gmail.com Sun Jul 4 13:19:55 2010 From: manusajith at gmail.com (Manu Ajith) Date: Sun, 4 Jul 2010 16:49:55 +0530 Subject: [BangPypers] BangPypers Digest, Vol 34, Issue 52 In-Reply-To: References: Message-ID: hi everyone myself Manu S Ajith I am new to this user group. I recently attended K-mug's DEVCON. I think you all should post a link in that too. regards MANU S AJITH On 6/27/10, bangpypers-request at python.org wrote: > Send BangPypers mailing list submissions to > bangpypers at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to > bangpypers-request at python.org > > You can reach the person managing the list at > bangpypers-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > > 1. Re: Indian Python Software Society (Sandip Bhattacharya) > 2. Twitter account for BAngPypers (Noufal Ibrahim) > 3. Volunteers to spread the word (Anand Balachandran Pillai) > 4. Re: Volunteers to spread the word (Dark Seid) > 5. Re: Volunteers to spread the word (Dark Seid) > 6. Re: Volunteers to spread the word (Noufal Ibrahim) > 7. Re: Volunteers to spread the word (Anand Balachandran Pillai) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 27 Jun 2010 12:51:15 +0530 > From: Sandip Bhattacharya > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] Indian Python Software Society > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > On Fri, Jun 18, 2010 at 5:53 AM, Kenneth Gonsalves > wrote: >> further information about the society may be obtained here: >> http://wiki.python.org/moin/CategoryIndianPythonSoftwareSociety >> >> anyone interested is welcome to join the mailing list > > Didn't want to nitpick, but wouldn't it be polite to put all the IPSS > related pages as subpages of say "IPSS" in the python.org wiki? Right > now the generic sounding pages are all "main pages". > > - Sandip > > > ------------------------------ > > Message: 2 > Date: Sun, 27 Jun 2010 13:35:28 +0530 > From: Noufal Ibrahim > To: Bangalore Python Users Group - India > Subject: [BangPypers] Twitter account for BAngPypers > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > I can't believe myself. I used to slam twitter and now I use it too much. > > Anyway. The PSF has a list for various user groups around the world. > It's over here http://twitter.com/ThePSF/user-groups > If we create a twitter account for ours and post things like "user > group meeting" etc., it would be nice. Anyone upto it? > > -- > ~noufal > http://nibrahim.net.in > > > ------------------------------ > > Message: 3 > Date: Sun, 27 Jun 2010 13:48:57 +0530 > From: Anand Balachandran Pillai > To: Mailing list for the PyCon India conference > Cc: Bangalore Python Users Group - India > Subject: [BangPypers] Volunteers to spread the word > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > Hi, > > It is nearly two week since we posted the CFP > and we have had only 3-4 responses. So clearly the word > of the event is not getting out to the outside world and > we need to do more. > > One of the things we can do is to search google/yahoo > groups for programming language communities and > post regarding the event there. > > This needs some time since one has to find out > relevant, active community mailing lists in Y! and Google > and post a message there. > > We need around 1-2 SPAM volunteers for this. Let > me know if anyone would like to help out. > > Thanks, > > -- > --Anand > > > ------------------------------ > > Message: 4 > Date: Sun, 27 Jun 2010 14:20:23 +0530 > From: Dark Seid > To: Bangalore Python Users Group - India > Cc: Mailing list for the PyCon India conference > Subject: Re: [BangPypers] Volunteers to spread the word > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > If you'd like me to, I can cross post the call to a few Ruby lists. With > regards to other Python lists, I did do some digging and the only lists I > found were the ones already listed at > http://wiki.python.org/moin/LocalUserGroups#India > > Cheers, > Sidu. > http://blog.sidu.in > http://c42.in > > On Sun, Jun 27, 2010 at 1:48 PM, Anand Balachandran Pillai < > abpillai at gmail.com> wrote: > >> Hi, >> >> It is nearly two week since we posted the CFP >> and we have had only 3-4 responses. So clearly the word >> of the event is not getting out to the outside world and >> we need to do more. >> >> One of the things we can do is to search google/yahoo >> groups for programming language communities and >> post regarding the event there. >> >> This needs some time since one has to find out >> relevant, active community mailing lists in Y! and Google >> and post a message there. >> >> We need around 1-2 SPAM volunteers for this. Let >> me know if anyone would like to help out. >> >> Thanks, >> >> -- >> --Anand >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > > ------------------------------ > > Message: 5 > Date: Sun, 27 Jun 2010 14:20:23 +0530 > From: Dark Seid > To: Bangalore Python Users Group - India > Cc: Mailing list for the PyCon India conference > Subject: Re: [BangPypers] Volunteers to spread the word > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > If you'd like me to, I can cross post the call to a few Ruby lists. With > regards to other Python lists, I did do some digging and the only lists I > found were the ones already listed at > http://wiki.python.org/moin/LocalUserGroups#India > > Cheers, > Sidu. > http://blog.sidu.in > http://c42.in > > On Sun, Jun 27, 2010 at 1:48 PM, Anand Balachandran Pillai < > abpillai at gmail.com> wrote: > >> Hi, >> >> It is nearly two week since we posted the CFP >> and we have had only 3-4 responses. So clearly the word >> of the event is not getting out to the outside world and >> we need to do more. >> >> One of the things we can do is to search google/yahoo >> groups for programming language communities and >> post regarding the event there. >> >> This needs some time since one has to find out >> relevant, active community mailing lists in Y! and Google >> and post a message there. >> >> We need around 1-2 SPAM volunteers for this. Let >> me know if anyone would like to help out. >> >> Thanks, >> >> -- >> --Anand >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > > ------------------------------ > > Message: 6 > Date: Sun, 27 Jun 2010 14:24:43 +0530 > From: Noufal Ibrahim > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] Volunteers to spread the word > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > On Sun, Jun 27, 2010 at 2:20 PM, Dark Seid wrote: >> If you'd like me to, I can cross post the call to a few Ruby lists. With >> regards to other Python lists, > > Please do. > > > -- > ~noufal > http://nibrahim.net.in > > > ------------------------------ > > Message: 7 > Date: Sun, 27 Jun 2010 15:19:38 +0530 > From: Anand Balachandran Pillai > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] Volunteers to spread the word > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > On Sun, Jun 27, 2010 at 2:24 PM, Noufal Ibrahim wrote: > >> On Sun, Jun 27, 2010 at 2:20 PM, Dark Seid wrote: >> > If you'd like me to, I can cross post the call to a few Ruby lists. With >> > regards to other Python lists,ted >> >> Please do. >> > > When you do please make sure the CFP link is posted > separately. > > http://in.pycon.org/2010/cfp > > Anyone else ? > > > >> >> -- >> ~noufal >> http://nibrahim.net.in >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > > > -- > --Anand > > > ------------------------------ > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > > End of BangPypers Digest, Vol 34, Issue 52 > ****************************************** > From noufal at gmail.com Sun Jul 4 16:33:19 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Sun, 4 Jul 2010 20:03:19 +0530 Subject: [BangPypers] Publicity Message-ID: On Sun, Jul 4, 2010 at 4:49 PM, Manu Ajith wrote: > hi everyone > myself Manu S Ajith > I am new to this user group. > I recently attended ?K-mug's DEVCON. I think you all should post a > link in that too. > Hi Manu, That's a good suggestion. I'm not familiar with K-mug or the DEVCON. Do you know some of the people involved there? If so, please pass on the word about PyCon to them and ask them to spread the word. Thanks again! -- ~noufal http://nibrahim.net.in From gopalakrishnan.subramani at gmail.com Mon Jul 5 14:09:54 2010 From: gopalakrishnan.subramani at gmail.com (Gopalakrishnan Subramani) Date: Mon, 5 Jul 2010 17:39:54 +0530 Subject: [BangPypers] Entry fees for Pycon 2010 Message-ID: Hello, Do you guys have any rough figure for Pycon 2010 entry fee per attendee for corporate members? It may be too early, but we can plan out if our team fund can be provided by the company. Regards, Gopalakrishnan, http://stacked.in From anandology at gmail.com Mon Jul 5 14:14:30 2010 From: anandology at gmail.com (Anand Chitipothu) Date: Mon, 5 Jul 2010 17:44:30 +0530 Subject: [BangPypers] Entry fees for Pycon 2010 In-Reply-To: References: Message-ID: 2010/7/5 Gopalakrishnan Subramani : > Hello, > > Do you guys have any rough figure for Pycon 2010 entry fee per attendee for > corporate members? It may be too early, but we can plan out if our team fund > can be provided by the company. Early bird registration: Rs. 250/- (July 6 - August 31). Regular registration: Rs. 350/- (Sept 1 - Sept 20) On spot registration: Rs.500/- Payments can be made online. Anand From orsenthil at gmail.com Mon Jul 5 14:41:05 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Mon, 5 Jul 2010 18:11:05 +0530 Subject: [BangPypers] Entry fees for Pycon 2010 In-Reply-To: References: Message-ID: <20100705124105.GB31330@remy> On Mon, Jul 05, 2010 at 05:44:30PM +0530, Anand Chitipothu wrote: > > Do you guys have any rough figure for Pycon 2010 entry fee per attendee for > > corporate members? It may be too early, but we can plan out if our team fund > > can be provided by the company. > > Early bird registration: Rs. 250/- (July 6 - August 31). > Regular registration: Rs. 350/- (Sept 1 - Sept 20) > On spot registration: Rs.500/- > > Payments can be made online. This is called Early Bird Registration Fees *Announcement*. :) The information is not there in the site yet and yeah delegate registration has not opened up yet. -- Senthil From noufal at gmail.com Mon Jul 5 18:25:58 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Mon, 05 Jul 2010 21:55:58 +0530 Subject: [BangPypers] Entry fees for Pycon 2010 In-Reply-To: <20100705124105.GB31330@remy> (Senthil Kumaran's message of "Mon, 5 Jul 2010 18:11:05 +0530") References: <20100705124105.GB31330@remy> Message-ID: <87zky5zyi1.fsf@gmail.com> Senthil Kumaran writes: > On Mon, Jul 05, 2010 at 05:44:30PM +0530, Anand Chitipothu wrote: >> > Do you guys have any rough figure for Pycon 2010 entry fee per attendee for >> > corporate members? It may be too early, but we can plan out if our team fund >> > can be provided by the company. >> >> Early bird registration: Rs. 250/- (July 6 - August 31). >> Regular registration: Rs. 350/- (Sept 1 - Sept 20) >> On spot registration: Rs.500/- >> >> Payments can be made online. > > This is called Early Bird Registration Fees *Announcement*. :) > The information is not there in the site yet and yeah delegate > registration has not opened up yet. Also, we don't have a "corporate fee". There's just one fee (which Anand has mentioned above). -- From orsenthil at gmail.com Tue Jul 6 06:14:05 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Tue, 6 Jul 2010 09:44:05 +0530 Subject: [BangPypers] FW: [Python-Dev] [RELEASE] Python 2.7 released In-Reply-To: References: Message-ID: <20100706041405.GA8695@remy> On Sun, Jul 04, 2010 at 10:34:57AM -0500, Benjamin Peterson wrote: > > On behalf of the Python development team, I'm jocund to announce the second > release candidate of Python 2.7. > > Python 2.7 will be the last major version in the 2.x series. However, it will > also have an extended period of bugfix maintenance. > > 2.7 includes many features that were first released in Python 3.1. The faster io > module, the new nested with statement syntax, improved float repr, set literals, > dictionary views, and the memoryview object have been backported from 3.1. Other > features include an ordered dictionary implementation, unittests improvements, a > new sysconfig module, auto-numbering of fields in the str/unicode format method, > and support for ttk Tile in Tkinter. For a more extensive list of changes in > 2.7, see http://doc.python.org/dev/whatsnew/2.7.html or Misc/NEWS in the Python > distribution. > > To download Python 2.7 visit: > > http://www.python.org/download/releases/2.7/ > > 2.7 documentation can be found at: > > http://docs.python.org/2.7/ > > This is a production release and should be suitable for all libraries and > applications. Please report any bugs you find, so they can be fixed in the next > maintenance releases. The bug tracker is at: > > http://bugs.python.org/ > > > Enjoy! > > -- > Benjamin Peterson > Release Manager > benjamin at python.org > (on behalf of the entire python-dev team and 2.7's contributors) > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/orsenthil%40gmail.com -- Senthil Algo s? ? imposs?vel at? que algu?m duvida e acaba provando o contr?rio. -- Albert Einstein From jeffjosejeff at gmail.com Tue Jul 6 09:20:56 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Tue, 6 Jul 2010 12:50:56 +0530 Subject: [BangPypers] FW: [Python-Dev] [RELEASE] Python 2.7 released In-Reply-To: <20100706041405.GA8695@remy> References: <20100706041405.GA8695@remy> Message-ID: Follow up reading. Python 2.7 released (and what that means) - http://sayspy.blogspot.com/2010/07/python-27-released-and-what-that-means.html /jeff On Tue, Jul 6, 2010 at 9:44 AM, Senthil Kumaran wrote: > On Sun, Jul 04, 2010 at 10:34:57AM -0500, Benjamin Peterson wrote: > > > > On behalf of the Python development team, I'm jocund to announce the > second > > release candidate of Python 2.7. > > > > Python 2.7 will be the last major version in the 2.x series. However, it > will > > also have an extended period of bugfix maintenance. > > > > 2.7 includes many features that were first released in Python 3.1. The > faster io > > module, the new nested with statement syntax, improved float repr, set > literals, > > dictionary views, and the memoryview object have been backported from > 3.1. Other > > features include an ordered dictionary implementation, unittests > improvements, a > > new sysconfig module, auto-numbering of fields in the str/unicode format > method, > > and support for ttk Tile in Tkinter. For a more extensive list of > changes in > > 2.7, see http://doc.python.org/dev/whatsnew/2.7.html or Misc/NEWS in the > Python > > distribution. > > > > To download Python 2.7 visit: > > > > http://www.python.org/download/releases/2.7/ > > > > 2.7 documentation can be found at: > > > > http://docs.python.org/2.7/ > > > > This is a production release and should be suitable for all libraries and > > applications. Please report any bugs you find, so they can be fixed in > the next > > maintenance releases. The bug tracker is at: > > > > http://bugs.python.org/ > > > > > > Enjoy! > > > > -- > > Benjamin Peterson > > Release Manager > > benjamin at python.org > > (on behalf of the entire python-dev team and 2.7's contributors) > > _______________________________________________ > > Python-Dev mailing list > > Python-Dev at python.org > > http://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/orsenthil%40gmail.com > > -- > Senthil > > Algo s? ? imposs?vel at? que algu?m duvida e acaba provando o > contr?rio. > -- Albert Einstein > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > From noufal at gmail.com Wed Jul 7 07:45:26 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 07 Jul 2010 11:15:26 +0530 Subject: [BangPypers] Fwd: T-shirt/Logo designs Message-ID: <87k4p7rgjt.fsf@gmail.com> Sorry to spam the list like this so often but this is something relevant to the Python community at large. -------------- next part -------------- -- From lgp171188 at gmail.com Wed Jul 7 08:29:33 2010 From: lgp171188 at gmail.com (Guruprasad) Date: Wed, 7 Jul 2010 11:59:33 +0530 Subject: [BangPypers] Fwd: T-shirt/Logo designs In-Reply-To: <87k4p7rgjt.fsf@gmail.com> References: <87k4p7rgjt.fsf@gmail.com> Message-ID: Hi, On Wed, Jul 7, 2010 at 11:15 AM, Noufal Ibrahim wrote: > > Sorry to spam the list like this so often but this is something relevant > to the Python community at large. I think the attachments to this email were discarded by mailman. Could you post them somewhere and share the link? Thanks and Regards, Guruprasad From noufal at gmail.com Wed Jul 7 08:30:05 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 7 Jul 2010 12:00:05 +0530 Subject: [BangPypers] Fwd: [Inpycon] T-shirt/Logo designs In-Reply-To: <878w5psvbu.fsf@gmail.com> References: <878w5psvbu.fsf@gmail.com> Message-ID: Sorry about the repeated email. The last one got mangled somehow. ---------- Forwarded message ---------- From: Noufal Ibrahim Date: Mon, Jul 5, 2010 at 10:46 PM Subject: [Inpycon] T-shirt/Logo designs To: Mailing list for the PyCon India conference Hello everyone, ? ? ? ?We need a T-shirt. ? ? ? ?This is going to be the one thing (apart from word of mouth) that will give us publicity *after* the conference. Therefore, it has to reappy kick butt. Also, the designer will get to see her designs wandering around the country for a whole year which is definitely good publicity. ? ? ? ?A logo and a snappy T-shirt design are two things we need to come up with. Needless to say, it would be highly preferred if someone from the community itself came up with a design. If not, we'll have to pay a professional artist to do it. That's a last resort and I'd rather not blow cash on it. We had some nice submissions for the Badges and need some nice ones for the T-shirt. ? ? ? ?A lot of people mailed me with cool badge ideas *after* we decided on the badges. I'm announcing this now so that people have time to work on something cool and exhibit it. ? ? ? ?The page to upload your contributions is http://wiki.python.org/moin/PyConIndia2010/Artwork (I've made sections for the T-shirt and logo). ? ? ? ?So, get the creative juices flowing and let's see what we can come up with! If you have artist friends looking for free advertising, let them know as well Thanks -- _______________________________________________ Inpycon mailing list Inpycon at python.org http://mail.python.org/mailman/listinfo/inpycon -- ~noufal http://nibrahim.net.in From santrajan at gmail.com Wed Jul 7 08:46:57 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Wed, 7 Jul 2010 12:16:57 +0530 Subject: [BangPypers] Fwd: [Inpycon] T-shirt/Logo designs In-Reply-To: References: <878w5psvbu.fsf@gmail.com> Message-ID: Why don't you contact these guys. http://www.inkfruit.com/ I am suggesting them because I read an article about them in rediff recently. http://getahead.rediff.com/slide-show/2010/may/28/slide-show-1-achievers-interview-with-founders-of-inkfruit.htm Why don't someone contact the founders and ask them if they can help. On Wed, Jul 7, 2010 at 12:00 PM, Noufal Ibrahim wrote: > Sorry about the repeated email. The last one got mangled somehow. > > > ---------- Forwarded message ---------- > From: Noufal Ibrahim > Date: Mon, Jul 5, 2010 at 10:46 PM > Subject: [Inpycon] T-shirt/Logo designs > To: Mailing list for the PyCon India conference > > > > Hello everyone, > We need a T-shirt. > > This is going to be the one thing (apart from word of mouth) > that will give us publicity *after* the conference. Therefore, it has to > reappy kick butt. Also, the designer will get to see her designs > wandering around the country for a whole year which is definitely good > publicity. > > A logo and a snappy T-shirt design are two things we need to come > up with. Needless to say, it would be highly preferred if someone from > the community itself came up with a design. If not, we'll have to pay a > professional artist to do it. That's a last resort and I'd rather not > blow cash on it. We had some nice submissions for the Badges and need > some nice ones for the T-shirt. > > A lot of people mailed me with cool badge ideas *after* we > decided on the badges. I'm announcing this now so that people have time > to work on something cool and exhibit it. > > The page to upload your contributions is > http://wiki.python.org/moin/PyConIndia2010/Artwork (I've made sections > for the T-shirt and logo). > > So, get the creative juices flowing and let's see what we can > come up with! If you have artist friends looking for free advertising, > let them know as well > > Thanks > > -- > _______________________________________________ > Inpycon mailing list > Inpycon at python.org > http://mail.python.org/mailman/listinfo/inpycon > > > > -- > ~noufal > http://nibrahim.net.in > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From noufal at gmail.com Wed Jul 7 12:26:32 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 07 Jul 2010 15:56:32 +0530 Subject: [BangPypers] Fwd: [Inpycon] T-shirt/Logo designs In-Reply-To: (Santosh Rajan's message of "Wed, 7 Jul 2010 12:16:57 +0530") References: <878w5psvbu.fsf@gmail.com> Message-ID: <87fwzvoaef.fsf@gmail.com> Santosh Rajan writes: > Why don't you contact these guys. > http://www.inkfruit.com/ > > I am suggesting them because I read an article > about them in rediff recently. > http://getahead.rediff.com/slide-show/2010/may/28/slide-show-1-achievers-interview-with-founders-of-inkfruit.htm > > Why > don't someone contact the founders and ask them if they can help. [...] I have a couple of people I can contact. I'd much prefer that the community itself came up with designs (similar to what we did for the logo last year). -- From santrajan at gmail.com Wed Jul 7 12:53:23 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Wed, 7 Jul 2010 16:23:23 +0530 Subject: [BangPypers] Fwd: [Inpycon] T-shirt/Logo designs In-Reply-To: <87fwzvoaef.fsf@gmail.com> References: <878w5psvbu.fsf@gmail.com> <87fwzvoaef.fsf@gmail.com> Message-ID: Hi Noufal, I entirely agree with you, nothing like the community coming up with the design. On Wed, Jul 7, 2010 at 3:56 PM, Noufal Ibrahim wrote: > Santosh Rajan writes: > > > Why don't you contact these guys. > > http://www.inkfruit.com/ > > > > I am suggesting them because I read an article > > about them in rediff recently. > > > http://getahead.rediff.com/slide-show/2010/may/28/slide-show-1-achievers-interview-with-founders-of-inkfruit.htm > > > > < > http://getahead.rediff.com/slide-show/2010/may/28/slide-show-1-achievers-interview-with-founders-of-inkfruit.htm > >Why > > don't someone contact the founders and ask them if they can help. > > [...] > > I have a couple of people I can contact. I'd much prefer that the > community itself came up with designs (similar to what we did for the > logo last year). > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From noufal at gmail.com Wed Jul 7 15:03:30 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 07 Jul 2010 18:33:30 +0530 Subject: [BangPypers] Fwd: Registrations open Message-ID: <87vd8r5tr1.fsf@gmail.com> PyCon India registrations are open. Please spread the word and let your friends know. -------------- next part -------------- -- From noufal at gmail.com Wed Jul 7 15:05:59 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 07 Jul 2010 18:35:59 +0530 Subject: [BangPypers] Fwd: [Inpycon] Registrations open In-Reply-To: <87pqyzpynm.fsf@gmail.com> (Noufal Ibrahim's message of "Wed, 07 Jul 2010 12:27:17 +0530") References: <87pqyzpynm.fsf@gmail.com> Message-ID: <87pqyz5tmw.fsf@gmail.com> Sorry again. My mail client forwards emails as attachments and that gets scrubbed by mailman apparently. Noufal Ibrahim writes: > The registrations for the conference are offically open as per what we > discussed on email. The link to the blog post with the details is here > http://in.pycon.org/2010/blog/6-Registrations-are-open! > > Please spread the word. Someone please forward this information to > BangPypers, ChennaiPy, Mumpy, Kerala group and any other groups that > you're one. > > Thanks. -- From rahul8590 at gmail.com Wed Jul 7 20:42:34 2010 From: rahul8590 at gmail.com (Rahul R) Date: Thu, 8 Jul 2010 00:12:34 +0530 Subject: [BangPypers] python program to fetch input data in complete bit format Message-ID: i was wondering if there is a way to fetch the raw data of any file i input for example if i accept a text file or a video file (particualr large video files ). i could fetch the the equivalent bits and store it in another file ----------------------------------------------------------- Rahul R Under Grad Student Computer Science Sir MVIT Bangalore Email : rahul8590 at gmail.com Site : www.rahulr.110mb.com Blog : www.rahulr.blog.co.uk ------------------------------------------------------- Google Talk: rahul8590 at gmail.com [image: Linkedin] [image: MySpace][image: Twitter] From noufal at gmail.com Wed Jul 7 21:54:22 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 08 Jul 2010 01:24:22 +0530 Subject: [BangPypers] python program to fetch input data in complete bit format In-Reply-To: (Rahul R.'s message of "Thu, 8 Jul 2010 00:12:34 +0530") References: Message-ID: <87hbkbm5jl.fsf@gmail.com> Rahul R writes: > i was wondering if there is a way to fetch the raw data of any file i > input for example if i accept a text file or a video file (particualr > large video files ). i could fetch the the equivalent bits and store > it in another file [...] I'm not sure what you want to do. What do you mean by the following terms - fetch (as in "fetch the raw data") - raw data - accept (as in "accept a text file") - equivalent (as in "equivalent bits") - store (as in "store it in another file") IF you're looking to make copies, it's simple enough. Just read from one (source) and write into the other (destination). -- From rahul8590 at gmail.com Wed Jul 7 22:29:54 2010 From: rahul8590 at gmail.com (Rahul R) Date: Thu, 8 Jul 2010 01:59:54 +0530 Subject: [BangPypers] python program to fetch input data in complete bit format In-Reply-To: <87hbkbm5jl.fsf@gmail.com> References: <87hbkbm5jl.fsf@gmail.com> Message-ID: On Thu, Jul 8, 2010 at 1:24 AM, Noufal Ibrahim wrote: > Rahul R writes: > > > i was wondering if there is a way to fetch the raw data of any file i > > input for example if i accept a text file or a video file (particualr > > large video files ). i could fetch the the equivalent bits and store > > it in another file > > [...] > > I'm not sure what you want to do. What do you mean by the following > terms > - fetch (as in "fetch the raw data") > - raw data > - accept (as in "accept a text file") > - equivalent (as in "equivalent bits") > - store (as in "store it in another file") > > IF you're looking to make copies, it's simple enough. Just read from one > (source) and write into the other (destination). > > > yep similar to that .. but i want the complete text or video file in bit level and if possible store it in a list. Well i never tried storing such huge amount of data to be stored in a list From gopalakrishnan.subramani at gmail.com Wed Jul 7 22:35:04 2010 From: gopalakrishnan.subramani at gmail.com (Gopalakrishnan Subramani) Date: Thu, 8 Jul 2010 02:05:04 +0530 Subject: [BangPypers] python program to fetch input data in complete bit format In-Reply-To: <87hbkbm5jl.fsf@gmail.com> References: <87hbkbm5jl.fsf@gmail.com> Message-ID: If I remember, Python 3.0 gas byte as a data type where you can play with bytes. Otherwise you can open file with read and binary mode rf = open("README.txt", "rb") bytes = f.read(n) # n bytes or simply read() but it returns string wf = open("README.txt", "wb") wf.write(bytes) #technically string OR have a look at http://docs.python.org/library/shutil.html which has many copy utilities which you need..very simple.. -- Krish, http://stacked.in On Thu, Jul 8, 2010 at 1:24 AM, Noufal Ibrahim wrote: > Rahul R writes: > > > i was wondering if there is a way to fetch the raw data of any file i > > input for example if i accept a text file or a video file (particualr > > large video files ). i could fetch the the equivalent bits and store > > it in another file > > [...] > > I'm not sure what you want to do. What do you mean by the following > terms > - fetch (as in "fetch the raw data") > - raw data > - accept (as in "accept a text file") > - equivalent (as in "equivalent bits") > - store (as in "store it in another file") > > IF you're looking to make copies, it's simple enough. Just read from one > (source) and write into the other (destination). > > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From abpillai at gmail.com Thu Jul 8 11:12:58 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 8 Jul 2010 14:42:58 +0530 Subject: [BangPypers] Help needed on reviewing my presentation for pycon. In-Reply-To: References: Message-ID: Hi Shiv, On Sat, Jun 26, 2010 at 8:12 PM, Shiv Shankar wrote: > Guys, > > The below mentioned is an overview of the contents included in the > presentation I would like to present in this years pycon. Could you guys > please look through it and let me know if you will get benefited from such > a > presentation. Also your suggestions and thoughts on it. > > Topic: *A peek into Staged Event Driven Architecture - Reasons to use > Twisted.* > > - Introduction. > - The need for concurrency in networking system, ways to achieve it ? > thread based concurrency and event based concurrency. > - A simple DNS server written in Python. > - *Explaining a simple name resolution server written in python, which > lets you specify specify arbitrary regexs to match hosts.* > - Concurrency of the above DNS server, the thread based approach > explained and sneak peak into python's GIL. > - Problems with Threads, a graph explaining max server throughput vs > threads executing in server explaining where it fails. > - Over load management and the c10k problem statement. > - Event based concurrency. > - A quick slide on non blocking i/o its importance. > - Writing a simple DNS server in Python using twisted. > - Explaining various stages, how is it different from a thread based > system. > - Benchmarks. > - Does it solve the c10k problem ? > - Questions. > Did you submit this ? If not please do - I am looking forward to this talk. > > > -- shiv > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > Thanks, -- --Anand From abpillai at gmail.com Fri Jul 9 18:00:39 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Fri, 9 Jul 2010 21:30:39 +0530 Subject: [BangPypers] PSF sponsoring Python sprints Message-ID: Hi all, If you want to take part in an Python sprint "officially", this is the opportunity since PSF has opened up a program for it. http://pythonsprints.com/2010/07/8/call-applications-now-open/ The discussions have been going on the PSF mailing list for a while and it has been officially opened now. Jesse Noller (of multiprocessing fame) is the co-ordinator of this program. -- --Anand From santrajan at gmail.com Sat Jul 10 04:01:25 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Sat, 10 Jul 2010 07:31:25 +0530 Subject: [BangPypers] PSF sponsoring Python sprints In-Reply-To: References: Message-ID: Great. maybe we can hold a sprint along with PyCon 2010? One day before or after? On Fri, Jul 9, 2010 at 9:30 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > Hi all, > > If you want to take part in an Python sprint "officially", > this is the opportunity since PSF has opened up a program > for it. > > http://pythonsprints.com/2010/07/8/call-applications-now-open/ > > The discussions have been going on the PSF mailing list for > a while and it has been officially opened now. Jesse Noller > (of multiprocessing fame) is the co-ordinator of this program. > > -- > --Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From lawgon at au-kbc.org Sat Jul 10 06:48:51 2010 From: lawgon at au-kbc.org (Kenneth Gonsalves) Date: Sat, 10 Jul 2010 10:18:51 +0530 Subject: [BangPypers] python 2.6 vs 2.5 Message-ID: <201007101018.51165.lawgon@au-kbc.org> hi I have a function that runs ok in a fedora 12 machine but crashes in a lenny machine. It is an ajax function (I did not write it) so no traceback. The only difference between the two machines is that fedora has python 2.6 whereas lenny has 2.5 - so can anyone tell me if there is anything python 2.6 specific about the code below: def allaccounts(request): filter_params = request.GET.get("head") or None filter_qs = Account.objects.filter(head=filter_params).values_list("id", "name") edit_url = lambda x: reverse("editaccount", kwargs={"id": x["id"]}) eval_filter_qs = map(lambda x: dict(zip(("id", "text"), x)), list(filter_qs)) map(lambda x: x.update({"attrs": {"href": edit_url(x), "remote": True, "id": unicode(x["id"]), }}), eval_filter_qs) serialized_output = json.dumps(eval_filter_qs) return HttpResponse(serialized_output, mimetype="application/json") -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC From orsenthil at gmail.com Sat Jul 10 06:58:14 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Sat, 10 Jul 2010 10:28:14 +0530 Subject: [BangPypers] python 2.6 vs 2.5 In-Reply-To: <201007101018.51165.lawgon@au-kbc.org> References: <201007101018.51165.lawgon@au-kbc.org> Message-ID: On Sat, Jul 10, 2010 at 10:18 AM, Kenneth Gonsalves wrote: > ? ? ? ?serialized_output = json.dumps(eval_filter_qs) http://docs.python.org/library/json.html Could it be this? -- Senthil From lawgon at au-kbc.org Sat Jul 10 07:38:19 2010 From: lawgon at au-kbc.org (Kenneth Gonsalves) Date: Sat, 10 Jul 2010 11:08:19 +0530 Subject: [BangPypers] python 2.6 vs 2.5 In-Reply-To: References: <201007101018.51165.lawgon@au-kbc.org> Message-ID: <201007101108.19979.lawgon@au-kbc.org> On Saturday 10 July 2010 10:28:14 Senthil Kumaran wrote: > On Sat, Jul 10, 2010 at 10:18 AM, Kenneth Gonsalves wrote: > > serialized_output = json.dumps(eval_filter_qs) > > http://docs.python.org/library/json.html > > Could it be this? > looks like it - same thing appeared in IRC, now all I need is to find the 2.5 equivalent of it -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC From lawgon at au-kbc.org Sat Jul 10 07:53:38 2010 From: lawgon at au-kbc.org (Kenneth Gonsalves) Date: Sat, 10 Jul 2010 11:23:38 +0530 Subject: [BangPypers] python 2.6 vs 2.5 In-Reply-To: <201007101108.19979.lawgon@au-kbc.org> References: <201007101018.51165.lawgon@au-kbc.org> <201007101108.19979.lawgon@au-kbc.org> Message-ID: <201007101123.38903.lawgon@au-kbc.org> On Saturday 10 July 2010 11:08:19 Kenneth Gonsalves wrote: > On Saturday 10 July 2010 10:28:14 Senthil Kumaran wrote: > > On Sat, Jul 10, 2010 at 10:18 AM, Kenneth Gonsalves > > wrote: > > > serialized_output = json.dumps(eval_filter_qs) > > > > > > http://docs.python.org/library/json.html > > > > Could it be this? > > > > looks like it - same thing appeared in IRC, now all I need is to find the > 2.5 equivalent of it > django has a built in django.utils.simplejson - using that I solved the problem -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC From vnbang2003 at yahoo.com Mon Jul 12 11:41:38 2010 From: vnbang2003 at yahoo.com (vijay) Date: Mon, 12 Jul 2010 15:11:38 +0530 (IST) Subject: [BangPypers] [JOB] Looking for a Python/Django developer Message-ID: <514614.45789.qm@web95309.mail.in2.yahoo.com> Hi, ??? We are looking for experienced python developers who will help?? spearhead the development of a next generation Purchase Order and Vendor Management system.? Required technical skills are: Python, DJango, PYMF, Postgres or Mysql, Object Oriented design skills, experience working with large OLTP systems. Experience:? Should have between 3-6 years Location:?????? Bangalore Company :??? Keystone Logic Pvt Limited (www.keystonelogic.net) If interested share your resume with me. Regards, Vijay From delegbede at dudupay.com Mon Jul 12 14:46:27 2010 From: delegbede at dudupay.com (Dipo Elegbede) Date: Mon, 12 Jul 2010 13:46:27 +0100 Subject: [BangPypers] [JOB] Looking for a Python/Django developer In-Reply-To: <514614.45789.qm@web95309.mail.in2.yahoo.com> References: <514614.45789.qm@web95309.mail.in2.yahoo.com> Message-ID: Would you consider a Nigerian Resident/ With the qualification stated? Thanks. On Mon, Jul 12, 2010 at 10:41 AM, vijay wrote: > Hi, > > We are looking for experienced python developers who will help > spearhead the development of a next generation Purchase Order and Vendor > Management system. Required technical skills are: > > > > Python, DJango, PYMF, Postgres or Mysql, Object Oriented design skills, > experience working with large OLTP systems. > > > > Experience: Should have between 3-6 years > > Location: Bangalore > > Company : Keystone Logic Pvt Limited (www.keystonelogic.net) > > > > > > If interested share your resume with me. > > > > Regards, > > Vijay > > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development From lawgon at au-kbc.org Tue Jul 13 09:22:10 2010 From: lawgon at au-kbc.org (Kenneth Gonsalves) Date: Tue, 13 Jul 2010 12:52:10 +0530 Subject: [BangPypers] [JOB] Looking for a Python/Django developer In-Reply-To: <514614.45789.qm@web95309.mail.in2.yahoo.com> References: <514614.45789.qm@web95309.mail.in2.yahoo.com> Message-ID: <201007131252.10178.lawgon@au-kbc.org> On Monday 12 July 2010 15:11:38 vijay wrote: > spearhead the development of a next generation Purchase Order and Vendor > Management system. > just curious - what is this generation Purchase Order and Vendor management system and how does it differ from the next generation? -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC From kpguy at rediffmail.com Tue Jul 13 16:30:41 2010 From: kpguy at rediffmail.com (Vikram ) Date: 13 Jul 2010 14:30:41 -0000 Subject: [BangPypers] =?utf-8?q?nested_list_question?= Message-ID: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Suppose you have two nested lists, X and Y. A sample element of X is: ['NM_032291', '67000041', '67000051', 'chr1', '+'] Another sample element of X is: ['NM_001097', '51183080', '51183635', 'chr22', '+'] A sample element of Y is: ['chr1', '67000046'] Another sample element of Y is: ['chrY', '59033300'] The objective is to identify whether the second element of an element of Y (e.g. 67000046) lies between the the second and third elements of an element of X (e.g. 67000041 and 67000051). Eventually, one should end up with a modified version of Y, let us say modY, which is a filtered version of Y in which the second element of an element of modY is contained within the second and third elements of an element of X. Any suggestions on how i should be going about implementing this? Thanking you, Vikram From caulagi at gmail.com Tue Jul 13 17:40:54 2010 From: caulagi at gmail.com (Pradip P Caulagi) Date: Tue, 13 Jul 2010 21:10:54 +0530 Subject: [BangPypers] nested list question In-Reply-To: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Message-ID: <20100713154054.GA2591@pcaulagi> On Tue, Jul 13, 2010 at 02:30:41PM -0000, Vikram wrote: > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '67000041', '67000051', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: > ['chr1', '67000046'] > > Another sample element of Y is: > ['chrY', '59033300'] > > The objective is to identify whether the second element of an element > of Y (e.g. 67000046) lies between the the second and third elements of > an element of X (e.g. 67000041 and 67000051). > > Eventually, one should end up with a modified version of Y, let us say > modY, which is a filtered version of Y in which the second element of > an element of modY is contained within the second and third elements > of an element of X. > > Any suggestions on how i should be going about implementing this? > What have you tried? From nitin.nitp at gmail.com Wed Jul 14 04:58:00 2010 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Wed, 14 Jul 2010 08:28:00 +0530 Subject: [BangPypers] nested list question In-Reply-To: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Message-ID: I think you can very well use map function map (function, list1, list2) where in function you can create your desired list. What map will do is it will call function for each element from list1 and list2 (same indexed) and will do the stuff defined in the function. Do let me know if i am close to what you want. On Tue, Jul 13, 2010 at 8:00 PM, Vikram wrote: > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '67000041', '67000051', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: > ['chr1', '67000046'] > > Another sample element of Y is: > ['chrY', '59033300'] > > The objective is to identify whether the second element of an element of Y > (e.g. 67000046) lies between the the second and third elements of an element > of X (e.g. 67000041 and 67000051). > > Eventually, one should end up with a modified version of Y, let us say > modY, which is a filtered version of Y in which the second element of an > element of modY is contained within the second and third elements of an > element of X. > > Any suggestions on how i should be going about implementing this? > > Thanking you, > Vikram > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Nitin K From anand.shashwat at gmail.com Wed Jul 14 05:31:00 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Wed, 14 Jul 2010 09:01:00 +0530 Subject: [BangPypers] nested list question In-Reply-To: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Message-ID: On Tue, Jul 13, 2010 at 8:00 PM, Vikram wrote: > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '67000041', '67000051', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: > ['chr1', '67000046'] > > Another sample element of Y is: > ['chrY', '59033300'] > > The objective is to identify whether the second element of an element of Y > (e.g. 67000046) lies between the the second and third elements of an element > of X (e.g. 67000041 and 67000051). > > Eventually, one should end up with a modified version of Y, let us say > modY, which is a filtered version of Y in which the second element of an > element of modY is contained within the second and third elements of an > element of X. > > Any suggestions on how i should be going about implementing this? > >>> modY = [y for y in Y for x in X if x[1] < y[1] < x[2]] > > Thanking you, > Vikram > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From anand.shashwat at gmail.com Wed Jul 14 05:42:23 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Wed, 14 Jul 2010 09:12:23 +0530 Subject: [BangPypers] nested list question In-Reply-To: References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Message-ID: On Wed, Jul 14, 2010 at 9:01 AM, Shashwat Anand wrote: > > > On Tue, Jul 13, 2010 at 8:00 PM, Vikram wrote: > >> Suppose you have two nested lists, X and Y. >> A sample element of X is: >> ['NM_032291', '67000041', '67000051', 'chr1', '+'] >> >> Another sample element of X is: >> ['NM_001097', '51183080', '51183635', 'chr22', '+'] >> >> >> A sample element of Y is: >> ['chr1', '67000046'] >> >> Another sample element of Y is: >> ['chrY', '59033300'] >> >> The objective is to identify whether the second element of an element of Y >> (e.g. 67000046) lies between the the second and third elements of an element >> of X (e.g. 67000041 and 67000051). >> >> Eventually, one should end up with a modified version of Y, let us say >> modY, which is a filtered version of Y in which the second element of an >> element of modY is contained within the second and third elements of an >> element of X. >> >> Any suggestions on how i should be going about implementing this? >> > > >>> modY = [y for y in Y for x in X if x[1] < y[1] < x[2]] > Also make sure you remove duplicates. > > >> >> Thanking you, >> Vikram >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > From srinivas_thatiparthy at akebonosoft.com Wed Jul 14 06:38:46 2010 From: srinivas_thatiparthy at akebonosoft.com (Srinivas Reddy Thatiparthy) Date: Wed, 14 Jul 2010 10:08:46 +0530 Subject: [BangPypers] nested list question References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> Message-ID: <4EF2BF691B890546B2694C99A2852F0C01D83434@astserver3.akebonosoft.com> >map (function, list1, list2) where in function you can create your desired list. List comprehensions are preferred to map and filter functions.In fact, filter is a syntactic sugar to list comprehension. Regards, Srini T. --When you are playing cricket, you should hit the ball out of the ground OR get bowled.Both are fine ;But what you shouldn't do is defending your wickets. From kpguy at rediffmail.com Wed Jul 14 11:47:21 2010 From: kpguy at rediffmail.com (Vikram ) Date: 14 Jul 2010 09:47:21 -0000 Subject: [BangPypers] =?utf-8?q?nested_list_question?= In-Reply-To: Message-ID: <1279078353.S.9358.10908.F.H.TlNoYXNod2F0IEFuYW5kAFJlOiBbQmFuZ1B5cGVyc10gbmVzdGVkIGxpc3QgcXVlc3Rpb24_.f6-144-156.old.1279100841.53786@webmail.rediffmail.com> > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '67000041', '67000051', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: > ['chr1', '67000046'] > > Another sample element of Y is: > ['chrY', '59033300'] > > The objective is to identify whether the second element of an element of Y > (e.g. 67000046) lies between the the second and third elements of an element > of X (e.g. 67000041 and 67000051). > > Eventually, one should end up with a modified version of Y, let us say > modY, which is a filtered version of Y in which the second element of an > element of modY is contained within the second and third elements of an > element of X. > > Any suggestions on how i should be going about implementing this? > >>> modY = [y for y in Y for x in X if x[1] < y[1] < x[2]] ----> The above got the job done. Thanks to all who responded to my query. From vid at svaksha.com Wed Jul 14 13:39:07 2010 From: vid at svaksha.com (=?UTF-8?B?IOCkuOCljeCkteCkleCljeCktyA=?=) Date: Wed, 14 Jul 2010 17:24:07 +0545 Subject: [BangPypers] How to run *.py scripts which interfaces with modules Message-ID: Hi, I'd like to know how individual python web scripts of a package are run independently? For example: http://bazaar.launchpad.net/~mailman-coders/mailman/2.1/annotate/head:/Mailman/Bouncers/BouncerAPI.py The BouncerAPI.py program when its run, in turn calls another module syslog (Mailman/Logging/Syslog.py). How can I execute the program BouncerAPI.py independently for a unit test and avoid "ImportError: No module named Mailman.Logging.Syslog" errors ? Currently each *.py file links (calls?) other modules in different directories. i'd like to be able to give the PATH externally, else the *.py file throws an error when its run. Its possible to internally modify each file but that is tedious task for more than 2-3 files. So how do i give the PATH externally which will run a *.py file sans the module errors? TIA, -- peace, vid || http://svaksha.com From nkhalasi at vayana.in Wed Jul 14 14:19:36 2010 From: nkhalasi at vayana.in (Naresh Khalasi) Date: Wed, 14 Jul 2010 17:49:36 +0530 Subject: [BangPypers] How to run *.py scripts which interfaces with modules In-Reply-To: References: Message-ID: Hi, The root directory (where your package starts) should be added to PYTHONPATH environment variable. e.g. if your root directory is /home//projects/mailman export PYTHONPATH=$PYTHONPATH:/home//projects/mailman Once you do that you "cd" in the project directory and execute by saying python Mailman/Bouncers/BouncerAPI.py or you can you use "python -m" if you want to run from a working directory which is not your project directory. Also ensure that each package directory contains "__init__.py" file so that python can treat/identify it as a package directory. - Naresh On Wed, Jul 14, 2010 at 5:09 PM, ?????? wrote: > Hi, > > I'd like to know how individual python web scripts of a package are > run independently? > > For example: > http://bazaar.launchpad.net/~mailman-coders/mailman/2.1/annotate/head:/Mailman/Bouncers/BouncerAPI.py > > The BouncerAPI.py program when its run, in turn calls another module > syslog (Mailman/Logging/Syslog.py). How can I execute the program > BouncerAPI.py independently for a unit test and avoid "ImportError: No > module named Mailman.Logging.Syslog" errors ? > > Currently each *.py file links (calls?) other modules in different > directories. i'd like to be able to give the PATH externally, else the > *.py file throws an error when its run. Its possible to internally > modify each file but that is tedious task for more than 2-3 files. So > how do i give the PATH externally which will run a *.py file sans the > module errors? > > TIA, > -- > peace, > vid || http://svaksha.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From jeffjosejeff at gmail.com Wed Jul 14 15:58:15 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Wed, 14 Jul 2010 19:28:15 +0530 Subject: [BangPypers] nested list question In-Reply-To: <4EF2BF691B890546B2694C99A2852F0C01D83434@astserver3.akebonosoft.com> References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> <4EF2BF691B890546B2694C99A2852F0C01D83434@astserver3.akebonosoft.com> Message-ID: > List comprehensions are preferred to map and filter functions.In fact, > filter is a syntactic sugar to list comprehension. > > You're right in saying list comprehensions are preferred to map and filter - not just from a readability standpoint but also from a performance standpoint. (we all hate that .0001 of sec right? - no seriously) However filter is *not* a syntactic sugar of list comprehension. >>> l = [1,2,3,4,5,6,7,8] >>> def foo(a): ... return [x for x in a if x % 2] ... >>> def bar(a): ... return filter(lambda x: x%2, a) ... >>> foo(l) [1, 3, 5, 7] >>> bar(l) [1, 3, 5, 7] >>> dis.dis(foo) 2 0 BUILD_LIST 0 3 DUP_TOP 4 LOAD_ATTR 0 (append) 7 STORE_FAST 1 (_[1]) 10 LOAD_FAST 0 (a) 13 GET_ITER >> 14 FOR_ITER 31 (to 48) 17 STORE_FAST 2 (x) 20 LOAD_FAST 2 (x) 23 LOAD_CONST 1 (2) 26 BINARY_MODULO 27 JUMP_IF_FALSE 14 (to 44) 30 POP_TOP 31 LOAD_FAST 1 (_[1]) 34 LOAD_FAST 2 (x) 37 CALL_FUNCTION 1 40 POP_TOP 41 JUMP_ABSOLUTE 14 >> 44 POP_TOP 45 JUMP_ABSOLUTE 14 >> 48 DELETE_FAST 1 (_[1]) 51 RETURN_VALUE 52 LOAD_CONST 0 (None) 55 RETURN_VALUE >>> dis.dis(bar) 2 0 LOAD_GLOBAL 0 (filter) 3 LOAD_CONST 1 ( at 0x2a955e4d50, file "", line 2>) 6 MAKE_FUNCTION 0 9 LOAD_FAST 0 (a) 12 CALL_FUNCTION 2 15 RETURN_VALUE 16 LOAD_CONST 0 (None) 19 RETURN_VALUE The alleged performance gain of list comprehension comes from the fact that `filter` involve a function call (here= lambda). I'm sure this can be easily proved using python -m timeit Then what is syntatic sugar ? This. >>> def foo(a): ... a += 1 ... return a ... >>> def bar(a): ... a = a+1 ... return a ... >>> foo(10) 11 >>> bar(10) 11 >>> dis.dis(foo) 2 0 LOAD_FAST 0 (a) 3 LOAD_CONST 1 (1) 6 INPLACE_ADD 7 STORE_FAST 0 (a) 3 10 LOAD_FAST 0 (a) 13 RETURN_VALUE 14 LOAD_CONST 0 (None) 17 RETURN_VALUE >>> dis.dis(bar) 2 0 LOAD_FAST 0 (a) 3 LOAD_CONST 1 (1) 6 BINARY_ADD 7 STORE_FAST 0 (a) 3 10 LOAD_FAST 0 (a) 13 RETURN_VALUE 14 LOAD_CONST 0 (None) 17 RETURN_VALUE /jeff From vid at svaksha.com Wed Jul 14 16:13:49 2010 From: vid at svaksha.com (=?UTF-8?B?IOCkuOCljeCkteCkleCljeCktyA=?=) Date: Wed, 14 Jul 2010 19:58:49 +0545 Subject: [BangPypers] How to run *.py scripts which interfaces with modules In-Reply-To: References: Message-ID: On Wed, Jul 14, 2010 at 18:04, Naresh Khalasi wrote: > Hi, > > The root directory (where your package starts) should be added to PYTHONPATH > environment variable. > e.g. if your root directory is /home//projects/mailman > export PYTHONPATH=$PYTHONPATH:/home//projects/mailman > > Once you do that you "cd" in the project directory and execute by saying > python Mailman/Bouncers/BouncerAPI.py Thanks for replying but I am able to execute independent python programs. So that's not what my earlier query was all about. Retrying, with another MM?example: http://bazaar.launchpad.net/~mailman-coders/mailman/2.1/annotate/head:/Mailman/Archiver/Archiver.py, where the Archiver.py?file will import the following program/ ?modules to run. from Mailman import Mailbox from Mailman import Utils from Mailman import Site from Mailman.SafeDict import SafeDict from Mailman.Logging.Syslog import syslog from Mailman.i18n import _ , This results in the "ImportError" (mentioned earlier). Besides?"from Mailman import Mailbox"?in turn?refers to email and its path is: sys.path.append("/home/<$user>/mailman-2.1.10/misc/email-2.58/email/"). So if I set this path inside each of of these *.pyfiles,? using?? --- sys.path.append("/home/<$user>/mailman-2.1.10/Mailman/")? command, etc...? <==? I'm able to test-run it. But without the path setting, the program fails throwing errors. Editing each *.py file to append it with "sys.path" is a tedious process. So I'd like to know, whether there exists?a better method to set the path externally without changing each program file? I'd like to execute these programs independently. Hope that explains my earlier query a bit more. TIA, -- peace, vid || http://svaksha.com From steve at lonetwin.net Thu Jul 15 00:30:14 2010 From: steve at lonetwin.net (steve) Date: Thu, 15 Jul 2010 04:00:14 +0530 Subject: [BangPypers] How to run *.py scripts which interfaces with modules In-Reply-To: References: Message-ID: <4C3E3A76.10104@lonetwin.net> Hi, On 07/14/2010 07:43 PM, ?????? wrote: > On Wed, Jul 14, 2010 at 18:04, Naresh Khalasi wrote: >> Hi, >> >> The root directory (where your package starts) should be added to PYTHONPATH >> environment variable. >> e.g. if your root directory is /home//projects/mailman >> export PYTHONPATH=$PYTHONPATH:/home//projects/mailman >> > [...snip...] > This results in the "ImportError" (mentioned earlier). > > Besides "from Mailman import Mailbox" in turn refers to email and its > path is: sys.path.append("/home/<$user>/mailman-2.1.10/misc/email-2.58/email/"). > > So if I set this path inside each of of these *.pyfiles, using --- > sys.path.append("/home/<$user>/mailman-2.1.10/Mailman/") command, > etc...<== I'm able to test-run it. But without the path setting, > the program fails throwing errors. That is what Naresh was trying to explain. If you want to set the path which the python interpreter would look at 'outside' the python modules, you can set the environment variable PYTHONPATH. eg: instead of doing a sys.path.append('/home/<$user>/...') do a: $ export PYTHONPATH="/home/<$user>/...:/some/other/path:..." ...before executing your python script/application. If you've ever used a Unix based system you'll recognize that the $PYTHONPATH variable is similar to the $PATH variable, in that the interpreter (sh or python) looks at this variable to find the command/script/module to execute/import. There is another way to fix this issue -- the .pth file/site.py. More information about this issue at: http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH http://docs.python.org/library/site.html http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-python-development/ cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From noufal at gmail.com Thu Jul 15 04:58:51 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 15 Jul 2010 08:28:51 +0530 Subject: [BangPypers] How to run *.py scripts which interfaces with modules In-Reply-To: <4C3E3A76.10104@lonetwin.net> (steve@lonetwin.net's message of "Thu, 15 Jul 2010 04:00:14 +0530") References: <4C3E3A76.10104@lonetwin.net> Message-ID: <87tyo1zc0k.fsf@gmail.com> steve writes: [...] > $ export PYTHONPATH="/home/<$user>/...:/some/other/path:..." [...] OR a "/usr/bin/env PYTHONPATH=$PYTHONPATH:~/extra/path python" as your interpreter. I generally don't like doing things that linger. -- From srinivas_thatiparthy at akebonosoft.com Thu Jul 15 06:20:36 2010 From: srinivas_thatiparthy at akebonosoft.com (Srinivas Reddy Thatiparthy) Date: Thu, 15 Jul 2010 09:50:36 +0530 Subject: [BangPypers] nested list question References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com><4EF2BF691B890546B2694C99A2852F0C01D83434@astserver3.akebonosoft.com> Message-ID: <4EF2BF691B890546B2694C99A2852F0C01D8343A@astserver3.akebonosoft.com> I read from Python 2.6.3 docs that,copied from chm.... " Note that filter(function, iterable) is equivalent to [item for item in iterable if function(item)] if function is not None and [item for item in iterable if item] if function is None." Since they said *equivalent* ,i thought both transform to same byte code.I missed the point that they are equal *logically*. Regards, Srini T. -- From rmathews at gmail.com Tue Jul 20 06:26:30 2010 From: rmathews at gmail.com (Roshan Mathews) Date: Tue, 20 Jul 2010 09:56:30 +0530 Subject: [BangPypers] Tip: Creating new classes on the fly Message-ID: I came across this in a blog post just now. See http://docs.python.org/library/functions.html#type >>> class Foo(object): pass ... >>> Bar = type('Bar', (object,), dict()) >>> f = Foo(); b = Bar() >>> type(f), type(b) (, ) Also see http://docs.python.org/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields >>> from collections import namedtuple >>> Baz = namedtuple('Baz', '') Anyone switched to Python 2.7 yet? -- http://roshan.mathews.in/ From rahul8590 at gmail.com Tue Jul 20 18:55:52 2010 From: rahul8590 at gmail.com (Rahul R) Date: Tue, 20 Jul 2010 20:55:52 +0400 Subject: [BangPypers] catching exceptions from SimpleHTTPServer Message-ID: how to catch exceptions from the simpleHTTPServer . ( srry if this sounds ridiculous ) the below is a small code snippet for a basic webserver . every time whenever there is a HTTP GET/POST request i can see the feedback in the terminal . how do i catch those feedbacks ? code snippet: http://codepad.org/eKWUhrnO From mbaiju at zeomega.com Tue Jul 20 19:28:35 2010 From: mbaiju at zeomega.com (Baiju M) Date: Tue, 20 Jul 2010 22:58:35 +0530 Subject: [BangPypers] catching exceptions from SimpleHTTPServer In-Reply-To: References: Message-ID: On Tue, Jul 20, 2010 at 10:25 PM, Rahul R wrote: > how to catch exceptions from the simpleHTTPServer . ?( srry if this sounds > ridiculous ) > the below is a small code snippet for a basic webserver . every time > whenever there is a HTTP GET/POST request i can see the feedback ?in the > terminal . how do i catch those feedbacks ? Those are standard error messages (sys.stderr), you can get it like this: -------------------------------------------- --- browser.py 2010-07-20 22:51:33.000000000 +0530 +++ browser-new.py 2010-07-20 22:55:20.000000000 +0530 @@ -18,4 +18,10 @@ sa = httpd.socket.getsockname() print "Serving HTTP on", sa[0], "port", sa[1], "..." -httpd.serve_forever() +import sys +out = open("browser.log", "w") +sys.stderr = out +try: + httpd.serve_forever() +except: + out.close() -------------------------------------------- I hope you can understand unified diff format: http://en.wikipedia.org/wiki/Diff Regards, Baiju M From rahul8590 at gmail.com Tue Jul 20 20:15:30 2010 From: rahul8590 at gmail.com (Rahul R) Date: Tue, 20 Jul 2010 22:15:30 +0400 Subject: [BangPypers] catching exceptions from SimpleHTTPServer In-Reply-To: References: Message-ID: > > -------------------------------------------- > --- browser.py 2010-07-20 22:51:33.000000000 +0530 > +++ browser-new.py 2010-07-20 22:55:20.000000000 +0530 > @@ -18,4 +18,10 @@ > > sa = httpd.socket.getsockname() > print "Serving HTTP on", sa[0], "port", sa[1], "..." > -httpd.serve_forever() > +import sys > +out = open("browser.log", "w") > +sys.stderr = out > +try: > + httpd.serve_forever() > +except: > + out.close() > -------------------------------------------- > > > negative aint working , i tried a few changes myself . when i referred to the class BaseHTTPServer s methods ( http://bit.ly/aYqnQE ) i found a particular method log_message which is similar to sys.stderr but for some reason it isnt appending ne data into the log file created. the revised code snippet: http://codepad.org/PRPXVUpY --Rahul From steve at lonetwin.net Wed Jul 21 01:52:35 2010 From: steve at lonetwin.net (steve) Date: Wed, 21 Jul 2010 05:22:35 +0530 Subject: [BangPypers] catching exceptions from SimpleHTTPServer In-Reply-To: References: Message-ID: <4C4636C3.4020608@lonetwin.net> On 07/20/2010 11:45 PM, Rahul R wrote: > negative aint working , i tried a few changes myself . when i referred to > the class BaseHTTPServer s methods ( http://bit.ly/aYqnQE ) i found a > particular method log_message which is similar to sys.stderr but for some > reason it isnt appending ne data into the log file created. > Seems to be working for me: http://codepad.org/MppnYU9n I'm taking a wild guess here, you skimmed the docs and saw log_message() but didn't realize it is a method of the BaseHTTPRequestHandler class, *not* the HTTPServer class. Did I get that right ? can't blame you if I did, the docs are arranged in a such a manner that making this mistake is easy :). cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From noufal at gmail.com Wed Jul 21 09:40:31 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 21 Jul 2010 13:10:31 +0530 Subject: [BangPypers] July meetup Message-ID: <87pqyhcmfk.fsf@gmail.com> Hello everyone, We'll need atleast a mini meetup in July atleast to collect registration money from offline registrants. How's this Sunday look? Thanks. -- From rahul8590 at gmail.com Wed Jul 21 09:57:27 2010 From: rahul8590 at gmail.com (Rahul R) Date: Wed, 21 Jul 2010 13:27:27 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87pqyhcmfk.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> Message-ID: On Wed, Jul 21, 2010 at 1:10 PM, Noufal Ibrahim wrote: > > Hello everyone, > We'll need atleast a mini meetup in July atleast to collect > registration money from offline registrants. > > How's this Sunday look? > > Thanks. > i would be delighted to come . this would be my first meet . From santhosh.divakar at gmail.com Wed Jul 21 10:08:20 2010 From: santhosh.divakar at gmail.com (Santhosh Divakar) Date: Wed, 21 Jul 2010 13:38:20 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87pqyhcmfk.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> Message-ID: On Wed, Jul 21, 2010 at 1:10 PM, Noufal Ibrahim wrote: > How's this Sunday look? > > +1 From anandology at gmail.com Wed Jul 21 11:07:34 2010 From: anandology at gmail.com (Anand Chitipothu) Date: Wed, 21 Jul 2010 14:37:34 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87pqyhcmfk.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> Message-ID: 2010/7/21 Noufal Ibrahim : > > Hello everyone, > ? ? ? ?We'll need atleast a mini meetup in July atleast to collect > registration money from offline registrants. > > ? ? ? ?How's this Sunday look? Once finalized, we can send mail to all the offline registrants in Bangalore to inform about the meetup. Anand From noufal at gmail.com Wed Jul 21 11:43:09 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 21 Jul 2010 15:13:09 +0530 Subject: [BangPypers] July meetup In-Reply-To: (Anand Chitipothu's message of "Wed, 21 Jul 2010 14:37:34 +0530") References: <87pqyhcmfk.fsf@gmail.com> Message-ID: <87y6d5maqa.fsf@gmail.com> Anand Chitipothu writes: > 2010/7/21 Noufal Ibrahim : >> >> Hello everyone, >> ? ? ? ?We'll need atleast a mini meetup in July atleast to collect >> registration money from offline registrants. >> >> ? ? ? ?How's this Sunday look? > > Once finalized, we can send mail to all the offline registrants in > Bangalore to inform about the meetup. [...] Yes. Is Sunday fine. Any detractors? Clashes? -- From duakapil at gmail.com Wed Jul 21 11:47:20 2010 From: duakapil at gmail.com (Kapsicum) Date: Wed, 21 Jul 2010 15:17:20 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87y6d5maqa.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> Message-ID: +1 On Wed, Jul 21, 2010 at 3:13 PM, Noufal Ibrahim wrote: > Anand Chitipothu writes: > > > 2010/7/21 Noufal Ibrahim : > >> > >> Hello everyone, > >> We'll need atleast a mini meetup in July atleast to collect > >> registration money from offline registrants. > >> > >> How's this Sunday look? > > > > Once finalized, we can send mail to all the offline registrants in > > Bangalore to inform about the meetup. > > [...] > > Yes. Is Sunday fine. Any detractors? Clashes? > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Kapil Dua Skype: mitr2mitr IRC: kaps Mobile: +919620249032 Don't be irreplaceable, If you can't be replaced, you can't be promoted From sudheer.s at sudheer.net Wed Jul 21 12:05:24 2010 From: sudheer.s at sudheer.net (Sudheer Satyanarayana) Date: Wed, 21 Jul 2010 15:35:24 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87y6d5maqa.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> Message-ID: <4C46C664.70107@sudheer.net> > [...] > > Yes. Is Sunday fine. Any detractors? Clashes? > > This Saturday and Sunday, I'm attending the Yahoo! Open Hack event - http://openhackindia.eventbrite.com/ . It would have been nice if the BangPypers meet was scheduled on another day. -- With warm regards, Sudheer. S Personal home page - http://sudheer.net | Tech Chorus - http://techchorus.net Web and IT services - http://binaryvibes.co.in From abpillai at gmail.com Thu Jul 22 10:46:54 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 22 Jul 2010 14:16:54 +0530 Subject: [BangPypers] July meetup In-Reply-To: <4C46C664.70107@sudheer.net> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> Message-ID: On Wed, Jul 21, 2010 at 3:35 PM, Sudheer Satyanarayana < sudheer.s at sudheer.net> wrote: > > [...] >> >> Yes. Is Sunday fine. Any detractors? Clashes? >> >> >> > This Saturday and Sunday, I'm attending the Yahoo! Open Hack event - > http://openhackindia.eventbrite.com/ . > > > It would have been nice if the BangPypers meet was scheduled on another > day. > Can we have it on 30th or 31st then ? Personally I prefer next week-end since I am a bit busy this week-end. Noufal ? > > > -- > With warm regards, > Sudheer. S > Personal home page - http://sudheer.net | Tech Chorus - > http://techchorus.net > Web and IT services - http://binaryvibes.co.in > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From noufal at gmail.com Thu Jul 22 10:51:16 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 22 Jul 2010 14:21:16 +0530 Subject: [BangPypers] July meetup In-Reply-To: (Anand Balachandran Pillai's message of "Thu, 22 Jul 2010 14:16:54 +0530") References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> Message-ID: <87wrsndhmj.fsf@gmail.com> Anand Balachandran Pillai writes: [...] > Can we have it on 30th or 31st then ? Personally I prefer > next week-end since I am a bit busy this week-end. > > Noufal ? [...] 31st is fine by me. Anyone else? -- From mujeesh at gmail.com Thu Jul 22 11:27:09 2010 From: mujeesh at gmail.com (mujeesh.v.s) Date: Thu, 22 Jul 2010 14:57:09 +0530 Subject: [BangPypers] Meeting Message-ID: Hi, Where you guys are going to meet.Can I join in this meeting Mujeesh.v.s From mbaiju at zeomega.com Thu Jul 22 11:35:48 2010 From: mbaiju at zeomega.com (Baiju M) Date: Thu, 22 Jul 2010 15:05:48 +0530 Subject: [BangPypers] Meeting In-Reply-To: References: Message-ID: On Thu, Jul 22, 2010 at 2:57 PM, mujeesh.v.s wrote: > Hi, > > ?Where you guys are going to meet.Can I join in this meeting Everyone is welcome to BangPypers meeting. This month's meeting date is not finalized yet. Regards, Baiju M From kpguy at rediffmail.com Thu Jul 22 11:51:38 2010 From: kpguy at rediffmail.com (Vikram ) Date: 22 Jul 2010 09:51:38 -0000 Subject: [BangPypers] =?utf-8?q?list_problem?= Message-ID: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Suppose you have the following list: >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] My problem is that i wish to obtain the following two dictionaries: xdictstart = {'cat':10, 'dog':1} xdictend = {'cat':30, 'dog':5} Any nice way to do the above? Thanks. ------- Those interested in the above problem may consider the following code (which does not actually do what i want): >>> xdictend = dict(x) >>> xdictend {'dog': 3, 'cat': 30} >>> x [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] >>> xdictstart = {} >>> map(xdictstart.setdefault, *zip(*x)) [10, 10, 10, 5, 5, 5] >>> xdictstart {'dog': 5, 'cat': 10} From navin.kabra at gmail.com Thu Jul 22 12:10:53 2010 From: navin.kabra at gmail.com (Navin Kabra) Date: Thu, 22 Jul 2010 15:40:53 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: I suggest that in such cases, avoid the temptation to do something clever. If it was difficult for you to write the code, it will be even more difficult to read and understand it. Unless there is a very good reason, write the simplest, most braindead code. xdictstart={} xdictend={} for item in sorted(x): xdictend[item[0]] = item[1] if not item[0] in xdictstart xdictstart[item[0]] = item[1] On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. > > ------- > Those interested in the above problem may consider the following code (which does not actually do what i want): > >>>> xdictend = dict(x) >>>> xdictend > {'dog': 3, 'cat': 30} > >>>> x > [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] >>>> xdictstart = {} >>>> map(xdictstart.setdefault, *zip(*x)) > [10, 10, 10, 5, 5, 5] >>>> xdictstart > {'dog': 5, 'cat': 10} > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From lawgon at au-kbc.org Thu Jul 22 12:23:33 2010 From: lawgon at au-kbc.org (Kenneth Gonsalves) Date: Thu, 22 Jul 2010 15:53:33 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: <201007221553.33942.lawgon@au-kbc.org> On Thursday, July 22, 2010 03:21:38 pm Vikram wrote: > Suppose you have the following list: > >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} I do not understand the question -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC From steve at lonetwin.net Thu Jul 22 12:42:04 2010 From: steve at lonetwin.net (steve) Date: Thu, 22 Jul 2010 16:12:04 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: <4C48207C.3040505@lonetwin.net> On 07/22/2010 03:21 PM, Vikram wrote: > Suppose you have the following list: > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > I don't get it, what's the criteria for creating xdictstart and xdictend ? Is start the lowest value of element 1 for each element 0 and xdictend the highest ? If it is: >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> d = {} >>> for k, v in x: ... d.setdefault(k, []).append(v) ... >>> d {'dog': [5, 1, 3], 'cat': [10, 20, 30]} >>> xstartdict = {} >>> xenddict = {} >>> for k, v in d.items(): ... xstartdict[k] = min(v) ... xenddict[k] = max(v) ... >>> xstartdict, xenddict ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >>> cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From emilchacko at gmail.com Thu Jul 22 12:49:31 2010 From: emilchacko at gmail.com (Emil Chacko) Date: Thu, 22 Jul 2010 16:19:31 +0530 Subject: [BangPypers] list problem Message-ID: >>> for subLi in x: ... if(xdictstart.has_key(subLi[0])): ... if(xdictstart[subLi[0]]>subLi[1]): ... xdictstart[subLi[0]]=subLi[1] ... else: ... xdictstart[subLi[0]]=subLi[1] The opposite can be done to obtain the xdictend.This is one way.There might be some easier way's but i'm not aware it. From b.ghose at gmail.com Thu Jul 22 13:28:16 2010 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Thu, 22 Jul 2010 16:58:16 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: > Suppose you have the following list: > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. Don't know if this is nice, but I might want to solve this problem in Python like this - ### from collections import defaultdict items = [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] item_values = defaultdict(list) # this makes the values of this dict lists by default starts = {} ends = {} for k, v in items: item_values[k].append(v) for k in item_values: starts[k] = min(item_values[k]) ends[k] = max(item_values[k]) print starts, ends ### Feedback appreciated. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com From abpillai at gmail.com Thu Jul 22 13:32:38 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 22 Jul 2010 17:02:38 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > > >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > Any nice way to do the above? Thanks. > > Yes. Try this. >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> x.sort() >>> xdictstart = dict(reversed(x)) >>> xdictend = dict(x) >>> xdictstart,xdictend ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) -- Anand From abpillai at gmail.com Thu Jul 22 13:41:56 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 22 Jul 2010 17:11:56 +0530 Subject: [BangPypers] nested list question In-Reply-To: <4EF2BF691B890546B2694C99A2852F0C01D8343A@astserver3.akebonosoft.com> References: <1279028670.S.2168.46372.webmail.rediff.com.drafts.old.1279031441.16292@webmail.rediffmail.com> <4EF2BF691B890546B2694C99A2852F0C01D83434@astserver3.akebonosoft.com> <4EF2BF691B890546B2694C99A2852F0C01D8343A@astserver3.akebonosoft.com> Message-ID: On Thu, Jul 15, 2010 at 9:50 AM, Srinivas Reddy Thatiparthy < srinivas_thatiparthy at akebonosoft.com> wrote: > I read from Python 2.6.3 docs that,copied from chm.... > > " Note that filter(function, iterable) is equivalent to [item for item in > iterable if function(item)] if function is not None and [item for item in > iterable if item] if function is None." > > Since they said *equivalent* ,i thought both transform to same byte code.I > missed the point that they are equal *logically*. > Never - "filter", "map" etc are implemented as functions so each call involve a function call in Python which is costly. List comprehensions are implemented in the language and hence much more optimized. So if you are aiming to extract maximum juice from your Python code, prefer native language constructs like comprehensions as opposed to "outsiders" like map, filter etc. If required, always prefer the itertools version of these functions such as itertools.imap etc. > > > > Regards, > Srini T. > -- > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > -- --Anand From santhosh.divakar at gmail.com Thu Jul 22 13:49:24 2010 From: santhosh.divakar at gmail.com (Santhosh Divakar) Date: Thu, 22 Jul 2010 17:19:24 +0530 Subject: [BangPypers] [JOB Opening] Juniper Networks Message-ID: *Tools Development Engineer* *Job Location: Bangalore* * * *Job Description:* As a member of the Engineering Software Tools group at Juniper you will be part of a global team with primary responsibility for the tools infrastructure of the JUNOS software development environment. You will design, develop and maintain internal development support tools, including build and deployment tools, system monitoring, and customizations and add-ons to development support tools. This position provides the opportunity to solve a wide variety of different problems, using different tools and integrating with different tools and environments. You will need to work closely with different technology teams to determine requirements and develop effective designs. *Must Have Skills:* ? 3 to 7 years experience in software development. ? Extensive experience any of the following languages (Perl, Python, C/C++) ? Extensive experience with UNIX-Internals & SHELL scripting. ? Experience with SQL databases. (Knowledge of the DB Basics / Ability to form and to understand complex SQL Queries) ? Experience across the complete application development lifecycle including design, prototyping, testing, implementation and deployment. ? Excellent communication skills (both writing and verbal). ? Extremely team oriented, collaborative and flexible. From santhosh.divakar at gmail.com Thu Jul 22 13:49:24 2010 From: santhosh.divakar at gmail.com (Santhosh Divakar) Date: Thu, 22 Jul 2010 17:19:24 +0530 Subject: [BangPypers] [JOB Opening] Juniper Networks Message-ID: *Tools Development Engineer* *Job Location: Bangalore* * * *Job Description:* As a member of the Engineering Software Tools group at Juniper you will be part of a global team with primary responsibility for the tools infrastructure of the JUNOS software development environment. You will design, develop and maintain internal development support tools, including build and deployment tools, system monitoring, and customizations and add-ons to development support tools. This position provides the opportunity to solve a wide variety of different problems, using different tools and integrating with different tools and environments. You will need to work closely with different technology teams to determine requirements and develop effective designs. *Must Have Skills:* ? 3 to 7 years experience in software development. ? Extensive experience any of the following languages (Perl, Python, C/C++) ? Extensive experience with UNIX-Internals & SHELL scripting. ? Experience with SQL databases. (Knowledge of the DB Basics / Ability to form and to understand complex SQL Queries) ? Experience across the complete application development lifecycle including design, prototyping, testing, implementation and deployment. ? Excellent communication skills (both writing and verbal). ? Extremely team oriented, collaborative and flexible. From ideamonk at gmail.com Thu Jul 22 15:15:50 2010 From: ideamonk at gmail.com (Abhishek Mishra) Date: Thu, 22 Jul 2010 18:45:50 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87wrsndhmj.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> Message-ID: Hackday this weekend, end of july sounds good. On Thu, Jul 22, 2010 at 2:21 PM, Noufal Ibrahim wrote: > Anand Balachandran Pillai writes: > > [...] > >> Can we have it on 30th or 31st then ? ?Personally I prefer >> next week-end since I am a bit busy this week-end. >> >> Noufal ? > > [...] > > 31st is fine by me. Anyone else? > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From steve at lonetwin.net Thu Jul 22 15:30:43 2010 From: steve at lonetwin.net (steve) Date: Thu, 22 Jul 2010 19:00:43 +0530 Subject: [BangPypers] list problem In-Reply-To: References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: <4C484803.6030805@lonetwin.net> Hi, On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: > On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > >> Suppose you have the following list: >> >> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >> >> My problem is that i wish to obtain the following two dictionaries: >> xdictstart = {'cat':10, 'dog':1} >> xdictend = {'cat':30, 'dog':5} > > >> Any nice way to do the above? Thanks. >> >> > Yes. Try this. > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>> x.sort() >>>> xdictstart = dict(reversed(x)) >>>> xdictend = dict(x) >>>> xdictstart,xdictend > ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) Are you sure that'll work ? Is creating a dict from a sequence guaranteed to be executed serially withing the sequence ? cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From kpguy at rediffmail.com Thu Jul 22 15:39:13 2010 From: kpguy at rediffmail.com (Vikram ) Date: 22 Jul 2010 13:39:13 -0000 Subject: [BangPypers] =?utf-8?q?list_problem?= In-Reply-To: Message-ID: <1279794254.S.9697.14894.F.H.Tk5hdmluIEthYnJhAFJlOiBbQmFuZ1B5cGVyc10gbGlzdCBwcm9ibGVt.f6-145-157.old.1279805953.4177@webmail.rediffmail.com> many thanks for this to naveen and others who responded. On Thu, 22 Jul 2010 15:54:14 +0530 wrote >I suggest that in such cases, avoid the temptation to do something clever. If it was difficult for you to write the code, it will be even more difficult to read and understand it. Unless there is a very good reason, write the simplest, most braindead code. xdictstart={} xdictend={} for item in sorted(x): xdictend[item[0]] = item[1] if not item[0] in xdictstart xdictstart[item[0]] = item[1] On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. > > ------- > Those interested in the above problem may consider the following code (which does not actually do what i want): > >>>> xdictend = dict(x) >>>> xdictend > {'dog': 3, 'cat': 30} > >>>> x > [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] >>>> xdictstart = {} >>>> map(xdictstart.setdefault, *zip(*x)) > [10, 10, 10, 5, 5, 5] >>>> xdictstart > {'dog': 5, 'cat': 10} > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers From anand.shashwat at gmail.com Thu Jul 22 16:00:54 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Thu, 22 Jul 2010 19:30:54 +0530 Subject: [BangPypers] list problem In-Reply-To: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> Message-ID: On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > > >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. > How about this : >>> x [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] Remove duplicates for key pair of dictionary. >>> keys = list(set(i[0] for i in x)) >>> keys ['dog', 'cat'] Now for every unique keys make a list containing all the items for that key. >>> [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys] [[['dog', 1], ['dog', 3], ['dog', 5]], [['cat', 10], ['cat', 20], ['cat', 30]]] You can now easily create dictionary. >>> xdictstart = dict(i[0] for i in [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys]) >>> xdictstart {'dog': 1, 'cat': 10} >>> xdictend = dict(i[-1] for i in [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys]) >>> xdictend {'dog': 5, 'cat': 30} The benefit is you can make a complete dictionary if you want, not only start and end values. > ------- > Those interested in the above problem may consider the following code > (which does not actually do what i want): > > >>> xdictend = dict(x) > >>> xdictend > {'dog': 3, 'cat': 30} > > >>> x > [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] > >>> xdictstart = {} > >>> map(xdictstart.setdefault, *zip(*x)) > [10, 10, 10, 5, 5, 5] > >>> xdictstart > {'dog': 5, 'cat': 10} > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf From anand.shashwat at gmail.com Thu Jul 22 16:01:54 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Thu, 22 Jul 2010 19:31:54 +0530 Subject: [BangPypers] list problem In-Reply-To: <4C484803.6030805@lonetwin.net> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> Message-ID: On Thu, Jul 22, 2010 at 7:00 PM, steve wrote: > Hi, > > > On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: > >> On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: >> >> Suppose you have the following list: >>> >>> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> >>> My problem is that i wish to obtain the following two dictionaries: >>> xdictstart = {'cat':10, 'dog':1} >>> xdictend = {'cat':30, 'dog':5} >>> >> >> >> Any nice way to do the above? Thanks. >>> >>> >>> Yes. Try this. >> >> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>>> x.sort() >>>>> xdictstart = dict(reversed(x)) >>>>> xdictend = dict(x) >>>>> xdictstart,xdictend >>>>> >>>> ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >> > > Are you sure that'll work ? Is creating a dict from a sequence guaranteed > to be executed serially withing the sequence ? It is nowhere mentioned in Docs IIRC but I have never seen any counter example. > > > cheers, > - steve > -- > random spiel: http://lonetwin.net/ > what i'm stumbling into: http://lonetwin.stumbleupon.com/ > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf From zubin.mithra at gmail.com Thu Jul 22 16:47:33 2010 From: zubin.mithra at gmail.com (Zubin Mithra) Date: Thu, 22 Jul 2010 20:17:33 +0530 Subject: [BangPypers] pycon hacksessions? Message-ID: Hey everyone, I could'nt find any info on whether or not hack sessions are going to be conducted as part of Pycon. Did I miss something(in the case that we *are *having them) or is there a reason we could'nt have them? Cheers, zm From abpillai at gmail.com Thu Jul 22 18:06:04 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 22 Jul 2010 21:36:04 +0530 Subject: [BangPypers] list problem In-Reply-To: <4C484803.6030805@lonetwin.net> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> Message-ID: On Thu, Jul 22, 2010 at 7:00 PM, steve wrote: > Hi, > > > On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: > >> On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: >> >> Suppose you have the following list: >>> >>> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> >>> My problem is that i wish to obtain the following two dictionaries: >>> xdictstart = {'cat':10, 'dog':1} >>> xdictend = {'cat':30, 'dog':5} >>> >> >> >> Any nice way to do the above? Thanks. >>> >>> >>> Yes. Try this. >> >> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>>> x.sort() >>>>> xdictstart = dict(reversed(x)) >>>>> xdictend = dict(x) >>>>> xdictstart,xdictend >>>>> >>>> ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >> > > Are you sure that'll work ? Is creating a dict from a sequence guaranteed > to be executed serially withing the sequence ? Yes, it is. Since the list is sorted, the entries are entered into the dictionary serially (list is ordered), so hence in normal order we find the larger value overwrites the others and in reversed order, the smaller value. I cannot think of a solution which is shorter than this. > > > cheers, > - steve > -- > random spiel: http://lonetwin.net/ > what i'm stumbling into: http://lonetwin.stumbleupon.com/ > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From pythonic at gmail.com Thu Jul 22 19:07:18 2010 From: pythonic at gmail.com (Shekhar Tiwatne) Date: Thu, 22 Jul 2010 22:37:18 +0530 Subject: [BangPypers] list problem In-Reply-To: References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> Message-ID: <4C487AC6.4020505@gmail.com> On Thursday 22 July 2010 09:36 PM, Anand Balachandran Pillai wrote: > On Thu, Jul 22, 2010 at 7:00 PM, steve wrote: > > >> Hi, >> >> >> On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: >> >> >>> On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: >>> >>> Suppose you have the following list: >>> >>>> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>> >>>> My problem is that i wish to obtain the following two dictionaries: >>>> xdictstart = {'cat':10, 'dog':1} >>>> xdictend = {'cat':30, 'dog':5} >>>> >>>> >>> >>> Any nice way to do the above? Thanks. >>> >>>> >>>> Yes. Try this. >>>> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> >>>>>> x.sort() >>>>>> xdictstart = dict(reversed(x)) >>>>>> xdictend = dict(x) >>>>>> xdictstart,xdictend >>>>>> >>>>>> >>>>> ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >>>>> >>> >> Are you sure that'll work ? Is creating a dict from a sequence guaranteed >> to be executed serially withing the sequence ? >> > > Yes, it is. Since the list is sorted, the entries are entered into the > dictionary > serially (list is ordered), so hence in normal order we find the larger > value > overwrites the others and in reversed order, the smaller value. > > I cannot think of a solution which is shorter than this. > Out of curiosity I tried benchmarking few of these solutions alongwith the one I wrote using itertools.groupby. My benchmarking did include large data sets and worst case. Results are the shortest solution (by Anand) was way faster than others. After that it was Steve's and mine and Navin was almost the same of the last spot. Which one is most readable? Well I leave that for now. Shekhar From anand.shashwat at gmail.com Thu Jul 22 19:23:55 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Thu, 22 Jul 2010 22:53:55 +0530 Subject: [BangPypers] list problem In-Reply-To: <4C487AC6.4020505@gmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> <4C487AC6.4020505@gmail.com> Message-ID: On Thu, Jul 22, 2010 at 10:37 PM, Shekhar Tiwatne wrote: > On Thursday 22 July 2010 09:36 PM, Anand Balachandran Pillai wrote: > >> On Thu, Jul 22, 2010 at 7:00 PM, steve wrote: >> >> >> >>> Hi, >>> >>> >>> On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: >>> >>> >>> >>>> On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: >>>> >>>> Suppose you have the following list: >>>> >>>> >>>>> >>> x >>>>> =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>>> >>>>> My problem is that i wish to obtain the following two dictionaries: >>>>> xdictstart = {'cat':10, 'dog':1} >>>>> xdictend = {'cat':30, 'dog':5} >>>>> >>>>> >>>>> >>>> >>>> Any nice way to do the above? Thanks. >>>> >>>> >>>>> >>>>> Yes. Try this. >>>>> >>>>> >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>> >>>> >>>>> x.sort() >>>>>>> xdictstart = dict(reversed(x)) >>>>>>> xdictend = dict(x) >>>>>>> xdictstart,xdictend >>>>>>> >>>>>>> >>>>>>> >>>>>> ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >>>>>> >>>>>> >>>>> >>>> >>> Are you sure that'll work ? Is creating a dict from a sequence guaranteed >>> to be executed serially withing the sequence ? >>> >>> >> >> Yes, it is. Since the list is sorted, the entries are entered into the >> dictionary >> serially (list is ordered), so hence in normal order we find the larger >> value >> overwrites the others and in reversed order, the smaller value. >> >> I cannot think of a solution which is shorter than this. >> >> > > Out of curiosity I tried benchmarking few of these solutions alongwith the > one I wrote using itertools.groupby. > My benchmarking did include large data sets and worst case. > Results are the shortest solution (by Anand) was way faster than others. > After that it was Steve's and mine and Navin was almost the same of the last > spot. > > Which one is most readable? Well I leave that for now. > Anand's solution is the preferred one obviously. Readable and fast. > > Shekhar > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf From b.ghose at gmail.com Fri Jul 23 05:41:40 2010 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Fri, 23 Jul 2010 09:11:40 +0530 Subject: [BangPypers] list problem In-Reply-To: <4C487AC6.4020505@gmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> <4C487AC6.4020505@gmail.com> Message-ID: > Out of curiosity I tried benchmarking few of these solutions alongwith the > one I wrote using itertools.groupby. > My benchmarking did include large data sets and worst case. > Results are the shortest solution (by Anand) was way faster than others. > After that it was Steve's and mine and Navin was almost the same of the last > spot. > > Which one is most readable? Well I leave that for now. How did mine perform? Regards, BG -- Baishampayan Ghose b.ghose at gmail.com From navin.kabra at gmail.com Fri Jul 23 07:04:34 2010 From: navin.kabra at gmail.com (Navin Kabra) Date: Fri, 23 Jul 2010 10:34:34 +0530 Subject: [BangPypers] list problem In-Reply-To: References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> Message-ID: On Thu, Jul 22, 2010 at 7:31 PM, Shashwat Anand wrote: >> Are you sure that'll work ? Is creating a dict from a sequence guaranteed >> to be executed serially withing the sequence ? > > It is nowhere mentioned in Docs IIRC but I have never seen any counter > example. Actually it is guaranteed. >From the documentation of "dict": "The elements of the argument must each also be of one of those kinds, and each must in turn contain exactly two objects. The first is used as a key in the new dictionary, and the second as the key?s value. If a given key is seen more than once, the last value associated with it is retained in the new dictionary." From pythonic at gmail.com Fri Jul 23 09:09:25 2010 From: pythonic at gmail.com (Shekhar Tiwatne) Date: Fri, 23 Jul 2010 12:39:25 +0530 Subject: [BangPypers] list problem In-Reply-To: References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> <4C487AC6.4020505@gmail.com> Message-ID: <4C494025.4090208@gmail.com> On Friday 23 July 2010 09:11 AM, Baishampayan Ghose wrote: >> Out of curiosity I tried benchmarking few of these solutions alongwith the >> one I wrote using itertools.groupby. >> My benchmarking did include large data sets and worst case. >> Results are the shortest solution (by Anand) was way faster than others. >> After that it was Steve's and mine and Navin was almost the same of the last >> spot. >> >> Which one is most readable? Well I leave that for now. >> > How did mine perform? > Hey BG, For worst case and dataset in problem your script beats all. For simple but large data it's Anand's solution just slightly ahead. Wow. Shekhar From b.ghose at gmail.com Fri Jul 23 09:40:20 2010 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Fri, 23 Jul 2010 13:10:20 +0530 Subject: [BangPypers] list problem In-Reply-To: <4C494025.4090208@gmail.com> References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> <4C487AC6.4020505@gmail.com> <4C494025.4090208@gmail.com> Message-ID: > For worst case and dataset in problem your script beats all. > For simple but large data it's Anand's solution just slightly ahead. > > Wow. Thanks for the info, Shekhar. I am happy :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com From suryajith1987 at gmail.com Fri Jul 23 09:45:30 2010 From: suryajith1987 at gmail.com (Suryajith Chillara) Date: Fri, 23 Jul 2010 13:15:30 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> Message-ID: <4C49489A.6060402@gmail.com> +1 31st is better. On 07/22/2010 06:45 PM, Abhishek Mishra wrote: > Hackday this weekend, end of july sounds good. > > On Thu, Jul 22, 2010 at 2:21 PM, Noufal Ibrahim wrote: >> Anand Balachandran Pillai writes: >> >> [...] >> >>> Can we have it on 30th or 31st then ? Personally I prefer >>> next week-end since I am a bit busy this week-end. >>> >>> Noufal ? >> >> [...] >> >> 31st is fine by me. Anyone else? >> >> -- >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers From emilchacko at gmail.com Fri Jul 23 09:56:37 2010 From: emilchacko at gmail.com (Emil Chacko) Date: Fri, 23 Jul 2010 13:26:37 +0530 Subject: [BangPypers] python speed comparison Message-ID: Below given is solution to a puzzle( http://projecteuler.net/index.php?section=problems&id=14) in python and c Python: import time startT=time.time() maxlen=0 longest=0 for i in xrange(1,1000000): last=i cnt=0 while(last <> 1): cnt=cnt+1 if(last%2==0): last=last/2 else: last=3*last+1 if(cnt>maxlen): maxlen=cnt longest=i print "time taken (sec) : ",time.time()-startT print maxlen,longest Python Output: time taken (sec) : 99.4702298641 524 837799 C: #include int main(int argc, char **argv) { int longest = 0; int maxlen = 0; int i; unsigned long last; for (i = 1; i <= 1000000; i++) { last = i; int cnt = 0; while (last != 1) { cnt++; if (last % 2 == 0) last = last / 2; else last = 3 * last + 1; } if (cnt > maxlen) { maxlen = cnt; longest = i; } } printf("longest: %d (%d)\n", longest, maxlen); return 0; } My doubt is that in C the result comes in 1-2 sec but in python it takes 99 secs.I don't expect python to be as fast as c but i cant understand why it should be so slow in python.i'm new to python so if there is better way to do the above prog in python please suggest. From santrajan at gmail.com Fri Jul 23 10:20:25 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Fri, 23 Jul 2010 13:50:25 +0530 Subject: [BangPypers] July meetup In-Reply-To: <4C49489A.6060402@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> Message-ID: 31st is better for me also, bcos i will be in bangalore then. However this is my first time and i don't know how i could be useful/helpful. Atleast I can meet you all and see how I could be useful/helpful. On Fri, Jul 23, 2010 at 1:15 PM, Suryajith Chillara wrote: > +1 > > 31st is better. > > > On 07/22/2010 06:45 PM, Abhishek Mishra wrote: > >> Hackday this weekend, end of july sounds good. >> >> On Thu, Jul 22, 2010 at 2:21 PM, Noufal Ibrahim wrote: >> >>> Anand Balachandran Pillai writes: >>> >>> [...] >>> >>> Can we have it on 30th or 31st then ? Personally I prefer >>>> next week-end since I am a bit busy this week-end. >>>> >>>> Noufal ? >>>> >>> >>> [...] >>> >>> 31st is fine by me. Anyone else? >>> >>> -- >>> _______________________________________________ >>> BangPypers mailing list >>> BangPypers at python.org >>> http://mail.python.org/mailman/listinfo/bangpypers >>> >>> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From b.ghose at gmail.com Fri Jul 23 10:21:22 2010 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Fri, 23 Jul 2010 13:51:22 +0530 Subject: [BangPypers] python speed comparison In-Reply-To: References: Message-ID: Emil, > Below given is solution to a puzzle( > http://projecteuler.net/index.php?section=problems&id=14) in python and c > > Python: > > import time > startT=time.time() > maxlen=0 > longest=0 > for i in xrange(1,1000000): > ?last=i > ?cnt=0 > ?while(last <> 1): > ?cnt=cnt+1 > ?if(last%2==0): > ? last=last/2 > ?else: > ? last=3*last+1 > ?if(cnt>maxlen): > ?maxlen=cnt > ?longest=i > print "time taken (sec) : ",time.time()-startT > print maxlen,longest > > Python Output: > time taken (sec) : ?99.4702298641 > 524 837799 > > C: > > #include > int main(int argc, char **argv) > { > int longest = 0; > int maxlen = 0; > int i; > unsigned long last; > for (i = 1; i <= 1000000; i++) > { > ?last = i; > ?int cnt = 0; > ?while (last != 1) > ?{ > ?cnt++; > ? if (last % 2 == 0) > ? ?last = last / 2; > ?else > ? ?last = 3 * last + 1; > ?} > ?if (cnt > maxlen) > ?{ > ?maxlen = cnt; > ?longest = i; > ?} > } > printf("longest: %d (%d)\n", longest, maxlen); > return 0; > } > > > My doubt is that in C the result comes in 1-2 sec but in python it takes 99 > secs.I don't expect python to be as fast as c but i cant understand why it > should be so slow in python.i'm new to python so if there is better way to > do the above prog in python please suggest. Python is undoubtedly slower than C, more so when you use a naive algorithm. Here is how I had solved this problem in Python on Jan, 2007 (had to really dig out the code from my archives) - #!/usr/bin/env python # Solution for problem #14 at Project Euler # (http://projecteuler.net/index.php?section=problems&id=14) # Author: Baishampayan Ghose length = 0 max = 0 start = 1 def cycle(x): ''' Calculate the max cycle length, ensuring that everything is < 1 million ''' i = 1 while (x != 1): if (x % 2 == 0): x = x / 2 else: x = 3*x + 1 i += 1 return i for i in xrange(800000, 840000): length = cycle(i) if length > max: max = length start = i print start ### The above code gets the result in 1.7 seconds on my machine (the C version takes 0.8 secs). The trick here was to calculate the range properly, which you can arrive at by using some math. Note that brute force approaches rarely work with project Euler problems. There is most certainly some math involved somewhere which can simplify your solution a lot. Hope this helps. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com From anand.shashwat at gmail.com Fri Jul 23 10:42:49 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Fri, 23 Jul 2010 14:12:49 +0530 Subject: [BangPypers] python speed comparison In-Reply-To: References: Message-ID: BTW the problem is known as 3n+1 problem and you can find it in ACM archives too. http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36 From anand.shashwat at gmail.com Fri Jul 23 10:58:43 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Fri, 23 Jul 2010 14:28:43 +0530 Subject: [BangPypers] python speed comparison In-Reply-To: References: Message-ID: On Fri, Jul 23, 2010 at 1:51 PM, Baishampayan Ghose wrote: > Emil, > > > Below given is solution to a puzzle( > > http://projecteuler.net/index.php?section=problems&id=14) in python and > c > > > > Python: > > > > import time > > startT=time.time() > > maxlen=0 > > longest=0 > > for i in xrange(1,1000000): > > last=i > > cnt=0 > > while(last <> 1): > > cnt=cnt+1 > > if(last%2==0): > > last=last/2 > > else: > > last=3*last+1 > > if(cnt>maxlen): > > maxlen=cnt > > longest=i > > print "time taken (sec) : ",time.time()-startT > > print maxlen,longest > > > > Python Output: > > time taken (sec) : 99.4702298641 > > 524 837799 > > > > C: > > > > #include > > int main(int argc, char **argv) > > { > > int longest = 0; > > int maxlen = 0; > > int i; > > unsigned long last; > > for (i = 1; i <= 1000000; i++) > > { > > last = i; > > int cnt = 0; > > while (last != 1) > > { > > cnt++; > > if (last % 2 == 0) > > last = last / 2; > > else > > last = 3 * last + 1; > > } > > if (cnt > maxlen) > > { > > maxlen = cnt; > > longest = i; > > } > > } > > printf("longest: %d (%d)\n", longest, maxlen); > > return 0; > > } > > > > > > My doubt is that in C the result comes in 1-2 sec but in python it takes > 99 > > secs.I don't expect python to be as fast as c but i cant understand why > it > > should be so slow in python.i'm new to python so if there is better way > to > > do the above prog in python please suggest. > def seq(n): kount = 1 while n != 1: if not n % 2: n /= 2 else: n = 3*n + 1 kount += 1 return kount sol, soln = 1, 1 for i in range(1,1000000): if sol < seq(i): sol, soln = seq(i), i print soln ### Takes 36 sec 14:23:33 l0nwlf-MBP:~/Codes/PE$ time python 14.py 837799 real 0m36.311s user 0m36.073s sys 0m0.091s > > Python is undoubtedly slower than C, more so when you use a naive > algorithm. Here is how I had solved this problem in Python on Jan, > 2007 (had to really dig out the code from my archives) - > > #!/usr/bin/env python > > # Solution for problem #14 at Project Euler > # (http://projecteuler.net/index.php?section=problems&id=14) > # Author: Baishampayan Ghose > > length = 0 > max = 0 > start = 1 > > def cycle(x): > ''' Calculate the max cycle length, > ensuring that everything is < 1 million > ''' > i = 1 > > while (x != 1): > if (x % 2 == 0): > x = x / 2 > else: > x = 3*x + 1 > i += 1 > > return i > > for i in xrange(800000, 840000): > So did you applied some maths here ? :-/ > length = cycle(i) > if length > max: > max = length > start = i > > print start > > ### > > The above code gets the result in 1.7 seconds on my machine (the C > version takes 0.8 secs). The trick here was to calculate the range > properly, which you can arrive at by using some math. > > Note that brute force approaches rarely work with project Euler > problems. There is most certainly some math involved somewhere which > can simplify your solution a lot. > > Hope this helps. > > Regards, > BG > > -- > Baishampayan Ghose > b.ghose at gmail.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf From venkat83 at gmail.com Fri Jul 23 11:04:29 2010 From: venkat83 at gmail.com (Venkatraman S) Date: Fri, 23 Jul 2010 14:34:29 +0530 Subject: [BangPypers] python speed comparison In-Reply-To: References: Message-ID: Try "extending" with python. -V- From steve at lonetwin.net Fri Jul 23 13:00:49 2010 From: steve at lonetwin.net (steve) Date: Fri, 23 Jul 2010 16:30:49 +0530 Subject: [BangPypers] list problem In-Reply-To: References: <20100722095138.8636.qmail@f6mail-145-185.rediffmail.com> <4C484803.6030805@lonetwin.net> Message-ID: <4C497661.4020507@lonetwin.net> On 07/23/2010 10:34 AM, Navin Kabra wrote: > On Thu, Jul 22, 2010 at 7:31 PM, Shashwat Anand > wrote: >>> Are you sure that'll work ? Is creating a dict from a sequence guaranteed >>> to be executed serially withing the sequence ? >> >> It is nowhere mentioned in Docs IIRC but I have never seen any counter >> example. > > Actually it is guaranteed. >> From the documentation of "dict": > > "The elements of the argument must each also be of one of those kinds, > and each must in turn contain exactly two objects. The first is used > as a key in the new dictionary, and the second as the key?s value. If > a given key is seen more than once, the last value associated with it > is retained in the new dictionary." Nice ! Thanks for digging that out Navin ! Anand's solution is really the most elegant. cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From gopalakrishnan.subramani at gmail.com Fri Jul 23 21:11:37 2010 From: gopalakrishnan.subramani at gmail.com (Gopalakrishnan Subramani) Date: Sat, 24 Jul 2010 00:41:37 +0530 Subject: [BangPypers] Need Python websites and blogs within India Message-ID: Hi All, I am collecting information for python related websites and blogs. I am primarily looking for the sites already offer RSS 1.0/2.0 or ATOM feeds with clear separation for python related information. A generic python related info like CPython, IronPython, Jython etc shall be mentioned here along with top level news site. Python related information shall be placed here.. http://stacked.in/python There would be separate sections like like /pythonblogs, /django and /djangoblogs shall be added soon. I read some blogs like ben bengret, Ian Bicking, Coders who says py, Amix, Guido (not in particular order). Do you read any specific python related blogs? You can visit here for more blog update from 100s of developer..http://planet.python.org/ I am not sure any Indian blog.. I could see Baiju blog mentioned in planet python...Do you write about python regularly? please share the link with me. Regards, Krish From mbaiju at zeomega.com Sat Jul 24 05:22:27 2010 From: mbaiju at zeomega.com (Baiju M) Date: Sat, 24 Jul 2010 08:52:27 +0530 Subject: [BangPypers] Indian language resources for Python Message-ID: Hi, If you got any Indian language resources (blog/article/book) for Python, please add it to the language pages in wiki: http://wiki.python.org/moin/CategoryLanguage I usually update Malayalam page whenever I get new links: http://wiki.python.org/moin/MalayalamLanguage Regards, Baiju M From anuj_abhishek at yahoo.com Sat Jul 24 06:39:01 2010 From: anuj_abhishek at yahoo.com (anuj abhishek) Date: Fri, 23 Jul 2010 21:39:01 -0700 (PDT) Subject: [BangPypers] List Problem.. In-Reply-To: References: Message-ID: <313111.51759.qm@web55608.mail.re4.yahoo.com> I am not very sure about what you are asking for.. But, if it's just a dictionary that you want from the given list then I beleive the folloeing will work.. >>> x=[['cat',30],['cat',40],['cat',10],['dog',5],['dog',7],['dog',1]] >>> x= sorted(x) >>> xdictstart=dict(zip([x[0][0],x[3][0]],[x[0][1],x[3][1]])) >>> xdictstart {'dog': 1, 'cat': 10} And similarly for dictend.. Regards, Anuj ________________________________ From: "bangpypers-request at python.org" To: bangpypers at python.org Sent: Thu, July 22, 2010 7:34:06 PM Subject: BangPypers Digest, Vol 35, Issue 21 Send BangPypers mailing list submissions to bangpypers at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/bangpypers or, via email, send a message with subject or body 'help' to bangpypers-request at python.org You can reach the person managing the list at bangpypers-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of BangPypers digest..." Today's Topics: 1. [JOB Opening] Juniper Networks (Santhosh Divakar) 2. [JOB Opening] Juniper Networks (Santhosh Divakar) 3. Re: July meetup (Abhishek Mishra) 4. Re: list problem (steve) 5. Re: list problem (Vikram ) 6. Re: list problem (Shashwat Anand) 7. Re: list problem (Shashwat Anand) ---------------------------------------------------------------------- Message: 1 Date: Thu, 22 Jul 2010 17:19:24 +0530 From: Santhosh Divakar To: Bangalore Python Users Group - India Subject: [BangPypers] [JOB Opening] Juniper Networks Message-ID: Content-Type: text/plain; charset=ISO-8859-1 *Tools Development Engineer* *Job Location: Bangalore* * * *Job Description:* As a member of the Engineering Software Tools group at Juniper you will be part of a global team with primary responsibility for the tools infrastructure of the JUNOS software development environment. You will design, develop and maintain internal development support tools, including build and deployment tools, system monitoring, and customizations and add-ons to development support tools. This position provides the opportunity to solve a wide variety of different problems, using different tools and integrating with different tools and environments. You will need to work closely with different technology teams to determine requirements and develop effective designs. *Must Have Skills:* ? 3 to 7 years experience in software development. ? Extensive experience any of the following languages (Perl, Python, C/C++) ? Extensive experience with UNIX-Internals & SHELL scripting. ? Experience with SQL databases. (Knowledge of the DB Basics / Ability to form and to understand complex SQL Queries) ? Experience across the complete application development lifecycle including design, prototyping, testing, implementation and deployment. ? Excellent communication skills (both writing and verbal). ? Extremely team oriented, collaborative and flexible. ------------------------------ Message: 2 Date: Thu, 22 Jul 2010 17:19:24 +0530 From: Santhosh Divakar To: Bangalore Python Users Group - India Subject: [BangPypers] [JOB Opening] Juniper Networks Message-ID: Content-Type: text/plain; charset=ISO-8859-1 *Tools Development Engineer* *Job Location: Bangalore* * * *Job Description:* As a member of the Engineering Software Tools group at Juniper you will be part of a global team with primary responsibility for the tools infrastructure of the JUNOS software development environment. You will design, develop and maintain internal development support tools, including build and deployment tools, system monitoring, and customizations and add-ons to development support tools. This position provides the opportunity to solve a wide variety of different problems, using different tools and integrating with different tools and environments. You will need to work closely with different technology teams to determine requirements and develop effective designs. *Must Have Skills:* ? 3 to 7 years experience in software development. ? Extensive experience any of the following languages (Perl, Python, C/C++) ? Extensive experience with UNIX-Internals & SHELL scripting. ? Experience with SQL databases. (Knowledge of the DB Basics / Ability to form and to understand complex SQL Queries) ? Experience across the complete application development lifecycle including design, prototyping, testing, implementation and deployment. ? Excellent communication skills (both writing and verbal). ? Extremely team oriented, collaborative and flexible. ------------------------------ Message: 3 Date: Thu, 22 Jul 2010 18:45:50 +0530 From: Abhishek Mishra To: Bangalore Python Users Group - India Subject: Re: [BangPypers] July meetup Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hackday this weekend, end of july sounds good. On Thu, Jul 22, 2010 at 2:21 PM, Noufal Ibrahim wrote: > Anand Balachandran Pillai writes: > > [...] > >> Can we have it on 30th or 31st then ? ?Personally I prefer >> next week-end since I am a bit busy this week-end. >> >> Noufal ? > > [...] > > 31st is fine by me. Anyone else? > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > ------------------------------ Message: 4 Date: Thu, 22 Jul 2010 19:00:43 +0530 From: steve To: bangpypers at python.org Subject: Re: [BangPypers] list problem Message-ID: <4C484803.6030805 at lonetwin.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: > On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > >> Suppose you have the following list: >> >> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >> >> My problem is that i wish to obtain the following two dictionaries: >> xdictstart = {'cat':10, 'dog':1} >> xdictend = {'cat':30, 'dog':5} > > >> Any nice way to do the above? Thanks. >> >> > Yes. Try this. > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>> x.sort() >>>> xdictstart = dict(reversed(x)) >>>> xdictend = dict(x) >>>> xdictstart,xdictend > ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) Are you sure that'll work ? Is creating a dict from a sequence guaranteed to be executed serially withing the sequence ? cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ ------------------------------ Message: 5 Date: 22 Jul 2010 13:39:13 -0000 From: "Vikram " To: Subject: Re: [BangPypers] list problem Message-ID: <1279794254.S.9697.14894.F.H.Tk5hdmluIEthYnJhAFJlOiBbQmFuZ1B5cGVyc10gbGlzdCBwcm9ibGVt.f6-145-157.old.1279805953.4177 at webmail.rediffmail.com> Content-Type: text/plain; charset="UTF-8" many thanks for this to naveen and others who responded. On Thu, 22 Jul 2010 15:54:14 +0530 wrote >I suggest that in such cases, avoid the temptation to do something clever. If it was difficult for you to write the code, it will be even more difficult to read and understand it. Unless there is a very good reason, write the simplest, most braindead code. xdictstart={} xdictend={} for item in sorted(x): xdictend[item[0]] = item[1] if not item[0] in xdictstart xdictstart[item[0]] = item[1] On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > >>>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. > > ------- > Those interested in the above problem may consider the following code (which >does not actually do what i want): > >>>> xdictend = dict(x) >>>> xdictend > {'dog': 3, 'cat': 30} > >>>> x > [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] >>>> xdictstart = {} >>>> map(xdictstart.setdefault, *zip(*x)) > [10, 10, 10, 5, 5, 5] >>>> xdictstart > {'dog': 5, 'cat': 10} > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers ------------------------------ Message: 6 Date: Thu, 22 Jul 2010 19:30:54 +0530 From: Shashwat Anand To: Bangalore Python Users Group - India Subject: Re: [BangPypers] list problem Message-ID: Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: > Suppose you have the following list: > > >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] > > My problem is that i wish to obtain the following two dictionaries: > xdictstart = {'cat':10, 'dog':1} > xdictend = {'cat':30, 'dog':5} > > Any nice way to do the above? Thanks. > How about this : >>> x [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] Remove duplicates for key pair of dictionary. >>> keys = list(set(i[0] for i in x)) >>> keys ['dog', 'cat'] Now for every unique keys make a list containing all the items for that key. >>> [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys] [[['dog', 1], ['dog', 3], ['dog', 5]], [['cat', 10], ['cat', 20], ['cat', 30]]] You can now easily create dictionary. >>> xdictstart = dict(i[0] for i in [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys]) >>> xdictstart {'dog': 1, 'cat': 10} >>> xdictend = dict(i[-1] for i in [sorted([i for i in x if i[0]==k], key=operator.itemgetter(1)) for k in keys]) >>> xdictend {'dog': 5, 'cat': 30} The benefit is you can make a complete dictionary if you want, not only start and end values. > ------- > Those interested in the above problem may consider the following code > (which does not actually do what i want): > > >>> xdictend = dict(x) > >>> xdictend > {'dog': 3, 'cat': 30} > > >>> x > [['cat', 10], ['cat', 20], ['cat', 30], ['dog', 5], ['dog', 1], ['dog', 3]] > >>> xdictstart = {} > >>> map(xdictstart.setdefault, *zip(*x)) > [10, 10, 10, 5, 5, 5] > >>> xdictstart > {'dog': 5, 'cat': 10} > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf ------------------------------ Message: 7 Date: Thu, 22 Jul 2010 19:31:54 +0530 From: Shashwat Anand To: Bangalore Python Users Group - India Subject: Re: [BangPypers] list problem Message-ID: Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jul 22, 2010 at 7:00 PM, steve wrote: > Hi, > > > On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote: > >> On Thu, Jul 22, 2010 at 3:21 PM, Vikram wrote: >> >> Suppose you have the following list: >>> >>> >>> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>> >>> My problem is that i wish to obtain the following two dictionaries: >>> xdictstart = {'cat':10, 'dog':1} >>> xdictend = {'cat':30, 'dog':5} >>> >> >> >> Any nice way to do the above? Thanks. >>> >>> >>> Yes. Try this. >> >> x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]] >>>>> x.sort() >>>>> xdictstart = dict(reversed(x)) >>>>> xdictend = dict(x) >>>>> xdictstart,xdictend >>>>> >>>> ({'dog': 1, 'cat': 10}, {'dog': 5, 'cat': 30}) >> > > Are you sure that'll work ? Is creating a dict from a sequence guaranteed > to be executed serially withing the sequence ? It is nowhere mentioned in Docs IIRC but I have never seen any counter example. > > > cheers, > - steve > -- > random spiel: http://lonetwin.net/ > what i'm stumbling into: http://lonetwin.stumbleupon.com/ > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~l0nwlf ------------------------------ _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers End of BangPypers Digest, Vol 35, Issue 21 ****************************************** From abpillai at gmail.com Sat Jul 24 10:05:43 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Sat, 24 Jul 2010 13:35:43 +0530 Subject: [BangPypers] List Problem.. In-Reply-To: <313111.51759.qm@web55608.mail.re4.yahoo.com> References: <313111.51759.qm@web55608.mail.re4.yahoo.com> Message-ID: On Sat, Jul 24, 2010 at 10:09 AM, anuj abhishek wrote: > I am not very sure about what you are asking for.. > But, if it's just a dictionary that you want from the given list then I > beleive > the folloeing will work.. > >>> x=[['cat',30],['cat',40],['cat',10],['dog',5],['dog',7],['dog',1]] > >>> x= sorted(x) > >>> xdictstart=dict(zip([x[0][0],x[3][0]],[x[0][1],x[3][1]])) > >>> xdictstart > {'dog': 1, 'cat': 10} > And similarly for dictend.. > Regards, > Anuj > Thank you for posting. Please try to trim the message backlog when replying. In your email, your reply was like 10% and the long tail made up 90% of the rest. It just adds up to the noise. --Anand From jeffjosejeff at gmail.com Sat Jul 24 12:20:05 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Sat, 24 Jul 2010 15:50:05 +0530 Subject: [BangPypers] Tip: Creating new classes on the fly In-Reply-To: References: Message-ID: On Tue, Jul 20, 2010 at 9:56 AM, Roshan Mathews wrote: > I came across this in a blog post just now. > See http://docs.python.org/library/functions.html#type > > >>> class Foo(object): pass > ... > >>> Bar = type('Bar', (object,), dict()) > What you mentioned here is the exact mechanism of a instantiation of a class by metaclass. Here class is `Bar` and MetaClass is `type` Normally, clsObj = Class() #l = list(), d = dict() etc and for instantiaing Class, Class = Metaclass(Class.__name__, bases, dict) > >>> f = Foo(); b = Bar() > >>> type(f), type(b) > (, ) > > Also see > http://docs.python.org/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields > > >>> from collections import namedtuple > >>> Baz = namedtuple('Baz', '') > > Anyone switched to Python 2.7 yet? > Nope, I'm stuck with 2.5 for a while at work. From manusajith at gmail.com Sun Jul 25 16:08:00 2010 From: manusajith at gmail.com (Manu Ajith) Date: Sun, 25 Jul 2010 19:38:00 +0530 Subject: [BangPypers] Pycon Accommodation Message-ID: My self Manu S Ajith, from College of Engineering Chengannur Few friends and me are planning to attend the pycon 2010, but accommodation is a problem. We have no contacts in Bangalore. Could anyone suggest a place to stay (hotel/lodge) or give contacts. Our budget is low, ( about 1000 for 4 people ). --- Manu S Ajith, Computer Science and Engineering - 2012, College of Engineering Chengannur, Alappuzha, Kerala - 689 121. From kpguy at rediffmail.com Tue Jul 27 08:48:05 2010 From: kpguy at rediffmail.com (Vikram ) Date: 27 Jul 2010 06:48:05 -0000 Subject: [BangPypers] =?utf-8?q?partial_flattening_of_list?= Message-ID: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> have the following: >>> x [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >>> for i in x: ... print i ... ['NM100', 1, 2] ['NM100', 3, 4] ['NM200', 5, 6] ------ how does one obtain list z such that z = [['NM100',1,2,3,4],['NM200',5,6]] From noufal at gmail.com Tue Jul 27 09:51:29 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Jul 2010 13:21:29 +0530 Subject: [BangPypers] July meetup In-Reply-To: (Santosh Rajan's message of "Fri, 23 Jul 2010 13:50:25 +0530") References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> Message-ID: <87iq41mkfy.fsf@gmail.com> So, is 31st fine with everyone? I will attend but am currently tied up with some work related matters. Will someone else take charge of organising this meetup (venue etc.) and collecting the registration money of the offline participants? Anand C. has a setup to mail the offline registrants with the venue etc. so that they can attend (not all of them are on BangPypers) so please let him know as well. -- From akk.saravanakumar at gmail.com Tue Jul 27 10:01:25 2010 From: akk.saravanakumar at gmail.com (Saravanakumar Karunanithi) Date: Tue, 27 Jul 2010 13:31:25 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> References: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> Message-ID: my_list = [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] temp_dict = {} for each in my_list: if each[0] in temp_dict.keys(): temp_dict[each[0]].extend(each[1:]) else: temp_dict[each[0]] = each[1:] print [[k] + v for k,v in temp_dict.iteritems()] On Tue, Jul 27, 2010 at 12:18 PM, Vikram wrote: > have the following: > > >>> x > [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > >>> for i in x: > ... print i > ... > ['NM100', 1, 2] > ['NM100', 3, 4] > ['NM200', 5, 6] > > ------ > how does one obtain list z such that > > z = [['NM100',1,2,3,4],['NM200',5,6]] > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Thanks & Regards, Saravanakumar Karunanithi From pythonic at gmail.com Tue Jul 27 10:59:22 2010 From: pythonic at gmail.com (Shekhar Tiwatne) Date: Tue, 27 Jul 2010 14:29:22 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> References: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> Message-ID: <4C4E9FEA.5080602@gmail.com> On Tuesday 27 July 2010 12:18 PM, Vikram wrote: > have the following: > > >>>> x >>>> > [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > >>>> for i in x: >>>> > ... print i > ... > ['NM100', 1, 2] > ['NM100', 3, 4] > ['NM200', 5, 6] > > ------ > how does one obtain list z such that > > z = [['NM100',1,2,3,4],['NM200',5,6]] > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > A less readable solution using itertools #------------ from itertools import * get_first = lambda x: x[0] filter_first_and_chain_rest = lambda seq: chain(*(x[1:] for x in seq)) data = [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] grouped = groupby(sorted(data), get_first) print list ([label] + list(filter_first_and_chain_rest(grp)) for label, grp in grouped) ~Shekhar From abpillai at gmail.com Tue Jul 27 11:46:03 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Tue, 27 Jul 2010 15:16:03 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: <4C4E9FEA.5080602@gmail.com> References: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> <4C4E9FEA.5080602@gmail.com> Message-ID: On Tue, Jul 27, 2010 at 2:29 PM, Shekhar Tiwatne wrote: > On Tuesday 27 July 2010 12:18 PM, Vikram wrote: > >> have the following: >> >> >> >>> x >>>>> >>>>> >>>> [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >> >> >>> for i in x: >>>>> >>>>> >>>> ... print i >> ... >> ['NM100', 1, 2] >> ['NM100', 3, 4] >> ['NM200', 5, 6] >> >> ------ >> how does one obtain list z such that >> >> z = [['NM100',1,2,3,4],['NM200',5,6]] >> > This problem begs for the use of collections.defaultdict class. All the other solutions are ok, but defaultdict is meant to solve problems like this. Here is the solution. >>> import collections >>> l=[['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >>> l2=[[x[0], x[1:]] for x in l] >>> d = collections.defaultdict(list) >>> for k, v in l2: d[k].extend(v) >>> [[k, v] for k,v in d.iteritems()] [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] What you want are the elements of the final list. --Anand From noufal at gmail.com Tue Jul 27 11:47:43 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Jul 2010 15:17:43 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87iq41mkfy.fsf@gmail.com> (Noufal Ibrahim's message of "Tue, 27 Jul 2010 13:21:29 +0530") References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> Message-ID: <87zkxdl0hs.fsf@gmail.com> Noufal Ibrahim writes: > So, is 31st fine with everyone? I will attend but am currently tied up > with some work related matters. Will someone else take charge of > organising this meetup (venue etc.) and collecting the registration > money of the offline participants? > > Anand C. has a setup to mail the offline registrants with the venue > etc. so that they can attend (not all of them are on BangPypers) so > please let him know as well. Anyone? -- From abpillai at gmail.com Tue Jul 27 11:53:13 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Tue, 27 Jul 2010 15:23:13 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: References: <20100727064805.14091.qmail@f6mail-145-186.rediffmail.com> <4C4E9FEA.5080602@gmail.com> Message-ID: On Tue, Jul 27, 2010 at 3:16 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > > > On Tue, Jul 27, 2010 at 2:29 PM, Shekhar Tiwatne wrote: > >> On Tuesday 27 July 2010 12:18 PM, Vikram wrote: >> >>> have the following: >>> >>> >>> >>>> x >>>>>> >>>>>> >>>>> [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >>> >>> >>>> for i in x: >>>>>> >>>>>> >>>>> ... print i >>> ... >>> ['NM100', 1, 2] >>> ['NM100', 3, 4] >>> ['NM200', 5, 6] >>> >>> ------ >>> how does one obtain list z such that >>> >>> z = [['NM100',1,2,3,4],['NM200',5,6]] >>> >> > This problem begs for the use of collections.defaultdict class. > > All the other solutions are ok, but defaultdict is meant to solve > problems like this. > > Here is the solution. > > >>> import collections > >>> l=[['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > >>> l2=[[x[0], x[1:]] for x in l] > >>> d = collections.defaultdict(list) > >>> for k, v in l2: d[k].extend(v) > >>> [[k, v] for k,v in d.iteritems()] > [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] > > What you want are the elements of the final list. > I didn't notice you want z = [['NM100',1,2,3,4],['NM200',5,6]] rather than, z= [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] So replace last line with, >>> [[k] + v for k,v in d.iteritems()] [['NM100', 1, 2, 3, 4], ['NM200', 5, 6]] > --Anand > > > > -- --Anand From abpillai at gmail.com Tue Jul 27 11:55:44 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Tue, 27 Jul 2010 15:25:44 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87zkxdl0hs.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> Message-ID: On Tue, Jul 27, 2010 at 3:17 PM, Noufal Ibrahim wrote: > Noufal Ibrahim writes: > > > So, is 31st fine with everyone? I will attend but am currently tied up > > with some work related matters. Will someone else take charge of > > organising this meetup (venue etc.) and collecting the registration > > money of the offline participants? > > > > Anand C. has a setup to mail the offline registrants with the venue > > etc. so that they can attend (not all of them are on BangPypers) so > > please let him know as well. > > > Anyone? > I am tied up myself otherwise would take this up gladly. > > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From pranny at gmail.com Tue Jul 27 12:22:55 2010 From: pranny at gmail.com (Pranav Prakash) Date: Tue, 27 Jul 2010 15:52:55 +0530 Subject: [BangPypers] Python websites and blogs Message-ID: Hi Gopalakrishnan Subramani, I write a blog which is not exclusively on Python, but contains a good amount of percentage of information/codes and other details on Python and Google App Engine platform. The URL is http://codecontrol.blogspot.com. You may visit the blog and add it to the list. Thanks, On Sat, Jul 24, 2010 at 10:09, wrote: > Gopalakrishnan Subramani -- *Pranav Prakash* "This life is more than ordinary" Twitter | Blog | Google From pranny at gmail.com Tue Jul 27 12:25:20 2010 From: pranny at gmail.com (Pranav Prakash) Date: Tue, 27 Jul 2010 15:55:20 +0530 Subject: [BangPypers] Using Google Moderators and Wave to make talks for PyCon India 2010 more interactive Message-ID: Hi, I was thinking if we can use Google Moderators ( http://www.google.com/moderator) and google wave to make the talks for PyCon India more interactive and lively. If we could come up with a plan of usage of these tools, maybe we can inform the speakers in advance so they will be more comfortable with it. -- *Pranav Prakash* "This life is more than ordinary" Twitter | Blog | Google From kpguy at rediffmail.com Tue Jul 27 12:45:10 2010 From: kpguy at rediffmail.com (Vikram ) Date: 27 Jul 2010 10:45:10 -0000 Subject: [BangPypers] =?utf-8?q?partial_flattening_of_list?= In-Reply-To: Message-ID: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> Hi Anand,vijay, and others, we have python 2.4.3 at our workplace and defaultdict is not present in the collections module in this python version. >>> dir(collections) ['__doc__', '__file__', '__name__', 'deque'] >>> Also, could u suggest some way to tackle the following problem: Given: l = [['NM100', 1, 3], ['NM100', 7, 10], ['NM200', 13, 16]] want something like: z = [['NM100',[1,2,3,7,8,9,10]],['NM200',[13,14,15,16]]] On Tue, 27 Jul 2010 15:33:00 +0530 wrote >On Tue, Jul 27, 2010 at 3:16 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > > > On Tue, Jul 27, 2010 at 2:29 PM, Shekhar Tiwatne wrote: > >> On Tuesday 27 July 2010 12:18 PM, Vikram wrote: >> >>> have the following: >>> >>> >>> >>>> x >>>>>> >>>>>> >>>>> [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >>> >>> >>>> for i in x: >>>>>> >>>>>> >>>>> ... print i >>> ... >>> ['NM100', 1, 2] >>> ['NM100', 3, 4] >>> ['NM200', 5, 6] >>> >>> ------ >>> how does one obtain list z such that >>> >>> z = [['NM100',1,2,3,4],['NM200',5,6]] >>> >> > This problem begs for the use of collections.defaultdict class. > > All the other solutions are ok, but defaultdict is meant to solve > problems like this. > > Here is the solution. > > >>> import collections > >>> l=[['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > >>> l2=[[x[0], x[1:]] for x in l] > >>> d = collections.defaultdict(list) > >>> for k, v in l2: d[k].extend(v) > >>> [[k, v] for k,v in d.iteritems()] > [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] > > What you want are the elements of the final list. > I didn't notice you want z = [['NM100',1,2,3,4],['NM200',5,6]] rather than, z= [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] So replace last line with, >>> [[k] + v for k,v in d.iteritems()] [['NM100', 1, 2, 3, 4], ['NM200', 5, 6]] > --Anand > > > > -- --Anand _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers From noufal at gmail.com Tue Jul 27 12:55:20 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Jul 2010 16:25:20 +0530 Subject: [BangPypers] Using Google Moderators and Wave to make talks for PyCon India 2010 more interactive In-Reply-To: (Pranav Prakash's message of "Tue, 27 Jul 2010 15:55:20 +0530") References: Message-ID: <874oflkxd3.fsf@gmail.com> Pranav Prakash writes: > Hi, > > I was thinking if we can use Google Moderators ( > http://www.google.com/moderator) and google wave to make the talks for PyCon > India more interactive and lively. > If we could come up with a plan of usage of these tools, maybe we can inform > the speakers in advance so they will be more comfortable with it. I've moved the discussion to the inpycon list since it's more appropriate there. Thanks -- From abpillai at gmail.com Tue Jul 27 13:00:09 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Tue, 27 Jul 2010 16:30:09 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> References: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> Message-ID: On Tue, Jul 27, 2010 at 4:15 PM, Vikram wrote: > > Hi Anand,vijay, and others, > we have python 2.4.3 at our workplace and defaultdict is not present in the > collections module in this python version. > > >>> dir(collections) > ['__doc__', '__file__', '__name__', 'deque'] > >From collections module documentation. "Changed in version 2.5: Added defaultdict ." So it is not present in Python <=2.4. > >>> > > Also, could u suggest some way to tackle the following problem: > Given: > > l = [['NM100', 1, 3], ['NM100', 7, 10], ['NM200', 13, 16]] > > want something like: > z = [['NM100',[1,2,3,7,8,9,10]],['NM200',[13,14,15,16]]] > Why don't you attempt an approach yourself before asking for help ? Now that you have already seen some solutions to the first query, isn't that better ? > > On Tue, 27 Jul 2010 15:33:00 +0530 wrote > >On Tue, Jul 27, 2010 at 3:16 PM, Anand Balachandran Pillai < > > abpillai at gmail.com> wrote: > > > > > > > > > > > On Tue, Jul 27, 2010 at 2:29 PM, Shekhar Tiwatne wrote: > > > > > >> On Tuesday 27 July 2010 12:18 PM, Vikram wrote: > > >> > > >>> have the following: > > >>> > > >>> > > >>> > > >>>> x > > >>>>>> > > >>>>>> > > >>>>> [['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > > >>> > > >>> > > >>>> for i in x: > > >>>>>> > > >>>>>> > > >>>>> ... print i > > >>> ... > > >>> ['NM100', 1, 2] > > >>> ['NM100', 3, 4] > > >>> ['NM200', 5, 6] > > >>> > > >>> ------ > > >>> how does one obtain list z such that > > >>> > > >>> z = [['NM100',1,2,3,4],['NM200',5,6]] > > >>> > > >> > > > This problem begs for the use of collections.defaultdict class. > > > > > > All the other solutions are ok, but defaultdict is meant to solve > > > problems like this. > > > > > > Here is the solution. > > > > > > >>> import collections > > > >>> l=[['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] > > > >>> l2=[[x[0], x[1:]] for x in l] > > > >>> d = collections.defaultdict(list) > > > >>> for k, v in l2: d[k].extend(v) > > > >>> [[k, v] for k,v in d.iteritems()] > > > [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] > > > > > > What you want are the elements of the final list. > > > > > > > I didn't notice you want > > > > z = [['NM100',1,2,3,4],['NM200',5,6]] > > > > rather than, > > > > z= [['NM100', [1, 2, 3, 4]], ['NM200', [5, 6]]] > > > > So replace last line with, > > > > >>> [[k] + v for k,v in d.iteritems()] > > [['NM100', 1, 2, 3, 4], ['NM200', 5, 6]] > > > > > > > > > --Anand > > > > > > > > > > > > > > > > > > > > -- > > --Anand > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From noufal at gmail.com Tue Jul 27 14:12:02 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Jul 2010 17:42:02 +0530 Subject: [BangPypers] July meetup In-Reply-To: (Anand Balachandran Pillai's message of "Tue, 27 Jul 2010 15:25:44 +0530") References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> Message-ID: <87lj8xjf8t.fsf@gmail.com> Anand Balachandran Pillai writes: > On Tue, Jul 27, 2010 at 3:17 PM, Noufal Ibrahim wrote: > >> Noufal Ibrahim writes: >> >> > So, is 31st fine with everyone? I will attend but am currently tied up >> > with some work related matters. Will someone else take charge of >> > organising this meetup (venue etc.) and collecting the registration >> > money of the offline participants? >> > >> > Anand C. has a setup to mail the offline registrants with the venue >> > etc. so that they can attend (not all of them are on BangPypers) so >> > please let him know as well. >> >> >> Anyone? >> > > > I am tied up myself otherwise would take this up gladly. [...] Is there no one with a little time to take care of this? It just involves a few emails/phone calls to the venue and an email to confirm the date. -- From kpguy1975 at gmail.com Tue Jul 27 15:33:30 2010 From: kpguy1975 at gmail.com (Vikram K) Date: Tue, 27 Jul 2010 19:03:30 +0530 Subject: [BangPypers] nested list help Message-ID: Suppose i have this nested list: >>> x [['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16, 17]] >>> for i in x: ... print i ... ['NM100', 3, 4, 5, 6, 7] ['NM100', 10, 11, 12, 13] ['NM200', 15, 16, 17] >>> how do i obtain from the above the following nested list: >>> z [['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]] >>> for i in z: ... print i ... ['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13] ['NM200', 15, 16, 17] >>> From santrajan at gmail.com Tue Jul 27 16:34:20 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Tue, 27 Jul 2010 20:04:20 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87lj8xjf8t.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> <87lj8xjf8t.fsf@gmail.com> Message-ID: Hi All, This is my first time and I really wish to contribute. I probably can make the phone calls. If you think I can do it send me the list with instructions and I will do the phone calls. Thanks Santosh On Tue, Jul 27, 2010 at 5:42 PM, Noufal Ibrahim wrote: > Anand Balachandran Pillai writes: > > > On Tue, Jul 27, 2010 at 3:17 PM, Noufal Ibrahim > wrote: > > > >> Noufal Ibrahim writes: > >> > >> > So, is 31st fine with everyone? I will attend but am currently tied up > >> > with some work related matters. Will someone else take charge of > >> > organising this meetup (venue etc.) and collecting the registration > >> > money of the offline participants? > >> > > >> > Anand C. has a setup to mail the offline registrants with the venue > >> > etc. so that they can attend (not all of them are on BangPypers) so > >> > please let him know as well. > >> > >> > >> Anyone? > >> > > > > > > I am tied up myself otherwise would take this up gladly. > > [...] > > Is there no one with a little time to take care of this? It just > involves a few emails/phone calls to the venue and an email to confirm > the date. > > > -- > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- http://hi.im/santosh From santrajan at gmail.com Tue Jul 27 19:02:32 2010 From: santrajan at gmail.com (Santosh Rajan) Date: Tue, 27 Jul 2010 22:32:32 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87zkxdl0hs.fsf@gmail.com> References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> Message-ID: Hi All, I have volunteered to help out in setting up this next meetup. This is my first time here, and my first effort. The proposed date and time is 31/07/2010 1600hrs. Proposed venue is Thoughtworks, Diamond district. They have not yet confirmed with me regarding this, However I am in touch with Sriram at ThoughtWorks and I am hopeful that it will be confirmed. In the mean while please let me know if this okay will all of you. And please help me make my first time effort successful. :) Thanks All Santosh From scorpion032 at gmail.com Tue Jul 27 19:18:04 2010 From: scorpion032 at gmail.com (Lakshman Prasad) Date: Tue, 27 Jul 2010 22:48:04 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> Message-ID: Hi, I have been looking forward to attending a BangPypers meet. I am going to be in Bangalore this Saturday and can co-ordinate efforts to help organize it. On Tue, Jul 27, 2010 at 10:32 PM, Santosh Rajan wrote: > Hi All, > > I have volunteered to help out in setting up this next meetup. This is my > first time here, and my first effort. The proposed date and time is > 31/07/2010 1600hrs. > Proposed venue is Thoughtworks, Diamond district. > They have not yet confirmed with me regarding this, However I am in touch > with Sriram at ThoughtWorks and I am hopeful that it will be confirmed. > > In the mean while please let me know if this okay will all of you. > > And please help me make my first time effort successful. :) > Thanks All > Santosh > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From kunalkantsen at gmail.com Tue Jul 27 19:26:53 2010 From: kunalkantsen at gmail.com (kunalkant sen) Date: Tue, 27 Jul 2010 22:56:53 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <87pqyhcmfk.fsf@gmail.com> <87y6d5maqa.fsf@gmail.com> <4C46C664.70107@sudheer.net> <87wrsndhmj.fsf@gmail.com> <4C49489A.6060402@gmail.com> <87iq41mkfy.fsf@gmail.com> <87zkxdl0hs.fsf@gmail.com> Message-ID: Friends, Microsoft also provide space for community meet up. PHP meet up happen often their. Do let me know if you guys need in touch with the concern person. He told me that he would be happy to provide space for community meet up. You can take this as alternate to other venue. The address is Microsoft, ground floor, signature building, EGL, Domlur. They have all setup ready and 50-60 people easily accommodate. I think wifi needs permission, rest everything is available for use. Regards Kunal Kant Sen 09241009423 On Tue, Jul 27, 2010 at 10:32 PM, Santosh Rajan wrote: > Hi All, > > I have volunteered to help out in setting up this next meetup. This is my > first time here, and my first effort. The proposed date and time is > 31/07/2010 1600hrs. > Proposed venue is Thoughtworks, Diamond district. > They have not yet confirmed with me regarding this, However I am in touch > with Sriram at ThoughtWorks and I am hopeful that it will be confirmed. > > In the mean while please let me know if this okay will all of you. > > And please help me make my first time effort successful. :) > Thanks All > Santosh > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From jeffjosejeff at gmail.com Tue Jul 27 21:19:41 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Wed, 28 Jul 2010 00:49:41 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> References: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> Message-ID: On Tue, Jul 27, 2010 at 4:15 PM, Vikram wrote: > > Hi Anand,vijay, and others, > we have python 2.4.3 at our workplace and defaultdict is not present in the > collections module in this python version. > > >>> dir(collections) > ['__doc__', '__file__', '__name__', 'deque'] > >>> > I dont have python 2.4.3 right now to test what I'm going to say, but behaviour of defaultdict can be simulated (correct me if I'm wrong, again because of version freeze I'm never over 2.5.1) using dict.setdefault The way I understand defaultdict is, it never raise a KeyError, instead assumes the default 'value' of every key as the one that you initialize it with (here= list) d = {} and instead of doing d[key_doesnt_exist] = my_values do d.setdefault(key_doesnt_exist, []).extend(my_values) # if key doesnt exist, it returns the default (second argument) .. and you can call methods on it - append, extend .. what have you. I'm assuming you know this already and hence this rather vague description. If you want more pointers just ask I can reply in a much more descriptive way. HTH /jeff From abpillai at gmail.com Wed Jul 28 09:31:34 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Wed, 28 Jul 2010 13:01:34 +0530 Subject: [BangPypers] nested list help In-Reply-To: References: Message-ID: On Tue, Jul 27, 2010 at 7:03 PM, Vikram K wrote: > Suppose i have this nested list: > > >>> x > [['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16, > 17]] > >>> for i in x: > ... print i > ... > ['NM100', 3, 4, 5, 6, 7] > ['NM100', 10, 11, 12, 13] > ['NM200', 15, 16, 17] > >>> > > how do i obtain from the above the following nested list: > > >>> z > [['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]] > >>> for i in z: > ... print i > ... > ['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13] > ['NM200', 15, 16, 17] > >>> > Isn't this the same question you asked in another thread ? Just that the list has more members now. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From vnbang2003 at yahoo.com Wed Jul 28 14:41:27 2010 From: vnbang2003 at yahoo.com (vijay) Date: Wed, 28 Jul 2010 18:11:27 +0530 (IST) Subject: [BangPypers] July meetup Message-ID: <740455.35883.qm@web95304.mail.in2.yahoo.com> missed? Address ???? ThoughtWorks Technologies (India) Pvt Ltd. (map view) ???? 2nd Floor, Tower C, Corporate Block, Diamond District ???? Airport Road ???? Bangalore - 560 008, India ???? t: +91 80 4064 9570 ???? f: +91 80 2508 9584 ???? regards vijay --- On Wed, 28/7/10, vijay wrote: From: vijay Subject: July meetup To: "Bangalore Python Users Group - India" Cc: habibpagarkar at gmail.com Date: Wednesday, 28 July, 2010, 6:08 PM All, ??? we got confirmation from Thoughtworks on venue. ??? Date?? ? ? : 31-july-2010 ??? Timing??? : 1600 hours(4 PM) ??? Duration : 1 hours (expected) regards Vijay From jeffjosejeff at gmail.com Wed Jul 28 21:28:04 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Thu, 29 Jul 2010 00:58:04 +0530 Subject: [BangPypers] nested list help In-Reply-To: References: Message-ID: On Wed, Jul 28, 2010 at 1:01 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > On Tue, Jul 27, 2010 at 7:03 PM, Vikram K wrote: > > > Suppose i have this nested list: > > > > >>> x > > [['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16, > > 17]] > > >>> for i in x: > > ... print i > > ... > > ['NM100', 3, 4, 5, 6, 7] > > ['NM100', 10, 11, 12, 13] > > ['NM200', 15, 16, 17] > > >>> > > > > how do i obtain from the above the following nested list: > > > > >>> z > > [['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]] > > >>> for i in z: > > ... print i > > ... > > ['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13] > > ['NM200', 15, 16, 17] > > >>> > > > > Isn't this the same question you asked in another thread ? Just that > the list has more members now. > > yeah you're right. The same question was posted elsewhere. I hope the author responds to the very many replies he got. > > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > --Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From abpillai at gmail.com Thu Jul 29 05:55:36 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 29 Jul 2010 09:25:36 +0530 Subject: [BangPypers] partial flattening of list In-Reply-To: References: <1280224980.S.10492.50812.F.H.TkFuYW5kIEJhbGFjaGFuZHJhbiBQaWxsYWkAUmU6IFtCYW5nUHlwZXJzXSBwYXJ0aWFsIGZsYXR0ZW5pbmc_.f6-144-156.old.1280227510.23319@webmail.rediffmail.com> Message-ID: On Wed, Jul 28, 2010 at 12:49 AM, Jeffrey Jose wrote: > On Tue, Jul 27, 2010 at 4:15 PM, Vikram wrote: > > > > > Hi Anand,vijay, and others, > > we have python 2.4.3 at our workplace and defaultdict is not present in > the > > collections module in this python version. > > > > >>> dir(collections) > > ['__doc__', '__file__', '__name__', 'deque'] > > >>> > > > > I dont have python 2.4.3 right now to test what I'm going to say, but > behaviour of defaultdict can be simulated (correct me if I'm wrong, again > because of version freeze I'm never over 2.5.1) using dict.setdefault > > > The way I understand defaultdict is, it never raise a KeyError, instead > assumes the default 'value' of every key as the one that you initialize it > with (here= list) > > > > d = {} > > and instead of doing > > d[key_doesnt_exist] = my_values > > do > > d.setdefault(key_doesnt_exist, []).extend(my_values) > > Yes, this approach works if you haven't got collections.defaultdict. >>> l=[['NM100', 1, 2], ['NM100', 3, 4], ['NM200', 5, 6]] >>> d={} >>> l2=[[x[0], x[1:]] for x in l] >>> for k,v in l2: d.setdefault(k,[]).extend(v) ... >>> d {'NM100': [1, 2, 3, 4], 'NM200': [5, 6]} > # if key doesnt exist, it returns the default (second argument) .. and you > can call methods on it - append, extend .. what have you. > > > I'm assuming you know this already and hence this rather vague description. > If you want more pointers just ask I can reply in a much more descriptive > way. > > HTH > /jeff > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From gopalakrishnan.subramani at gmail.com Thu Jul 29 08:38:58 2010 From: gopalakrishnan.subramani at gmail.com (Gopalakrishnan Subramani) Date: Thu, 29 Jul 2010 12:08:58 +0530 Subject: [BangPypers] python speed comparison In-Reply-To: References: Message-ID: IronPython (on .NET) and Jython (on Java) capable to use the multi core processors in your PC and they works faster than the CPython. Beware that not all the python packages shall be working with IronPython or Jython. Regards, Krish, http://www.stacked.in From habibpagarkar at gmail.com Thu Jul 29 08:56:19 2010 From: habibpagarkar at gmail.com (Habibullah Pagarkar) Date: Thu, 29 Jul 2010 12:26:19 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <740455.35883.qm@web95304.mail.in2.yahoo.com> Message-ID: Hello folks, Slight change of plans. The builders at our Domlur office want to perform some electrical maintenance work this weekend. I hope meeting at the Koramangala office instead at the same time wouldn't be too inconvenient. The address: ThoughtWorks Technologies (India) Pvt Ltd. view map ACR Mansion, 2nd floor, 147/F, 8th Main Rd. 3rd Block, Koramangala Bangalore - 560 034, India t: +91 80 4323 3700 f: +91 80 4323 3706 Directions: While going south on Inner Ring road, take a right at the Ooty Chocolates junction. Keep going down that road for 1 km. You'll see a "Sathya's Bar" on your right. Take a right at that intersection. The ThoughtWorks office is in that building. You'll have to sign in with reception on the 2nd floor and then proceed to the 3rd floor. The room that we'll meet up is called "Ajanta". The security guard should help you get there. I'll also be there and you can call me at 9611809292. Sorry for the last minute confusion. Habib On Wed, Jul 28, 2010 at 6:11 PM, vijay wrote: > >> missed Address >> >> ThoughtWorks Technologies (India) Pvt Ltd. (map >> view >> ) >> 2nd Floor, Tower C, Corporate Block, Diamond District >> Airport Road >> Bangalore - 560 008, India >> t: +91 80 4064 9570 >> f: +91 80 2508 9584 >> >> >> regards >> vijay >> >> >> --- On *Wed, 28/7/10, vijay * wrote: >> >> >> From: vijay >> Subject: July meetup >> To: "Bangalore Python Users Group - India" >> Cc: habibpagarkar at gmail.com >> Date: Wednesday, 28 July, 2010, 6:08 PM >> >> >> All, >> we got confirmation from Thoughtworks on venue. >> Date : 31-july-2010 >> Timing : 1600 hours(4 PM) >> Duration : 1 hours (expected) >> >> regards >> Vijay >> >> >> >> >> > > > -- > Habibullah Pagarkar > habibpagarkar at gmail.com > > http://www.cs.jhu.edu/~habib > http://habib.posterous.com/ > http://twitter.com/mhabibp > -- Habibullah Pagarkar habibpagarkar at gmail.com http://www.cs.jhu.edu/~habib http://habib.posterous.com/ http://twitter.com/mhabibp From vnbang2003 at yahoo.com Thu Jul 29 10:33:31 2010 From: vnbang2003 at yahoo.com (vijay) Date: Thu, 29 Jul 2010 01:33:31 -0700 (PDT) Subject: [BangPypers] July meetup In-Reply-To: Message-ID: <852499.59215.qm@web95301.mail.in2.yahoo.com> All, ??? Do let me know if this is fine with every one. with regardsvijay --- On Thu, 29/7/10, Habibullah Pagarkar wrote: From: Habibullah Pagarkar Subject: Re: July meetup To: vnbang2003 at yahoo.com Cc: "Bangalore Python Users Group - India" Date: Thursday, 29 July, 2010, 12:26 PM Hello folks, Slight change of plans. The builders at our Domlur office want to perform some electrical maintenance work this weekend. I hope meeting at the Koramangala office instead at the same time wouldn't be too inconvenient. The address: ThoughtWorks Technologies (India) Pvt Ltd. view map ACR Mansion, 2nd floor, 147/F, 8th Main Rd. 3rd Block, Koramangala Bangalore - 560 034, India t: +91 80 4323 3700 f: +91 80 4323 3706 Directions: While going south on Inner Ring road, take a right at the Ooty Chocolates junction. Keep going down that road for 1 km. You'll see a "Sathya's Bar" on your right. Take a right at that intersection. The ThoughtWorks office is in that building. You'll have to sign in with reception on the 2nd floor and then proceed to the 3rd floor. The room that we'll meet up is called "Ajanta". The security guard should help you get there. I'll also be there and you can call me at 9611809292. Sorry for the last minute confusion. Habib On Wed, Jul 28, 2010 at 6:11 PM, vijay wrote: missed? Address ???? ThoughtWorks Technologies (India) Pvt Ltd. (map view) ???? 2nd Floor, Tower C, Corporate Block, Diamond District ???? Airport Road ???? Bangalore - 560 008, India ???? t: +91 80 4064 9570 ???? f: +91 80 2508 9584 ???? regards vijay --- On Wed, 28/7/10, vijay wrote: From: vijay Subject: July meetup To: "Bangalore Python Users Group - India" Cc: habibpagarkar at gmail.com Date: Wednesday, 28 July, 2010, 6:08 PM All, ??? we got confirmation from Thoughtworks on venue. ??? Date?? ? ? : 31-july-2010 ??? Timing??? : 1600 hours(4 PM) ??? Duration : 1 hours (expected) regards Vijay -- Habibullah Pagarkar habibpagarkar at gmail.com http://www.cs.jhu.edu/~habib http://habib.posterous.com/ http://twitter.com/mhabibp -- Habibullah Pagarkar habibpagarkar at gmail.com http://www.cs.jhu.edu/~habib http://habib.posterous.com/ http://twitter.com/mhabibp From nitin.nitp at gmail.com Thu Jul 29 10:48:02 2010 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Thu, 29 Jul 2010 14:18:02 +0530 Subject: [BangPypers] how to delete base class attribute Message-ID: Hi all, Say I have 10 functions in base class and I have inherited it in some derived class. But I only want 9 of the base class function to be available in child class. (and I don?t want to make that one class private) class x: def __init__(self): self.a =3 self.b= 4 def A(self): print (self.a) def B(self): print (self.b) class y(x): def __init__(self): x.__init__(self) del (self.A) #This is giving del (self.A) AttributeError: A Anticipating your reply soon. -- Nitin K From steve at lonetwin.net Thu Jul 29 12:09:01 2010 From: steve at lonetwin.net (steve) Date: Thu, 29 Jul 2010 15:39:01 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: <4C51533D.6070703@lonetwin.net> Hi Nitin, On 07/29/2010 02:18 PM, Nitin Kumar wrote: > Hi all, > > > > Say I have 10 functions in base class and I have inherited it in some > derived class. > > But I only want 9 of the base class function to be available in child class. > (and I don?t want to make that one class private) > > Python encourages clear design by not providing facilities to /enforce/ policies as part of the language. That's the reason why there are no public/protected/private keywords in python. There are only conventions to be followed. Here are some possible solutions: a. Are you sure you got your class hierarchy right ? If one class needs all the methods of the other except one, the one with the most commonality should probably be the base class. In your case, it would be flipping the hierarchy on it' head. b. If some method is 'special' to a class name it using leading and trailing '__' so that users deriving from the class know it is special. c. This is now going into hacky territory -- if you decide to keep the same hierarchy as you have now, assign self.A in class 'y' to None[1] or explicitly implement it to raise an AttributeError[2]. The reason you cannot 'del' self.A is precisely because of what the error says "AttributeError: y instance has no attribute 'A'" -- A is just a 'bound' method to the object, not an attribute of the object and AFAICT there is no way to un-bind something off an object. [1] class y(x): def __init__(self): super(y, self).__init__() # btw, use super if possible self.A = None [2] class y(x): def __init__(self): ... def A(self): raise AttributeError("y instance has no attribute A") hth, cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From sibtey.mehndi at genpact.com Thu Jul 29 11:43:32 2010 From: sibtey.mehndi at genpact.com (Mehndi, Sibtey) Date: Thu, 29 Jul 2010 15:13:32 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: Nitin, del can only remove the elements present in the instance dictionary. If you check self.__dict__ then it shows that A is not in the dictionary only 'a' and 'b' exist in the dict that's why it is giving the attribute error. Sibtey -----Original Message----- From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto:bangpypers-bounces+sibtey.mehndi=genpact.com at python.org] On Behalf Of Nitin Kumar Sent: Thursday, July 29, 2010 2:18 PM To: Bangalore Python Users Group - India Subject: [BangPypers] how to delete base class attribute Hi all, Say I have 10 functions in base class and I have inherited it in some derived class. But I only want 9 of the base class function to be available in child class. (and I don't want to make that one class private) class x: def __init__(self): self.a =3 self.b= 4 def A(self): print (self.a) def B(self): print (self.b) class y(x): def __init__(self): x.__init__(self) del (self.A) #This is giving del (self.A) AttributeError: A Anticipating your reply soon. -- Nitin K _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person. From noufal at gmail.com Thu Jul 29 12:36:42 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 29 Jul 2010 16:06:42 +0530 Subject: [BangPypers] July meetup In-Reply-To: <852499.59215.qm@web95301.mail.in2.yahoo.com> (vijay's message of "Thu, 29 Jul 2010 01:33:31 -0700 (PDT)") References: <852499.59215.qm@web95301.mail.in2.yahoo.com> Message-ID: <87vd7y8thh.fsf@gmail.com> vijay writes: > All, > ??? Do let me know if this is fine with every one. [...] Fine by me. +1. -- From nitin.nitp at gmail.com Thu Jul 29 12:54:13 2010 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Thu, 29 Jul 2010 16:24:13 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: fine, but isn't there any way to hide few function of base class into derived one??? On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey wrote: > Nitin, > del can only remove the elements present in the instance > dictionary. If you check self.__dict__ then it shows that A is not in the > dictionary only 'a' and 'b' exist in the dict that's why it is giving the > attribute error. > > > Sibtey > > -----Original Message----- > From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto: > bangpypers-bounces+sibtey.mehndi = > genpact.com at python.org] On Behalf Of Nitin Kumar > Sent: Thursday, July 29, 2010 2:18 PM > To: Bangalore Python Users Group - India > Subject: [BangPypers] how to delete base class attribute > > Hi all, > > > > Say I have 10 functions in base class and I have inherited it in some > derived class. > > But I only want 9 of the base class function to be available in child > class. > (and I don't want to make that one class private) > > > > class x: > > def __init__(self): > > self.a =3 > > self.b= 4 > > def A(self): > > print (self.a) > > def B(self): > > print (self.b) > > > > class y(x): > > def __init__(self): > > x.__init__(self) > > del (self.A) #This is giving del > (self.A) > > AttributeError: A > > > > > > Anticipating your reply soon. > > -- > Nitin K > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > This e-mail (and any attachments), is confidential and may be privileged. > It may be read, copied and used only > by intended recipients. Unauthorized access to this e-mail (or attachments) > and disclosure or copying of its > contents or any action taken in reliance on it is unlawful. Unintended > recipients must notify the sender immediately > by e-mail/phone & delete it from their system without making any copies or > disclosing it to a third person. > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Nitin K From srinivas_thatiparthy at akebonosoft.com Thu Jul 29 13:16:09 2010 From: srinivas_thatiparthy at akebonosoft.com (Srinivas Reddy Thatiparthy) Date: Thu, 29 Jul 2010 16:46:09 +0530 Subject: [BangPypers] how to delete base class attribute References: Message-ID: <4EF2BF691B890546B2694C99A2852F0C01D83464@astserver3.akebonosoft.com> >>fine, but isn't there any way to hide few function of base class into >>derived one??? I didn't get what is meant by hiding? You can override the function/method of base class in sub class. In that method, you can modify the behaviour for subclass or raise an exception or simply include 'pass'. Anyway, deleting any property of a class in it's subclasses clearly violates the liksov substitution principle. From anandology at gmail.com Thu Jul 29 13:22:27 2010 From: anandology at gmail.com (Anand Chitipothu) Date: Thu, 29 Jul 2010 16:52:27 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <740455.35883.qm@web95304.mail.in2.yahoo.com> Message-ID: 2010/7/29 Habibullah Pagarkar : > Hello folks, > > Slight change of plans. The builders at our Domlur office want to perform > some electrical maintenance work this weekend. I hope meeting at the > Koramangala office instead at the same time wouldn't be too inconvenient. > > The address: > > ThoughtWorks Technologies (India) Pvt Ltd. view > map > ACR Mansion, 2nd floor, 147/F, 8th Main Rd. > 3rd Block, Koramangala > Bangalore - 560 034, India > t: +91 80 4323 3700 > f: +91 80 4323 3706 > > Directions: While going south on Inner Ring road, take a right at the Ooty > Chocolates junction. Keep going down that road for 1 km. You'll see a > "Sathya's Bar" on your right. Take a right at that intersection. The > ThoughtWorks office is in that building. You'll have to sign in with > reception on the 2nd floor and then proceed to the 3rd floor. The room that > we'll meet up is called "Ajanta". The security guard should help you get > there. I'll also be there and you can call me at 9611809292. > > Sorry for the last minute confusion. Here is a tinyurl for the map. http://tinyurl.com/thoughtworks-koramangala-map Anand From mdevan.foobar at gmail.com Thu Jul 29 14:03:23 2010 From: mdevan.foobar at gmail.com (Mahadevan R) Date: Thu, 29 Jul 2010 17:33:23 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: On Thu, Jul 29, 2010 at 4:24 PM, Nitin Kumar wrote: > fine, but isn't there any way to hide few function of base class into > derived one??? You can try obscuring it: class y(x): def __init__(self): x.__init__(self) self.A = None Cheers, -MD. From anandology at gmail.com Thu Jul 29 14:26:24 2010 From: anandology at gmail.com (Anand Chitipothu) Date: Thu, 29 Jul 2010 17:56:24 +0530 Subject: [BangPypers] July meetup In-Reply-To: <87vd7y8thh.fsf@gmail.com> References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: 2010/7/29 Noufal Ibrahim : > vijay writes: > >> All, >> ??? Do let me know if this is fine with every one. > > [...] > > Fine by me. +1. Is the venue final then? I've not seen may +1s. I need to send a mail to offline registrants about the usergroup meeting. I'm out of city right now and won't be able to make the meeting. Anand From vnbang2003 at yahoo.com Thu Jul 29 14:32:55 2010 From: vnbang2003 at yahoo.com (vijay) Date: Thu, 29 Jul 2010 18:02:55 +0530 (IST) Subject: [BangPypers] July meetup In-Reply-To: Message-ID: <359834.73340.qm@web95304.mail.in2.yahoo.com> Venue is final --- vijay --- On Thu, 29/7/10, Anand Chitipothu wrote: From: Anand Chitipothu Subject: Re: [BangPypers] July meetup To: "Bangalore Python Users Group - India" Date: Thursday, 29 July, 2010, 5:56 PM 2010/7/29 Noufal Ibrahim : > vijay writes: > >> All, >> ??? Do let me know if this is fine with every one. > > [...] > > Fine by me. +1. Is the venue final then? I've not seen may +1s. I need to send a mail to offline registrants about the usergroup meeting. I'm out of city right now and won't be able to make the meeting. Anand _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers From kunalkantsen at gmail.com Thu Jul 29 14:35:52 2010 From: kunalkantsen at gmail.com (kunalkant sen) Date: Thu, 29 Jul 2010 18:05:52 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: This time it wont possible in Microsoft. I spoke to him and he willing to help out from next time. They need atleast one week advance notice for meet up to arrange and for security clearance. Keep MS as alternative from next time. Regards Kunal Kant Sen 09241009423 On Thu, Jul 29, 2010 at 5:56 PM, Anand Chitipothu wrote: > 2010/7/29 Noufal Ibrahim : > > vijay writes: > > > >> All, > >> Do let me know if this is fine with every one. > > > > [...] > > > > Fine by me. +1. > > Is the venue final then? I've not seen may +1s. > > I need to send a mail to offline registrants about the usergroup meeting. > > I'm out of city right now and won't be able to make the meeting. > > Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From abpillai at gmail.com Thu Jul 29 15:04:12 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 29 Jul 2010 18:34:12 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: On Thu, Jul 29, 2010 at 5:33 PM, Mahadevan R wrote: > On Thu, Jul 29, 2010 at 4:24 PM, Nitin Kumar wrote: > > fine, but isn't there any way to hide few function of base class into > > derived one??? > > You can try obscuring it: > > class y(x): > def __init__(self): > x.__init__(self) > self.A = None > Trying to do something like this in Python shows a mistake in the design of your classes. There are different ways to do this in Python. Here are a few. 1. Prefix the function with double underscore ('__') as steve said in his email. 2. Override the function accessing method using a decorator and put the logic in the decorator to return None if a specific function is accessed. 3. Raise NotImplementedError if the calling class is not the super class. I have given sample code for (3) here. class A(object): def f1(self): print 'Hi' def f2(self, x): if self.__class__.__name__ != 'A': raise NotImplementedError print x class B(A): pass if __name__ == "__main__": a=A() a.f1() a.f2(10) b=B() b.f1() # Will raise exception b.f2(20) However it is better to look at why you need it than to use any of these approaches and correct that requirement. Normally in Python, you never need a requirement like this. HTH. --Anand > > Cheers, > -MD. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From abpillai at gmail.com Thu Jul 29 15:07:58 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Thu, 29 Jul 2010 18:37:58 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: On Thu, Jul 29, 2010 at 5:56 PM, Anand Chitipothu wrote: > 2010/7/29 Noufal Ibrahim : > > vijay writes: > > > >> All, > >> Do let me know if this is fine with every one. > > > > [...] > > > > Fine by me. +1. > > Is the venue final then? I've not seen may +1s. > > I need to send a mail to offline registrants about the usergroup meeting. > > I'm out of city right now and won't be able to make the meeting. > +1 from me. Koramangala is a short drive from Thoughtworks. > > Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From scorpion032 at gmail.com Fri Jul 30 19:58:54 2010 From: scorpion032 at gmail.com (Lakshman Prasad) Date: Fri, 30 Jul 2010 23:28:54 +0530 Subject: [BangPypers] Request for session Message-ID: I would find a talk on the lines of "Data Structures and Algorithms using Python" interesting. No body has submitted it so far: http://in.pycon.org/2010/talks I am sure there are people on this list that have expertise to do that. I am just planting an idea and encouraging someone to do that! The talk could discuss about all aspects of Trees, linked lists, O(n) etc, as can be reviewed quickly in pseudo code using this book: http://dotnetslackers.com/Community/files/folders/data-structures-and-algorithms/entry30283.aspx From orsenthil at gmail.com Fri Jul 30 20:05:55 2010 From: orsenthil at gmail.com (Senthil Kumaran) Date: Fri, 30 Jul 2010 23:35:55 +0530 Subject: [BangPypers] Request for session In-Reply-To: References: Message-ID: On Fri, Jul 30, 2010 at 11:28 PM, Lakshman Prasad wrote: > > I would find a talk on the lines of "Data Structures and Algorithms using > Python" interesting. No body has submitted it so far: > http://in.pycon.org/2010/talks http://uthcode.googlecode.com/files/pyconindia2009.zip We had it last year. See if you or any of your friends would like to do it. Feel free to use the same material. -- Senthil From anand.shashwat at gmail.com Fri Jul 30 20:10:53 2010 From: anand.shashwat at gmail.com (Shashwat Anand) Date: Fri, 30 Jul 2010 23:40:53 +0530 Subject: [BangPypers] Request for session In-Reply-To: References: Message-ID: On Fri, Jul 30, 2010 at 11:28 PM, Lakshman Prasad wrote: > I would find a talk on the lines of "Data Structures and Algorithms using > Python" interesting. No body has submitted it so far: > http://in.pycon.org/2010/talks Senthil gave a talk last year on 'DS and Algorithms'. Also my talk covers a particular Data Structure. It is not general but it is related. I even tagged it 'data structures, newbie' > > > I am sure there are people on this list that have expertise to do that. I > am > just planting an idea and encouraging someone to do that! > > The talk could discuss about all aspects of Trees, linked lists, O(n) etc, > as can be reviewed quickly in pseudo code using this book: > > http://dotnetslackers.com/Community/files/folders/data-structures-and-algorithms/entry30283.aspx > _______________________________________________ > From admin.nitjece at gmail.com Sat Jul 31 12:22:29 2010 From: admin.nitjece at gmail.com (Diptanu Choudhury) Date: Sat, 31 Jul 2010 15:52:29 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: +1 see you guys! On Jul 29, 2010 6:49 PM, "Anand Balachandran Pillai" wrote: > On Thu, Jul 29, 2010 at 5:56 PM, Anand Chitipothu wrote: > >> 2010/7/29 Noufal Ibrahim : >> > vijay writes: >> > >> >> All, >> >> Do let me know if this is fine with every one. >> > >> > [...] >> > >> > Fine by me. +1. >> >> Is the venue final then? I've not seen may +1s. >> >> I need to send a mail to offline registrants about the usergroup meeting. >> >> I'm out of city right now and won't be able to make the meeting. >> > > +1 from me. Koramangala is a short drive from Thoughtworks. > > >> >> Anand >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > > > -- > --Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers From abpillai at gmail.com Sat Jul 31 15:22:39 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Sat, 31 Jul 2010 18:52:39 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: > > > > +1 from me. Koramangala is a short drive from Thoughtworks. > I couldn't make it due to personal reasons. Waiting for an post on what happened. > > > > > >> > >> Anand > >> _______________________________________________ > >> BangPypers mailing list > >> BangPypers at python.org > >> http://mail.python.org/mailman/listinfo/bangpypers > >> > > > > > > > > -- > > --Anand > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > -- --Anand From manish at indiakhelo.com Sat Jul 31 15:55:05 2010 From: manish at indiakhelo.com (Manish Singh) Date: Sat, 31 Jul 2010 19:25:05 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: +1 (i am a newbie and would be glad to be a part of it) The timing is 4.00 pm right? Thanks Manish On Sat, Jul 31, 2010 at 6:52 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > > > > > > +1 from me. Koramangala is a short drive from Thoughtworks. > > > > I couldn't make it due to personal reasons. Waiting for > an post on what happened. > > > > > > > > > > >> > > >> Anand > > >> _______________________________________________ > > >> BangPypers mailing list > > >> BangPypers at python.org > > >> http://mail.python.org/mailman/listinfo/bangpypers > > >> > > > > > > > > > > > > -- > > > --Anand > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers at python.org > > > http://mail.python.org/mailman/listinfo/bangpypers > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > > -- > --Anand > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From manish at indiakhelo.com Sat Jul 31 16:10:50 2010 From: manish at indiakhelo.com (Manish Singh) Date: Sat, 31 Jul 2010 19:40:50 +0530 Subject: [BangPypers] July meetup In-Reply-To: References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: Oops thought that the meet was tomorrow. Will be there next time for sure Manish On Sat, Jul 31, 2010 at 7:25 PM, Manish Singh wrote: > +1 (i am a newbie and would be glad to be a part of it) > The timing is 4.00 pm right? > > Thanks > Manish > > > On Sat, Jul 31, 2010 at 6:52 PM, Anand Balachandran Pillai < > abpillai at gmail.com> wrote: > >> > > >> > > +1 from me. Koramangala is a short drive from Thoughtworks. >> > >> >> I couldn't make it due to personal reasons. Waiting for >> an post on what happened. >> >> >> > > >> > > >> > >> >> > >> Anand >> > >> _______________________________________________ >> > >> BangPypers mailing list >> > >> BangPypers at python.org >> > >> http://mail.python.org/mailman/listinfo/bangpypers >> > >> >> > > >> > > >> > > >> > > -- >> > > --Anand >> > > _______________________________________________ >> > > BangPypers mailing list >> > > BangPypers at python.org >> > > http://mail.python.org/mailman/listinfo/bangpypers >> > _______________________________________________ >> > BangPypers mailing list >> > BangPypers at python.org >> > http://mail.python.org/mailman/listinfo/bangpypers >> > >> > >> >> >> -- >> --Anand >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > From scorpion032 at gmail.com Sat Jul 31 16:21:52 2010 From: scorpion032 at gmail.com (Lakshman Prasad) Date: Sat, 31 Jul 2010 19:51:52 +0530 Subject: [BangPypers] Request for session In-Reply-To: References: Message-ID: Very interesting indeed that we had it last year. Perhaps you should do it again this year. At least I'd love it, if you did! > See if you or any of your friends would like to do it. As much as I would have loved to, my bandwidth is already taken off for another talk I submitted, which is specifically in my area of expertise. On Fri, Jul 30, 2010 at 11:35 PM, Senthil Kumaran wrote: > On Fri, Jul 30, 2010 at 11:28 PM, Lakshman Prasad > wrote: > > > > I would find a talk on the lines of "Data Structures and Algorithms using > > Python" interesting. No body has submitted it so far: > > http://in.pycon.org/2010/talks > > http://uthcode.googlecode.com/files/pyconindia2009.zip > > We had it last year. See if you or any of your friends would like to do it. > Feel free to use the same material. > > -- > Senthil > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From noufal at gmail.com Sat Jul 31 18:55:55 2010 From: noufal at gmail.com (Noufal Ibrahim) Date: Sat, 31 Jul 2010 22:25:55 +0530 Subject: [BangPypers] July meetup In-Reply-To: (Anand Balachandran Pillai's message of "Sat, 31 Jul 2010 18:52:39 +0530") References: <852499.59215.qm@web95301.mail.in2.yahoo.com> <87vd7y8thh.fsf@gmail.com> Message-ID: <87sk2z4mlg.fsf@gmail.com> Anand Balachandran Pillai writes: >> > >> > +1 from me. Koramangala is a short drive from Thoughtworks. >> > > I couldn't make it due to personal reasons. Waiting for > an post on what happened. [...] Nothing in particular to mention. There were quite a few students. We collected 5 registration fees (Rs. 250 each). I picked up the ZeOmega cheque. I'll endorse it and drop it at an ATM tomorrow. -- From jeffjosejeff at gmail.com Sat Jul 31 20:24:44 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Sat, 31 Jul 2010 23:54:44 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: On Thu, Jul 29, 2010 at 6:34 PM, Anand Balachandran Pillai < abpillai at gmail.com> wrote: > On Thu, Jul 29, 2010 at 5:33 PM, Mahadevan R >wrote: > > > On Thu, Jul 29, 2010 at 4:24 PM, Nitin Kumar > wrote: > > > fine, but isn't there any way to hide few function of base class into > > > derived one??? > > > > You can try obscuring it: > > > > class y(x): > > def __init__(self): > > x.__init__(self) > > self.A = None > > > > Trying to do something like this in Python shows a mistake > in the design of your classes. There are different ways to > do this in Python. Here are a few. > > 1. Prefix the function with double underscore ('__') > as steve said in his email. > I echo the same sentiments as Anand and Steve. If your class inherits from something, its assumed the child class is of the same `kind` as the parent. What you're asking sounds like this, I have a `Vehicle` class which can `drive()`, now I wanna subclass `Car`, but my `Car` doesnt implement `drive()` method. Having said that, I'll add another method to restrict access to this odd-function using __getattribute__. What is __getattribute__ ? Whenever you do access an attribute, be it for a function or an attribute (like obj.foo() or obj.value), obj.__getattribute__ is called. Things are really a little more involved than the simple explanation I wrote, but for this case you just need to know that much. class Parent(object): def childShouldntCallMe(self): doParentStuff() class Child(Parent): def __getattribute__(self, name): if name == "childShouldntCallMe": raise RestrictedAccessError # This could be a more polite NotImplementedError else: return super(Child, self).__getattribute__(name) /jeff From jeffjosejeff at gmail.com Sat Jul 31 20:27:54 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Sat, 31 Jul 2010 23:57:54 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey wrote: > Nitin, > del can only remove the elements present in the instance > dictionary. If you check self.__dict__ then it shows that A is not in the > dictionary only 'a' and 'b' exist in the dict that's why it is giving the > attribute error. > > > Sibtey > To add to what Sibtey already finely explained, The only valid use case of del/ __del__ happens to be cleaning up the namespace if you're writing a module. Every other use case of del/__del__ might or might not work. /jeff > > -----Original Message----- > From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto: > bangpypers-bounces+sibtey.mehndi = > genpact.com at python.org] On Behalf Of Nitin Kumar > Sent: Thursday, July 29, 2010 2:18 PM > To: Bangalore Python Users Group - India > Subject: [BangPypers] how to delete base class attribute > > Hi all, > > > > Say I have 10 functions in base class and I have inherited it in some > derived class. > > But I only want 9 of the base class function to be available in child > class. > (and I don't want to make that one class private) > > > > class x: > > def __init__(self): > > self.a =3 > > self.b= 4 > > def A(self): > > print (self.a) > > def B(self): > > print (self.b) > > > > class y(x): > > def __init__(self): > > x.__init__(self) > > del (self.A) #This is giving del > (self.A) > > AttributeError: A > > > > > > Anticipating your reply soon. > > -- > Nitin K > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > This e-mail (and any attachments), is confidential and may be privileged. > It may be read, copied and used only > by intended recipients. Unauthorized access to this e-mail (or attachments) > and disclosure or copying of its > contents or any action taken in reliance on it is unlawful. Unintended > recipients must notify the sender immediately > by e-mail/phone & delete it from their system without making any copies or > disclosing it to a third person. > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From nitin.nitp at gmail.com Sat Jul 31 20:41:39 2010 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Sun, 1 Aug 2010 00:11:39 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: Thanks Jeffrey, I have one more query, but i am not able to explain you. will send u a mail in few min. Thanks On Sat, Jul 31, 2010 at 11:57 PM, Jeffrey Jose wrote: > On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey > wrote: > > > Nitin, > > del can only remove the elements present in the instance > > dictionary. If you check self.__dict__ then it shows that A is not in the > > dictionary only 'a' and 'b' exist in the dict that's why it is giving the > > attribute error. > > > > > > Sibtey > > > > To add to what Sibtey already finely explained, > > The only valid use case of del/ __del__ happens to be cleaning up the > namespace if you're writing a module. Every other use case of del/__del__ > might or might not work. > > /jeff > > > > > > -----Original Message----- > > From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto: > > bangpypers-bounces+sibtey.mehndi = > > genpact.com at python.org] On Behalf Of Nitin Kumar > > Sent: Thursday, July 29, 2010 2:18 PM > > To: Bangalore Python Users Group - India > > Subject: [BangPypers] how to delete base class attribute > > > > Hi all, > > > > > > > > Say I have 10 functions in base class and I have inherited it in some > > derived class. > > > > But I only want 9 of the base class function to be available in child > > class. > > (and I don't want to make that one class private) > > > > > > > > class x: > > > > def __init__(self): > > > > self.a =3 > > > > self.b= 4 > > > > def A(self): > > > > print (self.a) > > > > def B(self): > > > > print (self.b) > > > > > > > > class y(x): > > > > def __init__(self): > > > > x.__init__(self) > > > > del (self.A) #This is giving > del > > (self.A) > > > > AttributeError: A > > > > > > > > > > > > Anticipating your reply soon. > > > > -- > > Nitin K > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > This e-mail (and any attachments), is confidential and may be privileged. > > It may be read, copied and used only > > by intended recipients. Unauthorized access to this e-mail (or > attachments) > > and disclosure or copying of its > > contents or any action taken in reliance on it is unlawful. Unintended > > recipients must notify the sender immediately > > by e-mail/phone & delete it from their system without making any copies > or > > disclosing it to a third person. > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Nitin K From jeffjosejeff at gmail.com Sat Jul 31 20:51:31 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Sun, 1 Aug 2010 00:21:31 +0530 Subject: [BangPypers] how to delete base class attribute In-Reply-To: References: Message-ID: On Sun, Aug 1, 2010 at 12:11 AM, Nitin Kumar wrote: > Thanks Jeffrey, > > I have one more query, but i am not able to explain you. > will send u a mail in few min. > > Thanks > I recommend sending mails to the whole group if your mail is a followup to the original problem. The purpose is 2 fold, 1. You'll get more eyeballs -> more quality responses. 2. We can document it more formally so that someone later on can browse mail archives. /jeff > On Sat, Jul 31, 2010 at 11:57 PM, Jeffrey Jose >wrote: > > > On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey > > wrote: > > > > > Nitin, > > > del can only remove the elements present in the instance > > > dictionary. If you check self.__dict__ then it shows that A is not in > the > > > dictionary only 'a' and 'b' exist in the dict that's why it is giving > the > > > attribute error. > > > > > > > > > Sibtey > > > > > > > To add to what Sibtey already finely explained, > > > > The only valid use case of del/ __del__ happens to be cleaning up the > > namespace if you're writing a module. Every other use case of del/__del__ > > might or might not work. > > > > /jeff > > > > > > > > > > -----Original Message----- > > > From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto: > > > bangpypers-bounces+sibtey.mehndi = > > > genpact.com at python.org] On Behalf Of Nitin Kumar > > > Sent: Thursday, July 29, 2010 2:18 PM > > > To: Bangalore Python Users Group - India > > > Subject: [BangPypers] how to delete base class attribute > > > > > > Hi all, > > > > > > > > > > > > Say I have 10 functions in base class and I have inherited it in some > > > derived class. > > > > > > But I only want 9 of the base class function to be available in child > > > class. > > > (and I don't want to make that one class private) > > > > > > > > > > > > class x: > > > > > > def __init__(self): > > > > > > self.a =3 > > > > > > self.b= 4 > > > > > > def A(self): > > > > > > print (self.a) > > > > > > def B(self): > > > > > > print (self.b) > > > > > > > > > > > > class y(x): > > > > > > def __init__(self): > > > > > > x.__init__(self) > > > > > > del (self.A) #This is giving > > del > > > (self.A) > > > > > > AttributeError: A > > > > > > > > > > > > > > > > > > Anticipating your reply soon. > > > > > > -- > > > Nitin K > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers at python.org > > > http://mail.python.org/mailman/listinfo/bangpypers > > > This e-mail (and any attachments), is confidential and may be > privileged. > > > It may be read, copied and used only > > > by intended recipients. Unauthorized access to this e-mail (or > > attachments) > > > and disclosure or copying of its > > > contents or any action taken in reliance on it is unlawful. Unintended > > > recipients must notify the sender immediately > > > by e-mail/phone & delete it from their system without making any copies > > or > > > disclosing it to a third person. > > > > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers at python.org > > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > Nitin K > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From jeffjosejeff at gmail.com Sat Jul 31 20:57:03 2010 From: jeffjosejeff at gmail.com (Jeffrey Jose) Date: Sun, 1 Aug 2010 00:27:03 +0530 Subject: [BangPypers] pycon hacksessions? In-Reply-To: References: Message-ID: As a person whos new to the whole scene, when you say "Hacksessions" what is it exactly ? And what happens in a Hacksession? /jeff On Thu, Jul 22, 2010 at 8:17 PM, Zubin Mithra wrote: > Hey everyone, > > I could'nt find any info on whether or not hack sessions are going to be > conducted as part of Pycon. Did I miss something(in the case that we > *are *having > them) or is there a reason we could'nt have them? > > Cheers, > zm > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From nitin.nitp at gmail.com Sat Jul 31 21:20:27 2010 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Sun, 1 Aug 2010 00:50:27 +0530 Subject: [BangPypers] how to handle attribute access Message-ID: Hi, I am working on automating some application. In one window say i have two ComboBox, but that window have scroll bar. Only one combo Box is visible at one time. I have functions to handle scroll of window. What i want is that how to handle attributes so that one i want to set some value in the combobox which is not visible, then first that scroll function is called then the comboBox will do what ever is required. I will try to explain using one example. class window: def __init__(self): self.CB1 = cbObject #CB1 is one combobox object (to do different task on Combo Box) #this is visible once scroll bar on top self.CB2 = cbObject #CB1 is 2nd combobox object (to do different task on Combo Box) #this is visible once scroll bar on bottom def scroll Up(self): ...................... def scrollBottom(self): ...................... #these above two functions can be used to scroll up and down. use: w=window() w.CB1.Select(val) w.CB2.Select(val) Now to set value in wnd comboBox in need to scroll down first. This thing i want to handle in class. Can i use metaclass (i dont know much about this) or __getattr__ for the same. point to note: CB1 or CB2 are objects not functions. So i don't know if I can over load that to achieve the purpose. Thanks Nitin K From zubin.mithra at gmail.com Sat Jul 31 21:23:34 2010 From: zubin.mithra at gmail.com (Zubin Mithra) Date: Sun, 1 Aug 2010 00:53:34 +0530 Subject: [BangPypers] pycon hacksessions? In-Reply-To: References: Message-ID: On Sun, Aug 1, 2010 at 12:27 AM, Jeffrey Jose wrote: > As a person whos new to the whole scene, when you say "Hacksessions" what > is it exactly ? > > And what happens in a Hacksession? > What I meant was that it would be really nice to work on something towards the end of the whole event or the end of each day. Maybe a person who might be giving a talk about an open source project of his could sit around with a few others who are also interested and work on it. Another thought that crossed my mind would be to host a sprint towards the end of the day; Pycon sponsors sprints for contributions on porting, documentation, bug fixes and much more. I was wondering if there were plans to have similar sessions during/after the event. zm From abpillai at gmail.com Sat Jul 31 21:35:06 2010 From: abpillai at gmail.com (Anand Balachandran Pillai) Date: Sun, 1 Aug 2010 01:05:06 +0530 Subject: [BangPypers] pycon hacksessions? In-Reply-To: References: Message-ID: On Sun, Aug 1, 2010 at 12:53 AM, Zubin Mithra wrote: > On Sun, Aug 1, 2010 at 12:27 AM, Jeffrey Jose >wrote: > > > As a person whos new to the whole scene, when you say "Hacksessions" > what > > is it exactly ? > > > > And what happens in a Hacksession? > > > > What I meant was that it would be really nice to work on something towards > the end of the whole event or the end of each day. > > Maybe a person who might be giving a talk about an open source project of > his could sit around with a few others who are also interested and work on > it. > > Another thought that crossed my mind would be to host a sprint towards the > end of the day; Pycon sponsors sprints for contributions on porting, > documentation, bug fixes and much more. > PSF has opened up a program for organizing and sponsoring "sprints" related to Python language in an official manner with the blessings of PSF. I will try to go on stage and give a few words regarding this initiative and a few plans on how to take advantage of this from our side, during the conference. This is not a "talk" but would be something close to the end of the conference on day 2. You can read more about this at http://pythonsprints.com/ . > > I was wondering if there were plans to have similar sessions during/after > the event. > > zm > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand From zubin.mithra at gmail.com Sat Jul 31 21:43:10 2010 From: zubin.mithra at gmail.com (Zubin Mithra) Date: Sun, 1 Aug 2010 01:13:10 +0530 Subject: [BangPypers] pycon hacksessions? In-Reply-To: References: Message-ID: > > > > PSF has opened up a program for organizing and sponsoring > "sprints" related to Python language in an official manner > with the blessings of PSF. > > I will try to go on stage and give a few words regarding > this initiative and a few plans on how to take advantage > of this from our side, during the conference. This is not > a "talk" but would be something close to the end of the > conference on day 2. > > You can read more about this at http://pythonsprints.com/ . > Is there anyway a sprint could be hosted during the conference? There is a lot of manpower in a conference such as Pycon-India and a lot could be achieved in a little time by hosting such a sprint. At the very least, it'll turn out to be a chance to kickstart one's contribution to Python. Also a typo in my earlier mail. Its PSF thats sponsoring the talks, not Pycon. zm