[BangPypers] Python freshers.
Hello everyone, The list seems to be inactive these days. However, I'm sure some of the old timers are still here so I'll post away! I've been running The Lycaeum program for a while now and I've managed to train a decent number of people who found good jobs mostly in the startup ecosystem. I absorbed some of them into my company (Hamon Technologies) and they've managed to deliver client projects quite well. The program is working well. Thanks to a certain virus which shall remain unnamed, we've pivoted a little and moved almost all of the program to an online platform. In addition we've added some extra features for the colleges where these students study and such. This has been partially rolled out and there's good adoption. The next thing we're doing is to try to move much of the Lycaeum program to the platform so that we can dispense with the "finishing school" and have good quality freshers when they're done with college. In this regard, I'm interested in speaking to a few companies that are open to hiring freshers by the end of Q1 or early Q2 in 2021 to help refine my syllabus and pedagogy. If you're one of these people, do let me know and spread the word in your networks. Thanks! -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Commercial] Python companies hiring freshers
On Sat, Aug 29 2020, Aakanksha Jain wrote: > Hi Noufal, > > Is this program career fair open to freshers who haven't been part of the > training programs mentioned by you? [...] Oh yes. Definitely. My original email was originally looking for companies who might be interested in this so that I can do a survey of sorts of plan it out. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] [Commercial] Python companies hiring freshers
Hello everyone, We're a startup headquartered in Kozhikode, Kerala and have been operating for a while. Our mission is to bridge the skill gap in engineering in India and we've been working towards that with a combination of online and offline training programs. We used to run a low volume high quality mentoring program that used Python as the language for all projects and our Alumni are working in various companies in Bangalore and abroad. Due to the Covid-19 situation, we've pivoted our offerings and have moved much of our activities online. As part of this, we're planning to conduct an online job fair in the coming month (approximately early October). This is exclusively for freshers who are looking for jobs in this climate. We intend to do a basic screening through our platforms and after that, put promising freshers in touch with companies who are participating. To plan the event and other details properly, I'd like to know how many organisations would be interested in hiring such freshers. Please email me directly if you are. Would love to discuss it with you. Thanks! -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Teaching yourself machine learning
On Thu, Aug 09 2018, Rohit Chormale wrote: > Thanks everyone for kind replies. [...] Much of ML is applied statistics. I recently refreshed some of my high school statistics using http://greenteapress.com/thinkstats/ and https://greenteapress.com/wp/think-bayes/ and found it fun. These might help too. This https://www.edx.org/course/introduction-to-probability-0 also came highly recommended. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Teaching yourself machine learning
On 2018-08-09 08:48, Rohit Chormale wrote: [..] Currently I am trying to teach myself machine learning. But I am facing difficulty to connect it in real life. I would really love to know the real life scenarios for machine-learning applications affecting individuals. How did you guy start apart from your job? What did you hack in your early days ? Any good ideas/proper directions are welcome. https://www.coursera.org/learn/machine-learning was my start since it was a completely new area for me and I was afraid of going about it the wrong way. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Capture and save running process on Python 3.6
On Thu, Nov 02 2017, Ajinkya Bobade wrote: [...] > However, I want to write this code for "*.bag" extension files that is > sys.stdout = open("/Volumes/aj/hello world.bag", 'w') . This file is > defined as Binary(application/octect-stream). The above code doesn't > work in this scenario. How do I make it work? [...] The contents of a file are not dependent on its extension. What is it that you're trying to do here? I assumed that you simply want to capture all your log messages. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Capture and save running process on Python 3.6
On Thu, Nov 02 2017, Ajinkya Bobade wrote: > Hello, > > Hope someone can help me on this. In the following code, I want to capture > print('Recording GPS Position...') on sd card, for now, this is printing > on terminal directly I want to capture this runtime process (p_1) from > terminal and store on sd card as it is being executed how do I do > this. You can either run your program with a stdout redirect e.g. python foo.py > logfile.txt or inside your program, replace sys.stdout with an open file object pointing to your log file. I'd go with the former. Secondly, if you want to capture logs and things, you should consider using the logging module. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Discussion] Monthly Webinar
On Tue, May 16 2017, kracekumar ramaraju wrote: [...] > To engage the large crowd, how about conducting a monthly webinar for one > hour? Along with the physical meetup, experiment with webinar and have one > talk per session. This sounds like an excellent idea. +1 As an aside, here's an article that language aficionados might find entertaining. I'm prompted to post this because of the use of that disaster neologism "webinar" http://www.slate.com/articles/life/the_good_word/2013/03/chillax_wikipedia_and_bridezilla_are_not_puns_against_adjoinages.html [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Bangpypers][Commercial][Job] We are hiring a Software Engineer, Data Scientist at AdStock
On Wed, Mar 22 2017, Bhavin Patel via BangPypers wrote: > What about genuine queries about python with attachments ? Let's not > have a knee jerk reaction to a one off issue. Like what? I've been on mailing lists for quite a while and the general way is to upload it somewhere and send a link rather than send a huge attachment (e.g. a screen shot) which will then be replicated for every person on the list. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Improving meetup attendance
On 2017-03-21 03:35, Sivasubramaniam Arunachalam wrote: [..] IMHO, being fair to the participants by asking money(to prove their seriousness in participation) doesn't look good for a 12 years old, matured and self-sustained community like Bangpyers. It is simply an additional headache to the event organizers. [..] While the community is old, all the participants are not. The current system seems designed to minimise administrative overhead and is fine but it expects responsible participants. If all the people were are mature as the group itself, this thread would be unnecessary. I think some kind of token to prove "seriousness" makes sense atleast as an experiment. If it prevents problems like the lack of seats mentioned earlier in this thread, it'd be worthwhile. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Meetup: Learn Algorithm with Python 1
Excellent work everyone. Bangpypers is becoming really enviable. I'm almost regretting leaving Bangalore. :) On 2017-03-20 17:21, kracekumar ramaraju wrote: Hi BangPypers is hosting learn algorithm with Python on 25th, March from 2:30 to 5:30 in Thought Factory, Domlur. The workshop will cover following topics - Algorithm and Big-O Notation - Sorting - Bubble Sort - Selection Sort - Quick Sort - Searching - Sequential Search - Binary Search - Trees - Binary Search Tree - Balanced Binary Search Tree aka AVL Tree The complete details are available in Meetup page, and RSVP is open [0]. [0]: https://www.meetup.com/BangPypers/events/238052401/ ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Need help using web python app.
On 2017-01-25 04:03, Blake Merriam wrote: Hello. I'm trying to figure out how to use this python app: http://wfuzz.org/ There is the following domain: games.skillz.com/games/ that has many numbered sub directories. Example: http://games.skillz.com/game/2314 http://games.skillz.com/game/942 I want to find all the numbered sub directories. Number with no static page redirect to games.skillz.com/list/ but not all games are listed there. So I want to use wfuzz to "web crawl" the directories. Hope this makes sense. Grateful for any help that can be offered!! Hello Blake, Do you have to use wfuzz to do this? A simpler approach would be simply to do a HEAD request for all URLs from http://games.skillz.com/game/1 to (say) http://games.skillz.com/game/. All the ones which are valid games will give you http 200 while the others will give you a http 302. If you find (say) 10 which are consecutively redirecting, then you can assume that you've reached the upper limit beyond which there are no more games. Thanks. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Registration for PyCon Pune 2017 is Open Now!
On Fri, Nov 18 2016, Shanki Singh Gandhi wrote: > Really astonished after visiting CFP site of pune pycon, wondering why > Junction is not being used for it. If we are not using the product > developed by use, then why other will use it. [...] Let's not go there. Junction is one option for managing CFPs. It has its own strengths and weaknesses and if one of the shortcomings is a showstopper for the PyCon Pune team, spending time fixing the software is a bad investment given how close the actual event is. Using whatever is available, even if it's low tech or not written in python, to keep the momentum going and getting things done is better than fixing software. After all, during the conference, the question of which system was used to gather and sort through the CFPs is more or less irrelevant. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Query on correct use of threading
On Tue, Nov 08 2016, Rajesh Deo wrote: > Dear All, > > I was exploring the threading module and came up with following, after > going through @raymondh's talk (https://www.youtube.com/watch?v=Bv25Dwe84g0) > > http://pastebin.com/usKE6nME Can you put it on another pastebin service? My ISP is blocking this. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] lists and tuples
On , Siva Ranganath wrote: Hi All, please let me know few cases when we will go with Lists and tuples in pyhton. Lists are like vectors (since you're from a C++ background). They can expand/contract depending on data and are also heterogeneous meaning that all the elements needn't be of the same type. It's a flexible container for holding things. Lists are often iterated over (e.g. for i in all_documents) or indexed (e.g. students[5] to get the fifth student). Tuples are more like C structures in that they're used to hold a few related things together. They have several behaviours similar to a list (can be indexed, iterated over etc.) but are not mutable (you can't add/remove elements from them). However, they're often used differently. They're used as C structs but without names for the fields. So, points in 2D space (x,y) are a good candidate for a tuple or maybe a colour in RGB colourspace denoted by (r,g,b). For a more in depth discussion, you should look at the official python tutorial at https://docs.python.org/3.6/tutorial/ ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Fund Raiser] Please donate generously for my efforts
Hello Annapoornima, Good work with the videos. I used to make tutorial videos of Emacs but stopped due to lack of time. I have a few suggestions that might help you get more mileage out of low cost equipment. 1. If you make the whole thing into a screencast rather than a video (via a webcam), you won't need the camera and you have a way to show slides/notes or something else that can support your presentation. This will be especially valuable during sessions where you're showing code. 2. It looks like you're recording using your laptop microphone. You can get much better audio quality if you use a cheap headset with a microphone close to your mouth. Your own voice will be much higher and the background noise will be much lower. I think the one I used was just a few hundred Rupees and was the kid of single ear thing that tech support people are often seen wielding. 3. There's a hum in the background (I'm guessing it's a fan). It's very uniform and you can easily clean this up using audacity or some other free tool. Here's an example of one of the Emacs screencasts that I made http://archive.org/embed/EmacsMovies/12.3-episode-gnus-3.webm. The noise clearing was done manually using audacity but the rest of the workflow (boosting audio, adding mezzanine clips, transcoding to multiple formats and uploading) is automated using ffmpeg and other tools. The details are there in this Makefile https://gist.github.com/nibrahim/2466292. One of the early posts on the website discusses the workflow too http://emacsmovies.org/blog/2012/01/21/welcome_to_emacsmovies.org/. Thanks. On , Annapoornima Koppad wrote: Dear All, I have been receiving a lot of appreciation and feedback on my Python Programming videos. Thank you for that. However, some of the feedback do suggest better video recording amongst others. I have been shooting my laptop camera which might explain the poor quality of the videos. In order to make my videos better, I am raising funds to buy better equipment. Please do donate and circulate amongst your friends as well. https://www.generosity.com/education-fundraising/python-programming-video-tutorials Thanks all so much for the encouragement and feedback. Best, Annapoornima ___ 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
Re: [BangPypers] [Inpycon] Pycon India 2016 Keynote Speaker: Van Lindberg
On Tue, Aug 30 2016, chandan kumar wrote: > Hello, > > We are delighted to announce our third keynote speaker for PyCon India > 2016: Van Lindberg [...] Wonderful! -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python 2.x Vs 3 & Books - Frequently Asked Question but on latest context
I think Python 3 has arrived. There are a few libraries that are not ported and there's legacy code which you might have to work on but apart from that, 3 is the way to go. Learn Python the Hard way is a good book to start with and the HTML version is available online. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] framework to write functional test cases
On Wed, Jun 01 2016, anu sree wrote: > Hi, > > I am looking for a framework which helps to write functional test > cases. Right now i am using unittest framework to do that, but that > is ugly. I consider py.test as one of Python's "killer applications". I've used it since 2010 or so for almost all my non trivial python projects. I've even recently started using it to test my C libraries. It's got a compatibility wrapper to run unittest tests so you can start using it without changing any of your existing tests. I could go on and on but it'll just be fanboyism. > How you guys are writing functional test cases. Often, for servers, I use subprocess to launch my application as a completely separate process and then poke it from the outside. > I also want to do stress test by sending thousands of concurrent > requests (run functional test cases in different threads). Are these http requests? I'm not sure py.test and related infrastructure is the best to do raw performance tests. Something like ab, siege or boom might be better. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Plotting Range [1e13 to 1e19] in linear scale
On Mon, May 09 2016, Santosh Chiniwar wrote: > Please find correct Python code for above mail. Thank you > [...] This doesn't help either. You need to be a little more specific and detailed about the problem that you're facing. I've found http://www.catb.org/esr/faqs/smart-questions.html to be a reasonably good guide on how to go about it. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Looking for corporate Python Trainers
On Thu, May 05 2016, Manjushree Hegde wrote: > Hello, > > > I am looking for Python trainers for corporate training. Please let me > know if anyone is interested in this. [...] We do corporate trainings on Python and other technologies via pipal.in. If you're interested, please email us at he...@pipal.in Thanks -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Looking for corporate Python Trainers
On Thu, May 05 2016, Suman Debnath via BangPypers wrote: > I would highly recommend Mr. Chandrashekhar Babu > (https://www.linkedin.com/in/chandrashekarbabu?authType=name=WHf > d=wonton-desktop). > He is the best training I have ever come across. [...] +1. I know him personally and he's really *really* good. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Tools/libraries to determine the call graph(call flow) of an python program (module/package)
On Tue, Jan 12 2016, ashish makani wrote: > thanks & true Noufal, but 2 points : > > 1. i imagine this is a fairly common usecase > you are given some source python codebase , X which is moderately complex > > i just want to give X & some typical args which X takes, to a > tool/library, so i get a visual, rough understanding of the typical > call flow when X is run. As in, i dont want to instrument or > "decorate" the python codebase X, treat X as a blackbox what say ? That makes sense. The trace[1] module, which, I must confess, is new to me, mentioned by Vasudev looks like exactly what you need. It should be simple to instrument your code with that module, get the call graph and then use graphviz or some similar tool to draw a picture of it. > 2. it seems like some easy to use library is out there which spits out > that pretty visual call flow diagram/graph which seems more > intuitive(though maybe less precise ?) than a text call stack Of course. Different strokes for different folks. [...] Footnotes: [1] https://pymotw.com/2/trace/ -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Tools/libraries to determine the call graph(call flow) of an python program (module/package)
On Tue, Jan 12 2016, ashish makani wrote: [...] > Is there a python library/tool/module , to which i give input the start > point of X, x.py > and the input arguments, arg1, arg2, ..., argn I once needed something like this but went about it statically using this http://code.activestate.com/recipes/577222-create-module-dependency-graph/ and then added some project specific stuff into it. It got me what I wanted. Generally though, the simplest way would be to stick an import pdb; pdb.set_trace() inside the appropriate function in v.py and then look at the call stack no? [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Call for proposals PyDelhi Conference
On Mon, Jan 11 2016, yogesh gupta wrote: > Does the event happens in mumbai anytime of the year ? [...] If you know sufficient Pythonistas in Mumbai, you should try to conduct a small scale conference by yourself. Lots of regional events is a good thing. :) -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python comparisons
On Sat, Dec 05 2015, Gora Mohanty wrote: [...] > Maybe because that was the historical way that C did it? I agree that > the Python 3 exception makes more sense. [...] We can only guess but you'll have to explicitly code this in and I can't think of any situation where it would make sense. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python comparisons
On Sat, Dec 05 2015, Anand Chitipothu wrote: [...] > Thats why you should use Python 3. Here is what you get with Python 3. [...] Yet another reason to move. I'm still curious why they did it the other way in 2.x though. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Python comparisons
So I came across this today.. >>> class Number(object): ...def __init__(self, n): ... self.n = n ... >>> m = Number(10) >>> n = Number(5) >>> >>> m < n True This is documented like so > If no __cmp__(), __eq__() or __ne__() operation is defined, class > instances are compared by object identity (“address”). over here https://docs.python.org/2/reference/datamodel.html#object.__cmp__ It seems a rather arbitrary thing to do. Why is it implemented at all? I'd expect it to just break with a TypeError similar to what would happen if I do >>> m + n Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for +: 'Number' and 'Number' >>> -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Zendesk
On Wed, Nov 25 2015, ashish makani wrote: > Weird. > I don't see such an error. > > Maybe some side effect of your mail program ? [...] Yup. Looks like it's just me. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Zendesk
Is "in...@surendran.zendesk.com" subscribed to the list? I get an automated reply for each and every email that comes on this list from that address. If others see something similar, please remove the address from the list roster. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Funding FOSS through CSR
On Sat, Nov 21 2015, Harsh Gupta wrote: [...] > So, what do you think about it? [...] I'm sceptical of organisations and much prefer that companies directly hire people to work on free software rather than first make x, then donate a small fraction of x to some organisation who then donate a fraction of that to the actual people who do the work from which said company profits. I think the historical shift from "free software" to "open source" has encourage a culture of parasitism in many commercial entities and they view open source as just a way to get good people without paying salaries. That's what needs to change. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Life lessons shared by Jesse Noller
On Thu, Oct 29 2015, Gora Mohanty wrote: [...] > With all due respect to Mr. Noller, the article is not germane to this > list. Please refrain from off-topic posts. [...] Perhaps not completely relevant to PyCon but it is, I think, useful to many people who are putting in time and energy to keep this community going. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Life lessons shared by Jesse Noller
On Fri, Oct 30 2015, Gora Mohanty wrote: [...] > OK, we will have to agree to disagree, Incidentally, this was posted > to the bangpypers list which is explicitly devoted to Python, and not > to the Pycon list. Yeah. I meant to say python but mistyped it. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Online communication channel
On Sat, Aug 15 2015, kracekumar ramaraju wrote: [...] Biggest problem with IRC is to on board new comers. The learning curve is steep for normal tech users. It only makes life for already acquainted users easier not for new comers. It hardly takes 5-15 minutes get new person to get used to slack whereas that is not case with IRC. My vote is for IRC. - It doesn't require registration (atleast not with some company). - It's something which a lot of projects still use and so the learning investment is worth it. - It's open and there are variety of clients ranging from a web based (webchat.freenode.net) to native GUI clients for all platforms. - It's been around for a long time and has more longevity than a freemium service from a startup. Also, countering some of the objections. - The learning curve is not that steep if you're using a GUI client. You get a list of servers. Connect to one and then a list of chatrooms (channels). Join #bangpypers with a click and you're on. Surely people who code and learn coding can pick up IRC. Once you stick on for a while, all the idiosyncrasies like the / commands become normal.[1] - Logging, notification etc. can be handled by one of the various open source bots out there. We can keep history with as much scrollback as necessary. Most open source chat rooms do this. [...] Footnotes: [1] I used IRC for my training classes at http://thelycaeum.in and the students had no problem in adjusting after one class. Also, I think Kushal uses IRC for his DGPLUG trainings which have tons of students online at once. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Online communication channel
On Sun, Aug 16 2015, sankarshan wrote: [...] An anecdote_of_one: a reason Slack or, Scrollback like services are often preferred over IRC/email is because of the asynchronous nature of request-response. For example, you seek some answer and unless you are logged in, the responses will not be available at a later stage (and here if you'd like to come in with IRC bouncers, logging and so forth ...) Good point. That *is* a convenience. [...] Surely people who want to participate and contribute ... Let's not limit these conversations to only those who want to code. True. Sorry. My general point was that it's not as technical as it's made out to be especially with a nice native or web based client. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Online communication channel
On Sun, Aug 16 2015, kracekumar ramaraju wrote: [...] AFAIK having apps in all platforms helps users to stick to the conversation and get notification. How awesome will it be if someone asks a question and gets an answer after 5 hours and notified for it. [...] Kind of like a mailing list. :) But yeah, true. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Online communication channel
On Sun, Aug 16 2015, kracekumar ramaraju wrote: [...] Surely people who want to participate and contribute ... Let's not limit these conversations to only those who want to code. +1. This will make huge difference. Significant amount of users are on windows and lot prefer web client. Web client has Desktop notification. This is big difference between IRC web client and messaging client. This can be big sticky factor. Notifications are configurable. [...] Sounds good. Give it a shot and if it has more traction than IRC and such, so much the better. I'm generally in favour of software that has and will last[1] rather than what is trendy now especially for core stuff but that's purely my personal opinion. Also, these things serve different roles. Mailing lists, the meetup group, the twitter account, the facebook page and now, perhaps the slack group which might not even be competing with IRC. As long as they bring in dividends, +1. Footnotes: [1] https://mako.cc/writing/hill-free_tools.html -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python script to open hyper terminal and send password text file
On Fri, Aug 14 2015, Python Consultant wrote: Hi Guys, I am writing a script to open hyper terminal and send password file for serial port reprocessing. using subprocess.Popen i am able to open hyper terminal subprocess.Popen([Hyperterminal path, saved session path]) Once it is opened, I need to click on file option and select send file option. [...] I haven't done this for a while but I remember automating a windows GUI using, I think, pywin32. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Connecting developers and companies
On Mon, Jul 20 2015, vijay kumar wrote: [...] Am one among them hence i want to see it continue to be what it is today. [...] That's great and I'm sure it'll get better. My comments were just my own thoughts. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Connecting developers and companies
On Mon, Jul 20 2015, vijay kumar wrote: [...] We expect companies to be alteast be active in community in share knowledge rather than just coming for job posting announcement. Companies are not interested in sharing knowledge. They're interested in hiring and making money as it should be. Employees from companies share knowledge and do things like what you've said and they sometimes move between organisations. A user group meetup is a fine place to do this. I just feel that we shouldn't get too leftist about the way we speak to companies. There is some place for commercial interests in a healthy community. A position where the community and the companies are completely separate and even confrontational is not sustainable. It might even endup becoming Job Fair where people(carry resumes) and companies(Carry boxes) come for hiring not to discuss about python. I don't see the point in shooting down an idea based on an extreme doomsday scenario. If people start doing this, the organisers can stop it. My expectation is that *most* of the companies get how the ecosystem works and will respect it. There will be a few people, probably non tech folks who just focus on hiring who might screw things up but we can always tell them to stop rather than cancel the whole project up front. In either case, it's really great that such a possibility is even being discussed. The people working on bangpypers really deserve our appreciation for bringing the whole thing upto this level and going forward, I'm sure it'll only get better. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Connecting developers and companies
I still think it's a worthwhile experiment and should be tried. If things go awry, it can be cancelled. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Connecting developers and companies
On Sun, Jul 19 2015, kracekumar ramaraju wrote: [...] There was a suggestion of having 10 minutes slot at the end of the meetup where companies can speak about them and openings for 2 minutes. +1 atleast as an experiment. Companies are part of the community. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Connecting developers and companies
On Sun, Jul 19 2015, Deep Sukhwani wrote: One major concern of all is that people showing up on meetups ONLY with an agenda of getting a chance to speak with employers. True but I think this distinction between community and companies is not as clear cut as it's made out to be. Companies do donate things like office space etc. and they get publicity and possibly, hires. To formalise that a little and to get them more involved sounds, to me, like a good thing. And, as a general rule, it's good to assume that the companies are good community players and design the meeting for good people. If we find someone trying to take advantage of the whole thing and poisoning the ecosystem, we can always do something then. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)
On 2015-06-21 19:48, anu sree wrote: Thanks noufal, I got it. After gevent.spawn, we have to do join or gevent.joinall or gevent.sleep or patched library call to start the greenlets, right ? join (and joinall) will pause the current greenlet till the ones you've joined terminate (similar to the threading.Thread join method). gevent.sleep will suspend the execution of the current greenlet and let other greenlets get some time to execute. I have see the code which not using any of these after gevent.spawn, How it is working there ? https://github.com/Juniper/contrail-controller/blob/master/src/opserver/uveserver.py#L656 Neither of these are *necessary*. Just creating a greenlet and `.start`ing it will make it run similar to a thread as long as other greenlets don't hog the CPU and have some calls that can context switch. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)
On Sun, Jun 21 2015, anu sree wrote: [...] This code has two pause (gevent.sleep(0)), in Consumer.start and Worker.run. Here control goes to Worker.run when Consumer.start pauses and Consumer.start gets control back when Worker.run pauses. There may be benefit from this switching, but I am still not understanding it. [...] The idea is that any non blocking call is an opportunity to switch between greenlets. The monkey patching system will enable this. If you don't have any place in your greenlets that are monkey patched (and therefore allow switching), you can be a good citizen and drop in a patched sleep call so that other greenlets will get time to run. Otherwise, you'll simply hog the interpreter and no one else will be able to run. This the principle. I still don't understand your question. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)
On Sat, Jun 20 2015, anu sree wrote: Hi, I have seen an example of gevent context switch http://sdiehl.github.io/gevent-tutorial/#synchronous-asynchronous-execution Could you please give some real use case with example. It would be fine If you can share link of github project which uses gevent context gevent.sleep(0). [...] The difference between a regular sleep and a gevent sleep is that the gevent sleep will not make the whole interpreter process sleep. It will instead, only make the current greenlet sleep which essentially tells the internal scheduler to not execute it till the time is over. You can see this happen like this. Make a greenlet in your interpreter like so from gevent import Greenlet class Printer(Greenlet): ... def _run(self): ... n = 0 ... while True: ... n += 1 ... print n This simply prints numbers starting from 1. now you can create this greenlet and start it p = Printer() p.start() Nothing will happen. This is cooperative multitasking where the current Greenlet (your interpreter shell) has to give up its time slice and let p execute. You can do this by monkey patching sleep from gevent import monkey monkey.patch_time() import time time.sleep(1) Now, control is handed over to the Greenlet. However, it is not cooperative and runs a tight loop without ever giving up control. This means, that you'll never be able to execute your own interpreter again. So you see, the various greenlets have to cooperate to get things done. This is in counter distinction to how preemptive multitasking works where the OS can force the currently executing thread or process to stop and then grant execution to something else. They don't need to be nice. If your greenlet looked like this class Printer(Greenlet): ...def _run(self): ... n = 0 ... while True: ... n += 1 ... time.sleep(0.1) ... print n the slot would be given up inside each iteration and other greenlets can execute. Try it. So people stick in a call to a monkey patched version of sleep inside tight loops to suspend the current interpreter for a short period of time thereby letting other greenlets execute. Krace's example is a good one. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Anyone who has worked on Lamson?
On Wed, May 27 2015, Ramdas S wrote: Need to have an offline call, if they have time and if available, to take a quick decision to take a call on to shelve or use this tool or build somethig from scratch... [...] I wrote an email interface to a ticketing system using lamson once. It's very nice. An MVC framework for emails. However, the community is not very active (I'm on the mailing list) and I don't know how much it's maintained and worked on. Also, it requires setup, monitoring, configuration etc. of an email server so we didn't deploy my solution and instead opted for a little script that fetched emails via IMAP from the gateway and processed them in batches on a regular basis. I wouldn't use it for a production system. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Anyone who has worked on Lamson?
On Wed, May 27 2015, Ramdas S wrote: Noufal, I want to use this for setting up an interim SMTP server which based on certain rules should decide whether the mails need to go through the normal corporate server, or should go through an alternate SMTP server. This is primarily to reduce outbound spam as a result of some marketing campaigns running on side. You want to use lamson to send emails? I've used it to receive and process emails programmatically based on header fields. I don't think it's a particularly good candidate to handle sending. Configuring a normal SMTP server properly would be better. I think most of them have ways of defining rules based on various fields to select where the next hop is. That sounds like what you want. Is this an application for which you can use Lamson, the docs and other stuff is very confusing. I don't think think so. tldr; 1)create a middleman SMTP gateway which captures the mail 2) parses it and 3) then decides what to do with it. The 2nd and 3rd part can be done easily with existing known libraries, is Lamson recommended to do the first job or is there anything better? Unless you need to do something other than some simple rule matching based on fields in the incoming mail and forwarding, I wouldn't use lamson. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] fresher jobs help
On Mon, Apr 20 2015, Abishek wrote: Myself Abishek ,2015 B.E passout (computer science and engineering ) fresher, looking for python based jobs in bangalore.If anyone know job opportunities pls let me know. I am so much interested in python programming,networks and security... [...] Try https://hasjob.co/?l=bangaloreq=python -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] April Meetup
On Sun, Apr 12 2015, kracekumar ramaraju wrote: [...] No, it is third saturday day of the month, following same tradition. Unfortunately, this time we had hiccup with venue host. [...] Cool. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] April Meetup
On Sun, Apr 12 2015, kracekumar ramaraju wrote: Hi We're hosting April meetup on 25 in IBM Accelerator, Domlur. RSVP is open http://www.meetup.com/BangPypers/events/178049472/. [...] Krace, Is it always on the last Saturday of the month? Thanks. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [JOBS] pythonistas with Django + JS + HTML5 + WS experience
On Sat, Mar 07 2015, HHB wrote: Hi Guys, Here’s more info: based on what people asked: 1. It’s an established product company, so competitive pay. (I am no HR though) [...] Surely it's simpler just mention the name of the company? Why all this cloak and dagger secrecy? :) -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python training material
On Tue, Jan 20 2015, Suyash Bhatt wrote: Hi Friends, I am looking for any Basic training material for Python which can be shared across (with due credit). Please let me know if anyone can help me with that. I wrote this for an early training I conducted. It's out of date though and needs fixing but you might be able to get something out of it. http://nibrahim.net.in/self-defence/ [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python training material
Fine be me but don't hold me responsible if you pick up some bad habits from my tutorial. Like I said, it's out of date and unmaintained. On Tue, Jan 20 2015, Shrayas rajagopal wrote: Hi Anand, Krace, Noufal, On Tue, Jan 20, 2015 at 10:42 AM, Anand Chitipothu anandol...@gmail.com wrote: http://anandology.com/python-practice-book/ On Tue, Jan 20, 2015 at 10:59 AM, kracekumar ramaraju kracethekingma...@gmail.com wrote: https://github.com/kracekumar/pythonbyexamplestutorial https://github.com/kracekumar/learnpythoninminutes/blob/master/learn_python_in_minutes.pdf On Tue, Jan 20, 2015 at 11:47 AM, Noufal Ibrahim KV nou...@nibrahim.net.in wrote: I wrote this for an early training I conducted. It's out of date though and needs fixing but you might be able to get something out of it. http://nibrahim.net.in/self-defence/ Is it ok if we use this for some of the Chennaipy training sessions? Best Regards, Shrayas ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Terrible choices: MySQL. What is the way ahead?
On Tue, Dec 30 2014, Okan bhan wrote: [...] My major reason to continue will be no exposure to PostgreSQL. And after struggling so much with MySQL, if I use Postgre I will be in a domain of unknown again. Can anyone please point to articles comparing latest version of both or share their view for a db novice. [...] I can't offer anything normative but in my experience (and it's a little dated since I don't use mySQL for anything these days), mySQL is a disaster waiting to hit you. If I had to recommend a path ahead, I'd suggest that you bite the bullet now and make the technical and other investments necessary to migrate from mySQL to postgres right away. It's a much more future proof investment. If your budget and situation doesn't allow for that, atleast make a plan to migrate and stop investing in mySQL for any of your work from now. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Terrible choices: MySQL. What is the way ahead?
On Tue, Dec 30 2014, Gora Mohanty wrote: On 30 December 2014 at 19:32, Noufal Ibrahim KV nou...@nibrahim.net.in wrote: [...] I can't offer anything normative but in my experience (and it's a little dated since I don't use mySQL for anything these days), mySQL is a disaster waiting to hit you. [...] Personally, I agree with this, but such arguments often degenerate into flamewars. IMHO, it comes down to a matter of knowing your tools, and what use-cases they can meet. Sometimes, mysql can be what one needs. [...] They're both RDBMs. Unless you have legacy stuff to support or are tied down to mySQL for any non tech. reason, I can't really think of how it would be what one needs. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Python books online (was: BangPypers Digest, Vol 88, Issue 21)
On Mon, Dec 29 2014, piyush singhai wrote: Hello, You can download from here. python essential reference 3rd edition https://microembedded.googlecode.com/files/Python_Essential_Reference_3rd_Edition.pdf [...] This looks like it's being hosted in violation of copyright. Please don't publicise or use such copies. People put in a lot of effort to produce these works and they deserve recognition and payment. If you want free books, there are several that are available online for free (legally). The official Python tutorial is one such example[1]. There's also Zed Shaws LPtHW[2] - the HTML version is freely available online. If you find it good, buy the PDF to support the author. Dive into Python[3] is another GFDL'ed book available online. There's also A Byte of Python[4]. Footnotes: [1] https://docs.python.org/3/tutorial/index.html [2] http://learnpythonthehardway.org/ [3] http://www.diveintopython.net/ [4] http://www.swaroopch.com/notes/python/ -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python certifications in India
On Wed, Dec 24 2014, Saager Mhatre wrote: [...] We... I wouldn't put quite as much stock in the CCNA given the people we interviewed at TW for a sysad position. CCNA's are the lowest rung as far as I know. They're fairly easy to get too. CCIEs are very hard to get and the ones I know who have the certification are top players in their game. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python certifications in India
On Mon, Dec 22 2014, Bibhas Ch Debnath wrote: Is there anyone or any company here that actually values a certificate for Python? In my experience, certification courses mean nothing, at least for Python developers. None of the people I know or have worked with, cares about a certificate. I'd love to pmeet someone who thinks otherwise. [...] Some companies sell products that require a lot of expertise for the end user (e.g. Cisco). Configuring their equipment/software can be a full time task in itself. If the company themselves do this for their end clients, they'll get a services component bolted onto their product and that will affect their long term plans. However, if they can create some kind of qualification in the market and provide material for that, people unassociated with the company will try to get it and will become employable. In that sense, certifications do have value. Given two people of roughly equal experience, if I were hiring someone to watch over a network of Cisco gear, I'd pick the one who has a Cisco certification. Language certifications don't really fall into this but I suppose when the ecosystem is large enough (e.g. Java), you can cut off a piece and certify people in that department. It will have marketing value for a class of clients. Python doesn't (yet) come under this category so I don't think there are any certifications in India. I don't know many people who use Python that would consider a certificate as something valuable. The only certificate course for Python that I know of is the O'Reilly one. [1]. Footnotes: [1] http://www.oreillyschool.com/certificate-programs/python-programming/ -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] List of n but same objects
On Thu, Dec 11 2014, Rajiv Subramanian M wrote: [...] Question: 1. How in the first case i.e [iter(x)] * 3 creates a list of 3 but the same objects? The * operator when applied to a list (or any sequence type) is a repetition. You can see the code for list_repeat here [1]. The line I've linked to shows what's happening. You allocate enough memory for a new list that's large enough and copy over stuff from the source to the target those many times. Multiplying a list by `n` returns a new list with each element of the said list repeated `n` times. 2. Is there any other possibility or way (like * operator does here) by which we can obtain the same result as in CASE 1? You could do something like this. x = range(10) [iter(x) for x in range(3)] This will call 3 iter times and give you 3 separate iterators. I think though that you're doing something wrong here. What's the larger problem you're trying to solve? 3. Does only list and listiterators objects can behave this way? what other python datatypes can behave this way? This the semantics of sequence types. I haven't checked for tuples etc. but the list sequence methods behave this way. I don't think the others will be different. It doesn't make sense to make copies of the original thing anyway. You can do that explicitly using copy or something if you want to. [...] Footnotes: [1] https://hg.python.org/cpython/file/ce66b65ad8d6/Objects/listobject.c#l567 -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Inpycon] [X-Post] Diversity
On Tue, Nov 18 2014, Vanitha Shanmugam wrote: [...] We have the mailing list ( http://lists.pssi.org.in/mailman/listinfo/diversity) created. This mailing list only for female pythonistas and the archives are not public so the discussions are kept private. [...] There is a Python diversity list at https://mail.python.org/mailman/listinfo/diversity which you might want to send your email to. There are folks from there from India and other countries who are interested and will probably be able to contribute. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] about python code
On Mon, Nov 17 2014, narayan naik wrote: hi, when I am running face detection code ,I am getting this error. [...] This is a very basic question. You should go probably go through a python tutorial before attempting this. I'm presuming that you actually want to do something with opencv. If you don't understand the basics of importing modules, you'll keep hitting roadblocks. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Does Python have lexical scoping?
On Sun, Nov 09 2014, Abhishek L wrote: [...] Here x was a mutable variable, doing a similiar ML construct, ie val x = ref 2 fun f y = !x + 2 f 10 ; evals to 12 x := 10 f 10 ; evals to 20 So this becomes a problem of closures over mutable variables? ie every closure looks up the value of same variable, x which gets mutated around. WDYT? [...] So the explanation I got is that it binds the environment at definition time but the environment means a mutable table of key value pairs. In other words, the closure closes only over the name of the variable and not the value at definition time. I don't really understand how useful this is unless you have some kind of environment that you can't get to (e.g. non local inside a function etc.). Also, and this is my real question, How is lexical scoping with a mutable environment different from dynamic scoping? -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Does Python have lexical scoping?
Okay, I've been struggling through the proglang course on coursera and this thing came up val x = 2; fun f y = x + y; The second line creates a function that adds `x` to it's argument. Since ML is statically scoped, this is really a function that adds 2 to its argument. Even if I later create a new binding for x later like so val x = 10; f (3); I will still get back 5 (i.e. 2 + 3) instead of 13 (10 + 3). This makes sense to me as an example of lexical scoping. The bindings are at the time of definition rather than invocation. With python, it's different. The claim is that it has lexical scoping but. x = 2 def f(y): return x + y x = 10 f(3) The answer is, distressingly, 13. The explanation was that although Python has lexical scoping, that closure close over variables rather than values. Meaning that the variables (and not their values) at definition time are stored in the closure. This is how elisp does it which claims to be, by default, dynamically scoped. (setq m 5) (defun test (x) (+ x m)) (test 3) ; - 8 (setq m 15) (test 3) ; - 18 So, my question is, how different is this from dynamic scoping (like in elisp) where the values are actually picked up from the execution (rather than definition) environment. This business of closes over variables rather than values sounds like a cop out. Comments? -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] BangPypers Digest, Vol 86, Issue 16
On Mon, Oct 27 2014, Okan bhan wrote: Hi Noufal, Thanks for responding and helping me explaining these. I see lots of my doubts are clear, except last (c). My explanations are inline. A simple implementation of this is: class SimpleMapping: def __init__(self, items): self._items = items def __getitems__(self, subitem): print('*' * 20) for item in self._items: if subitem in item: return True return False This is broken in two ways 1. The magic method is __getitem__ (not __getitems__). I'm assuming it's a typo otherwise, the rest of your code will not work even as you've mentioned. Yes. Indeed it should be __getitem__. It was typo while manually typing in gmail. 2. A mapping object is similar to a dictionary. It should return the actual object if you try to access it. Not a boolean True or False. Agree with you. Ideally it should have returned object and I can test by `if obj` or `if not obj`. Lets assume for now I want to continue with this. The mapping objects given are specifications of the locals and globals in which you will evaluate your string. Consult help(eval) for more information. eval(source[, globals[, locals]]) - value Makes sense. So essentially I'm trying to evaluate and expression ('foo' or 'foo and bar') against a local mapping. Not fully confident but I can see the use of locals globals here. Look at my comment above. Your Mapping object is flawed and all these responses are quite wrong. Yes. Sorry for the typo. Without typo these will be the expected answers. eval('5.6', {}, mapping) 5.6 I'm not sure how this will work. In my case, I see this. mapping = SimpleMapping(set(['aaa', 'bbb', 'ccc'])) eval('5.6', {}, mapping) Traceback (most recent call last): File stdin, line 1, in module TypeError: locals must be a mapping That is strange, I'm still getting 5.6 as result. I tried on different python versions as well. eval('aa.a', {}, mapping) AttributeError: 'bool' object has no attribute 'a' My doubts are: a. Why it didn't run for numeric 5.6? Also why is dot separated '5.6' any different to 'aa.a'? I looked around on eval documentation and examples but couldn't find use of eval with a mapping. 5.6 is not an attribute access. 5.6 is is a floating point number. aa.a is an attribute access. It will first return False for `aa` since there is no such key and your code returns False and then try to access `a` in the Boolean which, predictably, fails. Big thanks for this. Let me explain what, I understood here. Lets say statement we want to evaluate is `eval(expression)`. Python starts checking 'expression' against each datatype starting from int - float - str. For all native datatypes, it will return corresponding result. Finally if it doesn't matches any of native types, tries to access against mapping(or any other object in local or global scope). Which is the reason, type(eval('5.6')) is float type(eval('5.6') is str (expression is under double quotes). For the case of eval('aa.a'), it first tries to match 'aa'. This is not any native type so goes to check in mapping and finds it True. Then tries to find attribute 'a' of returned type (a boolean). Hence boolean object has no attribute 'a'. b. I see many blogs suggesting to refrain from using eval unless absolutely needed. Is this one use case we must use it? Do we have any better way to evaluate this? I'm not sure what exactly you want to do. Can you explain again? I came across blog posts suggesting not to use eval mostly as it can lead to un-secure code. So wanted to check should I put efforts in solving this with 'eval' or not. Not an option now. I will explain my problem in next question. c. If indeed, I have to evaluate a string containing dots, how to do in the above scenario? The object whose attribute you're trying to access should be there in the locals or globals and then should have an attribute with the given name. It will work then. [...] yes. If my above observation is correct, this is clear to me. I will try to explain my problem: I have a list of strings ( say ['aaa', 'bbb', '4.5-'] ) and I want to check if an expression (say 'aa') is a substring of any of this item. Simply: all([ item for item in ['aaa', 'bbb', '4.5-'] if 'aa' in item]) == gives True as 'aa' is a substring of 'aaa'. But my expression can be a logical expression like 'aa or bb', 'aa and bbb', 'aaa and 4.5' etc. This works in my above implementation. If we assume mapping object from above. Writing it again here for ease. class SimpleMapping: def __init__(self, items): self._items = items def __getitem__(self, subitem): for item in self._items: if subitem in item: return True return False mapping = SimpleMapping(set(['aaa', 'bbb', '4.5-'])) eval('aa and bb', {}, mapping)
[BangPypers] eval (was: BangPypers Digest, Vol 86, Issue 16)
Please ignore my earlier reply to your email. I hit send by accident. Please edit the subject line when you're replying to a digest. On Mon, Oct 27 2014, Okan bhan wrote: [...] 2. A mapping object is similar to a dictionary. It should return the actual object if you try to access it. Not a boolean True or False. Agree with you. Ideally it should have returned object and I can test by `if obj` or `if not obj`. Lets assume for now I want to continue with this. I didn't understand what you mean by this. What are you attempting to test with the `if` statements? And what do you want to continue with? The mapping objects given are specifications of the locals and globals in which you will evaluate your string. Consult help(eval) for more information. eval(source[, globals[, locals]]) - value Makes sense. So essentially I'm trying to evaluate and expression ('foo' or 'foo and bar') against a local mapping. Not fully confident but I can see the use of locals globals here. Every statement needs an evaluation context. Suppose I ask what the result of the statement `x+2` is, you need a context which provides the value of `x` to be able to answer meaningfully. Python has two such contexts. First is the local context which is inside the function and the second is the global context which is at the module level. Without these, the source referred to above cannot be `eval`uated. [...] That is strange, I'm still getting 5.6 as result. I tried on different python versions as well. What version of Python are you using? [...] 5.6 is not an attribute access. 5.6 is is a floating point number. aa.a is an attribute access. It will first return False for `aa` since there is no such key and your code returns False and then try to access `a` in the Boolean which, predictably, fails. Big thanks for this. Let me explain what, I understood here. Lets say statement we want to evaluate is `eval(expression)`. Python starts checking 'expression' against each datatype starting from int - float - str. For all native datatypes, it will return corresponding result. Finally if it doesn't matches any of native types, tries to access against mapping(or any other object in local or global scope). This is a theory that explains the observations but I can't fully endorse your wording. Statements like Python starts *checking* 'expression' against each *datatype* *starting* from int - float - str is too slipshod for my tastes. Expressions (and I use this to mean the expr_stmt in the grammar[1]), have to be evaluated. A variable is an expression and it is evaluated by a symbol lookup. It is looked up first in the local and on failure, in the global context. Which is the reason, type(eval('5.6')) is float type(eval('5.6') is str (expression is under double quotes). For the case of eval('aa.a'), it first tries to match 'aa'. This is not any native type so goes to check in mapping and finds it True. Then tries to find attribute 'a' of returned type (a boolean). Hence boolean object has no attribute 'a'. More or less but it doesn't try to match `aa`. The expression first tokenised. You can see this. 1,0-1,2:NAME'aa' 1,2-1,3:OP '.' 1,3-1,4:NAME'a' 2,0-2,0:ENDMARKER '' This will get reduced into an expression and then be evaluated. The `aa` is looked up and then the semantics indicate that an attribute lookup should take place. [...] I came across blog posts suggesting not to use eval mostly as it can lead to un-secure code. So wanted to check should I put efforts in solving this with 'eval' or not. Not an option now. I will explain my problem in next question. evaling code which you have complete control over and which you generate is as safe as general code (although trickier to debug). If there's some tainted data in the string that you eval, the effects might be unpredictable. [...] yes. If my above observation is correct, this is clear to me. I will try to explain my problem: I have a list of strings ( say ['aaa', 'bbb', '4.5-'] ) and I want to check if an expression (say 'aa') is a substring of any of this item. Simply: all([ item for item in ['aaa', 'bbb', '4.5-'] if 'aa' in item]) == gives True as 'aa' is a substring of 'aaa'. Fair enough. That makes sense. But my expression can be a logical expression like 'aa or bb', 'aa and bbb', 'aaa and 4.5' etc. I'd do this by creating a predicate function e.g. def test(x): 'aa' in x or 'bb' in x and then all(item for item in ['aaa', 'bbb', '4.5-'] if test(item)) This works in my above implementation. If we assume mapping object from above. Writing it again here for ease. class SimpleMapping: def __init__(self, items): self._items = items def __getitem__(self, subitem): for item in self._items: if subitem in item: return True return False mapping = SimpleMapping(set(['aaa', 'bbb', '4.5-']))
Re: [BangPypers] Evaluating a string against mapping in python.
On Sun, Oct 26 2014, Okan bhan wrote: [...] A simple implementation of this is: class SimpleMapping: def __init__(self, items): self._items = items def __getitems__(self, subitem): print('*' * 20) for item in self._items: if subitem in item: return True return False This is broken in two ways 1. The magic method is __getitem__ (not __getitems__). I'm assuming it's a typo otherwise, the rest of your code will not work even as you've mentioned. 2. A mapping object is similar to a dictionary. It should return the actual object if you try to access it. Not a boolean True or False. The mapping objects given are specifications of the locals and globals in which you will evaluate your string. Consult help(eval) for more information. eval(source[, globals[, locals]]) - value Playing around against it for a bit. mapping = SimpleMapping(set(['aaa', 'bbb', 'ccc'])) eval('ppp', {}, mapping) False eval('aa', {}, mapping) True eval('xxx and aaa', {}, mapping) False eval('xxx or aaa', {}, mapping) True Struggled in beginning but now they all seem obvious to me. Tricky is: Look at my comment above. Your Mapping object is flawed and all these responses are quite wrong. eval('5.6', {}, mapping) 5.6 I'm not sure how this will work. In my case, I see this. mapping = SimpleMapping(set(['aaa', 'bbb', 'ccc'])) eval('5.6', {}, mapping) Traceback (most recent call last): File stdin, line 1, in module TypeError: locals must be a mapping eval('aa.a', {}, mapping) AttributeError: 'bool' object has no attribute 'a' My doubts are: a. Why it didn't run for numeric 5.6? Also why is dot separated '5.6' any different to 'aa.a'? I looked around on eval documentation and examples but couldn't find use of eval with a mapping. 5.6 is not an attribute access. 5.6 is is a floating point number. aa.a is an attribute access. It will first return False for `aa` since there is no such key and your code returns False and then try to access `a` in the Boolean which, predictably, fails. b. I see many blogs suggesting to refrain from using eval unless absolutely needed. Is this one use case we must use it? Do we have any better way to evaluate this? I'm not sure what exactly you want to do. Can you explain again? c. If indeed, I have to evaluate a string containing dots, how to do in the above scenario? The object whose attribute you're trying to access should be there in the locals or globals and then should have an attribute with the given name. It will work then. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Thu, Sep 25 2014, Saager Mhatre wrote: [...] Alternatively, would it be possible to model Stats/StatsList as a composite hierarchy (potentially with Courtesy Implementations http://martinfowler.com/bliki/CourtesyImplementation.html)? [...] I didn't know about Courtesy implementations till now. Thanks. I'm not really convinced with Fowlers argument and I didn't like the solution but it's still an interesting patterns. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Thu, Sep 25 2014, Saager Mhatre wrote: [...] Alternatively, would it be possible to model Stats/StatsList as a composite hierarchy (potentially with Courtesy Implementations http://martinfowler.com/bliki/CourtesyImplementation.html)? [...] I didn't know about Courtesy implementations till now. Thanks. I'm not really convinced with Fowlers argument and I didn't like the solution but it's still an interesting pattern. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Return values
I've recently come across something that I'd like some comments on. It's a stylistic issue so not something that there's an objective answer for. Nevertheless. I have a function that gets some statistics from some source and returns it to the user as a Stats object. Let's call it get_stats. This has a parameter `consolidate`. If consolidate is True, it will combine all the statistics and return just one Stats object. If not, it will return a list of Stats objects. The problem now is that this function sometimes returns a single thing and some times a list. I don't like this since I have to alter my calling code to handle this. I'm surprised that I've never hit this before and I'm not really sure how to handle it. Comments? -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Senthil Kumaran wrote: [...] One option to me looks like, don't have consolidate as parameter for this function, but do the operation outside. Like providing a function called get_consolidated_stats, which will call get_stats and provide the consolidated result. The reason I am suggesting is, consolidation is one of the operation that be performed on the the collection and it seems that injecting that operation on the collection is 'limiting' the API. [...] I thought of this. If I can, for example, implement __add__ for the stats, I can say something like consolidated_stats = sum(get_stats(), Stats()) My only objection was if the consolidation is not trivial or depends on the time of sampling, then it might be complex, if not impossible. Still, this seems like the neatest way to do it. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Anand Chitipothu wrote: [...] Oh, that feels like PHP. That style seems to be popular in that side of the world. It might be a good idea to add consolidate method on the return value. Something like: class StatsList(list): def consolidate(self): .. print get_stats(..) print get_stats(..).consolidate() [...] That's a nice solution. It's similar to what Senthil suggested but I like the API better. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Vivek Ramakrishna wrote: Hi Noufal Why not create two methods, get_stats() and get_stats_list(). Both can share logic in a common function which takes the consolidate flag - meaning your logic is localised to one point only. It makes for more readable code when called as well. [...] This approach (especially with many calls) will make the API really big. I don't remember but I've seen things with get_something, get_something_list, get_something_dict and what not which don't really help readability. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Sriram Karra wrote: [...] I think the comparison is not strictly apples to apples. In case of sort ascending / descending flag parameterises the same sort algorithm. In your case, you do some additional things (loop through and add up stuff, perhaps) based on the value of the flag. That is very different. [...] Of course but the API should hide that in a neat way from you shouldn't it? If I have two switches an operation, I'd still like to have just one function. Not 4 representing all the combinations. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Sriram Karra wrote: [...] Having a method do two different things based on a flag is not a clean answer to anything. [...] That's a useful rule of thumb. Thank you. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Sriram Karra wrote: [...] But your problem can be addressed by naming the functions after what they do - after all your consolidate function does something tangible other than just return a different type of data. [...] Let me give you a specific example. The psutils library has a function to get cpu times (idle, busy etc.). It can either do this per CPU (in which case, it will return a list of CPUTime objects, one per CPU) or give you the total (in which case, you'll get back a single CPUTime object). This is controlled by a per_cpu boolean flag. You can write a separate method to sum the individual times and then keep the conslidation outside get_cpu_times. The library chooses to sometimes return a list and sometimes return a single item. I don't like that. Now, I can write two functions like get_cpu_times and get_cpu_times_per_cpu. I don't particularly like that either. From the thread so far, Anand's solution is the one I like best. Although it's something tailored for my problem rather than a general pattern. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Return values
On Sat, Sep 20 2014, Sriram Karra wrote: [...] Anand's solution is good. But with the added context you have given - why are you not creating classes for CPU and Machine, with get_stats() and set_stats() methods for them? Something like: This is a higher level abstraction and something I might cook up depending on the application. My question was about the implementation of the get_cpu_stats function and its behaviour depending on the summary flag. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python is still greek to india's top IT firms
On Sun, Sep 14 2014, sayantan bhattacharya wrote: Hello all, I work at TCS and they didn't know about Python either. Now that I have written a script that does the log monitoring easy for the Application support guys, they have accepted the language. But there seems to be a resistance among the people using Java to accept that Python is powerful and capable enough to do the same task that Java does. Not unconditionally. From what I know, the JVM handles cross platform issues, JITting, concurrency etc. much better than Python. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] The Python I would like to see - Armin Ronacher
On 2014-08-19 12:31, Saager Mhatre wrote: That's just a question of testing strategy. If you're writing 'elaborate' tests at every layer, you're probably validating too much or exercising too much of the system at each layer of testing. The cartesian product of tests required to validate every implementation at a level of abstraction is inevitable if you want confidence in all those implementations; but these need to be limited to each pair of collaborator as far as possible so that so single test becomes too elaborate. But that's a different discussion altogether. However, I always got the sense that dynamic languages made this both easier and hard at the same time. Easier in that you didn't have to declare explicit interfaces between layers; harder in that all barking ducks are only identified at runtime! I suppose so. My epiphany was that tests, at the end of the day, are code. They need to be maintained, refactored, cleaned up, optimised, cajoled and worshipped just like one does with the actual application. The less code I write, the better. So, yes, it's a tradeoff. Once upon a time, a more naive version of myself loved the freedom that I got from this kind of thing. The cynical version of myself that's typing this email is not so sure anymore. He, at some level, feels that the extra headache of specifying interfaces is a better investment than using a dynamic language and writing tests to validate all the possible inputs. I'm glad somebody finally said this; and doubly so that it was Noufal! ;) I'm surprised that you've never heard this from me before. It's something that I decided on a LONG time ago. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] The Python I would like to see - Armin Ronacher
On 2014-08-19 14:05, Saager Mhatre wrote: [..] I realized this myself a long time ago, around the time I joined TW and started putting Ruby in production. However, all the dynlang love in the air at the time seemed to be blinding people to it. Since then I've sensed this sentiment among those that have grown wiser with age and experience. But you're the first one I've heard call it out without mincing words. [..] I don't want to be misconstrued as taking a side though. I still like dynamic languages for glue kind of work and when I want the dynamism. Scripting rules, places where quick turn around is more important than correctness e.g. elisp for Emacs, perl for quick and dirty text processing and things like that. It's just that apart from a more general use the right tool for the job and everything has it's place attitude, I'm leaning towards actually putting these things in a hierarchy of some kind and saying that X is, on the whole, better than Y rather than just hand waving about how they're all equal. Two points. It's very likely that I'm wrong about this in which case, it's one of those stepping stones that people slip on more often than not and secondly, with all the new work on languages and implementations going on recently, it's a great (and prudent) time to embrace the virtues of being a polyglot programmer. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] The Python I would like to see - Armin Ronacher
On 2014-08-18 21:45, chandrakant kumar wrote: Python 3 has been a disappointment. I haven't used it enough to judge (and this has, in my experience, been the case with most critics). However, as the projects I deal with grow larger, I'm becoming increasingly frustrated with Python (and dynamic languages in general). ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] The Python I would like to see - Armin Ronacher
On 2014-08-19 11:11, Sriram Narayanan wrote: Hi Noufal, could you elaborate on this? I have enjoyed the freedom of non-static typing that Python and Ruby offer, but also sometimes miss the static type checking that C# and Java offer. Yes. I like the freedom and they're great for prototyping. When things get large with a lot of moving parts, you need to write elaborate tests at every layer to validate the whole thing and even then, things slip through. I've also felt that the freedom encourages a kind of loose thinking that I have to guard against. This is completely subjective though and based mostly on vague feelings that have accumulated inside my head over my career trying to tame these computer creatures. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Mailing list etiquette
On 2014-08-08 11:40, Saager Mhatre wrote: [..] Didn't we already have this discussion on this list? Besides, doesn't mailman let us set a limit on the attachment size? One configuration to rule them all! Not that I recall. Even so, it's not just the size of the attachment but that multiplied by the number of users that it has to pump out. I suppose my attitude is a relic of my low bandwidth past but I can't really see the reason for landing a few MB pdf into the inboxen of all the subscribers of a mailing list. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Mailing list etiquette
On Mon, Aug 04 2014, Jeffrey Jose wrote: [...] I'm curious how do you read your mails? Noufal, if my memory serves me right you're an emacs person. So emacs perhaps? I'm in the vim camp, so I use my browser for email. I download my email when I'm online and read them using either mutt or Gnus (Emacs) in batches offline. [...] .. and since I use browser, I appreciate an email that's nicely formatted. Yes, that includes contextual information with embedded images. Fair enough. However, large attachments being duplicated on a *mailing list* is unnecessary. That's the consderation. Things are different for your personal communication. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Mailing list etiquette
On Mon, Aug 04 2014, Jeffrey Jose wrote: I agree with almost all of it, except for these 2. 1. No HTML emails I don't like HTML emails because usual textual matter doesn't need it. It simply bloats things and if the renderer your client is using doesn't have some feature that the sender uses, it'll appear broken. 2. No attachments. This makes sense for a list because, as I understand it, the list server has to send a copy of the attachment to everyone on the list. It's an avoidable expense. A lot simpler to send a link to something on dropbox or somewhere. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] how to override sys.stdin
On Mon, Aug 04 2014, Nitin Kumar wrote: thats a typo error. in simple term my question would be: How to override sys.stdin. [...] The StringIO module gives you file like objects into which you can put data. They might work as substitues for sys.std* -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] [Commercial] Mentoring course using Python
Hello everyone, One of the reasons I moved out of Calicut was to try to start a hacker school like setup in North Kerala. There's plenty of colleges and talented students there but many of them lack direction and motivation. I've found myself a little place and am offerring a 3 month long course to help students develop some skills that they might find useful in the industry and in their technical careers in general. I'm hoping to get to know the students during the course and then put them in touch with small companies that are looking for talent. I have a website at http://thelycaeum.in (and it should be obvious that I'm quite lacking in the digital design department) and the site blog mentions the course and the contents. I'm mailing here because I know that a lof of companies that use Python hang out here and this might be relevant to them. Thanks. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Replying to digests (was: BangPypers Digest, Vol 82, Issue 1)
On Mon, Jun 02 2014, JERIN JACOB wrote: Dear friends thanks for all your supports [...] Please reply to individual threads rather than to a digest. It's hard to follow the conversations. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Restart when python script hangs
On Mon, Jun 02 2014, Rahul Gopan wrote: Hello, When I run a python script it hangs at random places. Is there any way to identify when the script hangs and to resume it automatically. When I see that it is not responding i do ^Z (Ctrl -Z) to stop and then use fg command to start it again. I want to automate this. From the zen of python Errors should never pass silently. You should find out why it's hanging and fix it. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] introduction
On Sun, Jun 01 2014, JERIN JACOB wrote: Dear friends I am new to the user group and also python,my main aim to study the phyton will the help of these group [...] You're very welcome. This is what I recommend to most people who want to learn python from scratch http://learnpythonthehardway.org/ Enjoy and feel free to ask questions you encounter along your journey. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Fwd: Python script hangs after using logging module
On Tue, May 27 2014, Rahul Gopan wrote: -- Forwarded message -- From: Rahul Gopan rahulpce...@gmail.com Date: Tue, May 27, 2014 at 12:06 PM Subject: Re: [BangPypers] Python script hangs after using logging module To: Noufal Ibrahim KV nou...@nibrahim.net.in 1. Used subprocess.check_output. . Same result , it hangs 2. Am trying to run a bin file /bin/range branch Begin_No End_No which is supposed to provide me the number of items available between the Begin_No and End_No. I guess its not waiting for any input, it works like charm outside the python code. 3. Running the command outside works file. It hangs only when i use logging.basicConfig(filename= 'Log_file.log',filemode='w',format='%(asctime)s %(message)s',level=logging.DEBUG) before executing the command /bin/range 4. Without logging line it works fine so i guess there wont be any issue with being same directory or environment. 5. Creating the file manually outside the script works. No issue with that. [...] The only other thing I can think of is to use strace. On the python program itself and on the /bin/range program. I think that's where the problem is. It's probably behaving differently when launched from a shell and non-interactively. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Redefine concepts, Rewrite Books
On Tue, May 27 2014, Venkatraman S wrote: https://github.com/django/django/pull/2692 [...] There should be a button to not allow comments on a github pull request. That whole thread is a waste of time. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Python script hangs after using logging module
On Tue, May 27 2014, Rahul Gopan wrote: #!/usr/local/bin/python2.7 import commands import subprocess items = commands.getoutput('COMMAND branch Begin_no End_no | wc -l') print items -- Works -- #!/usr/local/bin/python2.7 import commands import subprocess import logging logging.basicConfig(filename='Log_file.log',filemode='w',format='%(asctime)s %(message)s',level=logging.DEBUG) items = commands.getoutput('COMMAND branch Begin_no End_no | wc -l') print items -- Hangs -- A few suggestions. 1. Consider using subprocess or envoy[1] instead of commands. It's deprecated. 2. Please specify exactly what you're trying to run rather than the placeholder you've put in your script above. My guess is that it's waiting for input and holding up the pipeline so that wc is never run. 3. Try running that command outside to see what the behaviour is. 4. If the command works, make sure that your script is running in the same directory and with the same environment as the one where the command works. 5. I'd be inclined to do the `wc` in Python rather than use a pipe. It looks okay in this case but usually, involving the shell while trying to execute something leads to headaches with quoting, variable expansion and other such things that are not worth it. 6. The basicConfig line will actually create and open the Log_file.log file. If you're on a disk that's misbehaving (e.g. a stale NFS mount), it might hang. Try creating the file manually outside the script to see if that's the issue. [...] Footnotes: [1] https://github.com/kennethreitz/envoy -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Multiple return values from a function : Where to draw the line ?
On Fri, May 23 2014, Rohit Chormale wrote: How is it if you use DataContainer class set attributes of that class. Something like, class Data(object): def __init__(self, **kwargs): object.__setattr__(self, 'attribs', kwargs) def __getattr__(self, item): if item in self.attribs: return self.attribs[item] else: raise AttributeError def __setattr__(self, key, value): if key in self.attribs: self.attribs[key] = value else: object.__setattr__(self, key, value) [...] You could cheat by doing this. class Data(object): def __init__(self, **kwargs): self.__dict__ = kwargs instead of the above implementation. It's, of course, untested and unverified. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Multiple return values from a function : Where to draw the line ?
On Fri, May 23 2014, Mandar Vaze / मंदार वझे wrote: Currently I came across the code that returned 9 values (return statement spanned 5 lines due to pep8 limitation of 79 characters per line) The function returns various values that are used by the template to render HTML To give you an idea - consider following two code snippets : (This is just a sample - it might lead you to believe these are various columns of a user table. Actual code isn't a row from DB table. All 9 values are computed, and aren't related to each other) My usual way of doing this is something like return dict(fname = fname, lname = lname, saluation = salutation, gender= gender, addr1 = addr1, addr2 = addr2, city = city, state = state, country = country) I'm not sure what rules this violates but it works for me especially when I read the code later. Also, I'm not too sure if you should be worried, atleast on an abstract level, about the number of keys this dictionary has. If they are all a single logical coherent unit, it'll fit in the programmers head. e.g. an address makes sense regardless of how many fields it has (first name, last name, street, pin code etc.). If on the other hand it's something vague that makes sense only to your own program, it'll be harder to justify and might require some amount of cleanup. I'm not sure about the performance impact. There are no so many values. You're returning just a (reference to a) single dictionary. The values will be pulled out of the memory when you access them. I don't think this answers your question since it's mostly opinion but nevertheless... [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Multiple return values from a function : Where to draw the line ?
On Fri, May 23 2014, kracekumar ramaraju wrote: You can use namedtuple. from collections import namedtuple Person = namedtuple('Person', ['foo', 'bar', 'baz']) p = Person(foo='foo', bar='bar', baz='baz') [...] Much better although with namedtuple, the attributes are fixed aren't they? I don't use collections as much as I should. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Multiple return values from a function : Where to draw the line ?
On Fri, May 23 2014, kracekumar ramaraju wrote: Rohit Probably ease of writing may be right here. It's also more future proof. An attribute can be replaced by a property which implements access controls and other things without breaking API contracts. It's harder to do that while subscripting. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Raising issue WRT Bangpypers mailing list
Just for context, here's the email where Danny says that he was not offended by the first email and didn't interpret it in the way that Pratham did https://mail.python.org/pipermail/bangpypers/2014-May/010161.html and my follow up reply saying that I didn't mean it that way either. https://mail.python.org/pipermail/bangpypers/2014-May/010163.html Also, I'm not managing or policing the list so please don't CC me directly in any replies. The list owner is mentioned on the listinfo page is probably the right person to contact for this kind of thing. On Thu, May 22 2014, Pratham Gadre wrote: Hello Brian Jesse, I am an incognito member of the BangPypers mailing list. Reason for being incognito is simple, the people who run the list are very sensitive to criticism and react in a harsh and non-professional manner. I was looking to see, who I could raise this issue to, via the Python.org website, I saw Brian was the communications officer and Jesse is the Vice-Chairman of the PSF. This time, I write to you with links to the content of the emails, which can be found at https://mail.python.org/pipermail/bangpypers/2014-May/010156.html My replies are available here - http://pastebin.com/7kWWcMvF Both my emails were rejected with the response: Your message was deemed inappropriate by the moderator. Screenshot of replied from the moderator. http://www.anonimg.com/uploaded-510571c65c8efdb3970761d95f85f5a8.png.html At the risk of sounding like a 5 year old complaining about a bully hitting him in school, may I request you to kindly warn the moderators of the mailing list. I guess as member of the community, if I feel something is not right, I have the right to voice my opinion. A few months back Anand Pillai, a PSF member. https://mail.python.org/pipermail/bangpypers/2013-September/thread.html It would really help, if there is some intervention. I would have ideally written to the list owners, but I have real bad experience in dealing with them earlier. Regards Pratham -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Raising issue WRT Bangpypers mailing list
Let's just let this pass? I, for one, don't have the time or interest to handle these kinds of things. If any of the people want to discuss this on the list, please do but I don't really want to spend any of my time on it. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Who do I contact in regards to PyCon India sponsorship?
On Mon, May 19 2014, Pratham Gadre wrote: The message was not targetted at one person :-) [...] The occasional arrogance and lack of good faith will be there. It's part of getting things done. -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers