Re: [BangPypers] Dictionary : An elementary question

2010-08-18 Thread Shashwat Anand
On Thu, Aug 19, 2010 at 10:31 AM, Sahasranaman MS wrote: > On Thursday 19 August 2010 07:08 AM, Kenneth Gonsalves wrote: > >> On Wed, 2010-08-18 at 10:28 -0700, Anand Shankar wrote: >> >>> I have no clues. Any inputs?? >>> >> sort order of dictionary keys is not guaranteed. Only a list will retu

Re: [BangPypers] Dictionary : An elementary question

2010-08-18 Thread Shashwat Anand
On Wed, Aug 18, 2010 at 10:58 PM, Anand Shankar wrote: > During a tutorial python session with my colleagues I was presented with a > basic > question > > >>> d = {'apple':2,'banana':5, 'coke': 6} > >>> print d.keys() > ['coke', 'apple', 'banana'] > > > Question is why does it not return > > ['app

Re: [BangPypers] diffrerence between lambda function and ordinary one

2010-08-06 Thread Shashwat Anand
On Fri, Aug 6, 2010 at 8:37 PM, Pradeep Gowda wrote: > On Fri, Aug 6, 2010 at 10:45 AM, Shashwat Anand > wrote: > > I would prefer LC anyway: > > > >>>> sum(i for i in range(0,10,2)) > > 20 > > why use LC at all? > >> sum(range(0

Re: [BangPypers] diffrerence between lambda function and ordinary one

2010-08-06 Thread Shashwat Anand
> > > > You can write code like this: > > from operator import add > print reduce(add, filter(lambda x: x%2==0, xrange(10))) > > to print the sum of even numbers less than 10 > instead of: > tot = 0 > for i in xrange(10): > if i%2 == 0: > tot += i > print tot > > ... > I would prefer

Re: [BangPypers] pycon hacksessions?

2010-08-01 Thread Shashwat Anand
On Sun, Aug 1, 2010 at 1:04 PM, Senthil Kumaran wrote: > On Sun, Aug 01, 2010 at 12:00:33PM +0530, Zubin Mithra wrote: > > > > I was wondering if any of the speakers would be interested in taking the > > lead. > > If you would like hack around. Bring in your laptop and if the > connectivity is go

Re: [BangPypers] Request for session

2010-07-30 Thread Shashwat Anand
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

Re: [BangPypers] python speed comparison

2010-07-23 Thread Shashwat Anand
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,

Re: [BangPypers] python speed comparison

2010-07-23 Thread Shashwat Anand
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 ___ BangPypers mailing list BangPypers@python.org http://mail.p

Re: [BangPypers] list problem

2010-07-22 Thread Shashwat Anand
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,

Re: [BangPypers] list problem

2010-07-22 Thread Shashwat Anand
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]] >>

Re: [BangPypers] list problem

2010-07-22 Thread Shashwat Anand
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

Re: [BangPypers] nested list question

2010-07-13 Thread Shashwat Anand
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', '6741', '6751', '

Re: [BangPypers] nested list question

2010-07-13 Thread Shashwat Anand
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', '6741', '6751', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: >

Re: [BangPypers] sending sms through the web

2010-06-08 Thread Shashwat Anand
I used 'mechanize' to write a script which automatically login to SPOJ website and download submitted solution.. Not sure if it can fill the form too. On Wed, Jun 9, 2010 at 11:39 AM, Venkatraman S wrote: > On Wed, Jun 9, 2010 at 11:33 AM, Kenneth Gonsalves >wrote: > > > The site requires login

Re: [BangPypers] @dabeaz visiting b'lore

2010-04-28 Thread Shashwat Anand
10 - 15th may, the time when my ends-sem exams will be going on :( Will miss this, but best of luck to all who attend the meet. On Wed, Apr 28, 2010 at 6:24 PM, Noufal Ibrahim wrote: > On Wed, Apr 28, 2010 at 6:22 PM, Noufal Ibrahim wrote: > > There are around 10 people who've +1d[..] > > > Any

Re: [BangPypers] [COMMERCIAL] CodersCombat project hosting servicefor all

2010-04-14 Thread Shashwat Anand
t; be made public. This we see as a key differentiator among the dozens > > of free hosting provider available out there. > > > > We will be adding a FAQ section soon which will have these queries > > answered. > > > > -- Azhagu Selvan > > > > On

Re: [BangPypers] [COMMERCIAL] CodersCombat project hosting service for all

2010-04-13 Thread Shashwat Anand
why should someone using github or mercurial migrate to coderscombat ? On Wed, Apr 14, 2010 at 11:26 AM, Senthil Kumaran wrote: > On Wed, Apr 14, 2010 at 08:28:06AM +0530, Azhagu selvan wrote: > > > We are a bunch of students who have come up with this solution in > > order to provide project hos

[BangPypers] @dabeaz visiting b'lore

2010-03-30 Thread Shashwat Anand
A good news for fellow bangPypers, David Beazley is visiting bangalore. PS> Residing in Allahabad sucks big time :( ~l0nwlf ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] running python on mac...

2010-03-30 Thread Shashwat Anand
Just one question ? Why "Idle" after all ? On Tue, Mar 30, 2010 at 3:41 PM, Srinivas Reddy Thatiparthy < srinivas_thatipar...@akebonosoft.com> wrote: > Probably this link could help. > Anyway, i am not sarcastic about your question, > http://www.google.co.in/search?q=idle+font+size+mac > > Thanks

[BangPypers] Joel post on DVCS (probably his last one)

2010-03-19 Thread Shashwat Anand
In what might be his last Joel on Software post (for awhile, at least) http://www.joelonsoftware.com/items/2010/03/17.html Summary: Early 2009: Joel disses DVCSes. His programmers switch from subversion to hg. Joel grumbles. His programmers develop an hg-related product. Joel takes a better look.

[BangPypers] Fwd: PyCon 2011 - Call for Tutorial Volunteers

2010-02-26 Thread Shashwat Anand
-- Forwarded message -- From: Greg Lindstrom Date: Fri, Feb 26, 2010 at 7:53 PM Subject: PyCon 2011 - Call for Tutorial Volunteers To: python-l...@python.org, python-announce-l...@python.org PyCon 2010 is complete and plans for PyCon 2011 in Atlanta have already begun! The main

Re: [BangPypers] date range

2010-02-24 Thread Shashwat Anand
> > It can be called just once too... > > >>> def foo(): > ... print "called" > ... return 0 > ... > >>> 1 < foo() and foo() < 3 > called > False > This is because AND operator short-circuits. So when 1 < foo() is false, it terminates then and there. Srinivas is correct here. ~l0nwlf

Re: [BangPypers] ActiveState/O'Reilly Launch New and Improved Code Share Site (Python) via @Bret

2010-02-19 Thread Shashwat Anand
The site is the old one and still there but the* layout has changed* (I felt so). ~l0nwlf On Sat, Feb 20, 2010 at 4:52 AM, Senthil Kumaran wrote: > On Sat, Feb 20, 2010 at 4:27 AM, Shashwat Anand > wrote: > > code.activestate.com > > AFAIK, its been there for a while

[BangPypers] ActiveState/O'Reilly Launch New and Improved Code Share Site (Python) via @Bret

2010-02-19 Thread Shashwat Anand
ActiveState launched today the new code.activestate.com with code recipes for dynamic languages such as Python, Perl and Tcl and web development. This site is great recipe sharing site for all Python, Perl and Tcl developers. O'Reilly will be use recipes from the site for its next Python cook book

Re: [BangPypers] Students/Mentors for GSoC?

2010-02-19 Thread Shashwat Anand
Hi Yuvi, I had not decided yet but will apply for PSF most probably. Abhishek(ideamonk) will go for Sahana perhaps (he had done some major work during haiti-issue). Anand B.Pillai is planning to be a mentor this year from BangPypers AFAIK but am not too sure about organization. Also PyCon,2010 is o

Re: [BangPypers] PyCon 2010

2010-02-15 Thread Shashwat Anand
Best of luck to everyone going to pycon. I will miss it very much though :( On Mon, Feb 15, 2010 at 9:25 AM, Baiju M wrote: > Hi Senthil, > > Last year your tutorial was very well received. All the best for this > time also ! Best wishes for others also. Enjoy maadi ! > > On 2/15/10, Senthil Ku

Re: [BangPypers] Could not connect to freenode IRC

2010-02-12 Thread Shashwat Anand
59.93.15.10 seems like a dynamic IP. best workaround can be to flush that IP address. restarting the network may help (a wild guess) On Sat, Feb 13, 2010 at 10:54 AM, Shashwat Anand wrote: > Give some more details. > > Possible scenarios : > 1> You are using a we

Re: [BangPypers] Could not connect to freenode IRC

2010-02-12 Thread Shashwat Anand
Give some more details. Possible scenarios : 1> You are using a webclient such as webchat.freenode.net which is not allowed by that channel sol - use IRC clients 2> You are not authenticated and that channel does not permit unauthenticated nicks sol - authenticate your nick 3> You use a public ip

Re: [BangPypers] Regarding Python popularity

2010-02-08 Thread Shashwat Anand
> > On the other hand, I would like to point out that to really, really improve > your DS/Algo skills (two of the most important skills for a CS graduate, > IMO), python is a great language. You can learn, and prototype, and > experiment much faster than if you were to try the same thing in Java/C/

Re: [BangPypers] Regarding Python popularity

2010-02-08 Thread Shashwat Anand
Companies coming for hiring (campus-placement) never look the knowledge of python as an additional advantage. Infact none of them care. I check-listed the profile of all the 20+ companies which came and none of them had to deal with anything python (except google, amazon, directi) and even these t

Re: [BangPypers] using IPython from pdb

2010-02-08 Thread Shashwat Anand
@steve Thanks :) On Mon, Feb 8, 2010 at 12:15 PM, steve wrote: > Hi Shashwat, > > > On 02/06/2010 11:20 PM, Shashwat Anand wrote: > >> here is the bpython screencast : http://*bpython*- >> interpreter.org/static/* >> bpython*-screencast01. >> ogg >>

Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Shashwat Anand
here is the bpython screencast : http://*bpython*-interpreter.org/static/* bpython*-screencast01. ogg It's worth trying. By the way does anyone want to share their customized Vi features with respect to python. I am pretty much satisfied with my own but there is always scope for improvements. On

Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Shashwat Anand
@Jeffrey, bpython is a bit unstable and crash-prone but I prefer it over Ipython. On Sat, Feb 6, 2010 at 7:45 PM, Jeffrey Jose wrote: > [ caution, huge email follows ] > > Hey Senthil, > I was under the impression that everyone here used and loved IPython. Boy, > was I wrong. > I wont attempt t

Re: [BangPypers] Future of Python Programmers

2010-02-01 Thread Shashwat Anand
freaking awesome and enlightening replies. Thanks. On Mon, Feb 1, 2010 at 4:52 PM, Srinivas Reddy Thatiparthy < srinivas_thatipar...@akebonosoft.com> wrote: > OMG! This is the best of piece of advice I have ever got. > Thanks a lot to Roshan,Asokan( you r an IIT prof,right? [If my memory is > co

Re: [BangPypers] Pointers on where to try for internships

2010-01-31 Thread Shashwat Anand
Any mentor on this list ? I for sure is trying, it'l be python but havn't decided on organization yet. On Mon, Feb 1, 2010 at 12:42 AM, Pradeep Gowda wrote: > Have you considered google summer of code. G soc attracts very good mentors > across the python ecosphere. > > +pg > Sent from my iPhone.

Re: [BangPypers] Future of Python Programmers

2010-01-30 Thread Shashwat Anand
@Nikunj I just came through this : http://paisa.com/jobs/ and their criteria : http://txtb.in/9I8 On Sun, Jan 31, 2010 at 4:37 AM, Zaki Manian wrote: > Hi Nikunj, > > I think you will find plenty of demand for python programmers in Bangalore. > There are many people on this list who use python

Re: [BangPypers] Interesting Read

2010-01-30 Thread Shashwat Anand
Seen as somebody tweet, nice read :) On Sun, Jan 31, 2010 at 12:50 AM, nikunj badjatya wrote: > Hi, > Interesting Read indeed..! > Thanks !! > > -- > Nikunj Badjatya > BTech > ___ > BangPypers mailing list > BangPypers@python.org > http://mail.python.or

[BangPypers] Retrieving images from PDFs

2009-12-29 Thread Shashwat Anand
How can we retrieve images from PDFs. I need both images and the text beneath the image to form a database. I was able to parse text via PDFMiner but was crippled when it leads to images. ___ BangPypers mailing list BangPypers@python.org http://mail.pytho

Re: [BangPypers] [ANN] FWDE launched

2009-12-16 Thread Shashwat Anand
@Kenneth Nice effort .. I had tried Microsoft Certification some 3 years ago..it was a bunch of crap..I had not mentioned it even in my resume and all the faith in certification programs was lost. On Wed, Dec 16, 2009 at 1:54 PM, Kenneth Gonsalves wrote: > On Wednesday 16 Dec 2009 1:46:16 pm Kenn

Re: [BangPypers] SPOJ: Kamil -> Code Golf

2009-11-14 Thread Shashwat Anand
I left it. Will try again someday, the quest for perfection or should I say 53 chars should last by then :) On Sun, Nov 15, 2009 at 11:58 AM, Abhishek Mishra wrote: > I tried a lot, I give up. But I noticed this, > > if 'foo'.count (sub, [start, end]) > allowed us to place a regexp in place of su

[BangPypers] SPOJ: Kamil -> Code Golf

2009-11-13 Thread Shashwat Anand
I was doing a problem KAMIL : https://www.spoj.pl/problems/KAMIL/ and the shortest version i came up with was : >>> for i in range(10):t=raw_input();print 2**sum(t.count(i)for i in'DFLT') This is 71 character long. >>> s = "for i in range(10):t=raw_input();print 2**sum(t.count(i)for i in'DFLT')" >

Re: [BangPypers] Python moratorium

2009-11-13 Thread Shashwat Anand
Python widespread adoption is better idea. It's good to have a newer version arrive after a gap, so we can play catchup game. I hadn't still migrated to 3 though, still stuck with 2.6.2. The reason is same as everyone else. On Fri, Nov 13, 2009 at 12:00 PM, Noufal Ibrahim wrote: > On Fri, Nov 13

Re: [BangPypers] Google Go

2009-11-11 Thread Shashwat Anand
Go - a son of C++ and python .. ?? to me it looked like verbose C .. first impression..not good. I mean it's ok..but not to the level of Google. We expect better from mythical Google engineers. On Wed, Nov 11, 2009 at 6:28 PM, Ramdas S wrote: > On Wed, Nov 11, 2009 at 6:07 PM, Darkseid wrote: >

Re: [BangPypers] some doubts regarding python

2009-10-29 Thread Shashwat Anand
@Navin : Thanks in case #2: "reduce(lcm2, mylist)" works fine On Fri, Oct 30, 2009 at 5:58 AM, Navin Kabra wrote: > > Something like this should work: > > def lcm2(a, b): > > return a*b/fractions.gcd(a,b) > > > > def lcm(mylist): > > return reduce(lcm2, mylist) > > > > Actually, this probab

[BangPypers] some doubts regarding python

2009-10-29 Thread Shashwat Anand
*# 1:* >>> sum([1, 2, 3], 4) 10 How does it actually work ? ( ( (1 + 2) + 3) + 4) or ( ( (4 + 1) + 2 + 3) sum( ) -> sum: (sequence[, start]), so shouldn't 4 be the 'start' that's second case ? "Note that sum(range(n), m) is equivalent to reduce(operator.add, range(n), m)" >>> sum ( [ [ 1 ], [

Re: [BangPypers] Place the timer in Python script

2009-09-18 Thread Shashwat Anand
One really simple way is to do : $ time code.py Works for me for simple codes. For accuracy there is timeit :) On Fri, Sep 18, 2009 at 4:02 PM, Vishal wrote: > On Fri, Sep 18, 2009 at 3:43 PM, steve wrote: > >> On 09/18/2009 03:33 PM, Vamsi wrote: >> >>> How to place the timer in python code. >

Re: [BangPypers] Fwd: How to validate a String with spaces using inbuilt validate function

2009-09-15 Thread Shashwat Anand
Please be a little more precise as to what do you exactly mean by 'validat' ? What exactly do you want to achieve with it. Sample Input and desired output will help. On Tue, Sep 15, 2009 at 1:00 PM, Anand Balachandran Pillai < abpil...@gmail.com> wrote: > > > On Tue, Sep 15, 2009 at 11:38 AM, Sam

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Shashwat Anand
>>> s 24 >>> import math >>> len(str(math.factorial(100))) - len(str(math.factorial(100)).strip('0')) 24 >>> On Mon, Sep 14, 2009 at 7:13 PM, Shashwat Anand wrote: > The thought which comes to my mind is Modular exponentiation : > for a ** b % r

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Shashwat Anand
ends > 5. print out the rightmost 5 digits of what remains > > Highly inaccurate but helped crossing icpc prelims in 1st year because > there were humans who checked my solution with smaller inputs :) > > On Mon, Sep 14, 2009 at 6:36 PM, Shashwat Anand > wrote: > > > &

