From jrc.csus at gmail.com Mon Jun 4 04:32:54 2012 From: jrc.csus at gmail.com (J. R. Carroll) Date: Sun, 3 Jun 2012 19:32:54 -0700 Subject: [Baypiggies] Advice on how to improve my skills while working at a company that doesn't support Python Message-ID: Hi all, I am new to the list, new to Python (as of a few years ago), and definitely new to programming/scripting. I work as a practitioner for a company that has very little to do with programming of any kind, and I am the only one at the company that does any work in Python. Everything I know, up till now, has been self-taught. I have a substantial background in HTML/JavaScript, but most people don't count those for much of anything. With that said, I was just curious to know some thoughts on how I could improve my Python skills? I already "do projects", and I try to do everything I can in Python (I am a statistician at my company), but I am at the point with my Python skills that I am submitting code to stackoverflow or on the Python IRC channel and all I get is a lot of dissension and frustrated posters about how my code can be "optimized better", "why did you do it THAT way?!", or that "it's not pythonic" -- all of which just turns out to be empty criticisms with little suggestions on how to improve my code. I imagine that if I were at a "Python company" I'd have coworkers that could 'soundboard' with me or give me pointers, but I don't have access to that. In fact, I don't know anyone else that works in Python... Is there something you might suggest that I could 'do' to increase my skills as a python'er so the code I write is 'respectable'? Thanks, -J -------------- next part -------------- An HTML attachment was scrubbed... URL: From kellankade at gmail.com Mon Jun 4 04:57:54 2012 From: kellankade at gmail.com (Daniel Nowak) Date: Sun, 3 Jun 2012 19:57:54 -0700 Subject: [Baypiggies] Advice on how to improve my skills while working at a company that doesn't support Python In-Reply-To: References: Message-ID: <-9129393491341503168@unknownmsgid> Hey J, It sounds like you are off to a good start. I can suggest a couple of things. First don't let the people who say its not very pythonic derail you. Find an open source project you have interest in an try to go in and fix a bug or two. There are often several simple bugs that a person learning to go can fix. I know my own code there are always simple bugs that annoy me but I never get to fixing them because I am too busy fixing the big bugs. Second reach out and find a python group near you. Tooting my own horn a bit here but I teach a beginning python class which is free to the public. After my beginning class another instructor takes over and we work on a web project in python. Most of the students in the web class just got out of or are still in my class. So it's a great friendly place for people to ask questions. Even if my class is not the one for you there are other groups around that are open and welcoming. I don't know where in the bay you are so email if you need any details about our class. Cheers, Daniel On Jun 3, 2012, at 7:33 PM, "J. R. Carroll" wrote: > Hi all, > > I am new to the list, new to Python (as of a few years ago), and definitely new to programming/scripting. > > I work as a practitioner for a company that has very little to do with programming of any kind, and I am the only one at the company that does any work in Python. Everything I know, up till now, has been self-taught. I have a substantial background in HTML/JavaScript, but most people don't count those for much of anything. > > With that said, I was just curious to know some thoughts on how I could improve my Python skills? I already "do projects", and I try to do everything I can in Python (I am a statistician at my company), but I am at the point with my Python skills that I am submitting code to stackoverflow or on the Python IRC channel and all I get is a lot of dissension and frustrated posters about how my code can be "optimized better", "why did you do it THAT way?!", or that "it's not pythonic" -- all of which just turns out to be empty criticisms with little suggestions on how to improve my code. I imagine that if I were at a "Python company" I'd have coworkers that could 'soundboard' with me or give me pointers, but I don't have access to that. In fact, I don't know anyone else that works in Python... > > Is there something you might suggest that I could 'do' to increase my skills as a python'er so the code I write is 'respectable'? > > Thanks, > > -J > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From hyperneato at gmail.com Mon Jun 4 05:07:17 2012 From: hyperneato at gmail.com (Isaac) Date: Sun, 3 Jun 2012 23:07:17 -0400 Subject: [Baypiggies] Advice on how to improve my skills while working at a company that doesn't support Python In-Reply-To: References: Message-ID: Hi, I would suggest reading code from an open source project. I hear Flask has a really great codebase. Consider reading other open source projects that are inline with subjects that you are interested in. It's important to read code as well as write it to get a better understanding of the idioms. If you don't understand what is going on in the code, try to learn what it does. Ask the python-tutor mailing list if you need some assistance understanding it. Flask is a web framework, but if you are interested in machine learning, try to find an open source library that does that. There are some great books you can read that have examples that are very likely 'Pythonic'. Speaking of machine learning: "Programming Collective Intelligence" is one that uses Python. Also, "Learning Python" by M. Lutz is a great book that I read to learn the fundamentals of Python. Have you completed the Python tutorial within the documentation? Also, have you read the style guidelines? http://www.python.org/dev/peps/pep-0008/ Cheers, Isaac On Sun, Jun 3, 2012 at 10:32 PM, J. R. Carroll wrote: > Hi all, > > I am new to the list, new to Python (as of a few years ago), and > definitely new to programming/scripting. > > I work as a practitioner for a company that has very little to do with > programming of any kind, and I am the only one at the company that does any > work in Python. Everything I know, up till now, has been self-taught. I > have a substantial background in HTML/JavaScript, but most people don't > count those for much of anything. > > With that said, I was just curious to know some thoughts on how I could > improve my Python skills? I already "do projects", and I try to do > everything I can in Python (I am a statistician at my company), but I am at > the point with my Python skills that I am submitting code to stackoverflow > or on the Python IRC channel and all I get is a lot of dissension and > frustrated posters about how my code can be "optimized better", "why did > you do it THAT way?!", or that "it's not pythonic" -- all of which just > turns out to be empty criticisms with little suggestions on how to improve > my code. I imagine that if I were at a "Python company" I'd have coworkers > that could 'soundboard' with me or give me pointers, but I don't have > access to that. In fact, I don't know anyone else that works in Python... > > Is there something you might suggest that I could 'do' to increase my > skills as a python'er so the code I write is 'respectable'? > > Thanks, > > -J > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aahz at pythoncraft.com Mon Jun 4 16:38:12 2012 From: aahz at pythoncraft.com (Aahz) Date: Mon, 4 Jun 2012 07:38:12 -0700 Subject: [Baypiggies] Advice on how to improve my skills while working at a company that doesn't support Python In-Reply-To: References: Message-ID: <20120604143812.GB20146@panix.com> On Sun, Jun 03, 2012, J. R. Carroll wrote: > > Is there something you might suggest that I could 'do' to increase my > skills as a python'er so the code I write is 'respectable'? Go to a sprint Participate on comp.lang.python -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ https://en.wikipedia.org/wiki/Mary_Anning From hasan.diwan at gmail.com Mon Jun 4 19:08:11 2012 From: hasan.diwan at gmail.com (Hasan Diwan) Date: Mon, 4 Jun 2012 10:08:11 -0700 Subject: [Baypiggies] Advice on how to improve my skills while working at a company that doesn't support Python In-Reply-To: <20120604143812.GB20146@panix.com> References: <20120604143812.GB20146@panix.com> Message-ID: On 4 June 2012 07:38, Aahz wrote: > Participate on comp.lang.python > Is that still coming out? -- Sent from my mobile device Envoyait de mon portable -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony at tcapp.com Tue Jun 5 19:32:32 2012 From: tony at tcapp.com (Tony Cappellini) Date: Tue, 5 Jun 2012 10:32:32 -0700 Subject: [Baypiggies] gevent In-Reply-To: References: Message-ID: Do any of you know Sean McQuillan? He offered to do a presentation on Gevent- but hasn't replied to my emails. If you know him, would you please ask him to email me (and check his spam filter)? thanks On Thu, May 10, 2012 at 4:04 PM, Sean McQuillan wrote: > I'm a bit of a lurker on this mailing list but I have a bunch of > experience with Gevent and twisted and I stayed in a Holliday in express > last night :). > > I'd be up for putting a talk together. Who should I contact? > > Sean > > > On Thursday, May 10, 2012, David Lawrence wrote: > >> Can't shed light but I'd like to second the request for a talk on this if >> somebody has the time to put it together. >> >> >> >> On Thu, May 10, 2012 at 2:39 PM, wesley chun wrote: >> >>> interestingly enough, gevent, and more broadly, non-blocking I/O, is >>> the topic for the SeaPy users group meeting tonight: >>> http://lists.seapig.org/pipermail/seattle-python/2012-May/004396.html >>> >>> too bad we're not all up there right now as i'd like to hear more >>> about this stuff myself. anyone on the list feel like doing that, and >>> perhaps answer tony's question also? >>> >>> cheers, >>> --wesley >>> >>> >>> On Thu, May 10, 2012 at 1:51 PM, Tony Cappellini >>> wrote: >>> > >>> > Are any of you using gevent for non-web applications? >>> > If so, why did you choose it over other concurrency or parallelism >>> options >>> > available in Python? >>> >>> >>> -- >>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >>> "A computer never does what you want... only what you tell it." >>> wesley chun : wescpy at gmail : @wescpy/+wescpy >>> Python training & consulting : http://CyberwebConsulting.com >>> "Core Python" books : http://CorePython.com >>> Python blog: http://wescpy.blogspot.com >>> _______________________________________________ >>> Baypiggies mailing list >>> Baypiggies at python.org >>> To change your subscription options or unsubscribe: >>> http://mail.python.org/mailman/listinfo/baypiggies >>> >> >> > > -- > Sean McQuillan > 415.990.0854 > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtranby at enthought.com Thu Jun 7 20:14:27 2012 From: mtranby at enthought.com (Majken Tranby) Date: Thu, 7 Jun 2012 13:14:27 -0500 Subject: [Baypiggies] Python Training Class Message-ID: Hi Bay Piggies, I hope you are all having a nice week! I work at Enthought and wanted to let you know that we are having a Python open training class in San Jose from **Aug 27-31. I wondered if you might be willing to pass this along to your Python User Group and anyone who might be interested. If anyone is interested they should feel free to connect with us via info at enthought.com. Thank you so much! Best, Majken -- ***Majken E. Tranby* *Enthought Inc* 515 Congress Avenue, Suite 2100 Austin, TX 78701 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim at systemateka.com Thu Jun 7 21:50:42 2012 From: jim at systemateka.com (jim) Date: Thu, 07 Jun 2012 12:50:42 -0700 Subject: [Baypiggies] Python Training Class In-Reply-To: References: Message-ID: <1339098642.1707.104.camel@jim-LAPTOP> Thanks for the note, Majken. Please let us know where (if at Enthought, what room and maybe how to get to it) and if there's any cost (does "open" mean "free as in beer?"). On Thu, 2012-06-07 at 13:14 -0500, Majken Tranby wrote: > Hi Bay Piggies, > > I hope you are all having a nice week! I work at Enthought and wanted > to let you know that we are having a Python open training class in San > Jose from Aug 27-31. > > I wondered if you might be willing to pass this along to your Python > User Group and anyone who might be interested. If anyone is > interested they should feel free to connect with us via > info at enthought.com. > > Thank you so much! > > Best, > > Majken > -- > Majken E. Tranby > Enthought Inc > 515 Congress Avenue, Suite 2100 > Austin, TX 78701 > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From ljohnson at enthought.com Fri Jun 8 00:40:08 2012 From: ljohnson at enthought.com (Lauren J) Date: Thu, 7 Jun 2012 17:40:08 -0500 Subject: [Baypiggies] Python Training Class In-Reply-To: References: <1339098642.1707.104.camel@jim-LAPTOP> Message-ID: Hi Jim, The class, Python for Scientists and Engineers is a five-day intensive python session (8:30AM-5PM) with a focus on Python,NumPy, SciPy, integration with C/C++, Fortran, visualization and UI development. The curriculum is listed here. There is a fee associated with the class - $2500/participant with a 15 student max. The specific classroom location is TBD. Suggestions are appreciated. Most of the classes Enthought teaches are customized and onsite at companies and organizations with such modules as Parallel and HPC Python, Migrating from MATLAB, Time Series Management with Pandas, Reading and Writing Technical Data. In contrast to having to be with a certain company to attend, this class to "open" to anyone who registers. If you have any other questions, please let me know. Kind regards, Lauren P.S. On another topic, please spread the word that postersare still being accepted for the Scientific Computing with Python conference. Hopefully, it will provide an opportunity for people to share even very new things in works. On Thu, Jun 7, 2012 at 4:41 PM, Majken Tranby wrote: > Hello! > > Many of the details have yet to be sorted out. I have copied Lauren > Johnson who can maybe help answer some of your questions! > > Majken > > On Thu, Jun 7, 2012 at 2:50 PM, jim wrote: > >> >> >> Thanks for the note, Majken. Please let us >> know where (if at Enthought, what room and maybe >> how to get to it) and if there's any cost (does >> "open" mean "free as in beer?"). >> >> >> >> >> On Thu, 2012-06-07 at 13:14 -0500, Majken Tranby wrote: >> > Hi Bay Piggies, >> > >> > I hope you are all having a nice week! I work at Enthought and wanted >> > to let you know that we are having a Python open training class in San >> > Jose from Aug 27-31. >> > >> > I wondered if you might be willing to pass this along to your Python >> > User Group and anyone who might be interested. If anyone is >> > interested they should feel free to connect with us via >> > info at enthought.com. >> > >> > Thank you so much! >> > >> > Best, >> > >> > Majken >> > -- >> > Majken E. Tranby >> > Enthought Inc >> > 515 Congress Avenue, Suite 2100 >> > Austin, TX 78701 >> > >> > _______________________________________________ >> > Baypiggies mailing list >> > Baypiggies at python.org >> > To change your subscription options or unsubscribe: >> > http://mail.python.org/mailman/listinfo/baypiggies >> >> >> > > > -- > ***Majken E. Tranby* > *Enthought Inc* > 515 Congress Avenue, Suite 2100 > Austin, TX 78701 > > -- Lauren Johnson Enthought, Inc. Scientific Computing Solutions 512.536.1057 -------------- next part -------------- An HTML attachment was scrubbed... URL: From rbalfanz at gmail.com Mon Jun 11 20:21:15 2012 From: rbalfanz at gmail.com (Ryan Matthew Balfanz) Date: Mon, 11 Jun 2012 11:21:15 -0700 Subject: [Baypiggies] MindSnacks Backend Engineer Message-ID: *Hi All,* * * *My company is looking to hire another backend engineer. I'm currently the only engineer focused on this area. We build educational iOS games. Feel free to contact me if you're interested in hearing more!* * * *Apologies in advance if this post doesn't meet the requirments of the list (*http://www.baypiggies.net/ is currently pointing to a WebFaction page? so I wasn't able to double check). Cheers, Ryan ===== * San Francisco, CA (INTERN, H1B welcome) We build wonderful educational games in San Francisco. If you are nice and want to help us make splendid products, we'd love to hear from you. We're hiring in lots of areas! Here are a few: * Backend engineer: So much data, so little time! If you can extract signal from the noise, and want to improve the way people learn through our products, we want to hear from you! Experience with scaling multiplayer games or web services is a huge plus. * Mobile engineer: You build pocket-sized awesomeness on iOS and/or Android. We make games that teach people stuff. The perfect combination! We have plenty of fun and challenge projects for both mobile app and game developers. * UI designer: We believe that great design is essential to build products people love. If you live to make jaw-dropping UI experiences (web and/or mobile), this is the place to be! * -------------- next part -------------- An HTML attachment was scrubbed... URL: From bdbaddog at gmail.com Mon Jun 11 21:45:46 2012 From: bdbaddog at gmail.com (William Deegan) Date: Mon, 11 Jun 2012 12:45:46 -0700 Subject: [Baypiggies] MindSnacks Backend Engineer In-Reply-To: References: Message-ID: <49332883-60E8-42B8-9A1F-0DB93D1926C2@gmail.com> Ryan, Had to change DNS as provider moved us to another server so the site should be back up shortly. One of the requirements is that your posting should list how python is part of the job, which is missing from your listing below. -Bill On Jun 11, 2012, at 11:21 AM, Ryan Matthew Balfanz wrote: > Hi All, > > > > My company is looking to hire another backend engineer. I'm currently the only engineer focused on this area. We build educational iOS games. Feel free to contact me if you're interested in hearing more! > > Apologies in advance if this post doesn't meet the requirments of the list (http://www.baypiggies.net/ is currently pointing to a WebFaction page? so I wasn't able to double check). > > Cheers, > Ryan > > ===== > > > > San Francisco, CA (INTERN, H1B welcome) > > > > We build wonderful educational games in San Francisco. If you are nice and want to help us make splendid products, we'd love to hear from you. > > We're hiring in lots of areas! Here are a few: > > * Backend engineer: So much data, so little time! If you can extract signal from the noise, and want to improve the way people learn through our products, we want to hear from you! Experience with scaling multiplayer games or web services is a huge plus. > > * Mobile engineer: You build pocket-sized awesomeness on iOS and/or Android. We make games that teach people stuff. The perfect combination! We have plenty of fun and challenge projects for both mobile app and game developers. > > * UI designer: We believe that great design is essential to build products people love. If you live to make jaw-dropping UI experiences (web and/or mobile), this is the place to be! > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies -------------- next part -------------- An HTML attachment was scrubbed... URL: From bdbaddog at gmail.com Mon Jun 11 21:57:52 2012 From: bdbaddog at gmail.com (William Deegan) Date: Mon, 11 Jun 2012 12:57:52 -0700 Subject: [Baypiggies] Website moved to new IP, DNS just updated, may take a couple hours to propagate. Message-ID: All, Sorry for the hiccup, got a message from our hosting provider that it would move on 6/7, but missed that they were changing the IP. I'll post once I see that it's reachable again. -Bill From rbalfanz at gmail.com Tue Jun 12 20:46:15 2012 From: rbalfanz at gmail.com (Ryan Matthew Balfanz) Date: Tue, 12 Jun 2012 11:46:15 -0700 Subject: [Baypiggies] MindSnacks Backend Engineer In-Reply-To: <49332883-60E8-42B8-9A1F-0DB93D1926C2@gmail.com> References: <49332883-60E8-42B8-9A1F-0DB93D1926C2@gmail.com> Message-ID: Hi! Sorry, I forgot to mention that our entire backend stack is currently built on Python and Django, hosted on AWS. Python isn't just part of the job, it is the job! Cheers, Ryan On Mon, Jun 11, 2012 at 12:45 PM, William Deegan wrote: > Ryan, > > Had to change DNS as provider moved us to another server so the site > should be back up shortly. > > One of the requirements is that your posting should list how python is > part of the job, which is missing from your listing below. > > -Bill > On Jun 11, 2012, at 11:21 AM, Ryan Matthew Balfanz wrote: > > *Hi All,* > * > * > *My company is looking to hire another backend engineer. I'm currently > the only engineer focused on this area. We build educational iOS games. > Feel free to contact me if you're interested in hearing more!* > * > * > *Apologies in advance if this post doesn't meet the requirments of the > list (*http://www.baypiggies.net/ is currently pointing to a WebFaction > page? so I wasn't able to double check). > > Cheers, > Ryan > > ===== > * > > San Francisco, CA (INTERN, H1B welcome) > > We build wonderful educational games in San Francisco. If you are nice and > want to help us make splendid products, we'd love to hear from you. > > We're hiring in lots of areas! Here are a few: > > * Backend engineer: So much data, so little time! If you can extract > signal from the noise, and want to improve the way people learn through our > products, we want to hear from you! Experience with scaling multiplayer > games or web services is a huge plus. > > * Mobile engineer: You build pocket-sized awesomeness on iOS and/or > Android. We make games that teach people stuff. The perfect combination! We > have plenty of fun and challenge projects for both mobile app and game > developers. > > * UI designer: We believe that great design is essential to build products > people love. If you live to make jaw-dropping UI experiences (web and/or > mobile), this is the place to be! > > * > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Fri Jun 15 06:53:20 2012 From: itz at buug.org (Ian Zimmerman) Date: Thu, 14 Jun 2012 21:53:20 -0700 Subject: [Baypiggies] Trivial OOP pattern problem Message-ID: <87lijpp45b.fsf@foolinux.dyndns.org> I am writing some code using the cairo drawing library, or rather the pycairo binding to it. Unfortunately I sense a bit of API misdesign with the binding. To draw into a context ctx which I obtained somewhat like this: import cairo as C ctx = C.Context(surface) I am supposed to write a series of calls like this: ctx.set_source_rgb(1.0, 1.0, 1.0) ctx.rectangle(0.0, 0.0, float(rw), float(rh)) ctx.fill() ctx.scale(sx, sy) ... and it piles up. Each of these methods returns None, whilst it should conceivably return self, adding a lot of convenience: ctx.set_source_rgb(1.0, 1.0, 1.0).rectangle(0.0, 0.0, float(rw), float(rh)).fill() I would like to write a wrapper class around Context to enable this usage, but I don't know how to do that sanely. Sure, I could do this: class ContextWrapper(object): def __init__(self, surface): self.ctx = C.Context(surface) def fill(self): self.ctx.fill() return self def scale(self, sx, sy): self.ctx.scale(sx, sy) return self ... but then I have to wrap each method explicitly, or at least each method I use. I don't consider that sane. Is there a trick I am missing, perhaps using __dict__ or __getattr__ by which I could wrap all the methods wholesale? -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From isaac at overttone.com Fri Jun 15 07:28:51 2012 From: isaac at overttone.com (Isaac) Date: Fri, 15 Jun 2012 01:28:51 -0400 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: <87lijpp45b.fsf@foolinux.dyndns.org> References: <87lijpp45b.fsf@foolinux.dyndns.org> Message-ID: Hi, Why do you need each of the methods to return the instance? Can you just wrap the method calls in a function and return the instance? Cheers, Isaac On Fri, Jun 15, 2012 at 12:53 AM, Ian Zimmerman wrote: > > I am writing some code using the cairo drawing library, or rather the > pycairo binding to it. Unfortunately I sense a bit of API misdesign > with the binding. To draw into a context ctx which I obtained somewhat > like this: > > import cairo as C > > ctx = C.Context(surface) > > I am supposed to write a series of calls like this: > > ctx.set_source_rgb(1.0, 1.0, 1.0) > ctx.rectangle(0.0, 0.0, float(rw), float(rh)) > ctx.fill() > ctx.scale(sx, sy) > > ... and it piles up. Each of these methods returns None, whilst it > should conceivably return self, adding a lot of convenience: > > ctx.set_source_rgb(1.0, 1.0, 1.0).rectangle(0.0, 0.0, float(rw), > float(rh)).fill() > > I would like to write a wrapper class around Context to enable this > usage, but I don't know how to do that sanely. Sure, I could do this: > > class ContextWrapper(object): > > def __init__(self, surface): > self.ctx = C.Context(surface) > > def fill(self): > self.ctx.fill() > return self > > def scale(self, sx, sy): > self.ctx.scale(sx, sy) > return self > > ... > > but then I have to wrap each method explicitly, or at least each method > I use. I don't consider that sane. > > Is there a trick I am missing, perhaps using __dict__ or __getattr__ by > which I could wrap all the methods wholesale? > > -- > Ian Zimmerman > gpg public key: 1024D/C6FF61AD > fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD > http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png > Rule 420: All persons more than eight miles high to leave the court. > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Fri Jun 15 07:52:14 2012 From: itz at buug.org (Ian Zimmerman) Date: Thu, 14 Jun 2012 22:52:14 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: (isaac@overttone.com's message of "Fri, 15 Jun 2012 01:28:51 -0400") References: <87lijpp45b.fsf@foolinux.dyndns.org> Message-ID: <87haudp1f5.fsf@foolinux.dyndns.org> Isaac> Hi, Why do you need each of the methods to return the instance? Isaac> Can you just wrap the method calls in a function and return the Isaac> instance? I am not married to the idea of a wrapper class, but I don't understand what you propose instead. What would the example code look like under your scheme? -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From isaac at overttone.com Fri Jun 15 08:17:33 2012 From: isaac at overttone.com (Isaac) Date: Fri, 15 Jun 2012 02:17:33 -0400 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: <87haudp1f5.fsf@foolinux.dyndns.org> References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: I'm not an expert Pythonista but my first pass would be something like the following: import cairo as C # I don't know where surface is coming from def make_my_shape_now(surface, color=(1.0, 1.0, 1.0), rect_x=0.0, rect_y=0.0, rw=0.0, rh=0.0, fill=True): ctx = C.Context(surface) r, g, b = color ctx.set_source_rgb(r, g, b) ctx.rectangle(0.0, 0.0, rw, rh) ctx.fill() return ctx my_shape = make_my_shape_now(some_surface, rw=float(rw), rh=float(rh)) my_other_shape = make_my_shape_now(some_surface, rw=float(rw), rh=float(rh), fill=False) # etc. If you would like to make a class, just make the above function a method on a class that subclasses Context. It sounds like you want a short cut to override the return value of most or all of the Context methods that return None. I don't know of a way to do that. The above is a short cut when you know which methods you want to use. In addition to the above route, take a look at functools.partial http://docs.python.org/library/functools.html#functools.partial That might be what you want to use once you know the parameters that won't change ( or change very often ). I hope that helps! Cheers, Isaac On Fri, Jun 15, 2012 at 1:52 AM, Ian Zimmerman wrote: > > Isaac> Hi, Why do you need each of the methods to return the instance? > Isaac> Can you just wrap the method calls in a function and return the > Isaac> instance? > > I am not married to the idea of a wrapper class, but I don't understand > what you propose instead. What would the example code look like under > your scheme? > > -- > Ian Zimmerman > gpg public key: 1024D/C6FF61AD > fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD > http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png > Rule 420: All persons more than eight miles high to leave the court. > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bpalmer at gmail.com Fri Jun 15 08:28:36 2012 From: bpalmer at gmail.com (Brian Palmer) Date: Thu, 14 Jun 2012 23:28:36 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: <87haudp1f5.fsf@foolinux.dyndns.org> References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: > > Isaac> Hi, Why do you need each of the methods to return the instance? > Isaac> Can you just wrap the method calls in a function and return the > Isaac> instance? > > I am not married to the idea of a wrapper class, but I don't understand > what you propose instead. What would the example code look like under > your scheme? > Your initial solution seems like it'd work: class Wrap(object): def __init__(self, ctx): self.ctx = ctx def __getattr__(self, name): def myf(*args, **kwargs): getattr(self.ctx, name)(*args, **kwargs) return self return myf There are benefits to being less dynamic, but this might be good enough. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hyperneato at gmail.com Fri Jun 15 08:37:57 2012 From: hyperneato at gmail.com (Isaac) Date: Fri, 15 Jun 2012 02:37:57 -0400 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: Nice! On Fri, Jun 15, 2012 at 2:28 AM, Brian Palmer wrote: > > > Your initial solution seems like it'd work: > class Wrap(object): > def __init__(self, ctx): > self.ctx = ctx > > def __getattr__(self, name): > def myf(*args, **kwargs): > getattr(self.ctx, name)(*args, **kwargs) > return self > return myf > > There are benefits to being less dynamic, but this might be good enough. > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bpalmer at gmail.com Fri Jun 15 09:14:42 2012 From: bpalmer at gmail.com (Brian Palmer) Date: Fri, 15 Jun 2012 00:14:42 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: Well, I think your approach would lead to better replability (e.g., dir()), and be more efficient. I don't like the special-casing of None, though; it'd be better to have a list of methods not to override the return value of, probably, so that the default is to support chaining. The simple __getattr__ every time approach has the benefit of being simple; although perhaps it'd be worthwhile to also do setattr(self, obj, myf) before returning myf. By the way, does inspect.isbuiltin work for your decorator? I can't get pycairo to build, but it's possible you should be checking isinstance(foo, (types.MethodType, types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType)) (And of course that doesn't handle classes that are themselves callable). On Fri, Jun 15, 2012 at 12:04 AM, David Ginsburg wrote: > Sorry for all the messages, but what I was doing was overkill. > After re-reading Brian's message I suppose you could just do this: > > def __getattr__(self, name): > def myf(*args, **kwargs): > to_return = getattr(self.ctx, name)(*args, **kwargs) > if to_return is None: > to_return = self > return to_return > return myf > > cheers, > David > > > On Fri, Jun 15, 2012 at 12:01 AM, David Ginsburg wrote: > >> Hmm, so I just tried to actually run this and for some >> reason inspect.getmembers(cairo.Context, predicate=inspect.ismethod) >> returns an empty list. >> >> Here's my ugly workaround: >> >> def make_chainable_context(cls): >> >> def return_self_decorator(func): >> >> def wrapper(self, *args, **kwargs): >> to_return = func(self, *args, **kwargs) >> if to_return is None: >> to_return = self >> return to_return >> return wrapper >> >> #for method_name, method in inspect.getmembers(cairo.Context, >> predicate=inspect.ismethod): >> for method_name, method in inspect.getmembers(cairo.Context): >> if not method_name.startswith('__'): >> setattr(cls, method_name, return_self_decorator(method)) >> return cls >> >> Pretty sure this accomplishes what you wanted :). >> >> cheers, >> David >> >> On Thu, Jun 14, 2012 at 11:56 PM, David Ginsburg wrote: >> >>> Hello, >>> The problem with this is if a method needs to return a value other than >>> self, you break it. >>> This is probably hacky, but you could accomplish what you want doing the >>> following: >>> >>> import inspect >>> import functools >>> >>> def make_chainable_context(cls): >>> >>> def return_self_decorator(func): >>> >>> def wrapper(self, *args, **kwargs): >>> to_return = func(self, *args, **kwargs) >>> if to_return is None: >>> to_return = self >>> return to_return >>> return wrapper >>> >>> for method_name, method in inspect.getmembers(cairo.Context, >>> predicate=inspect.ismethod): >>> setattr(cls, method_name, return_self_decorator(method)) >>> return cls >>> >>> >>> @make_chainable_context >>> class ChainableContext(cairo.Context): >>> pass >>> >>> This way methods that return something other than None are not broken. >>> >>> cheers, >>> David >>> >>> On Thu, Jun 14, 2012 at 11:28 PM, Brian Palmer wrote: >>> >>>> On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: >>>> >>>>> >>>>> Isaac> Hi, Why do you need each of the methods to return the instance? >>>>> Isaac> Can you just wrap the method calls in a function and return the >>>>> Isaac> instance? >>>>> >>>>> I am not married to the idea of a wrapper class, but I don't understand >>>>> what you propose instead. What would the example code look like under >>>>> your scheme? >>>>> >>>> >>>> Your initial solution seems like it'd work: >>>> class Wrap(object): >>>> def __init__(self, ctx): >>>> self.ctx = ctx >>>> >>>> def __getattr__(self, name): >>>> def myf(*args, **kwargs): >>>> getattr(self.ctx, name)(*args, **kwargs) >>>> return self >>>> return myf >>>> >>>> There are benefits to being less dynamic, but this might be good enough. >>>> >>>> _______________________________________________ >>>> Baypiggies mailing list >>>> Baypiggies at python.org >>>> To change your subscription options or unsubscribe: >>>> http://mail.python.org/mailman/listinfo/baypiggies >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dav9dg at gmail.com Fri Jun 15 08:56:39 2012 From: dav9dg at gmail.com (David Ginsburg) Date: Thu, 14 Jun 2012 23:56:39 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: Hello, The problem with this is if a method needs to return a value other than self, you break it. This is probably hacky, but you could accomplish what you want doing the following: import inspect import functools def make_chainable_context(cls): def return_self_decorator(func): def wrapper(self, *args, **kwargs): to_return = func(self, *args, **kwargs) if to_return is None: to_return = self return to_return return wrapper for method_name, method in inspect.getmembers(cairo.Context, predicate=inspect.ismethod): setattr(cls, method_name, return_self_decorator(method)) return cls @make_chainable_context class ChainableContext(cairo.Context): pass This way methods that return something other than None are not broken. cheers, David On Thu, Jun 14, 2012 at 11:28 PM, Brian Palmer wrote: > On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: > >> >> Isaac> Hi, Why do you need each of the methods to return the instance? >> Isaac> Can you just wrap the method calls in a function and return the >> Isaac> instance? >> >> I am not married to the idea of a wrapper class, but I don't understand >> what you propose instead. What would the example code look like under >> your scheme? >> > > Your initial solution seems like it'd work: > class Wrap(object): > def __init__(self, ctx): > self.ctx = ctx > > def __getattr__(self, name): > def myf(*args, **kwargs): > getattr(self.ctx, name)(*args, **kwargs) > return self > return myf > > There are benefits to being less dynamic, but this might be good enough. > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dav9dg at gmail.com Fri Jun 15 09:01:00 2012 From: dav9dg at gmail.com (David Ginsburg) Date: Fri, 15 Jun 2012 00:01:00 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: Hmm, so I just tried to actually run this and for some reason inspect.getmembers(cairo.Context, predicate=inspect.ismethod) returns an empty list. Here's my ugly workaround: def make_chainable_context(cls): def return_self_decorator(func): def wrapper(self, *args, **kwargs): to_return = func(self, *args, **kwargs) if to_return is None: to_return = self return to_return return wrapper #for method_name, method in inspect.getmembers(cairo.Context, predicate=inspect.ismethod): for method_name, method in inspect.getmembers(cairo.Context): if not method_name.startswith('__'): setattr(cls, method_name, return_self_decorator(method)) return cls Pretty sure this accomplishes what you wanted :). cheers, David On Thu, Jun 14, 2012 at 11:56 PM, David Ginsburg wrote: > Hello, > The problem with this is if a method needs to return a value other than > self, you break it. > This is probably hacky, but you could accomplish what you want doing the > following: > > import inspect > import functools > > def make_chainable_context(cls): > > def return_self_decorator(func): > > def wrapper(self, *args, **kwargs): > to_return = func(self, *args, **kwargs) > if to_return is None: > to_return = self > return to_return > return wrapper > > for method_name, method in inspect.getmembers(cairo.Context, > predicate=inspect.ismethod): > setattr(cls, method_name, return_self_decorator(method)) > return cls > > > @make_chainable_context > class ChainableContext(cairo.Context): > pass > > This way methods that return something other than None are not broken. > > cheers, > David > > On Thu, Jun 14, 2012 at 11:28 PM, Brian Palmer wrote: > >> On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: >> >>> >>> Isaac> Hi, Why do you need each of the methods to return the instance? >>> Isaac> Can you just wrap the method calls in a function and return the >>> Isaac> instance? >>> >>> I am not married to the idea of a wrapper class, but I don't understand >>> what you propose instead. What would the example code look like under >>> your scheme? >>> >> >> Your initial solution seems like it'd work: >> class Wrap(object): >> def __init__(self, ctx): >> self.ctx = ctx >> >> def __getattr__(self, name): >> def myf(*args, **kwargs): >> getattr(self.ctx, name)(*args, **kwargs) >> return self >> return myf >> >> There are benefits to being less dynamic, but this might be good enough. >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dav9dg at gmail.com Fri Jun 15 09:04:46 2012 From: dav9dg at gmail.com (David Ginsburg) Date: Fri, 15 Jun 2012 00:04:46 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: Sorry for all the messages, but what I was doing was overkill. After re-reading Brian's message I suppose you could just do this: def __getattr__(self, name): def myf(*args, **kwargs): to_return = getattr(self.ctx, name)(*args, **kwargs) if to_return is None: to_return = self return to_return return myf cheers, David On Fri, Jun 15, 2012 at 12:01 AM, David Ginsburg wrote: > Hmm, so I just tried to actually run this and for some > reason inspect.getmembers(cairo.Context, predicate=inspect.ismethod) > returns an empty list. > > Here's my ugly workaround: > > def make_chainable_context(cls): > > def return_self_decorator(func): > > def wrapper(self, *args, **kwargs): > to_return = func(self, *args, **kwargs) > if to_return is None: > to_return = self > return to_return > return wrapper > > #for method_name, method in inspect.getmembers(cairo.Context, > predicate=inspect.ismethod): > for method_name, method in inspect.getmembers(cairo.Context): > if not method_name.startswith('__'): > setattr(cls, method_name, return_self_decorator(method)) > return cls > > Pretty sure this accomplishes what you wanted :). > > cheers, > David > > On Thu, Jun 14, 2012 at 11:56 PM, David Ginsburg wrote: > >> Hello, >> The problem with this is if a method needs to return a value other than >> self, you break it. >> This is probably hacky, but you could accomplish what you want doing the >> following: >> >> import inspect >> import functools >> >> def make_chainable_context(cls): >> >> def return_self_decorator(func): >> >> def wrapper(self, *args, **kwargs): >> to_return = func(self, *args, **kwargs) >> if to_return is None: >> to_return = self >> return to_return >> return wrapper >> >> for method_name, method in inspect.getmembers(cairo.Context, >> predicate=inspect.ismethod): >> setattr(cls, method_name, return_self_decorator(method)) >> return cls >> >> >> @make_chainable_context >> class ChainableContext(cairo.Context): >> pass >> >> This way methods that return something other than None are not broken. >> >> cheers, >> David >> >> On Thu, Jun 14, 2012 at 11:28 PM, Brian Palmer wrote: >> >>> On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: >>> >>>> >>>> Isaac> Hi, Why do you need each of the methods to return the instance? >>>> Isaac> Can you just wrap the method calls in a function and return the >>>> Isaac> instance? >>>> >>>> I am not married to the idea of a wrapper class, but I don't understand >>>> what you propose instead. What would the example code look like under >>>> your scheme? >>>> >>> >>> Your initial solution seems like it'd work: >>> class Wrap(object): >>> def __init__(self, ctx): >>> self.ctx = ctx >>> >>> def __getattr__(self, name): >>> def myf(*args, **kwargs): >>> getattr(self.ctx, name)(*args, **kwargs) >>> return self >>> return myf >>> >>> There are benefits to being less dynamic, but this might be good enough. >>> >>> _______________________________________________ >>> Baypiggies mailing list >>> Baypiggies at python.org >>> To change your subscription options or unsubscribe: >>> http://mail.python.org/mailman/listinfo/baypiggies >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dav9dg at gmail.com Fri Jun 15 09:30:24 2012 From: dav9dg at gmail.com (David Ginsburg) Date: Fri, 15 Jun 2012 00:30:24 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: I agree, if you don't care about a given return value from some method perhaps you'd want it to be "chainable", so I support your list of methods idea. >>> inspect.getmembers(cairo.Context, predicate=inspect.isbuiltin) [('__new__', ), ('__subclasshook__', )] >>> inspect.getmembers(cairo.Context, predicate=inspect.isclass) [('__class__', )] Only inspect.isbuiltin and inspect.isclass return non-empty lists, but if I remove my startswith('__') check, __delattr__ gets through. If I replace my startswith check with if isinstance(method, (types.MethodType, types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType)): ... the only methods that get through are: __new__ __subclasshook__ I don't know enough about pycairo to know why this would be the case. David On Fri, Jun 15, 2012 at 12:14 AM, Brian Palmer wrote: > Well, I think your approach would lead to better replability (e.g., > dir()), and be more efficient. I don't like the special-casing of None, > though; it'd be better to have a list of methods not to override the return > value of, probably, so that the default is to support chaining. The simple > __getattr__ every time approach has the benefit of being simple; although > perhaps it'd be worthwhile to also do setattr(self, obj, myf) before > returning myf. > > By the way, does inspect.isbuiltin work for your decorator? I can't get > pycairo to build, but it's possible you should be checking isinstance(foo, > (types.MethodType, types.FunctionType, types.BuiltinFunctionType, > types.BuiltinMethodType)) > > (And of course that doesn't handle classes that are themselves callable). > > > > On Fri, Jun 15, 2012 at 12:04 AM, David Ginsburg wrote: > >> Sorry for all the messages, but what I was doing was overkill. >> After re-reading Brian's message I suppose you could just do this: >> >> def __getattr__(self, name): >> def myf(*args, **kwargs): >> to_return = getattr(self.ctx, name)(*args, **kwargs) >> if to_return is None: >> to_return = self >> return to_return >> return myf >> >> cheers, >> David >> >> >> On Fri, Jun 15, 2012 at 12:01 AM, David Ginsburg wrote: >> >>> Hmm, so I just tried to actually run this and for some >>> reason inspect.getmembers(cairo.Context, predicate=inspect.ismethod) >>> returns an empty list. >>> >>> Here's my ugly workaround: >>> >>> def make_chainable_context(cls): >>> >>> def return_self_decorator(func): >>> >>> def wrapper(self, *args, **kwargs): >>> to_return = func(self, *args, **kwargs) >>> if to_return is None: >>> to_return = self >>> return to_return >>> return wrapper >>> >>> #for method_name, method in inspect.getmembers(cairo.Context, >>> predicate=inspect.ismethod): >>> for method_name, method in inspect.getmembers(cairo.Context): >>> if not method_name.startswith('__'): >>> setattr(cls, method_name, return_self_decorator(method)) >>> return cls >>> >>> Pretty sure this accomplishes what you wanted :). >>> >>> cheers, >>> David >>> >>> On Thu, Jun 14, 2012 at 11:56 PM, David Ginsburg wrote: >>> >>>> Hello, >>>> The problem with this is if a method needs to return a value other than >>>> self, you break it. >>>> This is probably hacky, but you could accomplish what you want doing >>>> the following: >>>> >>>> import inspect >>>> import functools >>>> >>>> def make_chainable_context(cls): >>>> >>>> def return_self_decorator(func): >>>> >>>> def wrapper(self, *args, **kwargs): >>>> to_return = func(self, *args, **kwargs) >>>> if to_return is None: >>>> to_return = self >>>> return to_return >>>> return wrapper >>>> >>>> for method_name, method in inspect.getmembers(cairo.Context, >>>> predicate=inspect.ismethod): >>>> setattr(cls, method_name, return_self_decorator(method)) >>>> return cls >>>> >>>> >>>> @make_chainable_context >>>> class ChainableContext(cairo.Context): >>>> pass >>>> >>>> This way methods that return something other than None are not broken. >>>> >>>> cheers, >>>> David >>>> >>>> On Thu, Jun 14, 2012 at 11:28 PM, Brian Palmer wrote: >>>> >>>>> On Thu, Jun 14, 2012 at 10:52 PM, Ian Zimmerman wrote: >>>>> >>>>>> >>>>>> Isaac> Hi, Why do you need each of the methods to return the instance? >>>>>> Isaac> Can you just wrap the method calls in a function and return the >>>>>> Isaac> instance? >>>>>> >>>>>> I am not married to the idea of a wrapper class, but I don't >>>>>> understand >>>>>> what you propose instead. What would the example code look like under >>>>>> your scheme? >>>>>> >>>>> >>>>> Your initial solution seems like it'd work: >>>>> class Wrap(object): >>>>> def __init__(self, ctx): >>>>> self.ctx = ctx >>>>> >>>>> def __getattr__(self, name): >>>>> def myf(*args, **kwargs): >>>>> getattr(self.ctx, name)(*args, **kwargs) >>>>> return self >>>>> return myf >>>>> >>>>> There are benefits to being less dynamic, but this might be good >>>>> enough. >>>>> >>>>> _______________________________________________ >>>>> Baypiggies mailing list >>>>> Baypiggies at python.org >>>>> To change your subscription options or unsubscribe: >>>>> http://mail.python.org/mailman/listinfo/baypiggies >>>>> >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Fri Jun 15 17:44:39 2012 From: itz at buug.org (Ian Zimmerman) Date: Fri, 15 Jun 2012 08:44:39 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: (David Ginsburg's message of "Fri, 15 Jun 2012 00:04:46 -0700") References: <87lijpp45b.fsf@foolinux.dyndns.org> <87haudp1f5.fsf@foolinux.dyndns.org> Message-ID: <874nqcful4.fsf@foolinux.dyndns.org> David> Sorry for all the messages, but what I was doing was overkill. David> After re-reading Brian's message I suppose you could just do this: > def __getattr__(self, name): > def myf(*args, **kwargs): > to_return = getattr(self.ctx, name)(*args, **kwargs) > if to_return is None: > to_return = self > return to_return > return myf I'll probably use this, or a close variant of it. Thanks to all for the ideas! -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From david at bitcasa.com Fri Jun 15 22:15:45 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 13:15:45 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing Message-ID: When I load the file into json, pythons memory usage spike to about 1.8GB and I can't seem to get that memory to be released. I put together a test case that's very simple: with open("test_file.json", 'r') as f: j = json.load(f) I'm sorry that I can't provide a sample json file, my test file has a lot of sensitive information, but for context, I'm dealing with a file in the order of 240MB. After running the above 2 lines I have the previously mentioned 1.8GB of memory in use. If I then do "del j" memory usage doesn't drop at all. If I follow that with a "gc.collect()" it still doesn't drop. I even tried unloading the json module and running another gc.collect. I'm trying to run some memory profiling but heapy has been churning 100% CPU for about an hour now and has yet to produce any output. Does anyone have any ideas? I've also tried the above using cjson rather than the packaged json module. cjson used about 30% less memory but otherwise displayed exactly the same issues. I'm running Python 2.7.2 on Ubuntu server 11.10. I'm happy to load up any memory profiler and see if it does better then heapy and provide any diagnostics you might think are necessary. I'm hunting around for a large test json file that I can provide for anyone else to give it a go. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Fri Jun 15 23:22:50 2012 From: bob at redivi.com (Bob Ippolito) Date: Fri, 15 Jun 2012 17:22:50 -0400 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence wrote: > When I load the file into json, pythons memory usage spike to about 1.8GB > and I can't seem to get that memory to be released. I put together a test > case that's very simple: > > with open("test_file.json", 'r') as f: > j = json.load(f) > > I'm sorry that I can't provide a sample json file, my test file has a lot > of sensitive information, but for context, I'm dealing with a file in the > order of 240MB. After running the above 2 lines I have the > previously mentioned 1.8GB of memory in use. If I then do "del j" memory > usage doesn't drop at all. If I follow that with a "gc.collect()" it still > doesn't drop. I even tried unloading the json module and running another > gc.collect. > > I'm trying to run some memory profiling but heapy has been churning 100% > CPU for about an hour now and has yet to produce any output. > > Does anyone have any ideas? I've also tried the above using cjson rather > than the packaged json module. cjson used about 30% less memory but > otherwise displayed exactly the same issues. > > I'm running Python 2.7.2 on Ubuntu server 11.10. > > I'm happy to load up any memory profiler and see if it does better then > heapy and provide any diagnostics you might think are necessary. I'm > hunting around for a large test json file that I can provide for anyone > else to give it a go. > It may just be the way that the allocator works. What happens if you load the JSON, del the object, then do it again? Does it take up 3.6GB or stay at 1.8GB? You may not be able to "release" that memory to the OS in such a way that RSS gets smaller... but at the same time it's not really a leak either. GC shouldn't really take part in a JSON structure, since it's guaranteed to be acyclic? ref counting alone should be sufficient to instantly reclaim that space. I'm not at all surprised that gc.collect() doesn't change anything for CPython in this case. $ python Python 2.7.2 (default, Jan 23 2012, 14:26:16) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os, subprocess, simplejson >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() ... >>> rss() '7284' >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> rss() '49032' >>> del l >>> rss() '42232' >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> rss() '49032' >>> del l >>> rss() '42232' $ python Python 2.7.2 (default, Jan 23 2012, 14:26:16) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os, subprocess, simplejson >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() ... >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in xrange(1000000)))) >>> rss() '288116' >>> del l >>> rss() '84384' >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in xrange(1000000)))) >>> rss() '288116' >>> del l >>> rss() '84384' -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From aahz at pythoncraft.com Fri Jun 15 23:30:23 2012 From: aahz at pythoncraft.com (Aahz) Date: Fri, 15 Jun 2012 14:30:23 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: <20120615213023.GA13251@panix.com> On Fri, Jun 15, 2012, David Lawrence wrote: > > When I load the file into json, pythons memory usage spike to about 1.8GB > and I can't seem to get that memory to be released. I put together a test > case that's very simple: > > with open("test_file.json", 'r') as f: > j = json.load(f) If you really need the memory released, do it in a subprocess. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ https://en.wikipedia.org/wiki/Mary_Anning From hjtoi at comcast.net Fri Jun 15 23:29:06 2012 From: hjtoi at comcast.net (Heikki Toivonen) Date: Fri, 15 Jun 2012 14:29:06 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: <027492f1-f2ca-4aef-8b03-9fb9870accf9@email.android.com> You probably want a json parser that does not load the whole thing into memory. Check out ijson. David Lawrence wrote: >When I load the file into json, pythons memory usage spike to about >1.8GB >and I can't seem to get that memory to be released. I put together a >test >case that's very simple: > >with open("test_file.json", 'r') as f: > j = json.load(f) > >I'm sorry that I can't provide a sample json file, my test file has a >lot >of sensitive information, but for context, I'm dealing with a file in >the >order of 240MB. After running the above 2 lines I have the >previously mentioned 1.8GB of memory in use. If I then do "del j" >memory >usage doesn't drop at all. If I follow that with a "gc.collect()" it >still >doesn't drop. I even tried unloading the json module and running >another >gc.collect. > >I'm trying to run some memory profiling but heapy has been churning >100% >CPU for about an hour now and has yet to produce any output. > >Does anyone have any ideas? I've also tried the above using cjson >rather >than the packaged json module. cjson used about 30% less memory but >otherwise displayed exactly the same issues. > >I'm running Python 2.7.2 on Ubuntu server 11.10. > >I'm happy to load up any memory profiler and see if it does better then >heapy and provide any diagnostics you might think are necessary. I'm >hunting around for a large test json file that I can provide for anyone >else to give it a go. >_______________________________________________ >Baypiggies mailing list >Baypiggies at python.org >To change your subscription options or unsubscribe: >http://mail.python.org/mailman/listinfo/baypiggies -- Sent from my Android phone with K-9. Please excuse my brevity. From bob at redivi.com Fri Jun 15 23:41:59 2012 From: bob at redivi.com (Bob Ippolito) Date: Fri, 15 Jun 2012 17:41:59 -0400 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 5:32 PM, David Lawrence wrote: > On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: > >> On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence wrote: >> >>> When I load the file into json, pythons memory usage spike to about >>> 1.8GB and I can't seem to get that memory to be released. I put together a >>> test case that's very simple: >>> >>> with open("test_file.json", 'r') as f: >>> j = json.load(f) >>> >>> I'm sorry that I can't provide a sample json file, my test file has a >>> lot of sensitive information, but for context, I'm dealing with a file in >>> the order of 240MB. After running the above 2 lines I have the >>> previously mentioned 1.8GB of memory in use. If I then do "del j" memory >>> usage doesn't drop at all. If I follow that with a "gc.collect()" it still >>> doesn't drop. I even tried unloading the json module and running another >>> gc.collect. >>> >>> I'm trying to run some memory profiling but heapy has been churning 100% >>> CPU for about an hour now and has yet to produce any output. >>> >>> Does anyone have any ideas? I've also tried the above using cjson >>> rather than the packaged json module. cjson used about 30% less memory but >>> otherwise displayed exactly the same issues. >>> >>> I'm running Python 2.7.2 on Ubuntu server 11.10. >>> >>> I'm happy to load up any memory profiler and see if it does better then >>> heapy and provide any diagnostics you might think are necessary. I'm >>> hunting around for a large test json file that I can provide for anyone >>> else to give it a go. >>> >> >> It may just be the way that the allocator works. What happens if you load >> the JSON, del the object, then do it again? Does it take up 3.6GB or stay >> at 1.8GB? You may not be able to "release" that memory to the OS in such a >> way that RSS gets smaller... but at the same time it's not really a leak >> either. >> >> GC shouldn't really take part in a JSON structure, since it's guaranteed >> to be acyclic? ref counting alone should be sufficient to instantly reclaim >> that space. I'm not at all surprised that gc.collect() doesn't change >> anything for CPython in this case. >> >> $ python >> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >> darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import os, subprocess, simplejson >> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >> str(os.getpid())], >> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >> ... >> >>> rss() >> '7284' >> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >> >>> rss() >> '49032' >> >>> del l >> >>> rss() >> '42232' >> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >> >>> rss() >> '49032' >> >>> del l >> >>> rss() >> '42232' >> >> $ python >> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >> darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import os, subprocess, simplejson >> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >> str(os.getpid())], >> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >> ... >> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >> xrange(1000000)))) >> >>> rss() >> '288116' >> >>> del l >> >>> rss() >> '84384' >> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >> xrange(1000000)))) >> >>> rss() >> '288116' >> >>> del l >> >>> rss() >> '84384' >> >> -bob >> >> > It does appear that deleting the object and running the example again the > memory stays static at about 1.8GB. Could you provide a little more detail > on what your examples are meant to demonstrate. One shows a static memory > footprint and the other shows the footprint fluctuating up and down. I > would expect the static footprint in the first example just from my > understanding of python free lists of integers. > > Both examples show the same thing, but with different data structures (list of int, dict of str:int). The only thing missing is that I left out the baseline in the second example, it would be the same as the first example. The other suggestions are spot on. If you want the memory to really be released, you have to do it in a transient subprocess, and/or you could probably have lower overhead if you're using a streaming parser (if there's something you can do with it incrementally). -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at bitcasa.com Fri Jun 15 23:44:44 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 14:44:44 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 2:41 PM, Bob Ippolito wrote: > On Fri, Jun 15, 2012 at 5:32 PM, David Lawrence wrote: > >> On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: >> >>> On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence wrote: >>> >>>> When I load the file into json, pythons memory usage spike to about >>>> 1.8GB and I can't seem to get that memory to be released. I put together a >>>> test case that's very simple: >>>> >>>> with open("test_file.json", 'r') as f: >>>> j = json.load(f) >>>> >>>> I'm sorry that I can't provide a sample json file, my test file has a >>>> lot of sensitive information, but for context, I'm dealing with a file in >>>> the order of 240MB. After running the above 2 lines I have the >>>> previously mentioned 1.8GB of memory in use. If I then do "del j" memory >>>> usage doesn't drop at all. If I follow that with a "gc.collect()" it still >>>> doesn't drop. I even tried unloading the json module and running another >>>> gc.collect. >>>> >>>> I'm trying to run some memory profiling but heapy has been churning >>>> 100% CPU for about an hour now and has yet to produce any output. >>>> >>>> Does anyone have any ideas? I've also tried the above using cjson >>>> rather than the packaged json module. cjson used about 30% less memory but >>>> otherwise displayed exactly the same issues. >>>> >>>> I'm running Python 2.7.2 on Ubuntu server 11.10. >>>> >>>> I'm happy to load up any memory profiler and see if it does better then >>>> heapy and provide any diagnostics you might think are necessary. I'm >>>> hunting around for a large test json file that I can provide for anyone >>>> else to give it a go. >>>> >>> >>> It may just be the way that the allocator works. What happens if you >>> load the JSON, del the object, then do it again? Does it take up 3.6GB or >>> stay at 1.8GB? You may not be able to "release" that memory to the OS in >>> such a way that RSS gets smaller... but at the same time it's not really a >>> leak either. >>> >>> GC shouldn't really take part in a JSON structure, since it's guaranteed >>> to be acyclic? ref counting alone should be sufficient to instantly reclaim >>> that space. I'm not at all surprised that gc.collect() doesn't change >>> anything for CPython in this case. >>> >>> $ python >>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>> darwin >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import os, subprocess, simplejson >>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>> str(os.getpid())], >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>> ... >>> >>> rss() >>> '7284' >>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> >>> rss() >>> '49032' >>> >>> del l >>> >>> rss() >>> '42232' >>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> >>> rss() >>> '49032' >>> >>> del l >>> >>> rss() >>> '42232' >>> >>> $ python >>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>> darwin >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import os, subprocess, simplejson >>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>> str(os.getpid())], >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>> ... >>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>> xrange(1000000)))) >>> >>> rss() >>> '288116' >>> >>> del l >>> >>> rss() >>> '84384' >>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>> xrange(1000000)))) >>> >>> rss() >>> '288116' >>> >>> del l >>> >>> rss() >>> '84384' >>> >>> -bob >>> >>> >> It does appear that deleting the object and running the example again the >> memory stays static at about 1.8GB. Could you provide a little more detail >> on what your examples are meant to demonstrate. One shows a static memory >> footprint and the other shows the footprint fluctuating up and down. I >> would expect the static footprint in the first example just from my >> understanding of python free lists of integers. >> >> > Both examples show the same thing, but with different data structures > (list of int, dict of str:int). The only thing missing is that I left out > the baseline in the second example, it would be the same as the first > example. > > The other suggestions are spot on. If you want the memory to really be > released, you have to do it in a transient subprocess, and/or you could > probably have lower overhead if you're using a streaming parser (if there's > something you can do with it incrementally). > > -bob > > Thank you all for the help. Multiprocessing with a Queue and blocking get() calls looks like it will work well. -------------- next part -------------- An HTML attachment was scrubbed... URL: From DennisR at dair.com Fri Jun 15 23:44:55 2012 From: DennisR at dair.com (Dennis Reinhardt) Date: Fri, 15 Jun 2012 14:44:55 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: <3WDb8C618hzNtQ@mail.python.org> At 01:15 PM 6/15/2012, David Lawrence wrote: >I'm happy to load up any memory profiler and see if it does better >then heapy and provide any diagnostics you might think are >necessary. I'm hunting around for a large test json file that I can >provide for anyone else to give it a go. What happens when you take Python out of the equation? Can you load this up in a webbrowser error free? Can you load it up in more than browser version? How much memory inder these conditions? The 1.8 G is a indication to me there is something wrong. It could be underlying your inability to free memory as well. ... or not but it is a starting point. I have been tearing out patches of hair over JavaScript (Json) going into hang conditions under Windows. Sorry I am not much help on Ubuntu. Dennis From david at bitcasa.com Fri Jun 15 23:32:24 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 14:32:24 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: > On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence wrote: > >> When I load the file into json, pythons memory usage spike to about 1.8GB >> and I can't seem to get that memory to be released. I put together a test >> case that's very simple: >> >> with open("test_file.json", 'r') as f: >> j = json.load(f) >> >> I'm sorry that I can't provide a sample json file, my test file has a lot >> of sensitive information, but for context, I'm dealing with a file in the >> order of 240MB. After running the above 2 lines I have the >> previously mentioned 1.8GB of memory in use. If I then do "del j" memory >> usage doesn't drop at all. If I follow that with a "gc.collect()" it still >> doesn't drop. I even tried unloading the json module and running another >> gc.collect. >> >> I'm trying to run some memory profiling but heapy has been churning 100% >> CPU for about an hour now and has yet to produce any output. >> >> Does anyone have any ideas? I've also tried the above using cjson rather >> than the packaged json module. cjson used about 30% less memory but >> otherwise displayed exactly the same issues. >> >> I'm running Python 2.7.2 on Ubuntu server 11.10. >> >> I'm happy to load up any memory profiler and see if it does better then >> heapy and provide any diagnostics you might think are necessary. I'm >> hunting around for a large test json file that I can provide for anyone >> else to give it a go. >> > > It may just be the way that the allocator works. What happens if you load > the JSON, del the object, then do it again? Does it take up 3.6GB or stay > at 1.8GB? You may not be able to "release" that memory to the OS in such a > way that RSS gets smaller... but at the same time it's not really a leak > either. > > GC shouldn't really take part in a JSON structure, since it's guaranteed > to be acyclic? ref counting alone should be sufficient to instantly reclaim > that space. I'm not at all surprised that gc.collect() doesn't change > anything for CPython in this case. > > $ python > Python 2.7.2 (default, Jan 23 2012, 14:26:16) > [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on > darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import os, subprocess, simplejson > >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', > str(os.getpid())], > stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() > ... > >>> rss() > '7284' > >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) > >>> rss() > '49032' > >>> del l > >>> rss() > '42232' > >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) > >>> rss() > '49032' > >>> del l > >>> rss() > '42232' > > $ python > Python 2.7.2 (default, Jan 23 2012, 14:26:16) > [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on > darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import os, subprocess, simplejson > >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', > str(os.getpid())], > stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() > ... > >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in > xrange(1000000)))) > >>> rss() > '288116' > >>> del l > >>> rss() > '84384' > >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in > xrange(1000000)))) > >>> rss() > '288116' > >>> del l > >>> rss() > '84384' > > -bob > > It does appear that deleting the object and running the example again the memory stays static at about 1.8GB. Could you provide a little more detail on what your examples are meant to demonstrate. One shows a static memory footprint and the other shows the footprint fluctuating up and down. I would expect the static footprint in the first example just from my understanding of python free lists of integers. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bitsink at gmail.com Sat Jun 16 00:06:55 2012 From: bitsink at gmail.com (Nam Nguyen) Date: Fri, 15 Jun 2012 15:06:55 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: If I recall correctly, CPython memory management does not free memory. Once it has allocated a slab, it will not release that slab. The garbage collector makes room for CPython allocated objects in all the heap spaces that CPython allocated. Nam On Fri, Jun 15, 2012 at 2:44 PM, David Lawrence wrote: > On Fri, Jun 15, 2012 at 2:41 PM, Bob Ippolito wrote: >> >> On Fri, Jun 15, 2012 at 5:32 PM, David Lawrence wrote: >>> >>> On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: >>>> >>>> On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence >>>> wrote: >>>>> >>>>> When I load the file into json, pythons memory usage spike to about >>>>> 1.8GB and I can't seem to get that memory to be released. ?I put together a >>>>> test case that's very simple: >>>>> >>>>> with open("test_file.json", 'r') as f: >>>>> ? ? j = json.load(f) >>>>> >>>>> I'm sorry that I can't provide a sample json file, my test file has a >>>>> lot of sensitive information, but for context, I'm dealing with a file in >>>>> the order of 240MB. ?After running the above 2 lines I have the >>>>> previously?mentioned?1.8GB of memory in use. ?If I then do "del j" memory >>>>> usage doesn't drop at all. ?If I follow that with a "gc.collect()" it still >>>>> doesn't drop. ?I even tried unloading the json module and running another >>>>> gc.collect. >>>>> >>>>> I'm trying to run some memory profiling but heapy has been churning >>>>> 100% CPU for about an hour now and has yet to produce any output. >>>>> >>>>> Does anyone have any ideas? ?I've also tried the above using cjson >>>>> rather than the packaged json module. ?cjson used about 30% less memory but >>>>> otherwise displayed exactly the same issues. >>>>> >>>>> I'm running Python 2.7.2 on Ubuntu server 11.10. >>>>> >>>>> I'm happy to load up any memory profiler and see if it does better then >>>>> heapy and provide any diagnostics you might think are necessary. ?I'm >>>>> hunting around for a large test json file that I can provide for anyone else >>>>> to give it a go. >>>> >>>> >>>> It may just be the way that the allocator works. What happens if you >>>> load the JSON, del the object, then do it again? Does it take up 3.6GB or >>>> stay at 1.8GB? You may not be able to "release" that memory to the OS in >>>> such a way that RSS gets smaller... but at the same time it's not really a >>>> leak either. >>>> >>>> GC shouldn't really take part in a JSON structure, since it's guaranteed >>>> to be acyclic? ref counting alone should be sufficient to instantly reclaim >>>> that space. I'm not at all surprised that gc.collect() doesn't change >>>> anything for CPython in this case. >>>> >>>> $ python >>>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>>> darwin >>>> Type "help", "copyright", "credits" or "license" for more information. >>>> >>> import os, subprocess, simplejson >>>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>>> >>> str(os.getpid())], >>>> >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>>> ... >>>> >>> rss() >>>> '7284' >>>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>>> >>> rss() >>>> '49032' >>>> >>> del l >>>> >>> rss() >>>> '42232' >>>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>>> >>> rss() >>>> '49032' >>>> >>> del l >>>> >>> rss() >>>> '42232' >>>> >>>> $ python >>>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>>> darwin >>>> Type "help", "copyright", "credits" or "license" for more information. >>>> >>> import os, subprocess, simplejson >>>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>>> >>> str(os.getpid())], >>>> >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>>> ... >>>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>>> >>> xrange(1000000)))) >>>> >>> rss() >>>> '288116' >>>> >>> del l >>>> >>> rss() >>>> '84384' >>>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>>> >>> xrange(1000000)))) >>>> >>> rss() >>>> '288116' >>>> >>> del l >>>> >>> rss() >>>> '84384' >>>> >>>> -bob >>>> >>> >>> It does appear that deleting the object and running the example again the >>> memory stays static at about 1.8GB. ?Could you provide a little more detail >>> on what your examples are meant to demonstrate. ?One shows a static memory >>> footprint and the other shows the footprint fluctuating up and down. ?I >>> would expect the static footprint in the first example just from my >>> understanding of python free lists of integers. >>> >> >> Both examples show the same thing, but with different data structures >> (list of int, dict of str:int). The only thing missing is that I left out >> the baseline in the second example, it would be the same as the first >> example. >> >> The other suggestions are spot on. If you want the memory to really be >> released, you have to do it in a transient subprocess, and/or you could >> probably have lower overhead if you're using a streaming parser (if there's >> something you can do with it incrementally). >> >> -bob >> > > Thank you all for the help. ?Multiprocessing with a Queue and blocking get() > calls looks like it will work well. > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From david at bitcasa.com Sat Jun 16 00:10:31 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 15:10:31 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 3:06 PM, Nam Nguyen wrote: > If I recall correctly, CPython memory management does not free memory. > Once it has allocated a slab, it will not release that slab. The > garbage collector makes room for CPython allocated objects in all the > heap spaces that CPython allocated. > Nam > > On Fri, Jun 15, 2012 at 2:44 PM, David Lawrence wrote: > > On Fri, Jun 15, 2012 at 2:41 PM, Bob Ippolito wrote: > >> > >> On Fri, Jun 15, 2012 at 5:32 PM, David Lawrence > wrote: > >>> > >>> On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: > >>>> > >>>> On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence > >>>> wrote: > >>>>> > >>>>> When I load the file into json, pythons memory usage spike to about > >>>>> 1.8GB and I can't seem to get that memory to be released. I put > together a > >>>>> test case that's very simple: > >>>>> > >>>>> with open("test_file.json", 'r') as f: > >>>>> j = json.load(f) > >>>>> > >>>>> I'm sorry that I can't provide a sample json file, my test file has a > >>>>> lot of sensitive information, but for context, I'm dealing with a > file in > >>>>> the order of 240MB. After running the above 2 lines I have the > >>>>> previously mentioned 1.8GB of memory in use. If I then do "del j" > memory > >>>>> usage doesn't drop at all. If I follow that with a "gc.collect()" > it still > >>>>> doesn't drop. I even tried unloading the json module and running > another > >>>>> gc.collect. > >>>>> > >>>>> I'm trying to run some memory profiling but heapy has been churning > >>>>> 100% CPU for about an hour now and has yet to produce any output. > >>>>> > >>>>> Does anyone have any ideas? I've also tried the above using cjson > >>>>> rather than the packaged json module. cjson used about 30% less > memory but > >>>>> otherwise displayed exactly the same issues. > >>>>> > >>>>> I'm running Python 2.7.2 on Ubuntu server 11.10. > >>>>> > >>>>> I'm happy to load up any memory profiler and see if it does better > then > >>>>> heapy and provide any diagnostics you might think are necessary. I'm > >>>>> hunting around for a large test json file that I can provide for > anyone else > >>>>> to give it a go. > >>>> > >>>> > >>>> It may just be the way that the allocator works. What happens if you > >>>> load the JSON, del the object, then do it again? Does it take up > 3.6GB or > >>>> stay at 1.8GB? You may not be able to "release" that memory to the OS > in > >>>> such a way that RSS gets smaller... but at the same time it's not > really a > >>>> leak either. > >>>> > >>>> GC shouldn't really take part in a JSON structure, since it's > guaranteed > >>>> to be acyclic? ref counting alone should be sufficient to instantly > reclaim > >>>> that space. I'm not at all surprised that gc.collect() doesn't change > >>>> anything for CPython in this case. > >>>> > >>>> $ python > >>>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) > >>>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] > on > >>>> darwin > >>>> Type "help", "copyright", "credits" or "license" for more information. > >>>> >>> import os, subprocess, simplejson > >>>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', > >>>> >>> str(os.getpid())], > >>>> >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() > >>>> ... > >>>> >>> rss() > >>>> '7284' > >>>> >>> l = simplejson.loads(simplejson.dumps([x for x in > xrange(1000000)])) > >>>> >>> rss() > >>>> '49032' > >>>> >>> del l > >>>> >>> rss() > >>>> '42232' > >>>> >>> l = simplejson.loads(simplejson.dumps([x for x in > xrange(1000000)])) > >>>> >>> rss() > >>>> '49032' > >>>> >>> del l > >>>> >>> rss() > >>>> '42232' > >>>> > >>>> $ python > >>>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) > >>>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] > on > >>>> darwin > >>>> Type "help", "copyright", "credits" or "license" for more information. > >>>> >>> import os, subprocess, simplejson > >>>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', > >>>> >>> str(os.getpid())], > >>>> >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() > >>>> ... > >>>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in > >>>> >>> xrange(1000000)))) > >>>> >>> rss() > >>>> '288116' > >>>> >>> del l > >>>> >>> rss() > >>>> '84384' > >>>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in > >>>> >>> xrange(1000000)))) > >>>> >>> rss() > >>>> '288116' > >>>> >>> del l > >>>> >>> rss() > >>>> '84384' > >>>> > >>>> -bob > >>>> > >>> > >>> It does appear that deleting the object and running the example again > the > >>> memory stays static at about 1.8GB. Could you provide a little more > detail > >>> on what your examples are meant to demonstrate. One shows a static > memory > >>> footprint and the other shows the footprint fluctuating up and down. I > >>> would expect the static footprint in the first example just from my > >>> understanding of python free lists of integers. > >>> > >> > >> Both examples show the same thing, but with different data structures > >> (list of int, dict of str:int). The only thing missing is that I left > out > >> the baseline in the second example, it would be the same as the first > >> example. > >> > >> The other suggestions are spot on. If you want the memory to really be > >> released, you have to do it in a transient subprocess, and/or you could > >> probably have lower overhead if you're using a streaming parser (if > there's > >> something you can do with it incrementally). > >> > >> -bob > >> > > > > Thank you all for the help. Multiprocessing with a Queue and blocking > get() > > calls looks like it will work well. > > > > _______________________________________________ > > Baypiggies mailing list > > Baypiggies at python.org > > To change your subscription options or unsubscribe: > > http://mail.python.org/mailman/listinfo/baypiggies > Lots of people have raised this idea in my hunt for answers. However, releasing memory to the OS appears to be objects dependent. I assume this is because different types use different memory allocators. Does anyone have a deeper understanding of this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jason.lai at gmail.com Sat Jun 16 00:49:55 2012 From: jason.lai at gmail.com (Jason Lai) Date: Fri, 15 Jun 2012 15:49:55 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 3:10 PM, David Lawrence wrote: > On Fri, Jun 15, 2012 at 3:06 PM, Nam Nguyen wrote: > >> If I recall correctly, CPython memory management does not free memory. >> Once it has allocated a slab, it will not release that slab. The >> garbage collector makes room for CPython allocated objects in all the >> heap spaces that CPython allocated. >> Nam > > > > Lots of people have raised this idea in my hunt for answers. However, > releasing memory to the OS appears to be objects dependent. I assume this > is because different types use different memory allocators. Does anyone > have a deeper understanding of this? > Python 2.5 should return memory to the C allocator (malloc), although depending on the system the allocator may or may not return the memory to the rest of the OS. There's this article on the topic, although I'm not sure how current it is: http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm - Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at bitcasa.com Sat Jun 16 00:08:42 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 15:08:42 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: <3WDb8C618hzNtQ@mail.python.org> References: <3WDb8C618hzNtQ@mail.python.org> Message-ID: In chrome, memory usage spikes to 3GB from 600MB, then the tab crashes ("Aw, Snap!"). On Fri, Jun 15, 2012 at 2:44 PM, Dennis Reinhardt wrote: > At 01:15 PM 6/15/2012, David Lawrence wrote: > >> I'm happy to load up any memory profiler and see if it does better then >> heapy and provide any diagnostics you might think are necessary. I'm >> hunting around for a large test json file that I can provide for anyone >> else to give it a go. >> > > What happens when you take Python out of the equation? Can you load this > up in a webbrowser error free? Can you load it up in more than browser > version? How much memory inder these conditions? > > The 1.8 G is a indication to me there is something wrong. It could be > underlying your inability to free memory as well. ... or not but it is a > starting point. > > I have been tearing out patches of hair over JavaScript (Json) going into > hang conditions under Windows. Sorry I am not much help on Ubuntu. > > Dennis > ______________________________**_________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/**mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at bitcasa.com Fri Jun 15 23:33:16 2012 From: david at bitcasa.com (David Lawrence) Date: Fri, 15 Jun 2012 14:33:16 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: <20120615213023.GA13251@panix.com> References: <20120615213023.GA13251@panix.com> Message-ID: This will probably be the course we have to take. On Fri, Jun 15, 2012 at 2:30 PM, Aahz wrote: > On Fri, Jun 15, 2012, David Lawrence wrote: > > > > When I load the file into json, pythons memory usage spike to about 1.8GB > > and I can't seem to get that memory to be released. I put together a > test > > case that's very simple: > > > > with open("test_file.json", 'r') as f: > > j = json.load(f) > > If you really need the memory released, do it in a subprocess. > -- > Aahz (aahz at pythoncraft.com) <*> > http://www.pythoncraft.com/ > > https://en.wikipedia.org/wiki/Mary_Anning > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjinux at gmail.com Sat Jun 16 02:56:26 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 15 Jun 2012 17:56:26 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: <87lijpp45b.fsf@foolinux.dyndns.org> References: <87lijpp45b.fsf@foolinux.dyndns.org> Message-ID: (Slightly off topic.) I am a language guy, so I love looking at other languages for cool features. You're looking for a way to chain a bunch of method calls together, a la jQuery. It turns out that Dart recently added a feature called method cascades that solve this problem: myTokenTable ..add("aToken"); ..add("anotherToken"); ..add("theUmpteenthToken"); ..setTitle("foo"); ..setBackgroundColor("green"); http://news.dartlang.org/2012/02/method-cascades-in-dart-posted-by-gilad.html I'm not encouraging you to switch to Dart; I just think it's interesting. -jj On Thu, Jun 14, 2012 at 9:53 PM, Ian Zimmerman wrote: > > I am writing some code using the cairo drawing library, or rather the > pycairo binding to it. Unfortunately I sense a bit of API misdesign > with the binding. To draw into a context ctx which I obtained somewhat > like this: > > import cairo as C > > ctx = C.Context(surface) > > I am supposed to write a series of calls like this: > > ctx.set_source_rgb(1.0, 1.0, 1.0) > ctx.rectangle(0.0, 0.0, float(rw), float(rh)) > ctx.fill() > ctx.scale(sx, sy) > > ... and it piles up. Each of these methods returns None, whilst it > should conceivably return self, adding a lot of convenience: > > ctx.set_source_rgb(1.0, 1.0, 1.0).rectangle(0.0, 0.0, float(rw), > float(rh)).fill() > > I would like to write a wrapper class around Context to enable this > usage, but I don't know how to do that sanely. Sure, I could do this: > > class ContextWrapper(object): > > def __init__(self, surface): > self.ctx = C.Context(surface) > > def fill(self): > self.ctx.fill() > return self > > def scale(self, sx, sy): > self.ctx.scale(sx, sy) > return self > > ... > > but then I have to wrap each method explicitly, or at least each method > I use. I don't consider that sane. > > Is there a trick I am missing, perhaps using __dict__ or __getattr__ by > which I could wrap all the methods wholesale? > > -- > Ian Zimmerman > gpg public key: 1024D/C6FF61AD > fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD > http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png > Rule 420: All persons more than eight miles high to leave the court. > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From DennisR at dair.com Sat Jun 16 03:52:38 2012 From: DennisR at dair.com (Dennis Reinhardt) Date: Fri, 15 Jun 2012 18:52:38 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: <3WDb8C618hzNtQ@mail.python.org> Message-ID: <3WDhR41xq2zNwN@mail.python.org> At 03:08 PM 6/15/2012, David Lawrence wrote: >In chrome, memory usage spikes to 3GB from 600MB, then the tab >crashes ("Aw, Snap!"). Tell me about it! I see a similar thing with Chrome on my own json code. It iterates through about 18-20 client-server exchanges and then the round trip delay gets progressively worse, *much worse*. Chrome crashes at about iteration 22 or so. I run IE and see what looks like 6 independent threads. That does not look reasonable but IE does not crash either. This is why I suggested trying more than one browser. I am pretty sure I have a JSON problem hanging up its host. I would not rule out that you have one too. I am suspecting that any fixes you make on the Python side might be futile until whatever is hanging JSON (and Chrome) is squared away. Dennis From jjinux at gmail.com Sat Jun 16 04:23:24 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 15 Jun 2012 19:23:24 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: <3WDhR41xq2zNwN@mail.python.org> References: <3WDb8C618hzNtQ@mail.python.org> <3WDhR41xq2zNwN@mail.python.org> Message-ID: Hey Dennis, If you think this is a bug in Chrome, can you please file a bug: http://code.google.com/p/chromium/issues/list Thanks! -jj On Fri, Jun 15, 2012 at 6:52 PM, Dennis Reinhardt wrote: > At 03:08 PM 6/15/2012, David Lawrence wrote: > >> In chrome, memory usage spikes to 3GB from 600MB, then the tab crashes >> ("Aw, Snap!"). >> > > Tell me about it! > > I see a similar thing with Chrome on my own json code. It iterates > through about 18-20 client-server exchanges and then the round trip delay > gets progressively worse, *much worse*. Chrome crashes at about iteration > 22 or so. > > I run IE and see what looks like 6 independent threads. That does not > look reasonable but IE does not crash either. This is why I suggested > trying more than one browser. > > I am pretty sure I have a JSON problem hanging up its host. I would not > rule out that you have one too. I am suspecting that any fixes you make on > the Python side might be futile until whatever is hanging JSON (and Chrome) > is squared away. > > > Dennis > > > > ______________________________**_________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/**mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Sat Jun 16 05:46:39 2012 From: itz at buug.org (Ian Zimmerman) Date: Fri, 15 Jun 2012 20:46:39 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: (Shannon's message of "Fri, 15 Jun 2012 17:56:26 -0700") References: <87lijpp45b.fsf@foolinux.dyndns.org> Message-ID: <877gv7vrz4.fsf@foolinux.dyndns.org> Shannon> (Slightly off topic.) I am a language guy, so I love looking Shannon> at other languages for cool features. You're looking for a way Shannon> to chain a bunch of method calls together, a la jQuery. IIRC it is mentioned in the Stroustrup C++ book, which surely precedes jQuery :-P -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From bob at redivi.com Sat Jun 16 06:29:35 2012 From: bob at redivi.com (Bob Ippolito) Date: Sat, 16 Jun 2012 00:29:35 -0400 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 5:41 PM, Bob Ippolito wrote: > On Fri, Jun 15, 2012 at 5:32 PM, David Lawrence wrote: > >> On Fri, Jun 15, 2012 at 2:22 PM, Bob Ippolito wrote: >> >>> On Fri, Jun 15, 2012 at 4:15 PM, David Lawrence wrote: >>> >>>> When I load the file into json, pythons memory usage spike to about >>>> 1.8GB and I can't seem to get that memory to be released. I put together a >>>> test case that's very simple: >>>> >>>> with open("test_file.json", 'r') as f: >>>> j = json.load(f) >>>> >>>> I'm sorry that I can't provide a sample json file, my test file has a >>>> lot of sensitive information, but for context, I'm dealing with a file in >>>> the order of 240MB. After running the above 2 lines I have the >>>> previously mentioned 1.8GB of memory in use. If I then do "del j" memory >>>> usage doesn't drop at all. If I follow that with a "gc.collect()" it still >>>> doesn't drop. I even tried unloading the json module and running another >>>> gc.collect. >>>> >>>> I'm trying to run some memory profiling but heapy has been churning >>>> 100% CPU for about an hour now and has yet to produce any output. >>>> >>>> Does anyone have any ideas? I've also tried the above using cjson >>>> rather than the packaged json module. cjson used about 30% less memory but >>>> otherwise displayed exactly the same issues. >>>> >>>> I'm running Python 2.7.2 on Ubuntu server 11.10. >>>> >>>> I'm happy to load up any memory profiler and see if it does better then >>>> heapy and provide any diagnostics you might think are necessary. I'm >>>> hunting around for a large test json file that I can provide for anyone >>>> else to give it a go. >>>> >>> >>> It may just be the way that the allocator works. What happens if you >>> load the JSON, del the object, then do it again? Does it take up 3.6GB or >>> stay at 1.8GB? You may not be able to "release" that memory to the OS in >>> such a way that RSS gets smaller... but at the same time it's not really a >>> leak either. >>> >>> GC shouldn't really take part in a JSON structure, since it's guaranteed >>> to be acyclic? ref counting alone should be sufficient to instantly reclaim >>> that space. I'm not at all surprised that gc.collect() doesn't change >>> anything for CPython in this case. >>> >>> $ python >>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>> darwin >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import os, subprocess, simplejson >>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>> str(os.getpid())], >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>> ... >>> >>> rss() >>> '7284' >>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> >>> rss() >>> '49032' >>> >>> del l >>> >>> rss() >>> '42232' >>> >>> l = simplejson.loads(simplejson.dumps([x for x in xrange(1000000)])) >>> >>> rss() >>> '49032' >>> >>> del l >>> >>> rss() >>> '42232' >>> >>> $ python >>> Python 2.7.2 (default, Jan 23 2012, 14:26:16) >>> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on >>> darwin >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import os, subprocess, simplejson >>> >>> def rss(): return subprocess.Popen(['ps', '-o', 'rss', '-p', >>> str(os.getpid())], >>> stdout=subprocess.PIPE).communicate()[0].splitlines()[1].strip() >>> ... >>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>> xrange(1000000)))) >>> >>> rss() >>> '288116' >>> >>> del l >>> >>> rss() >>> '84384' >>> >>> l = simplejson.loads(simplejson.dumps(dict((str(x), x) for x in >>> xrange(1000000)))) >>> >>> rss() >>> '288116' >>> >>> del l >>> >>> rss() >>> '84384' >>> >>> -bob >>> >>> >> It does appear that deleting the object and running the example again the >> memory stays static at about 1.8GB. Could you provide a little more detail >> on what your examples are meant to demonstrate. One shows a static memory >> footprint and the other shows the footprint fluctuating up and down. I >> would expect the static footprint in the first example just from my >> understanding of python free lists of integers. >> >> > Both examples show the same thing, but with different data structures > (list of int, dict of str:int). The only thing missing is that I left out > the baseline in the second example, it would be the same as the first > example. > > The other suggestions are spot on. If you want the memory to really be > released, you have to do it in a transient subprocess, and/or you could > probably have lower overhead if you're using a streaming parser (if there's > something you can do with it incrementally). > It does actually look like gc.collect() does some work in this case, despite the data structures being acyclic, because the GC will clear some of the freelists. It's not the sort of full compaction that you would expect, but it does help for certain kinds of objects. You're still better off with subprocesses for doing short work with a big transient data structure. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Sat Jun 16 06:44:48 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Fri, 15 Jun 2012 21:44:48 -0700 Subject: [Baypiggies] OT- The Secret of a Successful Programming Language? A Really Great Beard Message-ID: http://www.wired.com/wiredenterprise/2012/06/beard-gallery/ http://www.flickr.com/photos/termie/sets/72157616044454732/ I guess we just need to stop shaving... -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjinux at gmail.com Sat Jun 16 07:56:24 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 15 Jun 2012 22:56:24 -0700 Subject: [Baypiggies] OT- The Secret of a Successful Programming Language? A Really Great Beard In-Reply-To: References: Message-ID: That's why I'll never become a world-class programmer. I couldn't grow a beard even if my wife let me :( -jj On Fri, Jun 15, 2012 at 9:44 PM, Tony Cappellini wrote: > > > http://www.wired.com/wiredenterprise/2012/06/beard-gallery/ > http://www.flickr.com/photos/termie/sets/72157616044454732/ > > > I guess we just need to stop shaving... > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjinux at gmail.com Sat Jun 16 08:00:18 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 15 Jun 2012 23:00:18 -0700 Subject: [Baypiggies] Trivial OOP pattern problem In-Reply-To: <877gv7vrz4.fsf@foolinux.dyndns.org> References: <87lijpp45b.fsf@foolinux.dyndns.org> <877gv7vrz4.fsf@foolinux.dyndns.org> Message-ID: On Fri, Jun 15, 2012 at 8:46 PM, Ian Zimmerman wrote: > > Shannon> (Slightly off topic.) I am a language guy, so I love looking > Shannon> at other languages for cool features. You're looking for a way > Shannon> to chain a bunch of method calls together, a la jQuery. > > IIRC it is mentioned in the Stroustrup C++ book, which surely precedes > jQuery :-P To be fair, Stroustrup's book is large enough to contain a copy of "War and Peace", so perhaps it's forgivable that I didn't notice it ;) According to (http://en.wikipedia.org/wiki/Method_chaining), the practice may have started in Smalltalk. -jj -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From jglouderback at gmail.com Sat Jun 16 08:06:49 2012 From: jglouderback at gmail.com (Joe Louderback) Date: Fri, 15 Jun 2012 23:06:49 -0700 Subject: [Baypiggies] OT- The Secret of a Successful Programming Language? A Really Great Beard In-Reply-To: References: Message-ID: So where does John Backus fit in? On Fri, Jun 15, 2012 at 10:56 PM, Shannon -jj Behrens wrote: > That's why I'll never become a world-class programmer. I couldn't grow a > beard even if my wife let me :( > > -jj > > On Fri, Jun 15, 2012 at 9:44 PM, Tony Cappellini wrote: > >> >> >> http://www.wired.com/wiredenterprise/2012/06/beard-gallery/ >> http://www.flickr.com/photos/termie/sets/72157616044454732/ >> >> >> I guess we just need to stop shaving... >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > > > -- > In this life we cannot do great things. We can only do small things with > great love. -- Mother Teresa > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From DennisR at dair.com Sat Jun 16 18:30:47 2012 From: DennisR at dair.com (Dennis Reinhardt) Date: Sat, 16 Jun 2012 09:30:47 -0700 Subject: [Baypiggies] json using huge memory footprint and not releasing In-Reply-To: References: <3WDb8C618hzNtQ@mail.python.org> <3WDhR41xq2zNwN@mail.python.org> Message-ID: <3WF43D0LhJzNrN@mail.python.org> At 07:23 PM 6/15/2012, Shannon -jj Behrens wrote: >JJ>If you think this is a bug in Chrome, can you please file a bug: >http://code.google.com/p/chromium/issues/list > > >DR>I am pretty sure I have a JSON problem hanging up its host. I >would not rule out that you have one too. I am suspecting that any >fixes you make on the Python side might be futile until whatever is >hanging JSON (and Chrome) is squared away. JJ, This is a *long* way from something I can submit as a bug report. I have more investigation ahead to figure out what is happening. regards, Dennis From cappy2112 at gmail.com Sun Jun 17 23:55:32 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 17 Jun 2012 14:55:32 -0700 Subject: [Baypiggies] Newbie Nugget for June 2012 Message-ID: If anyone would like to give a nugget presentation for June, please post your suggestion to the list. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Mon Jun 18 23:03:25 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 18 Jun 2012 14:03:25 -0700 Subject: [Baypiggies] Books from Manning.com Message-ID: Hello Everyone, Manning has asked if anyone wants to review any of their books. They don't need to be Python-specific titles. If you request a book for review, you must complete the review within 30 days of receipt. You can keep the book as a token of thanks from the publisher. 1. Please look through these titles and email me **OFFLINE** if you would like to review a book. http://www.manning.com/ 2. Check the Baypiggies site to see if this book has already been reviewed. http://baypiggies.net/user-group-association-program/BookReviews If you find a book that has NOT been reviewed by Baypiggies, please send me the URL of the book. Most publishers are leaning on the ebook format to avoid shipping costs. http://www.manning.com/catalog/mobile/ Please state the ebook format that you are interested in. Thanks Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From jon at objectevolution.com Wed Jun 20 17:55:01 2012 From: jon at objectevolution.com (jon at objectevolution.com) Date: Wed, 20 Jun 2012 11:55:01 -0400 (EDT) Subject: [Baypiggies] Python Developer at Lucasfilm, San Francisco Message-ID: <1340207701.133715665@apps.rackspace.com> Howdy, I work in the Information Systems group at Lucasfilm and we looking for a Python developer with experience developing for the web as well as client-side apps. This is posted to the Baypiggies website as well. Thanks, Jon Lucasfilm is looking for a Python engineer to join the Information System team! Job Title: Software Developer III Company: Lucasfilm Entertainment Company Location: Letterman Digital Arts Center State: California City: San Francisco Benefited/Non-Benefited: Benefited Salary/Hourly: Salary Job Description Lucasfilm is looking for a mid to senior level developer to join a motivated group of developers in Lucasfilm's Information Systems department. Information Systems exists to support the fast-moving production environment at Lucasfilm and you will work with the knowledge that your contributions will have an immediate impact on employees and projects across the various Lucasfilm companies. The engineers in Information Systems build custom applications that enable other departments to efficiently create movies and games and more! -The IS Software Engineer is responsible for architecting and developing all proprietary software accessing our Oracle database. Their focus is on artist and production-related tools including systems that handle asset management, production tracking, workflow systems and resource management. -Improves, develops, tests, maintains, and documents script libraries and large-scale applications for use by artists and productions at every Lucasfilm division. -Develops and distributes new systems and scripts releases and maintains relevant versions and libraries; assists with and follows up on integration. -Manages requests and changes from internal customers, performs analysis, develops and integrates these changes into existing scripts and applications. -Troubleshoots specific tool/application issues with users and provides guidelines and assistance for all new development occurring outside the department. -Contributes to the team through code reviews, collaborating on new concepts and technologies, mentoring junior members, facilitating and integrating ideas and suggestions from peers. Requirements -Bachelor's degree in Computer Science or other technical degree with 3-5 years experience in a professional software development environment. -Demonstrated ability to serve as an effective contributor on mid to large scale development projects. -Proficient using modern Linux distributions, Windows and Mac OS X. -Python experience and knowledge is required. -Experience with Enterprise application development a plus. -Experience with GUI development using PyGTK preferred. -Experience in a fast-paced production environment a plus. -SQL and database experience a must, bonus points for time spent with Oracle. -Familiar with industry standard software development and QA practices. -Excellent communication and organization skills plus an enjoyment of meeting with people in a variety of positions throughout the company, and finding creative ways to solve their problems. -Must be able to juggle multiple projects and shifting priorities with ease. -Experience with any of the following is helpful as we use these technologies (and more) every day: Twisted, Pylons, Plone, jQuery, Apache, Lighttpd, Jabber, Memcached, Oracle, Redis, PyGTK, Virtualenv, Buildout, Supervisor, Buildbot, SQLAlchemy. To apply, please visit: https://www.lucasfilm.apply2jobs.com/ProfExt/index.cfm?fuseaction=mExternal.showJob&RID=3343&CurrentPage=1 From cappy2112 at gmail.com Fri Jun 22 22:59:00 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Fri, 22 Jun 2012 13:59:00 -0700 Subject: [Baypiggies] Meeting notes and question about next week In-Reply-To: References: Message-ID: The meetings are always n the 4th Thursday of the month. This has been the schedule for many years. The exceptions to this are in Nov & Dec, due to the holidays. This is on the website. ***** The date error was my typo. ******* There was no day-of-the meeting announcement posted to the list. There was no post to the list regarding the changes of weeks/dates for June. These should have been a clues. When in doubt, post a message. I was the one who is interested in a presentation on Gevent and arranging for Sean's presentation. I missed it. Everyone showed up a week early. Sorry about that. > >>So, would it make sense to check in with Sean again or look for > >>another speaker or wait until July? > TBD We have no presenters scheduled for the rest of the year. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjinux at gmail.com Sat Jun 23 00:07:27 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 22 Jun 2012 15:07:27 -0700 Subject: [Baypiggies] Meeting notes and question about next week In-Reply-To: References: Message-ID: Sorry you missed it. It was a great talk :) -jj On Fri, Jun 22, 2012 at 1:59 PM, Tony Cappellini wrote: > > The meetings are always n the 4th Thursday of the month. This has been the > schedule > for many years. The exceptions to this are in Nov & Dec, due to the > holidays. > This is on the website. > > ***** The date error was my typo. ******* > > There was no day-of-the meeting announcement posted to the list. > There was no post to the list regarding the changes of weeks/dates for > June. These should have been a clues. > When in doubt, post a message. > > I was the one who is interested in a presentation on Gevent and arranging > for Sean's presentation. > I missed it. > > Everyone showed up a week early. Sorry about that. > > > >> >>So, would it make sense to check in with Sean again or look for >> >>another speaker or wait until July? >> > TBD > > We have no presenters scheduled for the rest of the year. > > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjinux at gmail.com Sat Jun 23 00:08:04 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 22 Jun 2012 15:08:04 -0700 Subject: [Baypiggies] Flask or Pyramid Message-ID: Is anyone willing and able to give a talk at BayPiggies on Flash or Pyramid? Thanks, -jj -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From hcarrinski at gmail.com Sat Jun 23 00:12:57 2012 From: hcarrinski at gmail.com (Hy Carrinski) Date: Fri, 22 Jun 2012 15:12:57 -0700 Subject: [Baypiggies] Flask or Pyramid In-Reply-To: References: Message-ID: As the subject line stated, that's "Flask or Pyramid." :-) On Fri, Jun 22, 2012 at 3:08 PM, Shannon -jj Behrens wrote: > Is anyone willing and able to give a talk at BayPiggies on Flash or Pyramid? > > Thanks, > -jj > > -- > In this life we cannot do great things. We can only do small things with > great love. -- Mother Teresa > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From jjinux at gmail.com Sat Jun 23 00:20:06 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Fri, 22 Jun 2012 15:20:06 -0700 Subject: [Baypiggies] Flask or Pyramid In-Reply-To: References: Message-ID: My bad. A talk on integrating Pyramid with RIAs written in Flash would be cool too, but yeah, I meant to say Flask ;) -jj On Fri, Jun 22, 2012 at 3:12 PM, Hy Carrinski wrote: > As the subject line stated, that's "Flask or Pyramid." > > :-) > > On Fri, Jun 22, 2012 at 3:08 PM, Shannon -jj Behrens > wrote: > > Is anyone willing and able to give a talk at BayPiggies on Flash or > Pyramid? > > > > Thanks, > > -jj > > > > -- > > In this life we cannot do great things. We can only do small things with > > great love. -- Mother Teresa > > > > _______________________________________________ > > Baypiggies mailing list > > Baypiggies at python.org > > To change your subscription options or unsubscribe: > > http://mail.python.org/mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From vtuite at yahoo.com Sat Jun 23 02:28:22 2012 From: vtuite at yahoo.com (Vicky Tuite) Date: Fri, 22 Jun 2012 17:28:22 -0700 (PDT) Subject: [Baypiggies] What is going on with the meeting? Message-ID: <1340411302.98056.YahooMailNeo@web162801.mail.bf1.yahoo.com> >From what I can infer, there was an accidental meeting last night complete with the talk because of a date typo??? Please send out? what the plan for next week and update the website if the meeting is cancelled. -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Sat Jun 23 07:53:25 2012 From: itz at buug.org (Ian Zimmerman) Date: Fri, 22 Jun 2012 22:53:25 -0700 Subject: [Baypiggies] bound and unbound methods Message-ID: <87fw9ma816.fsf@foolinux.dyndns.org> Is there any semi-clean way to transform an unbound method into a bound one? class K(object): def meth(self, junk): print junk meth_cell = meth def another(self, gunk): # this doesn't work, what does? self.meth_cell(gunk) -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From mcquillan.sean at gmail.com Sat Jun 23 19:59:54 2012 From: mcquillan.sean at gmail.com (Sean McQuillan) Date: Sat, 23 Jun 2012 10:59:54 -0700 Subject: [Baypiggies] What is going on with the meeting? In-Reply-To: <1340411302.98056.YahooMailNeo@web162801.mail.bf1.yahoo.com> References: <1340411302.98056.YahooMailNeo@web162801.mail.bf1.yahoo.com> Message-ID: Hah, yes there was in fact an accidental meeting with a talk because of the date on the website =p. Sean On Fri, Jun 22, 2012 at 5:28 PM, Vicky Tuite wrote: > From what I can infer, there was an accidental meeting last night complete > with the talk because of a date typo? > > Please send out what the plan for next week and update the website if the > meeting is cancelled. > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- Sean McQuillan 415.990.0854 -------------- next part -------------- An HTML attachment was scrubbed... URL: From simeonf at gmail.com Sun Jun 24 07:49:07 2012 From: simeonf at gmail.com (Simeon Franklin) Date: Sat, 23 Jun 2012 22:49:07 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: <87fw9ma816.fsf@foolinux.dyndns.org> References: <87fw9ma816.fsf@foolinux.dyndns.org> Message-ID: What version of Python are you using? The code below does work exactly for me (2.6.5 on my unbuntu box) - but it isn't really illustrating your question either. You have at class definition an existing class method aliased to a new name (the "meth_cell = meth" line). But "meth" will be a bound method of any instantiated objects and generally if you add regular old functions dynamically to your classes Python converts them to bound methods when making objects out of your class. As long as your function takes a first parameter representing self you're OK. So given your class I did >>> k = K() >>> k.another('asdf') asdf Everything seems to work. As to your question: If you have a function defined outside the class you can add it to the class later with >>> K.another_method = some_func and things will just work. If you want to add functions to objects, however, that's when things get tricky. >>> def foo(self): ... print self >>> k = K() >>> k.foo = foo >>> k.foo() TypeError: foo() takes exactly 1 argument (0 given) >>> k.foo To attach a function to an object and convert it to a bound method import types and convert it manually to a bound method >>> k.foo = types.MethodType(foo, k, K) >>> k.foo > -regards Simeon Franklin On Fri, Jun 22, 2012 at 10:53 PM, Ian Zimmerman wrote: > > Is there any semi-clean way to transform an unbound method into a bound > one? > > class K(object): > > ? ? ?def meth(self, junk): > ? ? ? ? ?print junk > > ? ? ?meth_cell = meth > > ? ? ?def another(self, gunk): > ? ? ? ? ?# this doesn't work, what does? > ? ? ? ? ?self.meth_cell(gunk) > > -- > Ian Zimmerman > gpg public key: 1024D/C6FF61AD > fingerprint: 66DC D68F 5C1B 4D71 2EE5 ?BD03 8A00 786C C6FF 61AD > http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png > Rule 420: All persons more than eight miles high to leave the court. > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From recursive.cookie.jar at gmail.com Sun Jun 24 08:13:37 2012 From: recursive.cookie.jar at gmail.com (Zachary Collins) Date: Sat, 23 Jun 2012 23:13:37 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: References: <87fw9ma816.fsf@foolinux.dyndns.org> Message-ID: Woah. Dude, it's just a function. Why would you need to transform it to a bound method anyways? How about, meth_cell(self, gunk) ? Afterall, look at your method signatures. A method is just a function that takes an instance as its first argument (remember, and you even called it "self" right?) 2012/6/23 Simeon Franklin : > What version of Python are you using? The code below does work exactly > for me (2.6.5 on my unbuntu box) - but it isn't really illustrating > your question either. You have at class definition an existing class > method aliased to a new name (the "meth_cell = meth" line). But "meth" > will be a bound method of any instantiated objects and generally if > you add regular old functions dynamically to your classes Python > converts them to bound methods when making objects out of your class. > As long as your function takes a first parameter representing self > you're OK. So given your class I did > >>>> k = K() >>>> k.another('asdf') > asdf > > Everything seems to work. As to your question: If you have a function > defined outside the class you can add it to the class later with > >>>> K.another_method = some_func > > and things will just work. If you want to add functions to objects, > however, that's when things get tricky. >>>> def foo(self): > ... ? ? print self >>>> k = K() >>>> k.foo = foo >>>> k.foo() > TypeError: foo() takes exactly 1 argument (0 given) >>>> k.foo > > > To attach a function to an object and convert it to a bound method > import types and convert it manually to a bound method > >>>> k.foo = types.MethodType(foo, k, K) >>>> k.foo > > > > -regards > Simeon Franklin > > > > On Fri, Jun 22, 2012 at 10:53 PM, Ian Zimmerman wrote: >> >> Is there any semi-clean way to transform an unbound method into a bound >> one? >> >> class K(object): >> >> ? ? ?def meth(self, junk): >> ? ? ? ? ?print junk >> >> ? ? ?meth_cell = meth >> >> ? ? ?def another(self, gunk): >> ? ? ? ? ?# this doesn't work, what does? >> ? ? ? ? ?self.meth_cell(gunk) >> >> -- >> Ian Zimmerman >> gpg public key: 1024D/C6FF61AD >> fingerprint: 66DC D68F 5C1B 4D71 2EE5 ?BD03 8A00 786C C6FF 61AD >> http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png >> Rule 420: All persons more than eight miles high to leave the court. >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From guido at python.org Sun Jun 24 16:46:42 2012 From: guido at python.org (Guido van Rossum) Date: Sun, 24 Jun 2012 07:46:42 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: <87fw9ma816.fsf@foolinux.dyndns.org> References: <87fw9ma816.fsf@foolinux.dyndns.org> Message-ID: You gotta show the actual code and the traceback you got. The code you show here works. On Friday, June 22, 2012, Ian Zimmerman wrote: > > Is there any semi-clean way to transform an unbound method into a bound > one? > > class K(object): > > def meth(self, junk): > print junk > > meth_cell = meth > > def another(self, gunk): > # this doesn't work, what does? > self.meth_cell(gunk) > > -- > Ian Zimmerman > gpg public key: 1024D/C6FF61AD > fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD > http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png > Rule 420: All persons more than eight miles high to leave the court. > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Sun Jun 24 23:39:49 2012 From: itz at buug.org (Ian Zimmerman) Date: Sun, 24 Jun 2012 14:39:49 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: (Zachary Collins's message of "Sat, 23 Jun 2012 23:13:37 -0700") References: <87fw9ma816.fsf@foolinux.dyndns.org> Message-ID: <87mx3sv17e.fsf@foolinux.dyndns.org> Zachary> Woah. Dude, it's just a function. Why would you need to Zachary> transform it to a bound method anyways? How about, Zachary> meth_cell(self, gunk) Well, as you all suspect, that wasn't my actual code :-P Here is something closer. import SomeReactivePackage as SRP counter = 1 class Dispatcher(object): def handle_ev1(self, evdata): self.do_something(evdata) def handle_ev2(self, evdata): self.do_something_else(evdata) handler_table = ( ('ev1', handle_ev1), ('ev2', handle_ev2), ) def __init__(self): self.name = 'dispatcher %d' % counter counter += 1 for e, h in self.handler_table: # when I leave it like this, the handlers get called with # just 1 argument (evdata) SRP.register(e, h) def do_something(self, evdata): print 'Handling ev1: %s: %s' % (self.name, evdata) def do_something_else(self, evdata): print 'Handling ev2: %s: %s' % (self.name, evdata) Now, of course I can do this, and it works, I just feel it is ugly: def __init__(self): handler_table = ( ('ev1', self.handle_ev1), ('ev2', self.handle_ev2), ) self.name = 'dispatcher %d' % counter counter += 1 for e, h in self.handler_table: SRP.register(e, h) So I'm looking for something like this: handler_table = ( ('ev1', self.handle_ev1), ('ev2', self.handle_ev2), ) def __init__(self): self.name = 'dispatcher %d' % counter counter += 1 for e, h in self.handler_table: SRP.register(e, some_python_magic(self, h)) Clearer now? -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From davidoff56 at alluvialsw.com Mon Jun 25 03:25:37 2012 From: davidoff56 at alluvialsw.com (Monte Davidoff) Date: Sun, 24 Jun 2012 18:25:37 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: <87mx3sv17e.fsf@foolinux.dyndns.org> References: <87fw9ma816.fsf@foolinux.dyndns.org> <87mx3sv17e.fsf@foolinux.dyndns.org> Message-ID: <4FE7BE11.50207@alluvialsw.com> On 6/24/12 2:39 PM, Ian Zimmerman wrote: > > So I'm looking for something like this: > > handler_table = ( > ('ev1', self.handle_ev1), > ('ev2', self.handle_ev2), > ) > > def __init__(self): > for e, h in self.handler_table: > SRP.register(e, some_python_magic(self, h)) If I am understanding the question correctly, I think some_python_magic could be functools.partial. Here is a small working example of what I understood to be the key parts of your program: ==================================== class SRP(object): def __init__(self): self.handlers = {} def register(self, tag, handler): self.handlers[tag] = handler def __call__(self, n): for tag, handler in self.handlers.items(): print tag, handler(n) class C1(object): def h1(self, n): return n + 1 def h2(self, n): return n + 2 def __init__(self, srp): self.table = ( ('e1', self.h1), ('e2', self.h2), ) for e, h in self.table: srp.register(e, h) srp = SRP() C1(srp) srp(10) ==================================== It seemed to me you were looking for something like this: ==================================== from functools import partial class C2(object): def h1(self, n): return n + 1 def h2(self, n): return n + 2 table = ( ('e1', h1), ('e2', h2), ) def __init__(self, srp): for e, h in self.table: srp.register(e, partial(h, self)) srp = SRP() C2(srp) srp(20) ==================================== Monte From cappy2112 at gmail.com Mon Jun 25 04:34:13 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 24 Jun 2012 19:34:13 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) Message-ID: Since the presentation scheduled for June 28th accidentally took place on June 21st, several have asked if we will have a presentation on June 28th or not. Ask always, we should vote on it. However, if the majority of the votes are in favor of a presentation, we still need a presenter & topic. Given that there isn't much time left to put a presentation together, I'm in favor of leaving June behind us, and hope we can find someone to do a presentation for July. What do others think about this? +1 to wait for July or, suggest your topic for a presentation on June 28th. -------------- next part -------------- An HTML attachment was scrubbed... URL: From itz at buug.org Mon Jun 25 05:11:14 2012 From: itz at buug.org (Ian Zimmerman) Date: Sun, 24 Jun 2012 20:11:14 -0700 Subject: [Baypiggies] bound and unbound methods In-Reply-To: <4FE7BE11.50207@alluvialsw.com> (Monte Davidoff's message of "Sun, 24 Jun 2012 18:25:37 -0700") References: <87fw9ma816.fsf@foolinux.dyndns.org> <87mx3sv17e.fsf@foolinux.dyndns.org> <4FE7BE11.50207@alluvialsw.com> Message-ID: <87y5nc5bn1.fsf@foolinux.dyndns.org> Monte> On 6/24/12 2:39 PM, Ian Zimmerman wrote: Monte> If I am understanding the question correctly, I think Monte> some_python_magic could be functools.partial. Exactly. Thank you very much!! (I noticed that what I was asking for was in fact partial application applied to self, but I didn't think that was the right way to frame the question for a python audience. You proved me wrong :-) -- Ian Zimmerman gpg public key: 1024D/C6FF61AD fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png Rule 420: All persons more than eight miles high to leave the court. From simeonf at gmail.com Mon Jun 25 18:12:01 2012 From: simeonf at gmail.com (Simeon Franklin) Date: Mon, 25 Jun 2012 09:12:01 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: Message-ID: +1 On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini wrote: > > Since the presentation scheduled for June 28th accidentally took place on > June 21st, several have asked > if we will have a presentation on June 28th or not. > > Ask always, we should vote on it. > > However, if the majority of the votes are in favor of a presentation, we > still need a presenter & topic. > Given that there isn't much time left to put a presentation together, I'm in > favor of leaving June behind us, > and hope we can find someone to do a presentation for July. > > > What do others think about this? > > +1 to wait for July > > or, suggest your topic for a presentation on June 28th. > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From bryceverdier at gmail.com Mon Jun 25 18:46:07 2012 From: bryceverdier at gmail.com (Bryce Verdier) Date: Mon, 25 Jun 2012 09:46:07 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: Message-ID: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> Just wanting to ask the question, would it be possible for the presenter to give the talk again? +1 On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: > +1 > > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini wrote: >> >> Since the presentation scheduled for June 28th accidentally took place on >> June 21st, several have asked >> if we will have a presentation on June 28th or not. >> >> Ask always, we should vote on it. >> >> However, if the majority of the votes are in favor of a presentation, we >> still need a presenter & topic. >> Given that there isn't much time left to put a presentation together, I'm in >> favor of leaving June behind us, >> and hope we can find someone to do a presentation for July. >> >> >> What do others think about this? >> >> +1 to wait for July >> >> or, suggest your topic for a presentation on June 28th. >> >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From tony at tcapp.com Mon Jun 25 19:06:25 2012 From: tony at tcapp.com (Tony Cappellini) Date: Mon, 25 Jun 2012 10:06:25 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> Message-ID: Do you mean in June or July? On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: > Just wanting to ask the question, would it be possible for the presenter > to give the talk again? > > +1 > > On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: > > > +1 > > > > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini > wrote: > >> > >> Since the presentation scheduled for June 28th accidentally took place > on > >> June 21st, several have asked > >> if we will have a presentation on June 28th or not. > >> > >> Ask always, we should vote on it. > >> > >> However, if the majority of the votes are in favor of a presentation, we > >> still need a presenter & topic. > >> Given that there isn't much time left to put a presentation together, > I'm in > >> favor of leaving June behind us, > >> and hope we can find someone to do a presentation for July. > >> > >> > >> What do others think about this? > >> > >> +1 to wait for July > >> > >> or, suggest your topic for a presentation on June 28th. > >> > >> > >> > >> _______________________________________________ > >> Baypiggies mailing list > >> Baypiggies at python.org > >> To change your subscription options or unsubscribe: > >> http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > > Baypiggies mailing list > > Baypiggies at python.org > > To change your subscription options or unsubscribe: > > http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bryceverdier at gmail.com Mon Jun 25 19:24:56 2012 From: bryceverdier at gmail.com (Bryce Verdier) Date: Mon, 25 Jun 2012 10:24:56 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> Message-ID: <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> For June. On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: > Do you mean in June or July? > > On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: > Just wanting to ask the question, would it be possible for the presenter to give the talk again? > > +1 > > On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: > > > +1 > > > > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini wrote: > >> > >> Since the presentation scheduled for June 28th accidentally took place on > >> June 21st, several have asked > >> if we will have a presentation on June 28th or not. > >> > >> Ask always, we should vote on it. > >> > >> However, if the majority of the votes are in favor of a presentation, we > >> still need a presenter & topic. > >> Given that there isn't much time left to put a presentation together, I'm in > >> favor of leaving June behind us, > >> and hope we can find someone to do a presentation for July. > >> > >> > >> What do others think about this? > >> > >> +1 to wait for July > >> > >> or, suggest your topic for a presentation on June 28th. > >> > >> > >> > >> _______________________________________________ > >> Baypiggies mailing list > >> Baypiggies at python.org > >> To change your subscription options or unsubscribe: > >> http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > > Baypiggies mailing list > > Baypiggies at python.org > > To change your subscription options or unsubscribe: > > http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abhishek.vit at gmail.com Mon Jun 25 19:30:13 2012 From: abhishek.vit at gmail.com (Abhishek Pratap) Date: Mon, 25 Jun 2012 10:30:13 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: +1 for the same talk again either in June/July. -A On Mon, Jun 25, 2012 at 10:24 AM, Bryce Verdier wrote: > For June. > > On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: > > Do you mean in June or July? > > On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: > >> Just wanting to ask the question, would it be possible for the presenter >> to give the talk again? >> >> +1 >> >> On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: >> >> > +1 >> > >> > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini >> wrote: >> >> >> >> Since the presentation scheduled for June 28th accidentally took place >> on >> >> June 21st, several have asked >> >> if we will have a presentation on June 28th or not. >> >> >> >> Ask always, we should vote on it. >> >> >> >> However, if the majority of the votes are in favor of a presentation, >> we >> >> still need a presenter & topic. >> >> Given that there isn't much time left to put a presentation together, >> I'm in >> >> favor of leaving June behind us, >> >> and hope we can find someone to do a presentation for July. >> >> >> >> >> >> What do others think about this? >> >> >> >> +1 to wait for July >> >> >> >> or, suggest your topic for a presentation on June 28th. >> >> >> >> >> >> >> >> _______________________________________________ >> >> Baypiggies mailing list >> >> Baypiggies at python.org >> >> To change your subscription options or unsubscribe: >> >> http://mail.python.org/mailman/listinfo/baypiggies >> > _______________________________________________ >> > Baypiggies mailing list >> > Baypiggies at python.org >> > To change your subscription options or unsubscribe: >> > http://mail.python.org/mailman/listinfo/baypiggies >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tulioz at gmail.com Mon Jun 25 19:39:57 2012 From: tulioz at gmail.com (Ofer Goldstein) Date: Mon, 25 Jun 2012 10:39:57 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: <5BF5233D-BBDA-4666-8ED7-742E3D623165@gmail.com> +1 for the same talk, preferably this week. Perhaps someone who attended the talk could get the slides and give the talk so Sean(?) doesn't have to give the talk twice if he doesn't want to. On Jun 25, 2012, at 10:30 AM, Abhishek Pratap wrote: > +1 for the same talk again either in June/July. > > -A > > On Mon, Jun 25, 2012 at 10:24 AM, Bryce Verdier wrote: > For June. > > On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: > >> Do you mean in June or July? >> >> On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: >> Just wanting to ask the question, would it be possible for the presenter to give the talk again? >> >> +1 >> >> On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: >> >> > +1 >> > >> > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini wrote: >> >> >> >> Since the presentation scheduled for June 28th accidentally took place on >> >> June 21st, several have asked >> >> if we will have a presentation on June 28th or not. >> >> >> >> Ask always, we should vote on it. >> >> >> >> However, if the majority of the votes are in favor of a presentation, we >> >> still need a presenter & topic. >> >> Given that there isn't much time left to put a presentation together, I'm in >> >> favor of leaving June behind us, >> >> and hope we can find someone to do a presentation for July. >> >> >> >> >> >> What do others think about this? >> >> >> >> +1 to wait for July >> >> >> >> or, suggest your topic for a presentation on June 28th. >> >> >> >> >> >> >> >> _______________________________________________ >> >> Baypiggies mailing list >> >> Baypiggies at python.org >> >> To change your subscription options or unsubscribe: >> >> http://mail.python.org/mailman/listinfo/baypiggies >> > _______________________________________________ >> > Baypiggies mailing list >> > Baypiggies at python.org >> > To change your subscription options or unsubscribe: >> > http://mail.python.org/mailman/listinfo/baypiggies >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcquillan.sean at gmail.com Mon Jun 25 19:56:18 2012 From: mcquillan.sean at gmail.com (Sean McQuillan) Date: Mon, 25 Jun 2012 10:56:18 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <5BF5233D-BBDA-4666-8ED7-742E3D623165@gmail.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <5BF5233D-BBDA-4666-8ED7-742E3D623165@gmail.com> Message-ID: I'm comfortable giving the talk again if there's interest. Sean On Mon, Jun 25, 2012 at 10:39 AM, Ofer Goldstein wrote: > +1 for the same talk, preferably this week. Perhaps someone who attended > the talk could get the slides and give the talk so Sean(?) doesn't have to > give the talk twice if he doesn't want to. > > On Jun 25, 2012, at 10:30 AM, Abhishek Pratap wrote: > > +1 for the same talk again either in June/July. > > -A > > On Mon, Jun 25, 2012 at 10:24 AM, Bryce Verdier wrote: > >> For June. >> >> On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: >> >> Do you mean in June or July? >> >> On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: >> >>> Just wanting to ask the question, would it be possible for the presenter >>> to give the talk again? >>> >>> +1 >>> >>> On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: >>> >>> > +1 >>> > >>> > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini >>> wrote: >>> >> >>> >> Since the presentation scheduled for June 28th accidentally took >>> place on >>> >> June 21st, several have asked >>> >> if we will have a presentation on June 28th or not. >>> >> >>> >> Ask always, we should vote on it. >>> >> >>> >> However, if the majority of the votes are in favor of a presentation, >>> we >>> >> still need a presenter & topic. >>> >> Given that there isn't much time left to put a presentation together, >>> I'm in >>> >> favor of leaving June behind us, >>> >> and hope we can find someone to do a presentation for July. >>> >> >>> >> >>> >> What do others think about this? >>> >> >>> >> +1 to wait for July >>> >> >>> >> or, suggest your topic for a presentation on June 28th. >>> >> >>> >> >>> >> >>> >> _______________________________________________ >>> >> Baypiggies mailing list >>> >> Baypiggies at python.org >>> >> To change your subscription options or unsubscribe: >>> >> http://mail.python.org/mailman/listinfo/baypiggies >>> > _______________________________________________ >>> > Baypiggies mailing list >>> > Baypiggies at python.org >>> > To change your subscription options or unsubscribe: >>> > http://mail.python.org/mailman/listinfo/baypiggies >>> >>> _______________________________________________ >>> Baypiggies mailing list >>> Baypiggies at python.org >>> To change your subscription options or unsubscribe: >>> http://mail.python.org/mailman/listinfo/baypiggies >>> >> >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- Sean McQuillan 415.990.0854 -------------- next part -------------- An HTML attachment was scrubbed... URL: From simeonf at gmail.com Mon Jun 25 20:09:19 2012 From: simeonf at gmail.com (Simeon Franklin) Date: Mon, 25 Jun 2012 11:09:19 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <5BF5233D-BBDA-4666-8ED7-742E3D623165@gmail.com> Message-ID: +1 - June or July! On Mon, Jun 25, 2012 at 10:56 AM, Sean McQuillan wrote: > I'm comfortable giving the talk again if there's interest. > > Sean > > > On Mon, Jun 25, 2012 at 10:39 AM, Ofer Goldstein wrote: >> >> +1 for the same talk, preferably this week. Perhaps someone who attended >> the talk could get the slides and give the talk so Sean(?) doesn't have to >> give the talk twice if he doesn't want to. >> >> On Jun 25, 2012, at 10:30 AM, Abhishek Pratap wrote: >> >> +1 for the same talk again either in June/July. >> >> -A >> >> On Mon, Jun 25, 2012 at 10:24 AM, Bryce Verdier >> wrote: >>> >>> For June. >>> >>> On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: >>> >>> Do you mean in June or July? >>> >>> On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier >>> wrote: >>>> >>>> Just wanting to ask the question, would it be possible for the presenter >>>> to give the talk again? >>>> >>>> +1 >>>> >>>> On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: >>>> >>>> > +1 >>>> > >>>> > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini >>>> > wrote: >>>> >> >>>> >> Since the presentation scheduled for June 28th accidentally took >>>> >> place on >>>> >> June 21st, several have asked >>>> >> if we will have a presentation on June 28th or not. >>>> >> >>>> >> Ask always, we should vote on it. >>>> >> >>>> >> However, if the majority of the votes are in favor of a presentation, >>>> >> we >>>> >> still need a presenter & topic. >>>> >> Given that there isn't much time left to put a presentation together, >>>> >> I'm in >>>> >> favor of leaving June behind us, >>>> >> and hope we can find someone to do a presentation for July. >>>> >> >>>> >> >>>> >> What do others think about this? >>>> >> >>>> >> +1 to wait for July >>>> >> >>>> >> or, suggest your topic for a presentation on June 28th. >>>> >> >>>> >> >>>> >> >>>> >> _______________________________________________ >>>> >> Baypiggies mailing list >>>> >> Baypiggies at python.org >>>> >> To change your subscription options or unsubscribe: >>>> >> http://mail.python.org/mailman/listinfo/baypiggies >>>> > _______________________________________________ >>>> > Baypiggies mailing list >>>> > Baypiggies at python.org >>>> > To change your subscription options or unsubscribe: >>>> > http://mail.python.org/mailman/listinfo/baypiggies >>>> >>>> _______________________________________________ >>>> Baypiggies mailing list >>>> Baypiggies at python.org >>>> To change your subscription options or unsubscribe: >>>> http://mail.python.org/mailman/listinfo/baypiggies >>> >>> >>> >>> >>> _______________________________________________ >>> Baypiggies mailing list >>> Baypiggies at python.org >>> To change your subscription options or unsubscribe: >>> http://mail.python.org/mailman/listinfo/baypiggies >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies > > > > > -- > Sean McQuillan > 415.990.0854 > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From tony at tcapp.com Mon Jun 25 20:09:51 2012 From: tony at tcapp.com (Tony Cappellini) Date: Mon, 25 Jun 2012 11:09:51 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: >>For June. Given that most of the attendees have already seen his presentation, chances are a repeat of his presentation may yield a very small turnout. I don't feel that that is fair to Sean to ask him to come from SF for a few people. Can we get a show of hands (or +1) who would be interested in seeing Sean's presentation on Gevent either for the first or second time? -------------- next part -------------- An HTML attachment was scrubbed... URL: From abhishek.vit at gmail.com Mon Jun 25 20:38:37 2012 From: abhishek.vit at gmail.com (Abhishek Pratap) Date: Mon, 25 Jun 2012 11:38:37 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: +1 -A On Mon, Jun 25, 2012 at 11:09 AM, Tony Cappellini wrote: > >>For June. > > Given that most of the attendees have already seen his presentation, > chances are a repeat of his presentation > may yield a very small turnout. I don't feel that that is fair to Sean to > ask him to come from SF for a few people. > > Can we get a show of hands (or +1) who would be interested in seeing > Sean's presentation on Gevent either > for the first or second time? > > > > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vtuite at yahoo.com Mon Jun 25 20:57:19 2012 From: vtuite at yahoo.com (Vicky Tuite) Date: Mon, 25 Jun 2012 11:57:19 -0700 (PDT) Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: <1340650639.71099.YahooMailNeo@web162801.mail.bf1.yahoo.com> +1 on seeing Sean's (or anyone's) presentation on June 28 ________________________________ From: Tony Cappellini To: Bryce Verdier Cc: Baypiggies Sent: Monday, June 25, 2012 11:09 AM Subject: Re: [Baypiggies] Vote on another presentation for June 28th (or not) >>For June. Given that most of the attendees have already seen his presentation, chances are a repeat of his presentation may yield a very small turnout. I don't feel that that is fair to Sean to ask him to come from SF for a few people. Can we get a show of hands (or +1) who would be interested in seeing Sean's presentation on Gevent either for the first or second time? _______________________________________________ Baypiggies mailing list Baypiggies at python.org To change your subscription options or unsubscribe: http://mail.python.org/mailman/listinfo/baypiggies -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.berthelot at gmail.com Mon Jun 25 21:00:49 2012 From: david.berthelot at gmail.com (David Berthelot) Date: Mon, 25 Jun 2012 12:00:49 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <1340650639.71099.YahooMailNeo@web162801.mail.bf1.yahoo.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <1340650639.71099.YahooMailNeo@web162801.mail.bf1.yahoo.com> Message-ID: +1 From david at bitcasa.com Mon Jun 25 20:01:21 2012 From: david at bitcasa.com (David Lawrence) Date: Mon, 25 Jun 2012 11:01:21 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <5BF5233D-BBDA-4666-8ED7-742E3D623165@gmail.com> Message-ID: +1 for same talk this Thursday. On Mon, Jun 25, 2012 at 10:56 AM, Sean McQuillan wrote: > I'm comfortable giving the talk again if there's interest. > > Sean > > > On Mon, Jun 25, 2012 at 10:39 AM, Ofer Goldstein wrote: > >> +1 for the same talk, preferably this week. Perhaps someone who attended >> the talk could get the slides and give the talk so Sean(?) doesn't have to >> give the talk twice if he doesn't want to. >> >> On Jun 25, 2012, at 10:30 AM, Abhishek Pratap wrote: >> >> +1 for the same talk again either in June/July. >> >> -A >> >> On Mon, Jun 25, 2012 at 10:24 AM, Bryce Verdier wrote: >> >>> For June. >>> >>> On Jun 25, 2012, at 10:06 AM, Tony Cappellini wrote: >>> >>> Do you mean in June or July? >>> >>> On Mon, Jun 25, 2012 at 9:46 AM, Bryce Verdier wrote: >>> >>>> Just wanting to ask the question, would it be possible for the >>>> presenter to give the talk again? >>>> >>>> +1 >>>> >>>> On Jun 25, 2012, at 9:12 AM, Simeon Franklin wrote: >>>> >>>> > +1 >>>> > >>>> > On Sun, Jun 24, 2012 at 7:34 PM, Tony Cappellini >>>> wrote: >>>> >> >>>> >> Since the presentation scheduled for June 28th accidentally took >>>> place on >>>> >> June 21st, several have asked >>>> >> if we will have a presentation on June 28th or not. >>>> >> >>>> >> Ask always, we should vote on it. >>>> >> >>>> >> However, if the majority of the votes are in favor of a >>>> presentation, we >>>> >> still need a presenter & topic. >>>> >> Given that there isn't much time left to put a presentation >>>> together, I'm in >>>> >> favor of leaving June behind us, >>>> >> and hope we can find someone to do a presentation for July. >>>> >> >>>> >> >>>> >> What do others think about this? >>>> >> >>>> >> +1 to wait for July >>>> >> >>>> >> or, suggest your topic for a presentation on June 28th. >>>> >> >>>> >> >>>> >> >>>> >> _______________________________________________ >>>> >> Baypiggies mailing list >>>> >> Baypiggies at python.org >>>> >> To change your subscription options or unsubscribe: >>>> >> http://mail.python.org/mailman/listinfo/baypiggies >>>> > _______________________________________________ >>>> > Baypiggies mailing list >>>> > Baypiggies at python.org >>>> > To change your subscription options or unsubscribe: >>>> > http://mail.python.org/mailman/listinfo/baypiggies >>>> >>>> _______________________________________________ >>>> Baypiggies mailing list >>>> Baypiggies at python.org >>>> To change your subscription options or unsubscribe: >>>> http://mail.python.org/mailman/listinfo/baypiggies >>>> >>> >>> >>> >>> _______________________________________________ >>> Baypiggies mailing list >>> Baypiggies at python.org >>> To change your subscription options or unsubscribe: >>> http://mail.python.org/mailman/listinfo/baypiggies >>> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> >> >> >> _______________________________________________ >> Baypiggies mailing list >> Baypiggies at python.org >> To change your subscription options or unsubscribe: >> http://mail.python.org/mailman/listinfo/baypiggies >> > > > > -- > Sean McQuillan > 415.990.0854 > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at bitcasa.com Mon Jun 25 21:04:07 2012 From: david at bitcasa.com (David Lawrence) Date: Mon, 25 Jun 2012 12:04:07 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <1340650639.71099.YahooMailNeo@web162801.mail.bf1.yahoo.com> Message-ID: +1 for seeing Sean's gevent presentation for the first time on June 28th On Mon, Jun 25, 2012 at 12:00 PM, David Berthelot wrote: > +1 > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony at tcapp.com Tue Jun 26 01:57:50 2012 From: tony at tcapp.com (Tony Cappellini) Date: Mon, 25 Jun 2012 16:57:50 -0700 Subject: [Baypiggies] Repeat presentation on Gevent for June 28th Message-ID: For those who didn't make the presentation on Gevent on 6/21, we are having a repeat of the presentation on 6/28. The website isn't up to date at the moment, and I'm off to a meeting. I will update the website tonight, as well as make another announcement on Thursday. See you there. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.weisler at gmail.com Tue Jun 26 13:06:50 2012 From: mark.weisler at gmail.com (mark wissler) Date: Tue, 26 Jun 2012 04:06:50 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> Message-ID: <456A5254-8C54-49ED-A1C3-2F59493A295D@gmail.com> +1 On Jun 25, 2012, at 11:09 AM, Tony Cappellini wrote: >>> For June. > > Given that most of the attendees have already seen his presentation, chances are a repeat of his presentation > may yield a very small turnout. I don't feel that that is fair to Sean to ask him to come from SF for a few people. > > Can we get a show of hands (or +1) who would be interested in seeing Sean's presentation on Gevent either > for the first or second time? > > > > > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies From jjinux at gmail.com Tue Jun 26 16:10:03 2012 From: jjinux at gmail.com (Shannon -jj Behrens) Date: Tue, 26 Jun 2012 07:10:03 -0700 Subject: [Baypiggies] Vote on another presentation for June 28th (or not) In-Reply-To: <456A5254-8C54-49ED-A1C3-2F59493A295D@gmail.com> References: <1E225E93-AC94-4810-9F71-1F984B5F2255@gmail.com> <5A693390-FDE8-41D5-8948-732FBD88A665@gmail.com> <456A5254-8C54-49ED-A1C3-2F59493A295D@gmail.com> Message-ID: Only about 10 people showed up. Hence, it's likely that at least that many people would show up if he gave the same talk this week. -jj On Tue, Jun 26, 2012 at 4:06 AM, mark wissler wrote: > +1 > On Jun 25, 2012, at 11:09 AM, Tony Cappellini wrote: > > >>> For June. > > > > Given that most of the attendees have already seen his presentation, > chances are a repeat of his presentation > > may yield a very small turnout. I don't feel that that is fair to Sean > to ask him to come from SF for a few people. > > > > Can we get a show of hands (or +1) who would be interested in seeing > Sean's presentation on Gevent either > > for the first or second time? > > > > > > > > > > > > _______________________________________________ > > Baypiggies mailing list > > Baypiggies at python.org > > To change your subscription options or unsubscribe: > > http://mail.python.org/mailman/listinfo/baypiggies > > _______________________________________________ > Baypiggies mailing list > Baypiggies at python.org > To change your subscription options or unsubscribe: > http://mail.python.org/mailman/listinfo/baypiggies > -- In this life we cannot do great things. We can only do small things with great love. -- Mother Teresa -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Thu Jun 28 21:08:00 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Thu, 28 Jun 2012 12:08:00 -0700 Subject: [Baypiggies] Baypiggies meeting tonight. June 28, 7:30PM Message-ID: Hello Everyone, The presentation tonight will be a repeat presentation of Sean McQuillan's " Gevent looks like a wrapper on top of threads, so what's the point?" talk, previously presented on June 21st. I'm looking forward to seeing you there tonight. http://www.baypiggies.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Thu Jun 28 21:48:34 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Thu, 28 Jun 2012 12:48:34 -0700 Subject: [Baypiggies] New from O'Reilly: "Programming Computer Vision with Python" Message-ID: Are any of you interested in writing a review of this book? http://shop.oreilly.com/product/0636920022923.do Please reply OFF-LIST. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Thu Jun 28 23:33:51 2012 From: cappy2112 at gmail.com (Tony Cappellini) Date: Thu, 28 Jun 2012 14:33:51 -0700 Subject: [Baypiggies] NO MORE REPLIES needed for "Programming Computer Vision with Python" Message-ID: This topic is now closed. I received quite a lot of interest in this book. Thanks to all who replied. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcquillan.sean at gmail.com Fri Jun 29 19:30:05 2012 From: mcquillan.sean at gmail.com (Sean McQuillan) Date: Fri, 29 Jun 2012 10:30:05 -0700 Subject: [Baypiggies] Slides from "Gevent: What's the point?" Message-ID: Hi guys, Thanks to everyone who came out last night for the talk. I've uploaded the slides here: http://www.slideshare.net/seanmcq/gevent-whats-the-point Cheers, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: