Re: Open Source: you're doing it wrong - the Pyjamas hijack
On Tuesday, May 8, 2012 4:10:13 AM UTC-5, james hedley wrote: > Agreed with pretty much all of that. It's third-world politics, lurching from > one dictator to another. Risinger seems to have banned all discussion of the > subject from the list too, I'm not posting anymore because I don't want to > give him an excuse to wield his newly found banhammer. hello James, i'm not really sure what you're referring too ... you appear to be making these things up. i have not banned anything, or even alluded to it, whatsoever. i asked that one specific mail not be commented upon, as a request; perhaps this is the dreaded bannhammer you speak of? reading your accounts strewn about is interesting, what exactly are *your* motives? a simple curiosity, nothing more. your comparison to gov'ts is pretty skewed i would say, you know this as well as i. regardless of what you think or know of me, i have a permanent track record of being pretty fair and receptive to virtually anything, and am involved in a wide range of projects. Luke is a talented developer, there is no doubt of this, but he is one of the most socially inept persons i have ever encountered. leading your users to statements such as this: https://groups.google.com/forum/?fromgroups#!searchin/pyjamas-dev/credo/pyjamas-dev/xzp4CCWhJN4/nQ3-emtYFVgJ ... dozens of times on several occasions, is truly incredible. other such behavior, eg. being the only person in the history of the webkit project to ever be *ejected* from contributing or communicating *at all*, is further testament to the deficiencies provoking this maneuver. however, i have no interest in comparing or being compared. go read my notes again; i have a high level of respect for Luke in many capacities, and this has not changed. lets make one thing perfectly clear; you are not the only one who cares of this project or wishes it to succeed. mistakes were made. problems were had. the decisions however, stands. > But yeah, a lot of the commentary from the pro-rebel side ( not that any of > them admit they had anything to do with it ) really does come across as being > ill-informed and childish. indeed, you have witnessed little chatter. however, barring your belief of such, i had received dozens of notes thanking me and attesting to a renewed impetus for action. the original goal was to purchase a domain and fork -- i made this very clear in my notes -- `uxpy.net`. however, the most respectable member of the commit IMO convinced me otherwise. names names, yes you want names? sorry :-(. alas, he, myself, and numerous others are still active and moving forward. the list is actually approaching 100 ... not the "4-5" you so graciously quoted. i am simply the point man willing to stand the flurry. likewise, i did not "convince" the domain holder to give me the domain. not only was he already aware prior to me approaching him -- list member, passive -- he was more that willing to assist in reinstating the projects foundations and direction. he *was* the person who "left Luke in charge" ... why do you think he was the owner? as far as im concerned, the domain was already "hijacked"; this was, in good faith, intended as remedy. this was not a easy or light decision, the dissonance exists to this day. the idea was to retain Luke, but he decided to play legal threats as the first card (which i'm afraid can only backfire), before he even knew of the domain changes. hge is not a victim here, nor is anyone else. so please, show some cognitive capacity by realizing this is not as black-and-white as you's like it to be. when you decide to include yourself -- sooner, or later -- you are more than welcome. @alex23 ... try reading a bit further. as a human i am subject to annoyance and frustration. i probably shouldn't have started the message in that manner, but the absurdity and absolute inaccurate statements being made were rather upsetting. you will note that i make it perfectly clear that Luke is a fantastic developer, and a great part of the team. this of course has neither waned nor faltered. i encourage anyone willing to take the time to consult the archives, pyjamas' and elsewhere, as they are the only path to proper answers. this will impact the project in both known and untold ways, but we have a great number of minds willing to push beyond. -- C Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Open Source: you're doing it wrong - the Pyjamas hijack
st at their willful discretion. data was/is neither leaked nor compromised in any way. if anything, organization leaders failed to register with the Ministry their collection of personal data, and also failed to train agents on proper handling, if need be. ... that's the official statement, but like i said 100 times, i don't give a {explicit deleted} about this, and never wanted to: i seek the best for everyone. this thought stream is more likely a shoot yourself in the foot kind of path ... and not my own. while i do sincerely apologize to those affected/upset, the reality is a handful of people received a handful of mail, in a good faith attempt to reinstate a service they had both requested and retained. this was subsequently ceased once it was clear there was an issue with the latter, and a final, good faith attempt was made to detail and offer resumed services elsewhere ... so what? lets hypothetically suggest there was some transgression, people/Luke/whomever feverishly pursue, and the book get thrown my way ... what will anyone have gained? nothing. all that results is my life gets difficult, my fiance in final year of grad school is possibly compromised due to finances, and my toddler son must endure any hardship along with us ... more blood please? or revenge? or [...]? there is a positive resolution for everyone, and it will be found. > > indeed, you have witnessed little chatter > > I'd invite anyone to review the pyjamas list for the last 7 days before they > make > up their minds. Some of the statements I've seen have been regrettable. i don't know what you're referring to, or even talking about, at all. things have been rather peachy keen ... we even had some emerge from the shadows! ;-) > > by realizing this is not as black-and-white as you's like it to be. > > I have an ethical objection here, but moreover; it clearly just runs against > my > interests to support your actions. I'm not sure you considered the commercial > users > here, and with respect nor do I really get the impression you've understood > it, still. alright ... i *am* a commercial user. while the events may run afoul something, it certainly isn't your interests. when i give presentations, and early questions are not about the project, but some particular member, that signifies a problem ... i'll let you fill in the gaps. > By the way; I'm not associated with Luke at all. I've emailed him off-list a > few times > this week to discuss some angles to do with my work, but that's it. "it" you say? ok ... > In fact, I support Kees' proposition that Pyjamas should seek sponsorship > from the > Python/Apache/Free Software Foundation. This would resolve questions of > legitimacy and > leadership. > > In my ideal outcome, we could tailor pyjamas more to business use; e.g. > tidying up any license issues, offering a commercial support contract (this > will help > mitigate the damage done to perceptions of credibility), publishing a > commercial > use policy (one of the foundations could offer support with this I hope). oddly enough, your goals are inline with the advancements being made, and the some of the inadequacies behind the transition. understand that several inconsistencies were *introduced* by former leadership, and are only now being reconciled. regardless of your stance on the actual methods employed, you stand to benefit, and i daresay, *WILL* benefit. we are on the same side, James. contingent upon acceptance of an agreeable resolution, i am more than happy to transfer assets to the PSF, so we can simply absolve each other and get back to writing some damn code. however, such decisions will be made with the same care and consideration as those which brought us here ... i'm not in a hurry to witness the very encumbrances i worked hard -- and received much flak -- be reinstated. so far so good ... let's just continue working toward that goal, together. i am tight on time and resources, so this is be my last correspondence here ... best to everyone. -- C Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: else condition in list comprehension
On Mon, 10 Jan 2005 09:13:17 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: > Luis M. Gonzalez wrote: > > It's me wrote: > >>> z = [i + (2, -2)[i % 2] for i in range(10)] > >> > >> But then why would you want to use such feature? Wouldn't that make > >> the code much harder to understand ... > >> Or are we trying to write a book on "Puzzles in Python"? > > > > Once you get used to list comprehensions (and it doesn't take long), > > they are a more concise and compact way to express these operations. > > After looking the two suggestions over a couple of times, I'm still > undecided as to which one is more readable for me. The problem is not > the list comprehensions (which I love and use extensively). The problem > is the odd syntax that has to be used for an if/then/else expression in > Python. They're both pretty unreadable, IMHO. Why not just factor out the if/then/else function like this: .def plusMinusTwo(i): . if i%2 == 0: . return i-2 . else: . return i+2 . .z = [plusMinusTwo(i) for i in range(10)] Then you can add whatever you like into the function. Anthony -- - HyPEraCtiVE? HeY, WhO aRE YoU cALliNg HypERaCtIve?! [EMAIL PROTECTED] - -- http://mail.python.org/mailman/listinfo/python-list
Re: counting items
On Wed, 12 Jan 2005 17:42:50 GMT, It's me <[EMAIL PROTECTED]> wrote: > Okay, I give up. > > What's the best way to count number of items in a list? How long is a piece of string? There are many different ways, which give you different trade offs. > For instance, > > a=[[1,2,4],4,5,[2,3]] > > I want to know how many items are there in a (answer should be 7 - I don't > want it to be 4) > > I tried: > > b=len([x for y in a for x in y]) > > That doesn't work because you would get an iteration over non-sequence. And is very unreadable. > I tried: > > g=lambda x: (1,len(x))[isinstance(x,(list,tuple,dict))] > b=sum(lambda(x) for x in a) > > and that didn't work because I get a TypeError from the len function (don't > know why) Because you're trying to get the length of an integer, which is what's failing. If you know that the list nesting is only one deep, you can do something like: === #!/usr/local/bin/python compoundList = [[1,2,4],4,5,[2,3]] listLengths = [len(item) for item in compoundList if type(item) not in [int,long,str,float]] print listLengths compoundLength = len(compoundList) - len(listLengths) + sum(listLengths) print compoundLength === If the nesting is 2 deep or more, then the next two options that I would explore would be: 1. Have a look in the standard library. I'm pretty sure that there are list-manipulation libraries that'll do what you want (not sure on names, though). 2. Write a function to do what you want. Some sort of recursive thing should be pretty easy to write. Of course it depends on how fast you need to go, but that should give you a good first approximation. Anthony -- - HyPEraCtiVE? HeY, WhO aRE YoU cALliNg HypERaCtIve?! [EMAIL PROTECTED] - -- http://mail.python.org/mailman/listinfo/python-list
Re: THE GREATEST NEWS EVER ! °º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°` (new
I thought 'The Greatest News Ever' might mean something serious like transfer of the classic Beatles albums to SACD. But no, it's just religious crap. Now that the Pope's dead, do you think we could declare christianity officially extinct? Please? -- http://mail.python.org/mailman/listinfo/python-list
os.tilmes() problem
i have a problem with the os.times() command, on different Python versions, i get different printout: Server1# python Python 2.3.4 (#1, Feb 2 2005, 11:44:13) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 4880406.62 -- Server2% python Python 2.3.2 (#4, Sep 14 2004, 09:41:45) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] -21464227.74 --- Server3% python Python 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 18390711.21 and on the 3 servers, the linux command: $date returns the same value. any suggestions??? -- http://mail.python.org/mailman/listinfo/python-list
os.time()
i have a problem with the os.times() command, on different Python versions, i get different printout: Server1# python Python 2.3.4 (#1, Feb 2 2005, 11:44:13) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 4880406.62 -- Server2% python Python 2.3.2 (#4, Sep 14 2004, 09:41:45) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] -21464227.74 --- Server3% python Python 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 18390711.21 and on the 3 servers, the linux command: $date returns the same value. any suggestions??? what is the command that gives me the actual time? -- http://mail.python.org/mailman/listinfo/python-list
Re: python and os.system() failure
Thanks for the tip on strace. I will look into it. I only have a tempfile object: tmp = tempfile.mkstemp(dir="/var/tmp/") I will try to explicitly call a close() or whatever the syntax is to finalize the object to deletion by garbage collection. Thanks, Kenny -- http://mail.python.org/mailman/listinfo/python-list
Re: python and os.system() failure
Michael Hoffman wrote: > > Why aren't you using NamedTemporaryFile instead? Using mkstemp adds a > lot of complications that are usually unnecessary. I believe I originally used mktemp(), but forgot how I learned that I should use mkstemp() instead. I originally wrote the script over 1.5 years ago. =) I may have been afraid of the "deleted when closed" at the time, but now that really isn't an issue. > > I will try to explicitly call a close() or whatever the syntax is to > > finalize the object to deletion by garbage collection. > > Files created with mkstemp are neither closed nor deleted when they are > finalized. I don't see how GC comes into it either. Ah, that may explain it. Python.org did not say that mkstemp() is outside of close or gc. I tried to both close and call gc at various intervals, but, obviously, neither affected the running of the script. Thanks alot, I think this will help. -- Anthony -- http://mail.python.org/mailman/listinfo/python-list
Melbourne (Australia) Python User Group
Hi all, I'm interested in starting a Python user group in Melbourne, Australia. So far there seems to have been a lot of interest from various parties, but for whatever reasons it's fizzled out. So I've decided that if there's going to be a user group, I'll have to start it myself (hopefully without the meetup.com albatross). If you're in Melbourne, you're a python programmer and you're interested in meeting up, drop me an email and let me know. I'll probably also contact the Linux user groups in the area, but if you know of any other groups that would be interested, please let me know. If you want to forward this email on to other people or groups, feel free to do so. Thanks, Anthony -- - HyPEraCtiVE? HeY, WhO aRE YoU cALliNg HypERaCtIve?! [EMAIL PROTECTED] - -- http://mail.python.org/mailman/listinfo/python-list
Re: PYTHONPATH on OS X
On Oct 10, 11:00 pm, "mhearne808[insert-at-sign-here]gmail[insert-dot- here]com" <[EMAIL PROTECTED]> wrote: > I'm missing something major here. I'm trying to add a directory to my > python path using the PYTHONPATH environment variable, and it's being > ignored by the Python interactive shell. > > Below is a capture of what I did. Note that my newfolder appears > nowhere on the list of directories in sys.path. How do I get Python > to pay attention to my shell variables? > > Using bash on OS X 10.4.10. > > %:~ user$ echo $PYTHONPATH > > %:~ user$ PYTHONPATH=/Users/user/newfolder > %:~ user$ echo $PYTHONPATH > /Users/user/newfolder > %:~ user$ python > Python 2.5.1 (r251:54863, Aug 10 2007, 10:46:58) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "copyright", "credits" or "license" for more information.>>> > import sys > >>> sys.path > > ['', '/usr/local/lib/python2.5/site-packages/ > setuptools-0.7a1dev_r56320-py2.5.egg', '/usr/local/lib/python2.5/site- > packages/ipython1-0.9alpha2-py2.5.egg', '/usr/local/lib/python2.5/site- > packages/SQLAlchemy-0.4.0beta5-py2.5.egg', '/usr/local/lib/python2.5/ > site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-i386.egg', '/usr/ > local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/ > python2.5/plat-darwin', '/usr/local/lib/python2.5/plat-mac', '/usr/ > local/lib/python2.5/plat-mac/lib-scriptpackages', '/usr/local/lib/ > python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/usr/local/ > lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages/ > PIL'] Try export PYTHONPATH=/Users/user/newfolder Otherwise (without 'export') the variable is defined in the shell but not passed on when you launch python. Cheers, Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance question
On Mar 25, 11:44 am, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote: > While my intention is to get 1.2 I get 2.2 > I would like to know what would be the right way to yield the expected > results Is this what you want? class Foo(object): def __init__(self): self.id = 1 def getid(self): return self.id class FooSon(Foo): def __init__(self): Foo.__init__(self) self.id = 2 def getid(self): a = Foo().getid() b = self.id return '%d.%d' % (a,b) >>> FooSon().getid() '1.2' Best wishes, Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance question
On Mar 25, 2:31 pm, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote: > I wish it was that simple but 'a = Foo().getid()' is actually creating > a new instance of Foo whereas I want the data of the Foo instanced by > __init__ of FooSon(). I don't think Foo.__init__(self) creates an instance of the Foo class. If you want FooSon to create an instance of Foo, try: class FooSon(Foo): def __init__(self): self.foo = Foo() self.id = 2 def getid(self): a = self.foo.getid() b = self.id return '%d.%d' % (a,b) >>> FooSon().getid() '1.2' Or change "self.id" in Foo to something else, e.g., "self.id_foo". Does that help? Anthony -- http://mail.python.org/mailman/listinfo/python-list
Data Model:
I'm struggling on whether or not to implement GroupItem (below) with two separate models, or with one model that has a distinguishing key: Given: class ParentGroup: a group of values represented by class GroupItem class ChildGroup: a group of values represented by class GroupItem foreign-key to ParentGroup (many Children sum to one Parent) Option A: class GroupItem: foreign-key to ParentGroup foreign-key to ChildGroup GroupItemType in (ParentItem, ChildItem) value value-type Option B: class ParentGroupItem foreign-key to ParentGroup value value-type class ChildGroupItem foreign-key to ChildGroup value value-type What are my considerations when making this decision? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Data Model:
On Apr 12, 7:46 pm, Aaron Watters wrote: > On Apr 12, 10:14 pm, Anthony wrote: > > > > > I'm struggling on whether or not to implement GroupItem (below) with > > two separate models, or with one model that has a distinguishing key: > > > Given: > > class ParentGroup: > > a group of values represented by class GroupItem > > > class ChildGroup: > > a group of values represented by class GroupItem > > foreign-key to ParentGroup (many Children sum to one Parent) > > > Option A: > > class GroupItem: > > foreign-key to ParentGroup > > foreign-key to ChildGroup > > GroupItemType in (ParentItem, ChildItem) > > value > > value-type > > > Option B: > > class ParentGroupItem > > foreign-key to ParentGroup > > value > > value-type > > > class ChildGroupItem > > foreign-key to ChildGroup > > value > > value-type > > > What are my considerations when making this decision? > > > Thanks! > > It looks to me that the two designs > might be useful for different > purposes. What are you trying to do? > > -- Aaron Watters > > > whiff.sourceforge.nethttp://aaron.oirt.rutgers.edu/myapp/root/misc/erdTest The group values represent statistics that I'm tracking, based on activity groups. Some samples: Group: Johnson, Total Units Produced = 10, Total Units Consumed = 5 Chris Johnson, Units Produced = 6, Units Consumed = 3 Jim Johnson, Units Produced = 4, Units Consumed = 2 Group: Smith, Total Units Produced = 15, Total Units Consumed = 8 Mark Smith, Units Produced = 7, Units Consumed = 5 Bob Smith, Units Produced = 8, Units Consumed = 3 The groups will be responsible for entering their own statistics, so I will have to do some validation at data entry. The ability to create new statistic types (e.g. Units Broken) for new groups in the future is important. What would be the advantages of using option A versus option B? Thanks for the quick response. -- http://mail.python.org/mailman/listinfo/python-list
Re: Data Model:
On Apr 12, 8:10 pm, Aaron Brady wrote: > On Apr 12, 9:14 pm, Anthony wrote: > > > > > I'm struggling on whether or not to implement GroupItem (below) with > > two separate models, or with one model that has a distinguishing key: > > > Given: > > class ParentGroup: > > a group of values represented by class GroupItem > > > class ChildGroup: > > a group of values represented by class GroupItem > > foreign-key to ParentGroup (many Children sum to one Parent) > > > Option A: > > class GroupItem: > > foreign-key to ParentGroup > > foreign-key to ChildGroup > > GroupItemType in (ParentItem, ChildItem) > > value > > value-type > > > Option B: > > class ParentGroupItem > > foreign-key to ParentGroup > > value > > value-type > > > class ChildGroupItem > > foreign-key to ChildGroup > > value > > value-type > > > What are my considerations when making this decision? > > > Thanks! > > You want a ChildItem to have membership in two collections: > ParentGroup and ChildGroup. You also want a ParentItem to have > membership in one collection. For example: > > parentA: itemPA1, itemPA2, childA, childB > childA: itemCA1, itemCA2 > childB: itemCB1, itemCB2 > > Or, listing by child, > > itemPA1: parentA > itemPA2: parentA > itemCA1: childA > itemCA2: childA > itemCB1: childB > itemCB2: childB > childA: parentA > childB: parentA > > Correct so far? Thanks for the insightful response. Yes, everything you say is correct, with one clarification: The ChildItem can be a member of ParentGroup OR ChildGroup, but never both at the same time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Data Model:
On Apr 12, 9:36 pm, Aaron Brady wrote: > On Apr 12, 10:33 pm, Anthony wrote: > > > > > On Apr 12, 8:10 pm, Aaron Brady wrote: > > > > On Apr 12, 9:14 pm, Anthony wrote: > > > > > I'm struggling on whether or not to implement GroupItem (below) with > > > > two separate models, or with one model that has a distinguishing key: > > > > > Given: > > > > class ParentGroup: > > > > a group of values represented by class GroupItem > > > > > class ChildGroup: > > > > a group of values represented by class GroupItem > > > > foreign-key to ParentGroup (many Children sum to one Parent) > > > > > Option A: > > > > class GroupItem: > > > > foreign-key to ParentGroup > > > > foreign-key to ChildGroup > > > > GroupItemType in (ParentItem, ChildItem) > > > > value > > > > value-type > > > > > Option B: > > > > class ParentGroupItem > > > > foreign-key to ParentGroup > > > > value > > > > value-type > > > > > class ChildGroupItem > > > > foreign-key to ChildGroup > > > > value > > > > value-type > > > > > What are my considerations when making this decision? > > > > > Thanks! > > > > You want a ChildItem to have membership in two collections: > > > ParentGroup and ChildGroup. You also want a ParentItem to have > > > membership in one collection. For example: > > > > parentA: itemPA1, itemPA2, childA, childB > > > childA: itemCA1, itemCA2 > > > childB: itemCB1, itemCB2 > > > > Or, listing by child, > > > > itemPA1: parentA > > > itemPA2: parentA > > > itemCA1: childA > > > itemCA2: childA > > > itemCB1: childB > > > itemCB2: childB > > > childA: parentA > > > childB: parentA > > > > Correct so far? > > > Thanks for the insightful response. > > > Yes, everything you say is correct, with one clarification: The > > ChildItem can be a member of ParentGroup OR ChildGroup, but never both > > at the same time. > > I see. You described a collection class. Its members are items or > other collections. They are never nested more than two levels deep. > > However, in your example, you implied a collection class whose > attributes are aggregates of its members'. For simplicity, you can > use methods to compute the aggregate attributes. > > class Group: > def calculate_total_produced( self ): > total= sum( x.total_produced for x in self.members ) > > If you want to cache them for performance, the children will have to > notify the parent when one of their attributes changes, which is at > least a little more complicated. The class in the simpler structure > could even derive from 'set' or other built-in collection if you > want. Are you interested in the more complicated faster technique? Yes, in my example, the top level collection class is implicitly the aggregate of the lower level class. However, data entry will take place at the top level, not necessarily at the lower level. This means that the lower level values will never drive the top level value. Instead, the aggregate of the lower levels will be validated against the top level. If there is a discrepancy, then the remainder will be applied to an additional "Unregistered" instance of the lower level. e.g. Group: Johnson - Total Units Produced 25; Units Consumed 18; Chris Johnson - Units Produced 18; Units Consumed 10; Jim Johnson - Units Produced 3; Units Consumed 5; The group totals are the basis for any validations. In this example, another entry will be created to account for the discrepancy: Unregistered - Units Produced 4; Units Consumed 3 As far as child notification of the parent, I plan to only allow data entry on a form that includes both parent and child level values. Validation of top level to child level aggregates can happen at this time. This should remove the need for notification, right? Am I looking at 6 of one and half dozen of the other between options A and B at this point? I'm currently leaning towards option B. Is there anything I will be losing performance-wise by not choosing option A? Thanks again for conversing with me on this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Data Model:
On Apr 13, 1:26 am, Peter Otten <__pete...@web.de> wrote: > Anthony wrote: > > On Apr 12, 7:46 pm, Aaron Watters wrote: > >> On Apr 12, 10:14 pm, Anthony wrote: > > >> > I'm struggling on whether or not to implement GroupItem (below) with > >> > two separate models, or with one model that has a distinguishing key: > > >> > Given: > >> > class ParentGroup: > >> > a group of values represented by class GroupItem > > >> > class ChildGroup: > >> > a group of values represented by class GroupItem > >> > foreign-key to ParentGroup (many Children sum to one Parent) > > >> > Option A: > >> > class GroupItem: > >> > foreign-key to ParentGroup > >> > foreign-key to ChildGroup > >> > GroupItemType in (ParentItem, ChildItem) > >> > value > >> > value-type > > >> > Option B: > >> > class ParentGroupItem > >> > foreign-key to ParentGroup > >> > value > >> > value-type > > >> > class ChildGroupItem > >> > foreign-key to ChildGroup > >> > value > >> > value-type > > >> > What are my considerations when making this decision? > > >> > Thanks! > > >> It looks to me that the two designs > >> might be useful for different > >> purposes. What are you trying to do? > > >> -- Aaron Watters > > >> > > whiff.sourceforge.nethttp://aaron.oirt.rutgers.edu/myapp/root/misc/erdTest > > > > > > > The group values represent statistics that I'm tracking, based on > > activity groups. Some samples: > > > Group: Johnson, Total Units Produced = 10, Total Units Consumed = 5 > > Chris Johnson, Units Produced = 6, Units Consumed = 3 > > Jim Johnson, Units Produced = 4, Units Consumed = 2 > > > Group: Smith, Total Units Produced = 15, Total Units Consumed = 8 > > Mark Smith, Units Produced = 7, Units Consumed = 5 > > Bob Smith, Units Produced = 8, Units Consumed = 3 > > > The groups will be responsible for entering their own statistics, so I > > will have to do some validation at data entry. The ability to create > > new statistic types (e.g. Units Broken) for new groups in the future > > is important. > > > What would be the advantages of using option A versus option B? > > I may be missing something, but your example looks more like option C: > > class Group: > name > > class Member: > group # foreign key to Group > name > > class Item: > member # foreign key to Member > type > value > > You can calculate the totals for members or groups on the fly; the classical > tool would be a relational database. > > Peter You're absolutely right. This is also probably why I'm struggling with my two options, with neither one of them "feeling right." What got me going down this road is the fact that users will almost always only have the total level values to work with. The detail entries would be almost optional, from their point of view. This means that if I were to set it up as option C, then the default data entry use case would be to set up an "Unregistered" instance of the child. Now that you've highlighted that important point though, it seems to me like the proper course to follow. It implies a little bit of redesign on my part, but better now than further down the road. I just need to make sure now that there are no exception cases for top level calculation: i.e. Most of the time: Total Units Consumed = sum of (all Child Units Consumed) I need to develop a contingency plan for when the top level is not a straight sum of the child levels. -- http://mail.python.org/mailman/listinfo/python-list
Data Model - database load
Hello, I'm making a statistics tracking application and was wondering how my chosen data model design would affect performance. I'm not sure if I'm breaking up my objects into too granular a level in the interests of flexibility. class ParentStats """Summary level groups of stats""" class ChildStats """Detail level groups of stats. Sum of individual children stats x,y,z= individual parent stats x,y,z""" foreign key to ParentStats class StatLine """A group of stats being tracked.""" foreign key to ChildStats class StatField """a statistic object being tracked''' foreign key to StatLine statgroup (e.g. Temperature Related Stats, etc.) value name Today, I know that I will want to track stats "Units Made" and "Units Consumed." In the future, I may want to start tracking "Units Wasted" or some other unknown statistic. Will I be placing too much of a burden on the database if the application is built for serving up relatively low volumes of Statlines (including parent level summaries) to high volumes of users? -- http://mail.python.org/mailman/listinfo/python-list
round function error???
Isn't this a mistake??? >>> round(3499.349439034,44) 3499.3494390340002 >>> round(_,2) 3499.34999 >>> round(_,1) 3499.40001 My Python 2.5.1 spat that out.. -- http://mail.python.org/mailman/listinfo/python-list
Autocompletion and Interactive Tables in a Python IDE
Hi, I'm a FoxPro programmer, but I want to learn python before it's too late. I do a lot of statistical programming, so I import SPSS into python. In my opinion, the best features of Visual FoxPro 9.0 were: a) Intellisense (tells you what classes/methods are available and what variables go into a function) b) Code Completion (guesses your code after four letters) c) Data-Orientation; multiple data sessions can be open, data can be viewed easily Python's IDLE has only half of the first of these features. I did a lot of searching and found the PyDev extensions for Eclipse's Python IDE, and found that they've got Intellisense. I'm still missing b and c, and am getting extremely frustrated programming so slowly.. So two questions: Is there any package, gui, IDE, anything that will do FoxPro-style code completion? If it works in Eclipse, even better.. I can't find a good screenshot, but here's a better description: You type "BROW" and it pops up a window that says "BROWSE" ..at this point if you hit enter it completes the word.. and How can I view open SPSS data in one of the Python GUIs? Again, Eclipse would be the preference. Here's an example of how I'd like to browse the data: http://www.vfpconversion.com/ArticleImage.aspx?QuickID=0209071&Image=vfptoolkit_figure02.tif I don't want to have to switch back and forth between Python and SPSS while I'm programming; I just want to stay in one of them.. What can I do? I feel extremely inefficient when I don't have these three features.. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Autocompletion and Interactive Tables in a Python IDE
FoxPro is data-oriented, which means that at any time you have any number of data sets open in the workspace and browse them immediately by running one line of code in the command window. It's a really important feature in terms of efficiency; I don't want to have to move back and forth between SPSS and an IDE when I'm figuring out what code to write, that takes six keystrokes for what FoxPro can do in one. Again, here's what the BROWSE command presents: http://www.vfpconversion.com/ArticleImage.aspx?QuickID=0209071&Image=vfptoolkit_figure02.tif Does VIM have the capability to keep data open? -- Do any of these IDEs have this browse capability?? On Jul 24, 4:10 am, Aspersieman <[EMAIL PROTECTED]> wrote: > Anthony wrote: > > Hi, I'm a FoxPro programmer, but I want to learn python before it's > > too late. I do a lot of statistical programming, so I import SPSS > > into python. In my opinion, the best features of Visual FoxPro 9.0 > > were: > > a) Intellisense (tells you what classes/methods are available and what > > variables go into a function) > > b) Code Completion (guesses your code after four letters) > > c) Data-Orientation; multiple data sessions can be open, data can be > > viewed easily > > > Python's IDLE has only half of the first of these features. I did a > > lot of searching and found the PyDev extensions for Eclipse's Python > > IDE, and found that they've got Intellisense. I'm still missing b and > > c, and am getting extremely frustrated programming so slowly.. > > > So two questions: > > Is there any package, gui, IDE, anything that will do FoxPro-style > > code completion? If it works in Eclipse, even better.. > > I can't find a good screenshot, but here's a better description: > > You type "BROW" and it pops up a window that says "BROWSE" ..at this > > point if you hit enter it completes the word.. > > > and > > > How can I view open SPSS data in one of the Python GUIs? Again, > > Eclipse would be the preference. > > Here's an example of how I'd like to browse the data: > >http://www.vfpconversion.com/ArticleImage.aspx?QuickID=0209071&Image=... > > I don't want to have to switch back and forth between Python and SPSS > > while I'm programming; I just want to stay in one of them.. > > > What can I do? I feel extremely inefficient when I don't have these > > three features.. > > > Thanks in advance. > > -- > >http://mail.python.org/mailman/listinfo/python-list > > You might want to try vim. It has a steep learning curve, but definitely > increases productivity _alot_. > > Here is a tutorial on setting up vim with : > 1) Code completion (intellisense) - including tooltips (!!!) > 2) Jump between your python code and the python class libraries. > 3) Syntax checking > 4) A handy source browser > 5) Debugging (using pdb) > 6) [All the other vim goodies - already included] > Above instructions available > herehttp://blog.sontek.net/2008/05/11/python-with-a-modular-ide-vim/ > > I have been using the above setup for a while and find it superior to > _any_ IDE I've ever worked with. > > I'm not sure what you mean by 'Data-Orientation' but I'm sure there's a > suitable alternative/replacement for it in vim. > > Regards > > Nicolaas > > -- > > The three things to remember about Llamas: > 1) They are harmless > 2) They are deadly > 3) They are made of lava, and thus nice to cuddle. -- http://mail.python.org/mailman/listinfo/python-list
Looking for pointers/suggestion - how to make a webbrowser with these restriction?
Hi, all, It is kind of a MacGyver question. I am just looking for some general suggestions/pointer. First let me first describe the development environment I am in: it is a locked down WinXP PC with limited development tools and libraries. At my disposal I have python 2.6 , webkit 5.33 dll, wx 2.8 and probably a V8 dll. No visual studio or any C/C++ compiler. Do not have admin right. So given these existing ingredients, is it possible to build a rudimentary web browser using python as a glue language? What will be the main challenge/bottleneck in this sort of project? In particular how can I hook up V8 and Webkit? I have some working experience with Win32 APIs, so you may throw some low level stuff at me if needed. :-) Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for pointers/suggestion - how to make a webbrowser with these restriction?
Hi, Chris, Thanks for your reply. I really do not have any requirement. It is more a curiosity question (not work related). I'd like to find out how python can be used to 'glue' all these moving parts together. Performance and security are definitely not a concern as it is just a toy idea/project. Cheers -- http://mail.python.org/mailman/listinfo/python-list
Compairing filenames in a list
I have a list of filenames, and i need to find files with the same name, different extensions, and split that into tuples. does anyone have any suggestions on an easy way to do this that isn't O(n^2)? -- Thanks Kevin Anthony www.NoSideRacing.com Do you use Banshee? Download the Community Extensions: http://banshee.fm/download/extensions/ -- http://mail.python.org/mailman/listinfo/python-list
__setitem__ without position
I have a class that contains a list of items I can set items using __setitem__ but if i want to set the while list, i changes the variable from a myclass to a list. How can i accomblish this Example >>>C = myclass() >>>C[0] = 57 >>>type(C) myclass >>> C = [57,58,59,60] >>>type(C) list -- http://mail.python.org/mailman/listinfo/python-list
Re: __setitem__ without position
I'm not supprised... and understand why it's happening. I'm asking how to get around it. Basically i'm asking how to override, if i can, the `=` On Thu, Oct 11, 2012 at 5:32 PM, Dave Angel wrote: > On 10/11/2012 04:48 PM, Kevin Anthony wrote: > > I have a class that contains a list of items > > I can set items using __setitem__ but if i want to set the while list, i > > changes the variable from a myclass to a list. How can i accomblish this > > Example > >>>> C = myclass() > >>>> C[0] = 57 > >>>> type(C) > > myclass > >>>> C = [57,58,59,60] > This creates a list, and binds the name that used to refer to the > myclass to now refer to the list. The myclass object will go away, > since there are no more refs to it. > > >>>> type(C) > > list > > > > > Why is that a surprise? > > As for how to add multiple items to the existing mylist, how about: > > for index, item in enumerate([57, 50, 59, 60]) : > C[index] = item > > Alternatively, you could call one of the other methods in the class. > But since you gave us no clues, I'm shouldn't guess what it was called. > But if I were to make such a class, I might use slicing: > C[:] = [57, 50, 59, 60] > > BTW, your naming capitalization is backwards. Class names should begin > with a capital, Myclass. Instances should begin with lowercase - > myinstance > > -- > > DaveA > > -- Thanks Kevin Anthony www.NoSideRacing.com Do you use Banshee? Download the Community Extensions: http://banshee.fm/download/extensions/ -- http://mail.python.org/mailman/listinfo/python-list
list comprehension question
I've been teaching myself list comprehension, and i've run across something i'm not able to convert. here's the original code for matrix multiplcation retmatrix = Matrix(self.__row,other.__col) for m in range(0,retmatrix.__row): for n in range(0,retmatrix.__col): product = 0 for p in range(1,self.__col+1): product += (self.__matrix[m][p] * other.__matrix[p][n]) retmatrix.__matrix[m][n] = product Here is what i have so far: retmatrix.__matrix = [[ product = product + (self.__matrix[m][p]* other.__matrix[p][n]) if product else self.__matrix[m][p]* other.__matrix[p][n]) for p in range(0,self.col) for n in range(0,self.col)] for m in range(0,self.__row)] But i know that isn't correct, can someone nudge my in the right direction? -- Thanks Kevin Anthony www.NoSideRacing.com Do you use Banshee? Download the Community Extensions: http://banshee.fm/download/extensions/ -- http://mail.python.org/mailman/listinfo/python-list
Re: list comprehension question
Is it not true that list comprehension is much faster the the for loops? If it is not the correct way of doing this, i appoligize. Like i said, I'm learing list comprehension. Thanks Kevin On Oct 16, 2012 10:14 PM, "Dave Angel" wrote: > On 10/16/2012 09:54 PM, Kevin Anthony wrote: > > I've been teaching myself list comprehension, and i've run across > something > > i'm not able to convert. > > > > here's the original code for matrix multiplcation > > > > retmatrix = Matrix(self.__row,other.__col) > > for m in range(0,retmatrix.__row): > > for n in range(0,retmatrix.__col): > > product = 0 > > for p in range(1,self.__col+1): > > product += (self.__matrix[m][p] * other.__matrix[p][n]) > > retmatrix.__matrix[m][n] = product > > > > Here is what i have so far: > > retmatrix.__matrix = [[ product = product + (self.__matrix[m][p]* > > other.__matrix[p][n]) > > if product else self.__matrix[m][p]* > other.__matrix[p][n]) > > for p in range(0,self.col) > > for n in range(0,self.col)] > > for m in range(0,self.__row)] > > > > But i know that isn't correct, can someone nudge my in the right > direction? > > > > > > The biggest thing to learn about list comprehensions is when not to use > them. I can't imagine how your latter version (even if correct) is > clearer than the first. > > > > -- > > DaveA > > -- http://mail.python.org/mailman/listinfo/python-list
Command Line Progress Bar
Hello, I'm writing a file processing script(Linux), and i would like to have a progress bar. But i would also like to be able to print messages. Is there a simple way of doing this without implementing something like ncurses? -- Thanks Kevin Anthony www.NoSideRacing.com Do you use Banshee? Download the Community Extensions: http://banshee.fm/download/extensions/ -- http://mail.python.org/mailman/listinfo/python-list
Re: webbrowser.open always opens up Safari on Lion
If Safari is your default browser, Python will open the address in Safari. >From the Python docs: webbrowser.open(url[, new=0[, autoraise=True]]) Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible. If autoraise is True, the window is raised if possible (note that under many window managers this will occur regardless of the setting of this variable). Note that on some platforms, trying to open a filename using this function, may work and start the operating system’s associated program. However, this is neither supported nor portable. On Sat, Feb 25, 2012 at 8:33 PM, Leo wrote: > > Hello, > > On Lion and with its stock python version 2.7.1 r271:86832, > webbrowser.open('file://localhost/nonexistingfile') always opens up > Safari. Is this a bug? > > Leo > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Question about argparse and namespace
the documentation says argparse.prase_args creates a new empty namespace, but if i pass it a existing namespace, it seems to append the arguments to the existing namespace An example is if it's part of a class, calling parser.parse_args(namespace=self) doesn't seem to have any ill effects. Is this a good idea? is there a better way of doing this? -- Thanks Kevin Anthony Do you use Banshee? Download the Community Extensions: http://banshee.fm/download/extensions/ -- http://mail.python.org/mailman/listinfo/python-list
New member intro and question
Hi Everyone, I'm a new list member from the United States. Long time programmer, fairly new to Python and absolutely loving it so far! I'm 36, live in Oklahoma, and own a small Linux software development and consulting firm. Python has made my life a *lot* easier and, the more I learn, the easier it gets. Simply blown away. Now, for my question: I'm taking on a project that will run on plug computers and I'm thinking about using Python to do it. It seems like a really attractive option over C/C++ and I think it would cut down the dev time immensely. I know a scaled down version of Debian can run on the computer but I'm wondering about Python. Has anyone ever used Python to develop for extremely limited resource computers like this? Specifically, I'm going to be using the DreamPlug (http://www.geek.com/articles/gadgets/dreamplug-puts-a-1-2ghz-arm-pc-in-a-power-outlet-2011022/) which isn't too shabby but I wonder if it will work. Thanks! Anthony Papillion -- http://mail.python.org/mailman/listinfo/python-list
Re: New member intro and question
Just wanted to thank you guys for taking the time to respond. Looks like my 'limited resources' aren't so limited after all! Cheers, Anthony -- http://mail.python.org/mailman/listinfo/python-list
Simple question about loading a .glade UI file
Hi Everyone, So I'm tackling designing a non-CLI program using Glade. I went through some tutorials and it seems like I'm doing things right but I'm my UI won't load. Python keeps griping about "could not create glade XML object". I have a .glade file called MainWindow.glade and my main window is called (predictably) winMain. Here is the code I'm using to load it: #!/usr/bin/env python import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: print "GTK could not be loaded." sys.exit(1) class GMB: def __init__(self): self.gladefile = "MainWindow.glade" self.wTree = gtk.glade.XML(self.gladefile) self.wTree.signal_autoconnect(self) self.window = self.wTree.get_widget("winMain") if(self.window): self.window.connect("destroy", gtk.main_quit) def on_winMain_delete(self, widget, dummy): gtk.main_quit() if __name__ == "__main__": myGui = GMB() gtk.main() Is there any reason why I'd be getting this error from the code above? Both the UI file and the source code file are in the same directory. Thanks! Anthony -- http://mail.python.org/mailman/listinfo/python-list
Why are my signals being ignored?
Hello Everyone, So I figured out the last problem about why I couldn't load my UI files but now I've got something that has be totally stumped. I've worked on it most of the day yesterday, Google'd it, and fought with it today and I'm admitting defeat and coming to the group with hat in hand asking for help. For some reason, in the code below, my signals are being completely ignored. For example, you'll notice that I connected the 'btnExit' to the method called 'clickedButton()' but, for some reason, when the button is clicked, the method is never called. I've been following tutorials and this seems to be the proper way to wire signals yet mine simply don't work. Would anyone be so kind as to look over the following code and give me a bit of advice (or direction) as to what I might be doing wrong? Thanks! Anthony Code: #!/usr/bin/env python import sys try: import pygtk pygtk.require("2.0") except: print "Error. PYGTK could not be loaded." sys.exit(1) try: import gtk import gtk.glade except: print "GTK not present or not loaded." sys,exit(1) class TestClass(object): def __init__(self): self.uiFile = "MainWindow.glade" self.wTree = gtk.Builder() self.wTree.add_from_file(self.uiFile) self.window = self.wTree.get_object("winMain") if self.window: self.window.connect("destroy", gtk.main_quit) dic = { "on_btnExit_clicked" : self.clickButton, "on_winMain_destroy" : gtk.main_quit } self.wTree.connect_signals(dic) self.window.show() else: print "Could not load window" sys.exit(1) def clickButton(self, widget): print "You clicked exit!" def exit(self, widget): gtk.main_quit() def update_file_selection(self, widget, data=None): selected_filename = FileChooser.get_filename() print selected_filename if __name__ == "__main__": Tester = TestClass() gtk.main() -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
As someone who was a Visual Studio user for many years, I felt much the same way you do when I made the jump to Python on Linux last year. But then I discovered Glade and am quite satisfied. Glades UI design paradigm is a little different than that of VS but it's not so hard that you couldn't learn it in a week. It's very usable, pretty easy to learn, and doesn't cost you a penny. If you've not already, I recommend you check out Glade. I think it's probably what you're looking for. Anthony On 7/10/11, Ivan Kljaic wrote: > Ok Guys. I know that most of us have been expiriencing the need for a > nice Gui builder tool for RAD and most of us have been googling for it > a lot of times. But seriously. Why is the not even one single RAD tool > for Python. I mean what happened to boa constructor that it stopped > developing. I simply do not see any reasons why there isn't anything. > Please help me understand it. Any insights? > -- > http://mail.python.org/mailman/listinfo/python-list > -- Anthony Papillion Advanced Data Concepts Get real about your software/web development and IT Services Phone: (918) 919-4624 Does your business need to reduce its phone bill? I can help! Email me and ask me how! -- http://mail.python.org/mailman/listinfo/python-list
How to get or set the text of a textfield?
Hi Everyone, So I've built a UI with Glade and have loaded it using the standard Python code. In my UI, I have a textfield called txtUsername. How do I get and set the text in this field from my Python code? Thanks! Anthony -- Anthony Papillion Advanced Data Concepts Get real about your software/web development and IT Services Phone: (918) 919-4624 Does your business need to reduce its phone bill? I can help! Email me and ask me how! -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get or set the text of a textfield? - SOLVED
> I don't know anything about Glade, so I can't answer your question > definitively. However, as a general rule, you can use the dir() builtin > function to see what methods are defined by an object. Hi John, Thanks for the input and it looks like it's pretty simple. Basically, I can access the properties of objects like: self.objectname.property_or_method() So, to solve my question, I'd just use: self.txtUsername.set_text('Whatever I want') or enteredText = self.txtUsername.get_text() Pretty simple and this actually solves ALL of my Glade problems. I'm excited. Thanks for the direction! Anthony -- http://mail.python.org/mailman/listinfo/python-list
OK, I lied, I do have another question...
Hi Everyone, So I've used Glade to build a simple UI and I'm loading it with gtkBuilder. The UI loads fine but, for some reason, none of my signals are being connected. For example, in Glade, I said when the button called btnExit was clicked, execute the btnExit_clicked method. Then, in my App() class definition, I defined btnExit_clicked(self, widget) and simply added the gtk.main_quit() statement (to exit). But when I start my app, I am told that the btnExit_clicked() method isn't defined. This happens for every single signal I define. I'm assuming I'm simply putting something in the wrong place so can anyone have a look at this and tell me what that might be? It looks almost identical to examples I've seen on the net. Thanks! CODE: class App: def __init__(self): builder = gtk.Builder() builder.add_from_file('bcbackup.ui') builder.connect_signals({"on_window_destroy" : gtk.main_quit, "on_btnExit_clicked" : btnExit_clicked}) self.window = builder.get_object("winMain") self.window.show() def btnSaveInformation_clicked(self, widget): pass def btnExit_clicked(self, widget): gtk.main_quit() if __name__ == "__main__": myApp = App() gtk.main() END CODE -- http://mail.python.org/mailman/listinfo/python-list
An interesting beginner question: why we need colon at all in the python language?
Hi, all, Lately I am giving some presentations to my colleagues about the python language. A new internal project is coming up which will require the use of python. One of my colleague asked an interesting: *If Python use indentation to denote scope, why it still needs semi-colon at the end of function declaration and for/while/if loop?* My immediate response is: it allows us to fit statements into one line. e.g. if a == 1: print a However I do not find it to be a particularly strong argument. I think PEP8 does not recommend this kind of coding style anyway, so one-liner should not be used in the first place! Is there any other reasons for use of semi-colon in python? Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: An interesting beginner question: why we need colon at all in the python language?
Awesome! Thanks for blog post link Cheers On Tue, Jul 12, 2011 at 12:16 AM, Thomas Jollans wrote: > On 07/11/2011 03:51 PM, Anthony Kong wrote: > > Hi, all, > > > > Lately I am giving some presentations to my colleagues about the python > > language. A new internal project is coming up which will require the use > > of python. > > > > One of my colleague asked an interesting: > > > > /If Python use indentation to denote scope, why it still needs > > semi-colon at the end of function declaration and for/while/if loop?/ > > > > My immediate response is: it allows us to fit statements into one line. > > e.g. if a == 1: print a > > > > However I do not find it to be a particularly strong argument. I think > > PEP8 does not recommend this kind of coding style anyway, so one-liner > > should not be used in the first place! > > Basically, it looks better, and is more readable. A colon, in English > like in Python, means that something follows that is related to what was > before the colon. So the colon makes it abundantly clear to the human > reader that a block follows, and that that block is to be considered in > relation to what was just said, before the colon. > > Coincidentally, Guido wrote this blog post just last week, without which > I'd be just as much at a loss as you: > > > http://python-history.blogspot.com/2011/07/karin-dewar-indentation-and-colon.html > > -- > http://mail.python.org/mailman/listinfo/python-list > -- /*--*/ Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence _much_ too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
My take on 'Python Productivity tip for Java Programmer'. Could you give me more feedback?
Hi, all, Lately I am giving some presentations to my colleagues about the python language. A new internal project is coming up which will require the use of python. One of the goals of the presentations, as told by the 'sponsor' of the presentation, is to help the existing Java/Excel VBA programming team to become productive in python asap. I have a feeling that they are asking it based on their Java/Eclipse experience. By productive they are actually looking for some GUI tools that are as helpful as Eclipse. Having done Java programming before, I am thinking of answering the question this way: 1) For many of us, vi/emacs are sufficient for python development. (I used vim + ctags as my primary IDE for a very long time) 2) For a feature-rich GUI environment, we can consider pyCharm. (I was totally 'wowed' by it, and has convinced my last employer to purchased a few enterprise licenses) 3) The Python language itself is actually small and concise. The need for a full-blown IDE is less. The language itself could be counted as a part of the productive tool. 4) The functional aspect of the language (e.g. map, reduce, partial) helps to make program shorter and easier to understand 5) The 'battery included' standard library helps to avoid the need of complicated build tool. 6) The interactive shell helps to test out solutions in smaller units. It is probably not the team is expecting. Do you have more to add? What do you think about this 'answer'? Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: An interesting beginner question: why we need colon at all in the python language?
Sorry, typo in my original question. I do mean 'colon'. It should have read *If Python use indentation to denote scope, why it still needs colon at the end of function declaration and for/while/if loop?* Thanks On Tue, Jul 12, 2011 at 12:36 AM, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, Anthony Kong wrote: > >> Hi, all, >> >> Lately I am giving some presentations to my colleagues about the python >> language. A new internal project is coming up which will require the use >> of >> python. >> >> One of my colleague asked an interesting: >> >> *If Python use indentation to denote scope, why it still needs semi-colon >> at >> the end of function declaration and for/while/if loop?* >> >> My immediate response is: it allows us to fit statements into one line. >> e.g. >> if a == 1: print a >> >> However I do not find it to be a particularly strong argument. I think >> PEP8 >> does not recommend this kind of coding style anyway, so one-liner should >> not >> be used in the first place! >> >> Is there any other reasons for use of semi-colon in python? >> >> >> Cheers >> >> You're confusing the colon with the semi-colon. If you want two > statements on the same line, you use a semi-colon. > > The character you're asking about is the colon. It goes at the end of an > if, else, for, with, while statement. I doubt it's absolutely essential, > but it helps readability, since a conditional expression might span multiple > lines. >if someexpression == > someotherexpression: >body_of_the_conditional > > DaveA > > -- /*--*/ Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence _much_ too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Property setter and lambda question
Hi, all, This question is in the same context of my two earlier questions. This question was raised by some python beginners, and I would like to check with the list to ensure I provide a correct answer. Here is a code snippet I used to demonstrate the keyword *property*: class A(object): def __init__(self): self.__not_here = 1 def __get_not_here(self): return self.__not_here def __set_not_here(self, v): print "I am called" self.__not_here = v not_here = property(lambda self: self.__get_not_here(), lambda self, v: self.__set_not_here(v)) # not_here = property(lambda self: self.__not_here, lambda self, v: self.__not_here = v) So the question: is it possible to use lambda expression at all for the setter? (As in the last, commented-out line) Python interpreter will throw an exception right there if I use the last line ('SyntaxError: lambda cannot contain assignment'). I'd use pass a setter method anyway. What is your preferred solution? -- Tony Kong *blog:* www.ahwkong.com /*--*/ Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence _much_ too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: My take on 'Python Productivity tip for Java Programmer'. Could you give me more feedback?
Thomas, Thanks for the excellent suggestions. Generator is certainly an interesting subject. >From what i understand, the advantage of generator is mainly about saving memory, right? (i.e. no need to create a list in memory before iterate thru it) Duck typing... Although it can be easily demonstrated, I find it hard to explain its advantages to Java developers who are so used to Interfaces. (Is it about the certainty of type info... I am not sure about their concern actually) Jython is not a possibility, but I will show them an example anyway. We can use it to write some support script, I suppose. (Off topic) Monkey patching - It is a term used by Ruby developer a lot. If it means to change a function's implementation in run-time, i think python can achieve the same, right? Is it equivalent to Mixin? Cheers On Tue, Jul 12, 2011 at 2:00 AM, Thomas Jollans wrote: > On 07/11/2011 05:07 PM, Anthony Kong wrote: > > Hi, all, > > > > Lately I am giving some presentations to my colleagues about the python > > language. A new internal project is coming up which will require the use > > of python. > > > > One of the goals of the presentations, as told by the 'sponsor' of the > > presentation, is to help the existing Java/Excel VBA programming team to > > become productive in python asap. > > > > I have a feeling that they are asking it based on their Java/Eclipse > > experience. By productive they are actually looking for some GUI tools > > that are as helpful as Eclipse. > > > > Having done Java programming before, I am thinking of answering the > > question this way: > > > > 1) For many of us, vi/emacs are sufficient for python development. (I > > used vim + ctags as my primary IDE for a very long time) > > > > 2) For a feature-rich GUI environment, we can consider pyCharm. (I was > > totally 'wowed' by it, and has convinced my last employer to purchased a > > few enterprise licenses) > > > > 3) The Python language itself is actually small and concise. The need > > for a full-blown IDE is less. The language itself could be counted as a > > part of the productive tool. > > If your colleagues are used to Eclipse, it's almost certainly best to > continue using Eclipse, with PyDev. Don't make a big deal of the tools, > just say that many Pythonista don't use a heavy IDE, mention PyDev, and, > if you want to, recommend pyCharm. > > > 4) The functional aspect of the language (e.g. map, reduce, partial) > > helps to make program shorter and easier to understand > > Don't overemphasize this. Those functions can be very useful, and using > them can lead to very concise and simple code, but (big BUT) more often > than not, they're overly cryptic when compared to list comprehension and > generator expressions. > > Do make a huge case for generator expressions/list comprehension, and > generators. > > > 5) The 'battery included' standard library helps to avoid the need of > > complicated build tool. > > > > 6) The interactive shell helps to test out solutions in smaller units. > > Speaking of testing: introduce them to the doctest module. > > > It is probably not the team is expecting. Do you have more to add? What > > do you think about this 'answer'? > > If using Jython is an option, present it! Jython will allow Java > programmers to use their existing knowledge of the Java standard library. > > Explain, and make the case for, duck typing. > > While actual functional programming is, as I said, a bit "out there" > from a Java/VBA standpoint, do show off function objects. > > If you know what they're going to do with Python, you should point them > to relevant libraries/modules. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what > you get from ruthless massively parallel trial-and-error with a feedback > cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: Property setter and lambda question
Thanks again for your input, Thomas. I normally prefer not_here = property(lambda self: self.__get_not_here(), lambda self, v: self.__set_not_here(v)) than not_here = property(__get_not_here, __set_not_here) Because it allows me to have a pair getter/setter (when there is a need for it). Use of lambda there is ensure derived class of A can provide their custom version of getter/setter. But decorator! Of course! Thanks for reminding me this. In your example, where does '@not_here' come from? (Sorry, this syntax is new to me) Cheers On Tue, Jul 12, 2011 at 2:23 AM, Thomas Jollans wrote: > On 07/11/2011 05:54 PM, Anthony Kong wrote: > > Hi, all, > > > > This question is in the same context of my two earlier questions. This > > question was raised by some python beginners, and I would like to check > > with the list to ensure I provide a correct answer. > > > > Here is a code snippet I used to demonstrate the keyword *property*: > > > > > > class A(object): > > > > def __init__(self): > > self.__not_here = 1 > > > > def __get_not_here(self): > > return self.__not_here > > > > def __set_not_here(self, v): > > print "I am called" > > self.__not_here = v > > > > not_here = property(lambda self: self.__get_not_here(), lambda self, > > v: self.__set_not_here(v)) > > # not_here = property(lambda self: self.__not_here, lambda self, v: > > self.__not_here = v) > > > > So the question: is it possible to use lambda expression at all for the > > setter? (As in the last, commented-out line) > > > > Python interpreter will throw an exception right there if I use the last > > line ('SyntaxError: lambda cannot contain assignment'). I'd use pass a > > setter method anyway. > > > > What is your preferred solution? > > No, a lambda can only contain an expression, not a statement. This is > not C, assignments are not expressions. > > As to what I would do: > There's really no need to use lambdas at all here: > > class A(object): >def __init__(self): >self.not_here = 1 >def __get_not_here(self): >return self.__not_here > def __set_not_here(self, val): >self.__not_here = val >not_here = property(__get_not_here, __set_not_here) > > My favourite way to create properties is of course with decorators: > > class A(object): >def __init__(self): >self.not_here = 1 > > @property >def not_here(self): >return self.__not_here > >@not_here.setter >def not_here(self, val): >self.__not_here = val > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what > you get from ruthless massively parallel trial-and-error with a feedback > cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: Property setter and lambda question
Good point! Need to get my terminology right. Thanks On Tue, Jul 12, 2011 at 2:43 AM, Ian Kelly wrote: > On Mon, Jul 11, 2011 at 9:54 AM, Anthony Kong > wrote: > > Hi, all, > > This question is in the same context of my two earlier questions. This > > question was raised by some python beginners, and I would like to check > with > > the list to ensure I provide a correct answer. > > Here is a code snippet I used to demonstrate the keyword property: > > What Thomas said. But also, please note that "property" is a builtin, > not a keyword. > > > > Cheers, > Ian > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what > you get from ruthless massively parallel trial-and-error with a feedback > cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: Property setter and lambda question
> > PS: are you sure the lambda self: self.__foo() trick works, with > subclasses or otherwise? I haven't tested it, and I'm not saying it > doesn't, but I have a feeling double-underscore name mangling might be a > problem somewhere down the line? > > Awesome, Thomas. The trick only works if there is only *one* leading underscore in the *method* names. The following example works as I expected for the derived class B. class A(object): def __init__(self): self.__not_here = 1 def _get_not_here(self): return self.__not_here def _set_not_here(self, v): print "I am called" self.__not_here = v not_here = property(lambda self: self._get_not_here(), lambda self, v: self._set_not_here(v)) class B(A): def _set_not_here(self, v): print "version B" self.__not_here = v a = A() # print a.__not_here print a.not_here # a.set_not_here(10) a.not_here = 10 print a.not_here b = B() print b.not_here b.not_here = 70 # print version B print b.not_here -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what > you get from ruthless massively parallel trial-and-error with a feedback > cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: Property setter and lambda question
So subclass B has no access to __not_here in A after all... OK, in one of legacy Python I supported there are a lot of code floating around like this. It works OK (in term of business logic and unit test). That's probably due to luck :-) It also uses a lot of __slot__ = ['attr_a', 'attr_b'...] in class definitions to prevent accidental creation of new variables (due to typo for example). Needless to say it was first written up by programmers of static lang background who want to enforce the java/.net behavior... (private variables, variable declaration) Cheers On Tue, Jul 12, 2011 at 3:41 AM, Ian Kelly wrote: > On Mon, Jul 11, 2011 at 11:21 AM, Anthony Kong > wrote: > > Awesome, Thomas. The trick only works if there is only one leading > > underscore in the method names. > > The following example works as I expected for the derived class B. > > class A(object): > > def __init__(self): > > self.__not_here = 1 > > def _get_not_here(self): > > return self.__not_here > > def _set_not_here(self, v): > > print "I am called" > > self.__not_here = v > > not_here = property(lambda self: self._get_not_here(), lambda self, > v: > > self._set_not_here(v)) > > class B(A): > > def _set_not_here(self, v): > > print "version B" > > self.__not_here = v > > It shouldn't. You've still got the name __not_here used in both A and > B, so that the B version is setting a different attribute than the A > version (_B__not_here vs. _A__not_here). > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what > you get from ruthless massively parallel trial-and-error with a feedback > cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: An interesting beginner question: why we need colon at all in the python language?
Thanks, mate! I was writing that up really late at night. Somehow I changed term to semi-colon half way through, Cheers On Wed, Jul 13, 2011 at 5:36 PM, Thorsten Kampe wrote: > * Dave Angel (Mon, 11 Jul 2011 10:36:48 -0400) > > On 01/-10/-28163 02:59 PM, Anthony Kong wrote: > > > My immediate response is: it allows us to fit statements into one > > > line. e.g. > > > if a == 1: print a > > > > > You're confusing the colon with the semi-colon. If you want two > > statements on the same line, you use a semi-colon. > > He's not confusing anything at all. His example made it pretty clear > that he didn't mean "two statements" but "multiline statemements". > > Thorsten > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Functional style programming in python: what will you talk about if you have an hour on this topic?
Hi, all, If you have read my previous posts to the group, you probably have some idea why I asked this question. I am giving a few presentations on python to my colleagues who are mainly java developers and starting to pick up python at work. So I have picked this topic for one of my presentation. It is because functional programming technique is one of my favorite in my bag of python trick. It also takes me to the rabbit hole of the functional programming world, which is vastly more interesting than the conventional procedural/OO languages. I think I will go through the following items: - itertools module - functools module - concept of currying ('partial') I would therefore want to ask your input e.g. - Is there any good example to illustrate the concept? - What is the most important features you think I should cover? - What will happen if you overdo it? Cheers -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Functional style programming in python: what will you talk about if you have an hour on this topic?
(My post did not appear in the mailing list, so this is my second try. Apology if it ends up posted twice) Hi, all, If you have read my previous posts to the group, you probably have some idea why I asked this question. I am giving a few presentations on python to my colleagues who are mainly java developers and starting to pick up python at work. So I have picked this topic for one of my presentation. It is because functional programming technique is one of my favorite in my bag of python trick. It also takes me to the rabbit hole of the functional programming world, which is vastly more interesting than the conventional procedural/OO languages. I think I will go through the following items: itertools module functools module concept of currying ('partial') I would therefore want to ask your input e.g. Is there any good example to illustrate the concept? What is the most important features you think I should cover? What will happen if you overdo it? Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional style programming in python: what will you talk about if you have an hour on this topic?
Hi, James, > > You might also want to cover gotchas like Python's references. > Not sure what it means in the context of functional programming. If you can give some code to demonstrate, it will be great. Cheers -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the difference between PyPy and Python? are there lot of differences?
One of the main difference is that pypy supports only R-Python, which stands for 'Restricted Python". It is a subset of C-python language. See here for more info: http://codespeak.net/pypy/dist/pypy/doc/coding-guide.html#rpython-definition-not Cheers On Thu, Jul 14, 2011 at 12:06 AM, ArrC wrote: > Hey guys,i am a python newbie, > i just read a qustion on quora where it said that quora quys used pypy (and > pylon) to develop quora. > > So, i want to know what are the core diff btw PyPy and Python ? > > And they also talked about the lack of type check in python. > > So, how does it help (strongly typed) in debugging? > > Thanks > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the difference between PyPy and Python? are there lot of differences?
I stand corrected. Thanks Ian Cheers On Thu, Jul 14, 2011 at 1:18 AM, Ian Kelly wrote: > On Wed, Jul 13, 2011 at 8:19 AM, Anthony Kong > wrote: > > One of the main difference is that pypy supports only R-Python, which > stands > > for 'Restricted Python". > > It is a subset of C-python language. > > This is wrong. The PyPy *interpreter* is written in RPython. At the > application level, PyPy supports the full syntax and semantics of > Python (with a few minor differences of the same sort that you find in > Jython or IronPython). > -- Tony Kong *blog:* www.ahwkong.com Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence *much* too much credit. - Linus Torvalds -- http://mail.python.org/mailman/listinfo/python-list
Re: Aw: Re: Aw: Functional style programming in python: what will you talk about if you have an hour on this topic?
Thanks for all the great suggestion. First of all, Carl is right that it does not take much to impress a java programmer about the expressiveness of functional programming. Covered map, reduce and filter as Rainer suggested. Emphasized the advantages of functional style as summarised by Steve D'Aprano. I showcased the use of groupby() in itertools. Think about what it takes to implement similar logic in Java. Also introduced the gotcha of using groupby(): you must first sort the list in the same way you want to group them by. Then I got ambitious and tried to introduce partial(). I basically lost everyone right there. They can understand what partial does but do not know why it can be useful. My example was too trivial and it did not help. What is the best way to introduce partial/currying? -- http://mail.python.org/mailman/listinfo/python-list
Question about compiling python 30 from subversion repository on OSX
Hi, all, I have checked out source code from this url http://svn.python.org/projects/python/branches/py3k, then run ./configure --with-universal-archs=64-bit make First of all, I got this message: --- Modules/Setup.dist is newer than Modules/Setup; check to make sure you have all the updates you need in your Modules/Setup file. Usually, copying Modules/Setup.dist to Modules/Setup will work. --- Then the build failed with these messages /usr/bin/ranlib: file: libpython3.3m.a(dynamic_annotations.o) has no symbols /usr/bin/ranlib: file: libpython3.3m.a(pymath.o) has no symbols ranlib libpython3.3m.a ranlib: file: libpython3.3m.a(dynamic_annotations.o) has no symbols ranlib: file: libpython3.3m.a(pymath.o) has no symbols gcc -framework CoreFoundation -o python.exe Modules/python.o libpython3.3m.a -ldl -framework CoreFoundation Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: can't initialize sys standard streams Traceback (most recent call last): File "/Users/antkong/wd/python/python3/Lib/io.py", line 60, in /bin/sh: line 1: 55310 Abort trap CC='gcc' LDSHARED='gcc -bundle -undefined dynamic_lookup ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ./python.exe -E ./setup.py build make: *** [sharedmods] Error 134 I wonder what caused these error messages. Is it possible that I am checking out the wrong branch? The 3.2 branch (http://svn.python.org/projects/python/branches/release32-maint) can be compiled without much issue. Cheers -- http://mail.python.org/mailman/listinfo/python-list
pip does not find after Python 3.10.4 installed
The Python 3.10.4 (64-bit) and Python Launcher had been (standard) installed successfully. But I could not find pip anywhere. I uninstalled and re-installed a couple of times, it is still the problem. I checked the installed directory C:\Users\x\AppData\Local\Programs\Python\Python310\Tools\Scripts\ and also scanned the whole drive, pip could not be found. I also checked on the web and none of them help. Did I do something wrong? Note: I did install Python 3.8 on another Windows Pro desktop without any problem. Thank very much. Subscriber: aachu -- https://mail.python.org/mailman/listinfo/python-list
Re: pip does not find after Python 3.10.4 installed
I found that RAV Antivirus complains some processes even Python 3.10.4 installed successfully. Remove RAV and re-install Python; then everything goes OK. Thanks, On 05/26/2022 8:24 AM ANTHONY CHU wrote: > > > The Python 3.10.4 (64-bit) and Python Launcher had been (standard) > installed successfully. But I could not find pip anywhere. I uninstalled and > re-installed a couple of times, it is still the problem. I checked the > installed directory > C:\Users\x\AppData\Local\Programs\Python\Python310\Tools\Scripts\ and > also scanned the whole drive, pip could not be found. > I also checked on the web and none of them help. Did I do something > wrong? > Note: I did install Python 3.8 on another Windows Pro desktop without any > problem. > > Thank very much. > > Subscriber: aachu > -- https://mail.python.org/mailman/listinfo/python-list
i cant seem to figure out the error
hi everyone, please i need help with this assignment. I have written a code and i still get an error. please help me debug my code. instructions: - Create a constructor that takes in an integer and assigns this to a `balance` property. - Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly. - Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"` - Create a subclass MinimumBalanceAccount of the BankAccount class My code: class BankAccount(object): def __init__(self, balance): self.balance = balance def deposit(self, amount): self.amount=amount self.balance += amount return self.balance def withdraw(self, amount): self.amount=amount if(amount > self.balance): return ("Amount greater than available balance.") else: self.balance -= amount return self.balance class MinimumBalanceAccount(BankAccount): def __init__(self, minimum_balance): BankAccount.__init__(self) self.minimum_balance = minimum_balance act = BankAccount(5) act.deposit(400) act.withdraw(200) print act.balance error message: THERE IS AN ERROR/BUG IN YOUR CODE*Results: * {"finished": true, "success": [{"fullName": "test_balance", "passedSpecNumber": 1}, {"fullName": "test_deposit", "passedSpecNumber": 2}, {"fullName": "test_sub_class", "passedSpecNumber": 3}, {"fullName": "test_withdraw", "passedSpecNumber": 4}], "passed": false, "started": true, "failures": [{"failedSpecNumber": 1, "fullName": "test_invalid_operation", "failedExpectations": [{"message": "Failure in line 23, in test_invalid_operation\n self.assertEqual(self.my_account.withdraw(1000), \"invalid transaction\", msg='Invalid transaction')\nAssertionError: Invalid transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0, "time": "0.79"}} 205 -- https://mail.python.org/mailman/listinfo/python-list
Why do these statements evaluate the way they do?
I'm trying to figure out why the following statements evaluate the way they do and I'm not grasping it for some reason. I'm hoping someone can help me. 40+2 is 42 #evaluates to True But 2**32 is 2**32 #evaluates to False This is an example taken from a Microsoft blog on the topic. They say the reason is because the return is based on identity and not value but, to me, these statements are fairly equal. Can someone clue me in? Anthony -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- https://mail.python.org/mailman/listinfo/python-list
3D surface plot
I should know this ...! Anyway, I have a list of 36 tuples, each with x, y, z values I want to create a surface plot ... Need help putting data into right format for matplot3D ... This is a gmail account used by Keith D. Anthony On Sat, Mar 16, 2019 at 12:03 PM wrote: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to > python-list-requ...@python.org > > You can reach the person managing the list at > python-list-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > Today's Topics: > >1. Re: Question regarding the local function object (Terry Reedy) >2. subprocess svn checkout password issue (Martin De Kauwe) >3. RE: asyncio Question (Joseph L. Casale) >4. Re: Implement C's Switch in Python 3 (jf...@ms4.hinet.net) >5. Re: subprocess svn checkout password issue (dieter) >6. Re: subprocess svn checkout password issue (Martin De Kauwe) >7. Re: Question regarding the local function object (Gregory Ewing) >8. Re: how to embed non-tkinter VLC player into grid of tkinter > with python? (akashsahu...@gmail.com) >9. Re: subprocess svn checkout password issue (Dan Sommers) > > > > -- Forwarded message -- > From: Terry Reedy > To: python-list@python.org > Cc: > Bcc: > Date: Fri, 15 Mar 2019 13:00:50 -0400 > Subject: Re: Question regarding the local function object > On 3/15/2019 8:47 AM, Arup Rakshit wrote: > > Hi, > > > > I am reading a book where it says that: > > > > Just like module-level function definitions, the definition of a local > function happens at run time when the def keyword is executed. > Interestingly, this means that each call to sort_by_last_letter results in > a new definition of the function last_letter. That is, just like any other > name bound in a function body, last_letter is bound separately to a new > function each time sort_by_last_letter is called. > > > > If that above is true, why the below program shows the same object > reference for last_letter every time I call function sort_by_last_letter. > > > > # file name is sample.py > > > > def sort_by_last_letter(strings): > > def last_letter(s): > > return s[-1] > > print(last_letter) > > return sorted(strings, key=last_letter) > > > > python3 -i sample.py > >>>> sort_by_last_letter(['ghi', 'def', 'abc']) > > .last_letter at 0x1051e0730> > > ['abc', 'def', 'ghi'] > >>>> sort_by_last_letter(['ghi', 'def', 'abc']) > > .last_letter at 0x1051e0730> > > ['abc', 'def', 'ghi'] > >>>> sort_by_last_letter(['ghi', 'def', 'abckl']) > > .last_letter at 0x1051e0730> > > ['def', 'ghi', 'abckl'] > > To build on Calvin's explanation ... > intersperse other function definitions between the repeated calls > > sort_by_last_letter(['ghi', 'def', 'abc']) > def a(): return 'skjsjlskjlsjljs' > print(a) > sort_by_last_letter(['ghi', 'def', 'abc']) > def b(): return 546465465454 > print(b) > sort_by_last_letter(['ghi', 'def', 'abc']) > > and memory gets reused a different way. > > .last_letter at 0x03A51D40> > # <== is same memory as . > .last_letter at 0x043C2710> > # ditto > .last_letter at 0x043C2768> > > Creating a new list or string did not have the same effect. I believe > that CPython function objects must currently all have the same size or > at least the same max size and conclude that CPython currently allocates > them from a block of memory that is some multiple of that size. These > are, of course, current internal implementation details, subject to > change and even variation across hardware and OSes. > > -- > Terry Jan Reedy > > > > > > -- Forwarded message -- > From: Martin De Kauwe > To: python-list@python.org > Cc: > Bcc: > Date: Fri, 15 Mar 2019 15:17:22 -0700 (PDT) > Subject: subprocess svn checkout password issue > Hi, > > I'm trying to write a script that will make a checkout from a svn repo and > build the result for the user. However,
This is the email address I Believe I should email for support.
When I try to uninstall python 3.8.0 to reinstall, it says that the program is currsntly running. Please help Sent from [1]Mail for Windows 10 References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list
How to start using python
I am new to Python and have downloaded the software onto my pc. There is no shortcut on my desktop. How the heck do I access it to start learning how to program with it? Anthony Steventon. -- This email has been checked for viruses by AVG. https://www.avg.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to start using python
Thanks for the help from everyone. Operating system is windows 7. Download installation file is python-3.7.9-amd64.exe downloaded from python.org. No problems when I run it, installation successful. Have tried 2 + 3 with a result of 5 at the command prompt. whatever I put in after that I get a message telling me the entry is undefined. Anthony Steventon. From: Bob Gailer Sent: Thursday, November 12, 2020 8:58 PM To: Anthony Steventon Cc: python list Subject: Re: How to start using python On Nov 12, 2020 10:41 PM, "Anthony Steventon" wrote: > > I am new to Python and have downloaded the software onto my pc. There is no > shortcut on my desktop. How the heck do I access it to start learning how to > program with it? Visit www.Python.Org there should be some links to tutorials that should cover the topics of how to install python and how to start using it. If that does not help come back to us with more information including your operating system, the website from which you downloaded the installer, the name of the installer file, and what you did to install python. You also might try from a terminal or command prompt typing py, which should start up a python Interactive session. You should see>>> type 2 + 3 hit enter you should see a new line displaying five. Let us know how it goes and we'll give you a hand from there. Bob Gailer -- This email has been checked for viruses by AVG. https://www.avg.com -- https://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.4.2 (final)
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.2 (final). Python 2.4.2 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the more than 60 bugs squished in this release. For more information on Python 2.4.2, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.4.2 Highlights of this new release include: - Bug fixes. According to the release notes, more than 60 have been fixed, including bugs that prevented Python from working properly on 64 bit HP/UX and AIX systems. Highlights of the previous major Python release (2.4) are available from the Python 2.4 page, at http://www.python.org/2.4/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpwfrERwGZBK.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Problem processing Chinese
I believe that topic related to Chinese processing was discussed before. I could not dig out the info I want from the mail list archive. My Python script reads some Chinese text and then split a line delimited by white spaces. I got lists like ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', '\xa1\xa2'] I had #-*- coding: gbk -*- on top of the script. My Windows 2000 system's default language is Chinese (GB2312) and displays Chinese perfectly. I don't know how to configure python or what else I need to properly process such two-byte-character text. Thanks. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Problem splitting a string
I have this simple string: mystr = 'this_NP is_VL funny_JJ' I want to split it and give me a list as ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] 1. I tried mystr.split('_| '), but this gave me: ['this_NP is_VL funny_JJ'] It is not splitted at all. 2. I tried mystr.split('_'), and this gave me: ['this', 'NP is', 'VL funny', 'JJ'] in which, space is not used as a delimiter. 3. I tried mystr.split(' '), and this gave me: ['this_NP', 'is_VL', 'funny_JJ'] in which, '_' is not used as delimiter. I think the documentation does say that the separator/delimiter can be a string representing all delimiters we want to use. I do I split the string by using both ' ' and '_' as the delimiters at once? Thanks. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
An interesting question about "print '\a'"
We know that if we do print '\a' the bell will sound. Now, why do I hear the sound on my local machine when I run a python script on a remote host? I understand if I hear it when I do print '\a' on my local machine. Does the command get sent back to the client machine? Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Web presentation layer/framework for python - recommendations?
Hi, I am a python newbie and need some advice. I have been charged with redeveloping a web application with a front end written in python that has a backend of XML files. Currently it doesn't adequately separate out the presentation code from the content code. Frankly it’s a mess (think bowl of spagetti). Does anyone have any recommendations for python toolkits or templating systems that would simplify the cleanup and make the code more maintainable in the future? I am a newbie, but not afraid to have a go. I also haven't done any real application programming for a while - bit of perl and java stuff a few years back. Just do perl/python/shell scripting these days. All comments welcome :-) Regards Anthony. Mr Anthony Hornby Library Systems and Technology Coordinator Charles Darwin University (CRICOS 300K) Phone: +61 8 8946 6011 Email: [EMAIL PROTECTED] (remove the .no-spam) -- http://mail.python.org/mailman/listinfo/python-list
Is mod_python 3.1 good for commercial blogging/CMS?
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with mod_python 3.1.4 running on Apache 2.0 with the Publisher handler. However, I am still very hesitant to settle on Python. All my research brings up the same collection of scant articles and old mailing list messages that reference each other. I am not interested in using frameworks, partly because I am confused by them, but mostly because I don't want to add another layer of software complexity on top of my code since I already am expecting a hard time finding low-cost dedicated hosting with Apache 2 and mod_python 3 support. I have made a few assumptions regarding Python and mod_python's value. Hopefully the experts here can help correct any of my assumptions and give me some more comfort in committing to Python. 1. I want to use CGI through Publisher handler, instead of CGI handler or PSP. Despite the speed increase mod_python gives me, there is a problem of persistence that can be a problem when dealing with a site that will hosts potentially hundreds of simultaneous users. 2. I have found nothing to quantify the stability and reliability of mod_python 3, and in the absence of a list of major commercial sites that use mod_python, I am left feeling as is there might be technical (read as stability/security) reasons to favor mod_perl over mod_python. 3. I am not very attracted to PSP because I want to separate the logic from the presentation as completely as possible, and PHP and other template languages including PSP seem difficult to do that in. Learning template systems like PyMeld is an unattractive option for me since I don't understand their benefit. Why can't I just use req.write() to output my markup, relying completely on external CSS after the fact? My thought is that HTML templates provide a minimum set of static code that doesn't require extra processing, thus keeping performance up. However, if I minimize my use of req.write() will it make a difference? 4 A final question, is mod_python 2.7 suitable for use in a commercial production system? All I'm doing is text processing, string manipulation, database calls, and some very minor mathematics. If the Apache 1.3 series mod works fine, can I relieve myself of some stress and go with that combo? I'd appreciate some practical advise on this. I am funding this myself on a small budget with no hard deadline, so it is critical to me that I choose a language that will minimize my costs. Are my assumptions correct, or am I falling prey to FUD? Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Is mod_python 3.1 good for commercial blogging/CMS?
In article <[EMAIL PROTECTED]>, "Ben Sizer" <[EMAIL PROTECTED]> wrote: > Anthony L. wrote: > > 1. I want to use CGI through Publisher handler, instead of CGI handler > > or PSP. Despite the speed increase mod_python gives me, there is a > > problem of persistence that can be a problem when dealing with a site > > that will hosts potentially hundreds of simultaneous users. > > What problem? Could you elaborate further? Hi Ben. This is what I myself am trying to find out. From what I gather, hosts dislike long running processes, and so one reason for not supporting Python and mod_python is that, plus multiple instances of the python interpreter. Granted, a lot of this looks like old information combined with FUD, so I am suspicious. After all, high-traffic sites using mod_perl seem okay. > In theory, people use these templates to /improve/ the separation > between logic and presentation. When you just use req.write() you're > inevitably mixing logic and presentation. At least with the template > systems, you do the presentation once and the logic fills in the gaps. > It's even possible to edit the presentation in many WYSIWYG web editors > without affecting the code. Yes, I see your point. In this case it works for me (at the moment) because the HTML design will remain as is without subject to editing, whereas the look and feel (controlled by CSS) will be user-editable. > I don't think performance is a factor, really. HTML templates tend to > exist so that you can structure the page without worrying about the > Python code. They work well for fairly uniform pages that largely > require the same sort of data on each page. I am more of a programmer > than a designer so I prefer to think in terms of code and emit HTML as > it suits me. Okay, I might have been unfair in looking away from PSP then. Thanks Ben. Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Is mod_python 3.1 good for commercial blogging/CMS?
In article <[EMAIL PROTECTED]>, Francois Lepoutre <[EMAIL PROTECTED]> wrote: > > 3. I am not very attracted to PSP because I want to separate the logic > > from the presentation as completely as possible [...] > > In view of your project why not consider cherrypy as well? It may > be an alternative to consider. Hi Francois, I'm getting more open to considering other frameworks. As I mentioned earlier, I am aware that I am swimming against the current by not simply using Apache 1 and PHP, so I wanted to avoid investing in yet another esoteric piece of software. Thankfully, after a discussion with some prospective hosts today, I have the freedom to consider CherryPy and Django. > > manipulation, database calls, and some very minor mathematics. If the > > Apache 1.3 series mod works fine, can I relieve myself of some stress > > and go with that combo? > > Why not? But why not work with apache 2.x. mod_python works fine on > this platform. Oh, it's not that I have anything against Apache 2. My preference is to work with mod_python 3, and that requires Apache 2, which I want. I was just considering a less desirable pythonic option. Even among commodity shared hosting providers I've found the presence of earlier versions of python and mod_python. > no FUD here. Read the mod_python carefully, run your tests and make up > your choice. This is definitely a workable environment. > > Francois Thanks Francois. I am going to stick with Python for this. As it turns out, I'll have the freedom to use the software configuration I want, so now I don't have to worry about committing to Python, only discover that my Python code is useable only as a prototype for PHP or Perl. :) Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Is mod_python 3.1 good for commercial blogging/CMS?
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John J. Lee) wrote: > "Ben Sizer" <[EMAIL PROTECTED]> writes: > [...] > > It as not easy to work with the CGI-style code in a WYSIWYG web editor > > as it is to edit a template, which is probably the main reason for > > their use. Also, coding everything with req.write() means that each > [...] > > You seem to believe CGI is incompatible with templating. Why? The > two are entirely independent of each other. > > > John He was just referring to the idea of me perhaps editing the HTML markup in my Python code using an IDE like Dreamweaver and having a difficult time. I agree, editing an HTML doc in a WYSIWYG environment would be easier than me fishing through my req.write() calls and my strings to find my markup - which is what I am doing at the moment. Anthony -- http://mail.python.org/mailman/listinfo/python-list
How to enable bash mode at the interative mode?
That is, at the Python interactive mode, if I hit the upper arrow key, it'll bring up the last line of code. At http://groups.google.com/group/comp.lang.python/browse_thread/thread/fb8c2fd9eed0d/736fac8c33e84d0c?lnk=st&q=python+%22upper+arrow%22&rnum=2&hl=en#736fac8c33e84d0c , it seems that Michael Spalinski suggests of reinstalling Python. Any easier way to achieve this feature? Thanks. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Re: How to enable bash mode at the interative mode?
Hi, thanks. Look what I have: $ python Python 2.4.2 (#1, Nov 20 2005, 13:03:38) [GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)] on linux2 Yes, I realize that I don't have readline module available. The same Mandrake system has Python 2.3 as well, and it has the readline module. I don't know how to install the readline module. I tried what was suggested from the newsgroup, but got an error at make: make: *** [Modules/readline.o] Error 1 Thanks --- Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: > Anthony Liu wrote: > > That is, at the Python interactive mode, if I hit > the > > upper arrow key, it'll bring up the last line of > code. > > > > At > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/fb8c2fd9eed0d/736fac8c33e84d0c?lnk=st&q=python+%22upper+arrow%22&rnum=2&hl=en#736fac8c33e84d0c > > , it seems that Michael Spalinski suggests of > > reinstalling Python. > > > > Any easier way to achieve this feature? > > > > Thanks. > > You are probably missing the readline module. What > operating > system/python version are you using? > > Cheers, > > Carl Friedrich Bolz > > -- > http://mail.python.org/mailman/listinfo/python-list > __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ -- http://mail.python.org/mailman/listinfo/python-list
Problem with the maxent package
First of all, thank all of you who guided me through the readline library for enabling bash-like python interpreter. This has been taken care of nicely. I am trying to use the maxent package written by Zhang Le from here: http://homepages.inf.ed.ac.uk/s0450736/maxent_toolkit.html#download The binary package gives me error messages when I tried calling it from my python script. Then I attempted to compile the source code of the maxent packatge, only to find this: [EMAIL PROTECTED] maxent-20041229]$ ... ... checking for main in -lz... yes checking for main in -lg2c... no libg2c not found, this should be shipped with GNU Fortran compiler. configure gives up. [EMAIL PROTECTED] maxent-20041229]$ [EMAIL PROTECTED] maxent-20041229]$libg2c /usr/lib/libg2c.so.0.0.0 /usr/lib/libg2c.so.0 [EMAIL PROTECTED] maxent-20041229]$ I don't know how to let the installation know the path of the libg2c library. Anyone know how to go about this please? Thanks. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
One module cannot be found by the interpreter
I downloaded and built the python/c++ maxent package ( http://homepages.inf.ed.ac.uk/s0450736/maxent_toolkit.html ). I don't know what happened, the interpreter cannot find the cmaxent module, whereas cmaxent.py is right under the current directory. >>> from maxent import * cmaxent module not found, fall back to python implementation. >>> Could you please kindly advise? Thanks a lot. __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.3.5, release candidate 1
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.5 (release candidate 1). Python 2.3.5 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the bugs squished in this release. Assuming no major problems crop up, a final release of Python 2.3.5 will follow in about a week's time. Python 2.3.5 is the last release in the Python 2.3 series, and is being released for those people who still need to use Python 2.3. Python 2.4 is a newer release, and should be preferred if possible. From here, bugfix releases are switching to the Python 2.4 branch - a 2.4.1 will follow 2.3.5 final. For more information on Python 2.3.5, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.3.5 Highlights of this new release include: - Bug fixes. According to the release notes, more than 50 bugs have been fixed, including a couple of bugs that could cause Python to crash. Highlights of the previous major Python release (2.3) are available from the Python 2.3 page, at http://www.python.org/2.3/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpfPcU7iqsZR.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
You may want to check out Quixote http://www.mems-exchange.org/software/quixote/ A. -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange email.Parser error?
Hi, in the call fp.read(8192) the function read() gets 2 arguments : and <8192> Member functions implicitely get their object as first argument, this is why you get this error. So you have 2 possibilities : either read() doesn't take an argument anymore, or read() is not a member of fp. Anthony B. On 8/18/05, Andrey Smirnov <[EMAIL PROTECTED]> wrote: > I am getting the following traceback after upgrading my app to Python > 2.4.1. It's telling me that there is an error in Parser.py. It tells > me that 'fp.read(8192)' is given 2 arguments, but it is clearly not > true. Does anybody know what's going on here? > > Traceback (most recent call last): > File "/opt/etext/lib/python2.4/site-packages/etext/enqueue.py", line > 252, in work > worker(e.linkval, info) > File "/opt/etext/bin/etreceive", line 30, in worker > result = decode.searchfile(f) > File "/opt/etext/lib/python2.4/site-packages/etext/decode.py", line > 43, in searchfile > return Email(f) > File "/opt/etext/lib/python2.4/site-packages/etext/decode.py", line > 510, in __init__ > self.child.append(Email(mf)) > File "/opt/etext/lib/python2.4/site-packages/etext/decode.py", line > 404, in __init__ > msg = Parser().parse(f) > File "/opt/etext/lib/python2.4/email/Parser.py", line 65, in parse > data = fp.read(8192) > TypeError: read() takes exactly 1 argument (2 given) > > Thanks, > Andre. > > -- > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.4.2, release candidate 1
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.2 (release candidate 1). Python 2.4.2 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the more than 60 bugs squished in this release. Assuming no major problems crop up, a final release of Python 2.4.2 will follow in about a week's time. For more information on Python 2.4.2, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.4.2 Highlights of this new release include: - Bug fixes. According to the release notes, more than 60 have been fixed, including bugs that prevented Python from working properly on 64 bit HP/UX and AIX systems. Highlights of the previous major Python release (2.4) are available from the Python 2.4 page, at http://www.python.org/2.4/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.3.5, final
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.5 (final). Python 2.3.5 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the bugs squished in this release. Python 2.3.5 contains an important security fix for SimpleXMLRPCServer - for more, see the announcement of PSF-2005-001 at: http://www.python.org/security/PSF-2005-001/ Python 2.3.5 is the last planned release in the Python 2.3 series, and is being released for those people who still need to run Python 2.3. Python 2.4 is a newer release, and should be preferred if possible. From here, bugfix releases are switching to the Python 2.4 branch - 2.4.1 will be the next Python release. For more information on Python 2.3.5, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.3.5 Highlights of this new release include: - Bug fixes. According to the release notes, more than 50 bugs have been fixed, including a couple of bugs that could cause Python to crash. Highlights of the previous major Python release (2.3) are available from the Python 2.3 page, at http://www.python.org/2.3/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpsB8hmxTPi8.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Which module is "set " in?
I want to use the set function like mylist = ['a', 'b', 'b', 'd', 'e', 'a'] myset = set (mylist) But I don't know what to import, I tried sys, sets, they don't work. What's the easy way to find out the module that contains a particular function? __ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 -- http://mail.python.org/mailman/listinfo/python-list
Re: Which module is "set " in?
Thanks a lot, mine is Python 2.3, and from sets import Set as set works great! --- Steven Bethard <[EMAIL PROTECTED]> wrote: > Anthony Liu wrote: > > I want to use the set function like > > > > mylist = ['a', 'b', 'b', 'd', 'e', 'a'] > > myset = set (mylist) > > > > But I don't know what to import, I tried sys, > sets, > > they don't work. > > If you're using Python 2.4, they're builtin. If > you're using Python > 2.3, you'll probably want to do something like: > from sets import Set as set > Python's before 2.3 do not have a set type. > > > What's the easy way to find out the module that > > contains a particular function? > > Perhaps the documentation index? > > http://docs.python.org/lib/genindex.html > > Steve > -- > http://mail.python.org/mailman/listinfo/python-list > __ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 -- http://mail.python.org/mailman/listinfo/python-list
Is it possible to pass a parameter by reference?
I defined two functions, f1 and f2. f1 modifies the value of a variable called apple. I want to pass the modified value of apple to f2. How can I do this? I got stuck. __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail -- http://mail.python.org/mailman/listinfo/python-list
Is it possible to specify the size of list at construction?
I cannot figure out how to specify a list of a particular size. For example, I want to construct a list of size 10, how do I do this? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it possible to specify the size of list at construction?
Yes, that's helpful. Thanks a lot. But what if I wanna construct an array of arrays like we do in C++ or Java: myArray [][] Basically, I want to do the following in Python: myArray[0][1] = list1 myArray[1][2] = list2 myArray[2][3] = list3 How to do this, gurus? --- Michael Spencer <[EMAIL PROTECTED]> wrote: > Anthony Liu wrote: > > I cannot figure out how to specify a list of a > > particular size. > > > > For example, I want to construct a list of size > 10, > > how do I do this? > > > A list does not have a fixed size (as you probably > know) > > But you can initialize it with 10 somethings > > > >>> [None]*10 > [None, None, None, None, None, None, None, None, > None, None] > >>> range(10) > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > >>> > > Michael > > -- > http://mail.python.org/mailman/listinfo/python-list > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
convert a list to a string?
Suppose I have a list myList = ["this", "is", "a", "sample", "list"] If I don't want to iterate through it and concatenate the list elements, how do I easily convert it to a string like "this is a sample list" str(myList) will only give you things like "["this", "is", "a", "sample", "list"]" That is not what I want. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
RE: convert a list to a string?
Oh, yes, that's a cool function! I did that before but have forgotten. Thanks a lot! --- Tony Meyer <[EMAIL PROTECTED]> wrote: > > Suppose I have a list > > > > myList = ["this", "is", "a", "sample", "list"] > > > > If I don't want to iterate through it and > concatenate > > the list elements, how do I easily convert it to a > > string like > > > > "this is a sample list" > > " ".join(myList) > > =Tony.Meyer > > __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Equality operator
italy wrote: > Why doesn't this statement execute in Python: > > 1 == not 0 > > I get a syntax error, but I don't know why. > > Thanks, > Adam Roan Of course, you would normally want to use != to see if something is not equal to something else. 1 != 0 True -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.4.1, release candidate 1
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.1 (release candidate 1). Python 2.4.1 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the bugs squished in this release. Assuming no major problems crop up, a final release of Python 2.4.1 will follow in about a week's time. For more information on Python 2.4.1, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.4.1/ Highlights of this new release include: - Bug fixes. According to the release notes, several dozen bugs have been fixed, including a fix for the SimpleXMLRPCServer security issue (PSF-2005-001). Highlights of the previous major Python release (2.4) are available from the Python 2.4 page, at http://www.python.org/2.4/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpbzXOjmodRq.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.4.1, release candidate 2
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.1 (release candidate 2). Python 2.4.1 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the bugs squished in this release. Assuming no major problems crop up, a final release of Python 2.4.1 will be out around the 29th of March - straight after PyCon. For more information on Python 2.4.1, including download links for various platforms, release notes, and known issues, please see: http://www.python.org/2.4.1 Highlights of this new release include: - Bug fixes. According to the release notes, several dozen bugs have been fixed, including a fix for the SimpleXMLRPCServer security issue (PSF-2005-001). - A handful other bugs discovered in the first release candidate have been fixed in this version. Highlights of the previous major Python release (2.4) are available from the Python 2.4 page, at http://www.python.org/2.4/highlights.html Enjoy the new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgp5TIX746g9M.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
RELEASED Python 2.4 (final)
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4. Python 2.4 is a final, stable release, and we can recommend that Python users upgrade to this version. Python 2.4 is the result of almost 18 month's worth of work on top of Python 2.3 and represents another stage in the careful evolution of Python. New language features have been kept to a minimum, many bugs have been fixed and a wide variety of improvements have been made. Notable changes in Python 2.4 include improvements to the importing of modules, generator expressions, function decorators, a number of new modules (including subprocess, decimal and cookielib) and countless numbers of fixed bugs and smaller enhancements. For more, see the (subjective) highlights, the release notes, or Andrew Kuchling's What's New In Python, all available from the 2.4 web page. http://www.python.org/2.4/ Please log any problems you have with this release in the SourceForge bug tracker (noting that you're using Python 2.4): http://sourceforge.net/bugs/?group_id=5470 Enjoy the new (stable!) release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpDqFJH9F5xl.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: asynchat and threading
On Mon, 29 Nov 2004 23:24:54 -0500, Caleb Hattingh <[EMAIL PROTECTED]> wrote: > I heartily support something like this, but alas I have not the time to > help out with it. I like the Enthought python distribution because it > installs several packages in one shot. A pity there isn't a similar thing > for python addons in Linux (or is there?). Plenty of people would like to see this. Alas, no-one has stepped forward to do the work (or, if you have money but no time, to offer to fund the work). Python runs on volunteers - no-one's done this yet, so it's not happened. -- http://mail.python.org/mailman/listinfo/python-list
Re: RELEASED Python 2.4 (final)
On Tue, 30 Nov 2004 08:05:55 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > Newb question: Is it possible/recommended to have multiple versions of > Python installed simultaneously? Earlier, I installed 2.4rc1, and a number > of things in my 2.3.3 install stopped working. Are there known techniques > for managing multiple versions? If you're building from source, use 'make altinstall' rather than 'make install'. This will install Python as $prefix/bin/python2.4, and leave the 'python' executable alone. -- http://mail.python.org/mailman/listinfo/python-list
Re: RELEASED Python 2.4 (final)
On Tue, 30 Nov 2004 08:53:25 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > Should have been more specific. > > As I recall, after I installed 2.4rc1 I installed the latest versions of > wxWindows and SPE IDE into it. The 2.4 copy of SPE died silently when > started, which I can accept as a incompatible versions. > > What was strange to me was that at that point, the 2.3.3 copy of SPE did the > same thing. After I uninstalled 2.4, SPE ran again under 2.3.3, and that's > what I'm using now. > > What caused this kind of interaction between installs? SPE and wxWindows > both live in site-packages, which I would have thought would make them > Python-version specific. Beats me. You could try running SPE from a command line and seeing what errors it spits out - you're probably going to need to talk to whoever packaged up SPE. Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: RELEASED Python 2.4 (final)
On 30 Nov 2004 12:09:37 -0800, Chang LI <[EMAIL PROTECTED]> wrote:. > > On behalf of the Python development team and the Python community, I'm > > happy to announce the release of Python 2.4. > > > > Is there Windows 64-bit edition available? If you went to the 2.4 page, you'd see that there is indeed a windows-itanium version available. One click. http://www.python.org/2.4/ -- http://mail.python.org/mailman/listinfo/python-list
cx_Freeze 3.0.1
What is cx_Freeze? cx_Freeze is a set of utilities for freezing Python scripts into executables using many of the techniques found in Thomas Heller's py2exe, Gordon McMillan's Installer and the Freeze utility that ships with Python itself. Where do I get it? http://starship.python.net/crew/atuining http://www.computronix.com/utilities.shtml (it may be a few days before the second site is updated) What's new? 1) Added option --default-path which is used to specify the path used when finding modules. This is particularly useful when performing cross compilations (such as for building a frozen executable for Windows CE). 2) Added option --shared-lib-name which can be used to specify the name of the shared library (DLL) implementing the Python runtime that is required for the frozen executable to work. This option is also particularly useful when cross compiling since the normal method for determining this information cannot be used. 3) Added option --zip-include which allows for additional files to be added to the zip file that contains the modules that implement the Python script. Thanks to Barray Warsaw for providing the initial patch. 4) Added support for handling read-only files properly. Thanks to Peter Grayson for pointing out the problem and providing a solution. 5) Added support for a frozen executable to be a symbolic link. Thanks to Robert Kiendl for providing the initial patch. 6) Enhanced the support for running a frozen executable that uses an existing Python installation to locate modules it requires. This is primarily of use for embedding Python where the interface is C but the ability to run from source is still desired. 7) Modified the documentation to indicate that building from source on Windows currently requires the mingw compiler (http://www.mingw.org). 8) Workaround the problem in Python 2.3 (fixed in Python 2.4) which causes a broken module to be left in sys.modules if an ImportError takes place during the execution of the code in that module. Thanks to Roger Binns for pointing this out. -- Anthony Tuininga [EMAIL PROTECTED] Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax:(780) 454-3838 http://www.computronix.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html