Re: [BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Shashwat Anand
The thought which comes to my mind is Modular exponentiation : for a ** b % r ( if a ** b very large ) I had coded it in C++ but in python the pow() have inbuilt modular-function made. so pow(a ,b, r) does the trick Here for factorial : F(n) = n * n-1 * n-2 ...* 2 * 1 Just like in earlier case wh

[BangPypers] Implementing a fast factorial function in python

2009-09-14 Thread Shashwat Anand
How do we calculate last 5-digits of 10**12 ignoring trailing zeros. The code i wrote works good until 10**8 and after that take ages. The source of problem is Project Euler : http://projecteuler.net/index.php?section=problems&id=160 The code is pasted here : http://paste.pocoo.org/show/139745/

Re: [BangPypers] Google CodeJam in python

2009-09-13 Thread Shashwat Anand
CJ is a fresh breeze regarding the current scenario :) On Sun, Sep 13, 2009 at 7:51 AM, Senthil Kumaran wrote: > On Sun, Sep 13, 2009 at 02:12:47AM +0530, Shashwat Anand wrote: > > Google CodeJam doesn't have a feature where we can sort solutions by > language > > Go here h

[BangPypers] Google CodeJam in python

2009-09-12 Thread Shashwat Anand
Google CodeJam doesn't have a feature where we can sort solutions by language and almost all the solutions I checked are in C++. Are there any python coders on this list who tried GCJ. Can they share their codes ? ___ BangPypers mailing list BangPypers@py

Re: [BangPypers] A doubt in list comprehension

2009-09-11 Thread Shashwat Anand
the * expression* in a regular if statement. courtesy ~ http://docstore.mik.ua/orelly/other/python/0596001886_pythonian-chp-4-sect-9.html """ On Sat, Sep 12, 2009 at 7:48 AM, srid wrote: > On Fri, Sep 11, 2009 at 4:57 PM, Shashwat Anand > wrote: > > However what if I w

[BangPypers] A doubt in list comprehension

2009-09-11 Thread Shashwat Anand
We can pack multiple if-loops and if-else within a list generators. Here is an example : >>> [i*j for i in range(1,10) for j in range(1,10) if i==j ] [1, 4, 9, 16, 25, 36, 49, 64, 81] Another one: >>> noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)] >>> primes = [x for x in range(2,