Re: [BangPypers] Welcome to the BangPypers mailing list
and fruitful to you and the community. Thank you, List Administrator(s) To post to this list, send your message to: bangpypers@python.org General information about the mailing list is at: https://mail.python.org/mailman/listinfo/bangpypers If you ever want to unsubscribe or change your options (eg, switch to or from digest mode, change your password, etc.), visit your subscription page at: https://mail.python.org/mailman/options/bangpypers/bnayak%40icubecsi.com You can also make such adjustments via email by sending a message to: bangpypers-requ...@python.org with the word `help' in the subject or body (don't include the quotes), and you will get back a message with instructions. You must know your password to change your options (including changing the password, itself) or to unsubscribe without confirmation. It is: sonusimmi Normally, Mailman will remind you of your python.org mailing list passwords once every month, although you can disable this if you prefer. This reminder will also include instructions on how to unsubscribe or change your account options. There is also a button on your options page that will email your current password to you. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Do you pin your requirements.txt ?
Oh! Is that a big deal? Of course we pin our requirements (in all languages) and that's how it should be done. Otherwise you can't get repeatable builds. ~BG On Thu, Sep 12, 2013 at 5:45 PM, BibhasD m...@bibhas.in wrote: Quick googling suggests pinning = specifying versions. I do it. I think that makes more sense if you're depending on 3rd party packages. -- Bibhas On Thursday 12 September 2013 05:41 PM, Baishampayan Ghose wrote: What do you mean by pin? ~BG On Thu, Sep 12, 2013 at 5:37 PM, Shabda Raaj sha...@agiliq.com wrote: Curious how many people are doing/not doing it. (We pin our requirements.txt). -- Thanks, Shabda Agiliq.com - Building Amazing Apps agiliq.com/blog/ | github.com/agiliq US: +13152854388 | IN: +919949997612 | Skype: shabda.raaj Our Android Apps https://play.google.com/store/apps/developer?id=Agiliq | Our iOS Apps https://itunes.apple.com/us/artist/agiliq/id407918088 ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Do you pin your requirements.txt ?
What do you mean by pin? ~BG On Thu, Sep 12, 2013 at 5:37 PM, Shabda Raaj sha...@agiliq.com wrote: Curious how many people are doing/not doing it. (We pin our requirements.txt). -- Thanks, Shabda Agiliq.com - Building Amazing Apps agiliq.com/blog/ | github.com/agiliq US: +13152854388 | IN: +919949997612 | Skype: shabda.raaj Our Android Apps https://play.google.com/store/apps/developer?id=Agiliq | Our iOS Apps https://itunes.apple.com/us/artist/agiliq/id407918088 ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Listing files in a folder using python
I didn't read the whole PHP code, but I guess you are trying to scan a directory for files, etc. This can be accomplished using the os.walk function in Python - http://docs.python.org/2/library/os.html#os.walk Regards, BG On Tue, Feb 26, 2013 at 8:19 AM, T S KAMATH tsk.kam...@gmail.com wrote: as a newbie to python, I am looking for some advance examples for some functions.. so that my learning curve is short.. I have used a code in php http://www.php.net/manual/en/function.scandir.php#109115, which works fine, My question is can a similar featured listing be done in Python.. if you could guide me it would be great.. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Try Ninja IDE
Heh, replies are not mandatory, I, for one, wasn't really holding my breath to see a reply from you to Yoganand's email :) It's not about me here, it's about very basic mailing list etiquette. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Inpycon] Sad demise of our dear KG (Keneth Gonsalvas)
:'( RIP Kenneth! It was great knowing you. Regards, BG On Fri, Aug 3, 2012 at 3:25 PM, JAGANADH G jagana...@gmail.com wrote: Hi All, Just now I got a message that our dear KG (Kenneth Gonsalvas) passed away. He was admitted in hospital due to Asthma attack and passed away today morning. Cremation will be held at ooty on 4th Aug 2012. -- ** JAGANADH G http://jaganadhg.in ILUGCBE http://ilugcbe.org.in ___ Inpycon mailing list inpy...@python.org http://mail.python.org/mailman/listinfo/inpycon -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] Python/Django Internship position
On Mon, Jul 30, 2012 at 12:58 PM, Kiran Jonnalagadda j...@pobox.com wrote: As the adage goes: Q: How do you know someone is from IIT or IIM? A: They tell you. When I hear someone is from IIT or IIM, I instinctively ignore that person because repeat experience has taught me to do so. These people tend to believe that they are superior to everyone else because of where they studied. Some of the most ruinous corporate decisions I've seen come from IIT/IIM graduates who keep reminding everyone that they are IIT/IIM graduates. This is of course not true for everyone, but there are enough of these jokers going around that if you are serious about your startup, please do not advertise your IIT/IIM background -- you will be ignored by the people you really need to talk to. Couldn't agree more. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] Python/Django Internship position
On Fri, Jul 13, 2012 at 10:10 AM, Prashanth munichli...@gmail.com wrote: Looking for Fresh college graduates for Internship position at Noida. We are a internet based startup started by IIT, BITS alumnus. *sigh* one more of a IIT BITS IIM keyword job posting. Do you think you can get investor on board just by saying those keywords? If no, how do you expect programmers to join you? How does your keywords matter more than your idea and business model? It's not a business model, it's a way of life... :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python script to limit access to Internet...
but one thing, networks where you rely on the dhcp server on the router are highly unsafe. Please avoid them. Why so? in the first place, these are setup by the 'technical' staff of the service provider. The root password is usually root123, the firewall is identical on all modems, the permissions are the widest possible and the client machines are usually windows. I use this, but my machines are all linux with proper firewalls, and I can see the sort of rubbish the router lets in in the logs. True, but I am not sure how this is related to running the DHCP server on the router. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] JOB - Senior Web Developer - Talented Team!
Ah well, that was supposed to go to the sender. My bad. Ignore it. welcome to the club Bad karma. I should set the return address for the group to the sender perhaps :) [...] Please don't. A mail client should have some way of specifying reply to sender or reply to reply-to address. Its not just the mail client's fault. If header munging in Mailman is set it wont help what the client settings are. So for your suggestion to work, this ML settings in Mailman for Edit anonymous_list and header munging Edit first_strip_reply_to settings should be set to NO and reply_goes_to_list must be set to go to the poster -- gmail's web interface now automatically recognizes this feature. Earlier it was not the case. People wanting to reply to the OP (or anyone else) in private is 10% of the use-case. Such emails should either be composed separately or at least the person sending the email should verify that the mail is indeed going to the intended recipient. Let's not change the default setting to address a corner case. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] getpython3
That is not the one I started, this is a new one from Jesse Noller. getpython3.net I stopped as there was not any interest from the community. If anyone want to take over it, I can give the domain and other details. May be you should just redirect getpython3.net to getpython3.com with a 301. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] getpython3
That is not the one I started, this is a new one from Jesse Noller. getpython3.net I stopped as there was not any interest from the community. If anyone want to take over it, I can give the domain and other details. May be you should just redirect getpython3.net to getpython3.com with a 301. Done. Awesome! Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] re module help
On Mon, Jan 9, 2012 at 4:57 PM, Ganesh Kumar bugcy...@gmail.com wrote: I tried also subprocess module, But didn't got result, I tried the same pattern. But didn't match the string over the stream. Are you sure you're getting the output from the command in your string? I got output from terminal command working fine Is your tool, writing to stdout or stderr? Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] golf problem
a golf course has 18 holes. There are three types of hole - par 3, par 4 and par 5. For a certain type of tournament it is necessary to generate a random list of 6 holes. The only condition is that this list should contain at least one of each type of hole. What would be an elegant way of doing this. Sample data for Ooty golf course is given below. The hole number is the first element of each tuple and the par is the second element. This is my solution - http://dpaste.org/wrgG8/ Mine is similar to Gora's solution, except that I have tried to maintain the actual probabilities of each par in the course and minimise the number of passes through the list. It shouldn't matter much for a small list though. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Text/Mail filtering/classification using python
You need a Naive Bayes Classifier. Take a look at PyZor - http://sourceforge.net/apps/trac/pyzor/ Regards, BG On Fri, Dec 23, 2011 at 5:01 PM, Amit Sethi amit.pureene...@gmail.com wrote: Hi All, I am looking for a spam filtering/classification solution . The essential requirement are : 1. Return a negative on all text with certain words. But apart from returning negative on certain words. I want it to be able to classify certain positives. For ex - Given the fact that [Sachin, Cricket, Batsmen] are related to cricket - returns a positive on cricket Given the fact that [ Inflation, Share Price ] are related to Finance - returns a positive on finance etc ... What kind of tool set/ library can help me achieve that ? -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] webmail server
Lamson - http://lamsonproject.org/ Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] webmail server
On Wed, 2011-10-12 at 18:01 +0530, Baishampayan Ghose wrote: Lamson - http://lamsonproject.org/ sorry - wrong question - I meant webmail client - like openwebmail. PyWebmail? - http://code.google.com/p/webpymail/ Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] - Yahoo!
On Wed, Sep 14, 2011 at 5:30 PM, Kiran Jonnalagadda j...@pobox.com wrote: +1. Censoring opinion does no one any good. I'm with Noufal and Roshan on this thread. Public criticism can help companies get unstuck *really fast*, as I learnt about Y! last month in a separate incident. If, as in this case, any company wants to use a public resource to recruit, they should also be willing to explain why they are a good place to work. This is a fair expectation for their use of the resource. Instead, there's only been objection to criticism, which makes the company look all the worse. +1 to Kiran and Noufal here. +1 Trillion to Roshan (of which a few Billions are just for the style). Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] if not with comparision statement in python
On Mon, Aug 1, 2011 at 4:38 PM, Dhananjay Nene dhananjay.n...@gmail.com wrote: I also find map much more atomic and portable construct to think in - after all every list comprehension is syntactic sugar around map + filter, and map/reduce/filter are far more omnipresent than list comprehensions. The above will especially make sense to someone who programs in multiple programming languages in his day job. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] if not with comparision statement in python
On Mon, Aug 1, 2011 at 5:09 PM, Anand Chitipothu anandol...@gmail.com wrote: I also find map much more atomic and portable construct to think in - after all every list comprehension is syntactic sugar around map + filter, and map/reduce/filter are far more omnipresent than list comprehensions. The above will especially make sense to someone who programs in multiple programming languages in his day job. I envy them. :) Why envy them when you can join them ;-) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] parsing xml
On Fri, Jul 29, 2011 at 1:09 PM, Venkatraman S venka...@gmail.com wrote: IMHO, regexps are much more powerful and fault tolerant than XML parsing. XMLs are brittle. Did you mean parsing XML using Regular Expressions is more powerful and fault tolerant than using a XML parser? Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] parsing xml
here is a simplified version of an xml file: ?xml version=1.0 encoding=UTF-8? gpx metadata author nameCloudMade/name email id=support domain=cloudmade.com / link href=http://maps.cloudmade.com;/link /author copyright author=CloudMade licensehttp://cloudmade.com/faq#license/license /copyright time2011-07-28T07:04:01/time /metadata extensions distance1489/distance time344/time startSägerstraße/start endIm Gisinger Feld/end /extensions /gpx I want to get the value of the distance element - 1489. What is the simplest way of doing this? #!/usr/bin/env python # -*- coding: utf-8 -*- from xml.etree.ElementTree import fromstring data = ?xml version=1.0 encoding=UTF-8? gpx metadata author nameCloudMade/name email id=support domain=cloudmade.com / link href=http://maps.cloudmade.com;/link /author copyright author=CloudMade licensehttp://cloudmade.com/faq#license/license /copyright time2011-07-28T07:04:01/time /metadata extensions distance1489/distance time344/time startSägerstraße/start endIm Gisinger Feld/end /extensions /gpx def parse_xml(s): element = fromstring(s) return element.find(extensions/distance).text if __name__ == __main__: print parse_xml(data) Hope that helps. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] parsing xml
minidom is the fastest solution if you consider the programmer time instead of developer time. Minidom is available in standard library, you don't have to add another dependency and worry about PyPI downtimes and lxml compilations failures. FWIW, ElementTree is a part of the standard library as well and is known to be much better than minidom in various ways. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [OT] language fanaticism
why ? any personal bad experience or some technical reasons? many bitter experiences - security is a nightmare for php apps. Take a look at the number of security updates wordpress has per *month* - more than django has had in 6 *years*. http://wordpress-security.net/wordpress-software-security-updates/ --- do you want to live on the edge like this? Most LUG sites run php, maintained by 'experts' - they are regularly spammed or cracked even when the most draconian lockdown/captchas are implemented. Volunteers just do not have the time to spend half their nights applying security patches. quote Important note about updating Themes: If you have made **any** changes to your theme (tweaking things in style.css or changes to the template files), the changes will be overwritten when the theme is updated. Be ready to re-do the changes after updating. unquote what fun! I don't understand how Django apps can automatically guarantee a certain level of security while PHP applications can't. Are you trying to indicate that each and every Django app that you've built is free from any security hole? IMHO if an application is insecure, it's the programmer who is to blame and not the language/framework. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [pythonpune] Cool developments on the PyPy front
Interesting, seems to be similar to Clojure's approach towards managing state. Regards, BG On Fri, Jul 1, 2011 at 2:15 AM, Dhananjay Nene dhananjay.n...@gmail.com wrote: This is an informational post only. I've been watching some of the performance developments on PyPy, but this one made me feel real good. Apparently PyPy is going to lose the GIL and implement locking via STM http://morepypy.blogspot.com/2011/06/global-interpreter-lock-or-how-to-kill.html -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Uninstalling Python 2.6
I want to remove Python 2.6 from my computer, or at least change the default python to 2.5. When I try to remove Python 2.6 through the package manager, it asks me if I want to remove about 200 other things, which I don't want to do. Things that only support Python 2.5 (like vim.. etc) try to use python 2.6 instead of python 2.5 by default, which screws things up. How do I fix this? Note: I am trying with ubuntu-9.10(Karmic) You won't be able to remove python-2.6 because of dependencies, but you can install python-2.5 and make it the default by using the `update-alternatives` command (http://manpages.ubuntu.com/manpages/karmic/man8/update-alternatives.8.html). It would be something like (after installing python-2.5) - # update-alternatives --config python Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Uninstalling Python 2.6
# update-alternatives --config python Ganesh:~# update-alternatives --config python update-alternatives: error: no alternatives for python. Hmm, in that case, you might need to do something like this but YMMV - # update-alternatives --install /usr/bin/python python /usr/bin/python2.6 1 # update-alternatives --install /usr/bin/python python /usr/bin/python2.5 10 # update-alternatives --config python I would recommend that you read the update-alternatives manual page before trying any of the above. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] remote ip change
If you _want_ to involve python, then take a look at func. With Func, changing the machine IP is just one of the many sysadmin tasks you'll be able to perform. Do you have a URL Sriram? It sounds useful. https://fedorahosted.org/func/ Seems to be similar to Fabric [http://fabfile.org] but limited to administering Fedora machines. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] The myth of free software
On Wed, May 18, 2011 at 6:27 PM, Santosh Rajan santra...@gmail.com wrote: (FUNCTION TROLL ((FUNCTION PRINT) Hello World))) You clearly don't know enough Lisp to even craft a joke properly. Stick to what you know, that will suite you better. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] editor for restructured text
On Thu, Apr 28, 2011 at 12:55 PM, Noufal Ibrahim nou...@gmail.com wrote: Contrary to popular opinion, you *can* use Emacs as just a text editor without buying into it's whole lispy philsophy. FWIW, only a small percentage of Emacs users buy into the whole lispy philosophy. Nevertheless, the path to mastering Emacs does intersect with the path to mastering Lisp in some important places. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Broken pipe error
On Thu, Apr 14, 2011 at 3:21 PM, Amit Sethi amit.pureene...@gmail.com wrote: File /usr/lib/python2.6/socket.py, line 286, in flush self._sock.sendall(buffer) error: [Errno 32] Broken pipe This happens when the request from the client (browser) is closed/interrupted. Sometimes this happens when you press the Esc key or move to another page before the original page has loaded completely. This is not a serious issue and you can ignore it safely. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Nice feature
On Fri, Apr 1, 2011 at 6:17 PM, Noufal Ibrahim nou...@gmail.com wrote: Came across this at PyCon. Comments? foo = (1,[2,3,4]) foo[1] += [6] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'tuple' object does not support item assignment foo (1, [2, 3, 4, 6]) Even nicer this way - foo = (1, [2, 3, 4]) foo[1].append(5) foo (1, [2, 3, 4, 5]) foo[1].append(6) foo (1, [2, 3, 4, 5, 6]) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Dictionary in Python - A doubt
On Thu, Mar 24, 2011 at 5:34 PM, Jins Thomas jinstho...@gmail.com wrote: My problem was to find the occurance of each word in a file f = open('hello.txt', 'r') count = {} for line in f: words = line.split() for i in words : if i in count: count[i] += 1 else: count[i] = 1 print (count) I was just comparing hash in Perl. In Perl 'if i in count: else:' statement is not required i could simply uses count{i} +=1 even if it exists or not exists. I was thinking why Python has put this restriction. Or is it something which i did wrongly. Perl let's you do a += on a dictionary value because Perl is weakly typed(?) and Python is not. To tell Python to assume that the default value of your dictionary is an integer instead of anything else, you will have to use `defaultdict`[1] which is a subclass of the built-in Python dict. This is how you can use it - count = defaultdict(int) with open(hello.txt, r) as f: for line in f: words = line.split() for i in words: count[i] += 1 print (count) Hope this helps. Regards, BG [1] http://docs.python.org/library/collections.html#collections.defaultdict -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Proposed python module: simpleoauth
After getting very confused and frustrated at the state of OAuth libraries in python, I decided that there needs to be a simpler way of doing OAuth in Python. As a proof-of-concept I've implemented the following: https://github.com/ngkabra/simpleoauth Where is the code? simpleoauth/__init__.py seems to have only one line - /home/navin/d/hacks/python/oauth/simple_oauth.py Another thing, please sanitize the examples and remove your own API keys, they look real to me :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] indentation problems
I have a problem - whenever I load the code written by a particular team member indentation in many places vanishes. I have a feeling this has something to do with tabs and spaces - anyone faced this problem? If a file has a mixture of tabs and spaces that can cause a lot of problems. Some editors can visually indicate if tabs and spaces are mixed in a file. You can use the tabnanny module to detect such files. $ python -m tabnanny file # for a single file $ python -m tabnanny . # for all files in the current directory Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Ideas for Python concurrency...
Mutliprocessing means, data copying, talking to each other through PIPES, also it has its issues with running on Windows (all function calls should be pickelable) Threads seems pretty stable on most platforms where Python runs. Threads won't help you much because of the Python GIL. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] Python developer required in Pune with web development experience
This interesting job comes with industry competitive compensation. how much? I wonder why in India people never mention salary range. One reason for not stating the actual range and just saying according to industry standards is that there is no such thing as a standard compensation. The actual pay differs with the person, the role the company. Nevertheless, it's a nice way of saying we won't short-change you. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] Python developer required in Pune with web development experience
how much? I wonder why in India people never mention salary range. One reason for not stating the actual range and just saying according to industry standards is that there is no such thing as a standard compensation. The actual pay differs with the person, the role the company. Nevertheless, it's a nice way of saying we won't short-change you. or a way of saying: 'there is going to be bargaining here'? I do not know much about the software industry, but surely there must be an approximate range - or at least a maximum that a company is willing to shell out? I agree. That is indeed, one way of saying the salary is negotiable. Having said that, I have never seen companies like Google, Facebook, etc. mention a pay range in job postings, but I guess people still get some idea about the salary range through various channels like glassdoor.com Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOB] Python developer required in Pune with web development experience
I agree. That is indeed, one way of saying the salary is negotiable. Having said that, I have never seen companies like Google, Facebook, etc. mention a pay range in job postings, google, facebook etc are the top range - it goes without saying that the salaries will be far above industry standards. I am talking about our local small start ups that no one has ever heard of. I have seen lot of people who say 'we pay very well', but actually the end offer is often peanuts. I personally always specify a maximum - that way every one knows where they stand and people do not need to waste their time applying for a job where the salary is not up to their expectations. That said, the best candidates (as far as I am concerned) are those who say that salary is not the main criterion - what work are you going to give me? While I completely agree with you on this, just FYI, Google (US, don't know about India) pays considerably less than the industry standards but makes it up with the perks. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] refactoring
[dubious aside: remember this one? There once was a master programmer who wrote unstructured programs. A novice programmer, seeking to imitate him, also began to write unstructured programs. When the novice asked the master to evaluate his progress, the master criticized him for writing unstructured programs, saying, ``What is appropriate for the master is not appropriate for the novice. You must understand the Tao before transcending structure. http://www.canonical.org/~kragen/tao-of-programming.html for more koans like the one above. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] What kind of applications can we develop with Python
one that I know of is flickr. About the power of the language there are others on this list who can better articulate. Flickr is written in PHP. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Clojure style multimethod functions in python
Without making any change whatsoever to multi() and multi_method(), the result of the following code : # Declare the existence of a multi method switcher encounter = multi(lambda x,y : (x[Species], y[Species])) @multi_method(encounter, (Bunny,Lion)) def encounter(a1, a2): return run-away @multi_method(encounter, (Lion,Bunny)) def encounter(a1, a2): return eat @multi_method(encounter, (Bunny,Bunny)) def encounter(a1, a2): return mate @multi_method(encounter, (Lion,Lion)) def encounter(a1, a2): return fight b1 = {Species : Bunny, Other : Stuff} b2 = {Species : Bunny, Other : Stuff} l1 = {Species : Lion, Other : Stuff} l2 = {Species : Lion, Other : Stuff} print encounter(b1, b2) print encounter(b1, l1) print encounter(l1, b1) print encounter(l1, l2) *is * mate run-away eat fight Is that consistent with the expectations ? Fair enough. Good work, Dhananjay. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Clojure style multimethod functions in python
While python's multimethod module allows function overloading based on types, here's another approach to do the same based on a switching function (clojure style) or on a set of conditions. Clojure style multimethod functions in pythonhttp://codeblog.dhananjaynene.com/2010/08/clojure-style-multi-methods-in-python/ Please don't claim that the above is `Clojure style multimethods'. Clojure multimethods can dispatch on an arbitrary function of `the arguments' given to the multimethod and not just on any arbitrary function of `the properties of the object'. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Clojure style multimethod functions in python
Dhananjay, Could you help explain in light of the following (the argument lists are in bold). The switcher function is provided exactly the same arguments as the various multimethods. Probably something about clojure I am not aware of ? Dhananjay def multi(switcher_func): Declares a multi map based method which will switch to the appropriate function based on the results of the switcher func def dispatcher(*args, **kwargs): key = *switcher_func(*args, **kwargs)* func = dispatcher.dispatch_map[key] if func : return *func(*args,**kwargs)* else : raise Exception(No function defined for dispatch key: %s % key ) dispatcher.dispatch_map = {} return dispatcher Multimethods are supposed to dispatch on the ``value'' returned by the dispatch function and not just when a specific condition is satisfied. What will you do when there are multiple possibilities? Ideally, I should be able to prefer a specific method to another one in case there is some ambiguity. Yours will always pick the first one that satisfies the condition, which is again dependent on the order in which the code is evaluated. For example, try implementing the following using your code - http://clojure.org/runtime_polymorphism Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] source
in using virtualenv and some other python programs I see the use of 'source' - google search does not throw up anything useful. What is 'source'? is it python or something else, and where can I get a link to material on it? It's a shell built-in and is equivalent to `.'. http://www.gnu.org/software/bash/manual/bashref.html#Bourne-Shell-Builtins Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] list problem
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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] python speed comparison
Emil, Below given is solution to a puzzle( http://projecteuler.net/index.php?section=problemsid=14) in python and c Python: import time startT=time.time() maxlen=0 longest=0 for i in xrange(1,100): last=i cnt=0 while(last 1): cnt=cnt+1 if(last%2==0): last=last/2 else: last=3*last+1 if(cntmaxlen): 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 stdio.h int main(int argc, char **argv) { int longest = 0; int maxlen = 0; int i; unsigned long last; for (i = 1; i = 100; 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=problemsid=14) # Author: Baishampayan Ghose b.gh...@gnu.org 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(80, 84): 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@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] list problem
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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Query generation engine/library
I am looking for a a way to generate optimised queries in SQL (or SQL-like languages like Hadoop Pig) by chaining clauses such as where, group by, order by etc based on a set of (optimising) rules. Is there any such library in python which would let me do that. Example approach would be create a query object and then use some inbuilt method to generate the actual query before executing it. I will probably have to change whatever alternatives are so a good starting point would be helpful. Take something like Django's ORM or SQLAlchemy and hack it until you are satisfied :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Internationals getting Python/Programming Jobs
You also get Fosters here :) [OT] May be it's not common knowledge here in India, but nobody drinks Foster's in Australia. Whatever we see in the ads here is all propaganda :) Having said that, I would recommend Rory to consider moving to Pune, India. It has the right blend of tech. community, peaceful life, work opportunities, infrastructure and nice weather. It's also cheaper than the so-called metro cities. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] How should I do it?
It is a clever hack, taking advantage of the nature of the data. But it is far more faster than the other approaches posted here. I thought eval was evil :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Why do indians copy?
Why do indian programmers ask for code in Usenet (particularly Google groups) ? Most Indian programmers were never supposed to be programmers. They simply lack the cognitive skills required to be in the business. Yet they are the ones who work for large/medium/small software service companies. So when they face a problem, they have absolutely no clue as to where to look for solutions. They also have no idea about the various programming communities and their modus operandi. They just join some random group and ask for solutions (it's akin to asking for some software in some shareware group). The problem is also inside the organisations; people who ask their seniors questions are deemed to be fools, etc. I think there is no solution to this specific problem. It's more of a culture issue. Unless and until parents let their children do whatever they want and the society treats people from all professions equally, people will keep flocking into the most fashionable profession of that decade. Computer programming is on its way out... management is much more fashionable now; the only difference is that a programmer's work revolves around the Internet and the Internet never forgets :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [OT] Guido's Tweet on Top Posting
why? in the first place I am extremely sensitive to top posting, but have never used usenet or been in a C forum. I only learned about interleaved posting in about 2002 or so. And the vast majority of people online now have similar experience to mine. And also the vast majority of top posters do so not out of Just because you came late does not mean you can't have the same sensibilities of the Usenet era. In short, many people who joined the mailing list bandwagon recently have learnt the right etiquette from others and by noticing how inline, contextual postings are much better than top posting. Others, unfortunately fail to accept it; they are simply too lazy to be courteous to others. I would blame the webmail clients for that though. They are simply not smart enough to put the cursor in the right place (which is below the quote). Thunderbird does that nicely. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] HTML Parsing in python
Can anyone suggest me a good library for html parsing in python ? I googled a found few libararies BeautifulSoup, HTMLParser, SGMLParser etc. Can anyone suggest me which should I go for from your experience. BeautifulSoup was OK, but now it's broken. Use lxml, it's very good. http://codespeak.net/lxml/ Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Any python metaclasses for UID
I think I just fell down the rabbit hole. I think BangPypers just got its own John Harrop. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Any python metaclasses for UID
I didn't call _you_ Jo[h]n Harrop, man :) I called the OP a troll because his question is pretty much meaningless and is causing unnecessary irritation. May be it was because of the way I quoted the mail. Sorry for the confusion :-p Regards, BG On 7/30/09, Roshan Mathews rmath...@gmail.com wrote: On Thu, Jul 30, 2009 at 1:43 AM, Baishampayan Ghoseb.gh...@gmail.com wrote: I think I just fell down the rabbit hole. I think BangPypers just got its own John Harrop. Jon, I think you mean (although there is a John Harrop in the Clojure community), in which case I'm guessing you're trying hard to say I'm trolling (like the JH in comp.lang.lisp) ... except I wasn't, I just wanted context. Something which Noufal seemed to pull out of thin air. Roshan ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Sent from my mobile device Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Any python metaclasses for UID
May be it was because of the way I quoted the mail. Sorry for the confusion :-p top posting almost invariably causes confusion - an excellent way of making sure no one knows what you are talking about Hehe :) I for one merely wanted to add to Roshan's sentiment by drawing an analogy with the usual way in which Jon Harrop traumatises different mailing lists. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] CPython's 'bignum' Implementation
Now, how does CPython implement bignum? From what I gather, there is more than way of doing it- using a different radix (base), an array of numbers. One hint is given by http://www.python.org/dev/peps/pep-0237/. However, if any of you folks know something concrete, I would appreciate it. I have given a cursory glance to the Python code base and I think I know how it's implemented :) My findings are here - http://stackoverflow.com/questions/867393/how-do-languages-such-as-python-overcome-cs-integral-data-limits/870429#870429 I would appreciate a few up-votes if you deem my answer to be satisfying :-p Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Joins with Django
I am trying to learn django and write a small application. I am facing issue in executing a join with django. I am able to find a work around by executing a raw SQL query using cursor. But that have problem that I need to access fields using object.0' or 'object.1' which is too verbose and error prone. Is there better way of doing the same thing or executing joins using Django models. here is my table structure table 1 : Company id = IntField name = CharField table 2 : Schmes id = Int field Name = CharFiled comp_id = ForeignKey (company) table 3 : Price scheme_id = ForeignKey(Schemes) price = CharField() Date = DateTimeField() I want to execute a query on the price table where I can select the price of all the schemes for the specified company. something like this if I write SQL : select price from Price, Schemes, Company where Price.scheme_id = Scheme.id and Scheme.comp_id = Company.id and Company.id = 1. Puneet, Try something like this: company = Company.objects.get(name=foocorp) prices = Price.objects.filter(scheme_id__comp_id=company) You can use __ (double underscores) to span relationships. The Docs have more: http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Cloud Camp at IIM Bangalore on March 29
Would anyone be interested in Giving a talk on Google App-Engine ? I can talk on GAE. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers