Re: time between now and the next 2:30 am?
On 7/23/2010 10:01 AM, Jim wrote: How can I calculate how much time is between now and the next 2:30 am? Naturally I want the system to worry about leap years, etc. Thanks, Jim DAYSECS = 24*60*60 GOALSECS = (2*60 + 30)*60 now = (GOALSECS + DAYSECS - (int(time.time()) % DAYSECS)) % DAYSECS This is for UT; the adjustment for timezone should be obvious. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
Hi! I have two super classes: class SuperClass1(object): def __init__(self, word): print word class SuperClass2(object): def __init__(self, word, word2): print word, word2 Also I have subclass of these classes: class SubClass(SuperClass1, SuperClass2): def __init__(self): pass I have two questions. 1) Inside __init__ of SubClass how can I firstly call __init__ of SuperClass1, and then __init__ of SuperClass2, using builtin super() function. 2) Why should I use super() at all, if it is very easy to call methods of super class like this: class SubClass(SuperClass1, SuperClass2): def __init__(self): SuperClass1.__init__(self, 'Python') SuperClass2.__init__(self, 'Hello', 'world') Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
On Jul 24, 12:47 am, Lacrima wrote: > Hi! > > I have two super classes: > > class SuperClass1(object): > def __init__(self, word): > print word > > class SuperClass2(object): > def __init__(self, word, word2): > print word, word2 > > Also I have subclass of these classes: > > class SubClass(SuperClass1, SuperClass2): > def __init__(self): > pass > > I have two questions. > 1) Inside __init__ of SubClass how can I firstly call __init__ of > SuperClass1, and then __init__ of SuperClass2, using builtin super() > function. I would write it like this: class SuperClass1(object): def __init__(self, **kwds): word = kwds.pop('word') print word super(SuperClass1, self).__init__(**kwds) class SuperClass2(object): def __init__(self, **kwds): word1 = kwds.pop('word1') word2 = kwds.pop('word2') print word1, word2 super(SuperClass2, self).__init__(**kwds) class SubClass(SuperClass1, SuperClass2): def __init__(self, **kwds): super(SubClass, self).__init__(**kwds) SubClass(word='Python', word1='Hello', word2='World') > 2) Why should I use super() at all, if it is very easy to call methods > of super class like this: > class SubClass(SuperClass1, SuperClass2): > def __init__(self): > SuperClass1.__init__(self, 'Python') > SuperClass2.__init__(self, 'Hello', 'world') That works just fine in this case. The challenge arises in "diamond diagrams" such as A->B A->C B->D C->D where both B and C are written independently of D and both need to call A's __init__ but that method should only be called once (not once by B and again by C). In that case, the super() pattern shown above will let each parent's method be called exactly once and guarantee that parents are called before grandparents and guarantee that the left-to-right ordering of multiple bases is respected. Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: 'as' keyword - when/how to use it
On 7/24/2010 2:33 AM, Dummey wrote: I am having the hardest time trying to find documentation on proper use of the 'as' keyword (aside from . I initially thought that I would be allowed to do something such as: import shared.util as util The as statement seems to be causing a lot of ''module' object has no attribute'. Is it safe to assume that this is not the way to use it? Give an example of real code raising an exception when importing from the stdlib and the corresponding error traceback in its entirety. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: C interpreter in Lisp/scheme/python
In article , gneun...@comcast.net says... >I don't think it's accurate to say that [some] experts really "scorn" >newbies, but I do agree that newbies are occasionally mistreated. > >One thing newbies have to realize is that on Usenet you are quite >likely to be talking to people who were there at the beginning and, of >necessity, are largely self educated in whatever the subject matter >might be. Many - I'd even say most - are happy to clarify >understanding and help with complicated problems, but there is a >general expectation that newbies have some basic research skills and >that they have tried to solve their problem before asking for help. > >Unfortunately, there is a small percentage of people who think Usenet >and other online forums are for answering homework questions or for >digging out of a jam at work. Getting help depends a lot on how the >question is asked: strident pleas for quick help or demands for an >answer are immediate red flags, but so are questions that begin with >"X is crap, why can't I do ..." and even seemingly polite questions >that are vague or unfocused (possibly indicating little or no thought >behind them) or posts which are directed to a large number of groups >(such as this thread we're in now). > >And, of course, in the language forums, drawing comparisons to >non-subject languages is generally considered rude except when done to >illustrate a relevant discussion point. Introducing irrelevant >comparisons, deliberately proselytizing X in a Y group or doing a lot >of complaining about the subject language is bound to attract disdain. > >As the Internet has grown, the absolute number of people in that >"small percentage" has grown as well. A newbie can simply be unlucky >enough to ask a question at the wrong time. If there has been a >recent rash of problem posts then experts may accidentally respond >negatively to a legitimate question. > >Of course, there are cross-cultural issues too. Many of the technical >groups are English-language. English, even when polite, can seem >harsh and/or abrupt to non-native speakers. > >On the whole, moderated groups are more conducive to helping newbies >because the moderator(s) filter obvious red flag posts. > >And, finally, newbies themselves should realize that experts are >donating time to answer questions and do get frustrated answering the >same questions over and over. They should not be offended by "cold" >responses that direct them to FAQs or that just give links to study >material. Newbies who need hand-holding or warm welcoming responses >filled with detail should go find a tutor. > > >> ... you have the bad "professors" who are freaks >>(probably they have a lot of problems at home, their wives >>screwing all the males on the block, daughters drug addicts etc) >>and want to take their hatred out on you, > >Unquestionably, there are experts who need their dosages adjusted. But >the same can be said for some percentage of other users too. > >OTOH, newbies often aren't in the position to know who is an expert >... obviously, anyone able to correctly answer their question knows >more about that specific issue. That doesn't necessarily qualify the >responder as an "expert". Some people get defensive at the edges of >their comfort zones. > > >Just some thoughts. YMMV. >George Yes I agree, you expressed the thought better than I did. Then let's not go on with this thread any further and let the newsgroups carry on programming language support and discussions. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple versions of Python coexisting in the same OS
On 24/07/2010 04:17, Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to look out for ? I have already run into a number of them. I installed Python 2.7 and 3.1.2 into completely folders, but immediately ran into serious problems executing a Python script. The first problem is that just invoking Python will start whichever version is first in the PATH, and this is true from the command line or internally in a Python script. The second problem is that invoking a script ( some xxx.py ) will start whichever version of Python is associated with the .py extension. The third problem is if some software expects its scripts, which it puts in some Python subdirectory to be in the PATH. There may be other considerations but overall having to versions coexisting has turned out to be a big headache involving both changes in the PATH and in the .py association. Does anybody know of other things to look out for ? I found this only yesterday and found it extremely helpful, find the post by Gabriel Genellina. http://www.eggheadcafe.com/software/aspnet/35716114/maintain-2-versions-of-py.aspx HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: 'as' keyword - when/how to use it
On Fri, 23 Jul 2010 23:33:55 -0700, Dummey wrote: > I am having the hardest time trying to find documentation on proper use > of the 'as' keyword (aside from . I initially thought that I would be > allowed to do something such as: > > import shared.util as util > > The as statement seems to be causing a lot of ''module' object has no > attribute'. Is it safe to assume that this is not the way to use it? It works for me. >>> import math as spam >>> spam >>> import email.mime.text as ham >>> ham My guess is that you are trying to import individual objects from a module using the package dot notation: >>> import math.sin as eggs Traceback (most recent call last): File "", line 1, in ImportError: No module named sin -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
On Jul 24, 11:20 am, Raymond Hettinger wrote: > On Jul 24, 12:47 am, Lacrima wrote: > > > > > Hi! > > > I have two super classes: > > > class SuperClass1(object): > > def __init__(self, word): > > print word > > > class SuperClass2(object): > > def __init__(self, word, word2): > > print word, word2 > > > Also I have subclass of these classes: > > > class SubClass(SuperClass1, SuperClass2): > > def __init__(self): > > pass > > > I have two questions. > > 1) Inside __init__ of SubClass how can I firstly call __init__ of > > SuperClass1, and then __init__ of SuperClass2, using builtin super() > > function. > > I would write it like this: > > class SuperClass1(object): > def __init__(self, **kwds): > word = kwds.pop('word') > print word > super(SuperClass1, self).__init__(**kwds) > > class SuperClass2(object): > def __init__(self, **kwds): > word1 = kwds.pop('word1') > word2 = kwds.pop('word2') > print word1, word2 > super(SuperClass2, self).__init__(**kwds) > > class SubClass(SuperClass1, SuperClass2): > def __init__(self, **kwds): > super(SubClass, self).__init__(**kwds) > > SubClass(word='Python', word1='Hello', word2='World') > > > 2) Why should I use super() at all, if it is very easy to call methods > > of super class like this: > > class SubClass(SuperClass1, SuperClass2): > > def __init__(self): > > SuperClass1.__init__(self, 'Python') > > SuperClass2.__init__(self, 'Hello', 'world') > > That works just fine in this case. > The challenge arises in "diamond diagrams" > such as A->B A->C B->D C->D where both B and C > are written independently of D and both need to call > A's __init__ but that method should only be called > once (not once by B and again by C). > > In that case, the super() pattern shown above will > let each parent's method be called exactly once > and guarantee that parents are called before grandparents > and guarantee that the left-to-right ordering of multiple > bases is respected. > > Raymond Hi, Raymond! Thank you for your answer. Some things are still not clear. Your example works great. But if I remove "super(SuperClass1, self).__init__(**kwds)" from SuperClass1's __init__, the example stops working. That is when I instantiate SubClass only __init__ of SuperClass1 is called and __init__ of SuperClass2 is omitted, i.e. only 'Python' is printed. Why is it so? So as I understand every parent should necessarily call super() at the end of its __init__ method in order for things to work properly. But what if SuperClass1 is from third party library? Then I can't modify it to follow this convention, that is when I instantiate my SubClass only __init__ from SuperClass1 will be called, and __init__ from SuperClass2 will be omitted. How to deal with that? My post is quite intricate, but this is because of my English. Sorry. Looking forward for help. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: time between now and the next 2:30 am?
On Jul 23, 8:52 pm, MRAB wrote: > > dt_twothirty=dt_localtime.replace(hour=settings.UPDATE_TIME_HOURS,minute=se > > ttings.UPDATE_TIME_MINS,second=0,microsecond=0) > > You're changing the time of day, but not the date. You might want to add > a day to the shutdown time if it's earlier than the current time. I started out by finding the right date (I used a less-than test and toordinal and fromordinal() ). However, after some trials, I came to believe that I don't need to find the right date. The part of that calculation I need, and later refer to, is the .seconds attribute. I perceive that the way TimeDelta objects are laid out, the seconds attribute will be the same, regardless of whether I calculate it using 2:30 today or first finding which is the right date and using its 2:30. That is, as I understood it, if it is now 2:29 then the .seconds attribute will be 60. If it is now 2:31 then the .seconds attribute will be 24*60*60-60. I believe this holds regardless of which day I use. >>> import time,datetime >>> x=datetime.datetime(2010,7,23) >>> dt_localtime=x.fromtimestamp(time.time()) >>> dt_localtime datetime.datetime(2010, 7, 24, 7, 17, 46, 122642) >>> dt_twothirty=dt_localtime.replace(hour=2,minute=30,second=0,microsecond=0) >>> print dt_twothirty 2010-07-24 02:30:00 >>> dd_diff=dt_twothirty-dt_localtime >>> print dd_diff -1 day, 19:12:13.877358 >>> dt_tomorrow_twothirty=dt_localtime.replace(day=25,hour=2,minute=30,second=0,microsecond=0) >>> print dt_tomorrow_twothirty 2010-07-25 02:30:00 >>> dd_tomorrow_diff=dt_tomorrow_twothirty-dt_localtime >>> print dd_tomorrow_diff 19:12:13.877358 Tested it, of course. Not that I haven't gotten things wrong in the past, even though I tested them. :-} Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: non-blocking IO EAGAIN on write
In article , Kushal Kumaran wrote: > In general, after select has told you a descriptor is ready, the > first write after that should always succeed. I used to think that too. Over the last few years, I've been maintaining a large hunk of cross-platform C++ code which makes heavy use of select(), with both UDP and TCP sockets. I've seen lots of strange behavior. For the moment, assume we're talking about a single-threaded program. This simplifies things a lot. If you write (pseudo-code): select(fd) write(fd) when the select indicates fd is ready, it's not really saying, "The following i/o call will succeed". What it's saying is, "The following i/o call won't block". It could return an error, as long as it returns it immediately. Consider, for example, a write on a TCP connection. You are sitting in a select(), when the other side closes the connection. The select() should return, and the write should then immediately fail. If you're tempted to say that the select() should return some sort of error, consider the case where the remote end closes the connection after the select() returns but before your process gets to execute the following write() call. We also saw a case where (due to what we consider a kernel bug), a received UDP packet with a checksum error would cause the select() to wake up, *then* notice the checksum error and discard the packet, and thus the following read() would block. The bottom line is if you really want to make sure you never block in an I/O call, put your descriptor into non-blocking mode, and treat select() as a *hint*. A way to ask the kernel, "Tell me when you think it might be a good idea to try polling this descriptor again". -- http://mail.python.org/mailman/listinfo/python-list
Are those features still the same?
Hi, I'm not a Python programmer but I'm interested in it and I found this table from Norvig that dates for some years (I re-posted it temporarily on my site below to take it out of context a little). I'm not interested in any comparisons only in the Python features ( last column), can someone whether the information in the Python features column is still correct today. Thanks http://francoatgrex.tripod.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
On Sat, 24 Jul 2010 14:45:52 +0200, francogrex wrote: > Hi, I'm not a Python programmer but I'm interested in it and I found > this table from Norvig that dates for some years (I re-posted it > temporarily on my site below to take it out of context a little). I'm > not interested in any comparisons only in the Python features ( last > column), can someone whether the information in the Python features > column is still correct today. Thanks > > http://francoatgrex.tripod.com/ I could quibble on a few minor wordings, but yes, it is broadly correct. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
francogrex wrote: > Hi, I'm not a Python programmer but I'm > interested in it and I found this table from > Norvig that dates for some years (I re-posted > it temporarily on my site below to take it out > of context a little). I'm not interested in > any comparisons only in the Python features ( > last column), can someone whether the > information in the Python features column is > still correct today. Thanks The original page is here: http://norvig.com/python-lisp.html Yes, the table is fairly up-to-date and general enough to stay up-to-date for the next few years. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
On 07/24/2010 02:45 PM, francogrex wrote: > Hi, I'm not a Python programmer but I'm > interested in it and I found this table from > Norvig that dates for some years (I re-posted > it temporarily on my site below to take it out > of context a little). I'm not interested in > any comparisons only in the Python features ( > last column), can someone whether the > information in the Python features column is > still correct today. Thanks Mostly all true, with a few changes and inaccuracies. And a definite bias towards the LISP. (and the author didn't even specify a dialect on lisp. My my...) > "Support heterogeneous lists" ==> "Yes (array)" This is nonsense, and has always been. Python lists (not arrays) have always been heterogeneous. They store objects and don't care about the type. Python arrays (from the array module) are homogeneous, and limited to storing numerical data. Quite a different beast. > "Number of implementations" ==> [...]branches[...] I wouldn't cann Jython a branch. You could say that there are currently two major branches of the Python language, and the CPython interpreter: Python 2.x and Python 3.x. There are a number of implementations of Python, the big names being CPython, Jython, IronPython, and PyPy > Data types: Python 2's int and long (there called integer and bignum) are now (Python 3.x) a single type. Again, the author of the table reveals that he is is a lisp programmer only passingly acquainted with Python: Python lists are *not* arrays. They are (linked) lists. They're not identical to lisp (cons'd) lists, but they are, nonetheless, lists, not arrays. > Exceptions: string exceptions, as demonstrated in the table, are gone in Python 3. > "no other control structures" now that's a bit hard on Python. Technically true perhaps, but the author could have mentioned generators somewhere. > function application apply is gone in Python 3.x -- use the fn(*args) syntax instead. Also, execfile("file.py") is NOT identical to import file. > other high-order functions Check out itertools and functools. (std library) > "close over writable var" Can be done in Python 3.x with the nonlocal keyword. Also, to a point, objects have always supported the same behaviour, with a twist. > FEATURES > "quotation" The way this is presented doesn't really fit with Python. Very lisp way to look at quotation. > "operations on arrays" ahem. -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
On 24 Jul 2010, at 23:19, Thomas Jollans wrote: "Support heterogeneous lists" ==> "Yes (array)" This is nonsense, and has always been. Python lists (not arrays) have always been heterogeneous. They store objects and don't care about the type. Python arrays (from the array module) are homogeneous, and limited to storing numerical data. Quite a different beast. He means that Python lists are implemented using arrays, not that the Python "array" module provides the functionality. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
Thomas Jollans wrote: >> "Support heterogeneous lists" ==> "Yes (array)" > > This is nonsense, and has always been. I think you are misunderstanding that statement. Python's list stores its items in a continuous chunk of memory, a layout that is called array in common CS terminology as opposed to lists which are typically linked lists. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
On 07/24/2010 03:48 PM, Brian Quinlan wrote: > > On 24 Jul 2010, at 23:19, Thomas Jollans wrote: >>> "Support heterogeneous lists" ==> "Yes (array)" >> >> This is nonsense, and has always been. >> Python lists (not arrays) have always been heterogeneous. They store >> objects and don't care about the type. Python arrays (from the array >> module) are homogeneous, and limited to storing numerical data. Quite a >> different beast. > > He means that Python lists are implemented using arrays, not that the > Python "array" module provides the functionality. Oh dear, and all this time I thought python lists where implemented as lists, without ever checking the code. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 17, 10:40 pm, Stephen Hansen wrote: > On 7/17/10 10:01 PM, be.krul wrote: > > > why is this group being spammed? > > Because while God created the Internet, the Devil twisted it by creating > spammers. > > What do you expect? Adam just didn't pay enough attention when Eve made > him a waldorf salad; we descendants of Seth have gone and tried to > devour not only the knowledge of good and evil but all knowledge of all > things, most notably breasts. > > Of course there'd be a dire consequence for our hubris. > > -- > > Stephen Hansen > ... Also: Ixokai > ... Mail: me+list/python (AT) ixokai (DOT) io > ... Blog:http://meh.ixokai.io/ > > signature.asc > < 1KViewDownload Interesting, I thought Al Gore creted Internet!? -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 17, 10:09 pm, Chris Rebert wrote: > On Sat, Jul 17, 2010 at 10:01 PM, be.krul wrote: > > why is this group being spammed? > > Because that's what happens in unmoderated USENET newsgroups. > > Cheers, > Chris I thought this group can be moderated, but turns out this is USENET Group.. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 17, 10:24 pm, Ben Finney wrote: > "be.krul" writes: > > why is this group being spammed? > > What kind of answer are you looking for? Are you asking about the > motives of spammers, or the technical explanation for how the spam > arrives, or something else? > > -- > \ “The best ad-libs are rehearsed.” —Graham Kennedy | > `\ | > _o__) | > Ben Finney Why not moderate this group? -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 17, 10:57 pm, "Alf P. Steinbach /Usenet" wrote: > * be.krul, on 18.07.2010 07:01: > > > why is this group being spammed? > > It depends a little on what you're asking, e.g. technical versus motivation. > > But I'll answer about something you probably didn't mean to ask, namely what > human trait enables and almost forces that kind of behavior. > > And I believe it is the same trait that let hypnotists do funny TV-shows with > quite normal folks behaving in ridiculous ways, the same trait that causes > wars, > the same trait that causes religion, the same trait that holds back science so > that "paradigm shifts" only occur when new generations take over, a trait that > /makes/ your feet start moving to the rhythm when you hear the right kind of > music, and so on. Namely the instinctual drive to fit in in a social group by > sharing that group's behavior and values. This instinct is possibly stronger > than the sex drive, e.g., wars are seldom fought over sex ("surrender, and > give > us sex!", no, that's not it, it's "surrender, and become part of us!"). > > Consider, there would be almost no spam if spamming didn't pay. > > And the only way that spam can pay is if there are at least some suckers with > good money. > > And the only way that there can be a reasonable number of suckers of such > monumental stupidity, who also have good money, is, as I see it, if > intelligence > and good sense is not a requirement for succeeding in society. > > But what is required, then, for succeeding in society? > > Some of it is no doubt blind chance, but I believe that the main requirement > is > simply one of fitting in, conformance. Thus, if my hypothesis is right, almost > any idiot can rise to any level of responsibility and social standing simply > by > fitting in, conforming. This idiot then has good money and might be one of the > suckers responding to spam. > > Cheers, > > - Alf > > -- > blog at http://alfps.wordpress.com> Alf - You re my next hero! Who could answer so eloquently. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 17, 10:01 pm, "be.krul" wrote: > why is this group being spammed? What I was asking is why not moderate the group. this is the only Python group I could find.. But maybe owner of this group do no care in that case we *all* get spammed! -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On 07/24/2010 04:20 PM, be.krul wrote: > On Jul 17, 10:09 pm, Chris Rebert wrote: >> On Sat, Jul 17, 2010 at 10:01 PM, be.krul wrote: >>> why is this group being spammed? >> >> Because that's what happens in unmoderated USENET newsgroups. >> >> Cheers, >> Chris > > I thought this group can be moderated, but turns out this is USENET > Group.. What did you think it was? -- http://mail.python.org/mailman/listinfo/python-list
Re: Jesus in the Glorious Qur'an ------ The True Message of Jesus Christ
On Jul 23, 3:14 pm, nais-saudi wrote: > Jesus in the Glorious Qur'an -- The True Message of Jesus Christ > > The Qur’an tells us a lot of wonderful things about Jesus. As a > result, believers in the Qur’an love Jesus, honour him, and believe in > him. In fact, no Muslim can be a Muslim unless he or she believes in > Jesus, on whom be peace. > > The Qur’an says that Jesus was born of a virgin, that he spoke while > he was still only a baby, that he healed the blind and the leper by > God’s leave, and that he raised the dead by God’s leave. > > What then is the significance of these miracles? First, the virgin > birth. God demonstrates his power to create in every way. God created > everyone we know from a man and a woman. But how about Adam, on whom > be peace? God created him from neither a man nor a woman. And Eve from > only a man, but not a woman. And, finally, to complete the picture, > God created Jesus from a woman, but not a man. > > What about the other miracles? These were to show that Jesus was not > acting on his own behalf, but that he was backed by God. The Qur’an > specifies that these miracles were performed by God’s leave. This may > be compared to the Book of Acts in the Bible, chapter 2, verse 22, > where it says that the miracles were done by God to show that he > approved of Jesus. Also, note that Jesus himself is recorded in the > Gospel of John to have said, “I can do nothing of my own > authority” (5:30). The miracles, therefore, were done not by his own > authority, but by God’s authority. > > What did Jesus teach? The Qur’an tells us that Jesus came to teach the > same basic message which was taught by previous prophets from God—that > we must shun every false god and worship only the one true God. Jesus > taught that he is the servant and messenger of that one true God, the > God of Abraham. These Quranic teachings can be compared with the Bible > ( Mark 10:18; Matthew 26:39; John 14:28, 17:3, and 20:17) where Jesus > teaches that the one he worshipped is the only true God. See also > Matthew 12:18; Acts 3:13, and 4:27 where we find that his disciples > knew him as Servant of God. > > The Qur’an tells us that some of the Israelites rejected Jesus, and > conspired to kill him, but Allah (God) rescued Jesus and raised him to > Himself. Allah will cause Jesus to descend again, at which time Jesus > will confirm his true teachings and everyone will believe in him as he > is and as the Qur’an teaches about him. > > Jesus is the Messiah. He is a word from Allah, and a spirit from Him. > He is honoured in this world and in the hereafter, and he is one of > those brought nearest to Allah. > > Jesus was a man who spoke the truth which he heard from God. This can > be compared with the Gospel According to John where Jesus says to the > Israelites: “You are determined to kill me, a man who has told you the > truth that I heard from God” (John 8:40). > > The Virgin Birth of Jesus > Muslims believe in the virgin birth of Jesus. When the angels > announced to Mary (peace be upon her) about Allah’s promise that she > will have a son, she was surprised, since she was a virgin. “How can > this be?” she thought. She was reminded that it is easy for Allah to > create whatever he wills. > > She said: My Lord! How can I have a child when no mortal hath touched > me? He said: So (it will be). Allah createth what He will. If He > decreeth a thing, He saith unto it only: Be! and it is (Qur’an 3:47). > > It is not difficult for Allah to do anything he wants. He can create a > child with both human parents or only one. No miracle is beyond His > power. After all, He had created Adam (peace be upon him) from neither > a man nor a woman. He created the rest of us from both man and woman. > What is so hard if Allah decides to create a human being from a woman > only? He only commands “Be!” and it occurs. > > Some people think that since Jesus, peace be upon him, had no human > father then God must be his father. The Qur’an rejects this view. The > position of Jesus with Allah is comparable to the position of Adam > with Allah. Just because Adam had no human parent does not mean we > should call him the Son of God. > > Lo! the likeness of Jesus with Allah is as the likeness of Adam. He > created him from dust, then He said unto him: Be! and he is. (Qur’an > 3:59). > > According to the Qur’an, everyone except Allah are His servants. > > And they say: the Beneficent hath taken unto Himself a Son. Assuredly > ye utter a disastrous thing, whereby almost the heavens are torn, and > the earth is split asunder and the mountains fall to ruins, that ye > ascribe to the Beneficent a son, when it is not meet for (the Majesty > of) the Beneficent that He should chose a son. There is none in the > heavens and the earth but cometh unto the Beneficent as a slave. > (Qur’an 19:88-93) > > The Miracles of Jesus > According to the Qur’an, Jesus, on whom be peace, performed the > following miracles by Allah’s leave: > > 1.
Checking that 2 pdf are identical (md5 a solution?)
Hi I am working on a program that generates various pdf files in the / results folder. "scenario1.pdf" results from scenario1 "scenario2.pdf" results from scenario2 etc Once I am happy with scenario1.pdf and scenario2.pdf files, I would like to save them in the /check folder. Now after having developed/modified the program to produce scenario3.pdf, I would like to be able to re-generate files /results/scenario1.pdf /results/scenario2.pdf and compare them with /check/scenario1.pdf /check/scenario2.pdf I tried using the md5 module to compare these files but md5 reports differences even though the code has *not* changed at all. Is there a way to compare 2 pdf files generated at different time but identical in every other respect and validate by program that the files are identical (for all practical purposes)? -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Jul 24, 7:39 am, Thomas Jollans wrote: > On 07/24/2010 04:20 PM, be.krul wrote: > > > On Jul 17, 10:09 pm, Chris Rebert wrote: > >> On Sat, Jul 17, 2010 at 10:01 PM, be.krul wrote: > >>> why is this group being spammed? > > >> Because that's what happens in unmoderated USENET newsgroups. > > >> Cheers, > >> Chris > > > I thought this group can be moderated, but turns out this is USENET > > Group.. > > What did you think it was? Because i joined from Goggle Groups and not the Usenet Client. -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking that 2 pdf are identical (md5 a solution?)
rlevesque wrote: > Is there a way to compare 2 pdf files generated at different time but > identical in every other respect and validate by program that the > files are identical (for all practical purposes)? I wonder, do the PDFs have a timestamp within them from when they are created? That would ruin your MD5 plan. Pete -- http://www.petezilla.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking that 2 pdf are identical (md5 a solution?)
rlevesque wrote: > Hi > > I am working on a program that generates various pdf files in the / > results folder. > > "scenario1.pdf" results from scenario1 > "scenario2.pdf" results from scenario2 > etc > > Once I am happy with scenario1.pdf and scenario2.pdf files, I would > like to save them in the /check folder. > > Now after having developed/modified the program to produce > scenario3.pdf, I would like to be able to re-generate > files > /results/scenario1.pdf > /results/scenario2.pdf > > and compare them with > /check/scenario1.pdf > /check/scenario2.pdf > > I tried using the md5 module to compare these files but md5 reports > differences even though the code has *not* changed at all. > > Is there a way to compare 2 pdf files generated at different time but > identical in every other respect and validate by program that the > files are identical (for all practical purposes)? Here's a naive approach, but it may be good enough for your purpose. I've printed the same small text into 1.pdf and 2.pdf (Bad practice warning: this session is slightly doctored; I hope I haven't introduced an error) >>> a = open("1.pdf").read() >>> b = open("2.pdf").read() >>> diff = [i for i, (x, y) in enumerate(zip(a, c)) if x != y] >>> len(diff) 2 >>> diff [160, 161] >>> a[150:170] '0100724151412)\n>>\nen' >>> a[140:170] 'nDate (D:20100724151412)\n>>\nen' >>> a[130:170] ')\n/CreationDate (D:20100724151412)\n>>\nen' OK, let's ignore "lines" starting with "/CreationDate " for our custom comparison function: >>> def equal_pdf(fa, fb): ... with open(fa) as a: ... with open(fb) as b: ... for la, lb in izip_longest(a, b, fillvalue=""): ... if la != lb: ... if not la.startswith("/CreationDate "): return False ... if not lb.startswith("/CreationDate "): return False ... return True ... >>> from itertools import izip_longest >>> equal_pdf("1.pdf", "2.pdf") True Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On Sat, Jul 17, 2010 at 11:01 PM, be.krul wrote: > why is this group being spammed? > -- > http://mail.python.org/mailman/listinfo/python-list > Here's a few of theories: 1) This isn't a strong enough community to warrant a group of people who moderate the list and make sure spam doesn't come through 2) Thousands of python hackers aren't smart enough to figure out how to stop spam 3) Whenever people post threads asking why this list is getting spammed they get heckled 4) Uber leet old skool script kiddies read the list through some mechanism that allows them to get rid of the spam, unlike the other 99% of us. -- http://mail.python.org/mailman/listinfo/python-list
Library versions
Hi, I'm writing a library for doing sysadmin tasks at my workplace. These kind of scripts have a tendency to live for decades and I want to make sure that I don't break anything when I'm updating the library. My current plan is to call the library something like 'foo1' and import it into scripts like 'import foo1 as foo'. Releases that change the API would be installed as 'foo2', 'foo3' and so on. This works fine but it will be quite difficult to create new releases (documentation and library code are littered with references to 'foo1'). Is there some other smart way to do acheive this? Thanks / Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
Brian, would you like to volunteer? On Sat, Jul 24, 2010 at 8:59 AM, Brian J Mingus wrote: > > > On Sat, Jul 17, 2010 at 11:01 PM, be.krul wrote: > >> why is this group being spammed? >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > Here's a few of theories: > > 1) This isn't a strong enough community to warrant a group of people who > moderate the list and make sure spam doesn't come through > 2) Thousands of python hackers aren't smart enough to figure out how to > stop spam > 3) Whenever people post threads asking why this list is getting spammed > they get heckled > 4) Uber leet old skool script kiddies read the list through some mechanism > that allows them to get rid of the spam, unlike the other 99% of us. > -- \|/ ( ~ ~ ) @( 0 0 )@ ( C ) \ \_/ / |___| | | -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking that 2 pdf are identical (md5 a solution?)
On Jul 24, 11:50 am, Peter Otten <__pete...@web.de> wrote: > rlevesque wrote: > > Hi > > > I am working on a program that generates various pdf files in the / > > results folder. > > > "scenario1.pdf" results from scenario1 > > "scenario2.pdf" results from scenario2 > > etc > > > Once I am happy with scenario1.pdf and scenario2.pdf files, I would > > like to save them in the /check folder. > > > Now after having developed/modified the program to produce > > scenario3.pdf, I would like to be able to re-generate > > files > > /results/scenario1.pdf > > /results/scenario2.pdf > > > and compare them with > > /check/scenario1.pdf > > /check/scenario2.pdf > > > I tried using the md5 module to compare these files but md5 reports > > differences even though the code has *not* changed at all. > > > Is there a way to compare 2 pdf files generated at different time but > > identical in every other respect and validate by program that the > > files are identical (for all practical purposes)? > > Here's a naive approach, but it may be good enough for your purpose. > I've printed the same small text into 1.pdf and 2.pdf > > (Bad practice warning: this session is slightly doctored; I hope I haven't > introduced an error) > > >>> a = open("1.pdf").read() > >>> b = open("2.pdf").read() > >>> diff = [i for i, (x, y) in enumerate(zip(a, c)) if x != y] > >>> len(diff) > 2 > >>> diff > [160, 161] > >>> a[150:170] > > '0100724151412)\n>>\nen'>>> a[140:170] > > 'nDate (D:20100724151412)\n>>\nen'>>> a[130:170] > > ')\n/CreationDate (D:20100724151412)\n>>\nen' > > OK, let's ignore "lines" starting with "/CreationDate " for our custom > comparison function: > > >>> def equal_pdf(fa, fb): > > ... with open(fa) as a: > ... with open(fb) as b: > ... for la, lb in izip_longest(a, b, fillvalue=""): > ... if la != lb: > ... if not la.startswith("/CreationDate > "): return False > ... if not lb.startswith("/CreationDate > "): return False > ... return True > ...>>> from itertools import izip_longest > >>> equal_pdf("1.pdf", "2.pdf") > > True > > Peter Thanks a lot Peter. Unfortunately there is an other pair of values that does not match and it is not obvious to me how to exclude it (as is done with the " / CreationDate" pair). To illustrate the problem, I have modified your code as follows: def equal_pdf(fa, fb): idx=0 with open(fa) as a: with open(fb) as b: for la, lb in izip_longest(a, b, fillvalue=""): idx+=1 #print idx if la != lb: #if not la.startswith(" /CreationDate"): print "***", idx , la,'\n',lb #return False print "Last idx:",idx return True from itertools import izip_longest file1='K/results/Test2.pdf' file1c='K:/check/Test2.pdf' print equal_pdf(file1, file1c) I got the following output: *** 237 /CreationDate (D:20100724123129+05'00') /CreationDate (D:20100724122802+05'00') *** 324 [(,\315'\347\003_\253\325\365\265\006\)J\216\252\215) (, \315'\347\003_\253\325\365\265\006\)J\216\252\215)] [(~s\211VIA\3426}\242XuV2\302\002) (~s\211VIA \3426}\242XuV2\302\002)] Last idx: 331 True As you can see, there are 331 pair comparisons and 2 of the comparisons do not match. Your code correctly handles the " /CreationDate" pair but the other one does not have a common element that can be used to handle it. :-( As additional information in case it matters, the first pair compared equals '%PDF-1.4\n' and the pdf document is created using reportLab. One hope I have is that item 324 which is near to the last item (331) could be part of the 'trailing code' of the pdf file and might not reflect actual differences between the 2 files. In other words, maybe it would be sufficient for me to check all but the last 8 pairs... -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking that 2 pdf are identical (md5 a solution?)
rlevesque wrote: > Unfortunately there is an other pair of values that does not match and > it is not obvious to me how to exclude it (as is done with the " / > CreationDate" pair). > and the pdf document is created using reportLab. I dug into the reportlab source and in reportlab/rl_config.py found the line invariant= 0 #produces repeatable,identical PDFs with same timestamp info (for regression testing) I suggest that you edit that file or add from reportlab import rl_config rl_config.invariant = True to your code. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking that 2 pdf are identical (md5 a solution?)
On Jul 24, 1:34 pm, Peter Otten <__pete...@web.de> wrote: > rlevesque wrote: > > Unfortunately there is an other pair of values that does not match and > > it is not obvious to me how to exclude it (as is done with the " / > > CreationDate" pair). > > and the pdf document is created using reportLab. > > I dug into the reportlab source and in > > reportlab/rl_config.py > > found the line > > invariant= 0 #produces > repeatable,identical PDFs with same timestamp info (for regression testing) > > I suggest that you edit that file or add > > from reportlab import rl_config > rl_config.invariant = True > > to your code. > > Peter WOW!! You are good! Your suggested solution works perfectly. Given your expertise I will not be able to 'repay' you by helping on Python problems but if you ever need help with SPSS related problems I will be pleased to provide the assistance you need. (I am the author of "SPSS Programming and Data Management" published by SPSS Inc. (an IBM company)) Regards, Raynald Levesque www.spsstools.net -- http://mail.python.org/mailman/listinfo/python-list
Re: non-blocking IO EAGAIN on write
On 7/23/2010 1:45 AM, Thomas Guettler wrote: Hi, I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN IOError. At the OS level, if you get EAGAIN, no bytes have been written. If you get EOK from a non-blocking request, you must check the number of bytes written to see if everything was written. You may have to write more after an EOK. Ref: http://www.opengroup.org/onlinepubs/009695399/functions/write.html "If the O_NONBLOCK flag is set, write() shall not block the thread. If some data can be written without blocking the thread, write() shall write what it can and return the number of bytes written. Otherwise, it shall return -1 and set errno to [EAGAIN]." At the Python level, it's different. http://docs.python.org/library/stdtypes.html#file-objects says that "file.write(s)" returns nothing. If a non-blocking write can't complete, you get an "io.BlockingIOError" exception (ref "http://docs.python.org/release/3.0.1/library/io.html";) from which you can retrieve the number of bytes written. This is only in Python 3.x, and may not be working right (ref "http://bugs.python.org/issue7786";). It's unclear what happens in this situation in Python 2.x, but it's probably not what you wanted to happen. However, "socket.send(s)" returns the number of bytes sent. "send" and "recv" do work on pipes (with problems; see "http://bugs.python.org/issue5573";). So use "send", not "write", and pay attention to the number of bytes sent. If I get EAGAIN can I just sleep, and then retry with the same data chunk? Yes. But if you've filled the pipe, you may have to wait until the program reading from the pipe reads more. This can take however long the other program needs. Incidentally, "select" apparently doesn't work on pipes under Windows. Since your code isn't doing anything else while waiting for a write to complete on the pipe, why use non-blocking I/O at all? (I know, the Python I/O timeout logic is broken in some versions. You're probably working around that.) John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Library versions
On Jul 24, 8:56 am, Peo wrote: > Hi, > > I'm writing a library for doing sysadmin tasks at my workplace. These > kind of > scripts have a tendency to live for decades and I want to make sure > that I don't break anything when I'm updating the library. > > My current plan is to call the library something like 'foo1' and > import it into > scripts like 'import foo1 as foo'. Releases that change the API would > be installed > as 'foo2', 'foo3' and so on. This works fine but it will be quite > difficult > to create new releases (documentation and library code are littered > with > references to 'foo1'). > > Is there some other smart way to do acheive this? The typical way to do this is to delegate responsibility to load the most recent release to another module. Create a module called foo.py, and it have it import all the objects from the most recent release module. IOW, you should have a foo.py module that looks like this: from foo1 import * Which you update whenever there's a new release. Then in your code you simply use: import foo This is, incidentally, one of the few cases where it's recommended to use from module import *. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On 24/07/2010 18:01, Dennis Lee Bieber wrote: On Sat, 24 Jul 2010 07:32:30 -0700 (PDT), "be.krul" declaimed the following in gmane.comp.python.general: But maybe owner of this group do no care in that case we *all* get spammed! There is NO OWNER of comp.lang.python; and turning a comp.* group into moderated takes a fairly long time assuming you can find someone willing to be the moderators -- what would likely happen is that comp.lang.python.moderated would be created and then take a few months to be picked up by the servers, and a few more months for the real users to leave comp.lang.python to use it. Oh, and also the hassle of the mailing-list<>usenet gateway (does it pass traffic to both groups, drop the existing one, etc.). And readers on Google may still see spam if Google takes posts stuff before it passes through the moderation board. For the benefit of those who might have missed it, I'll repeat that I'm reading this from gmane.comp.python.general and see little or no spam. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
Hi, can I subscribe this by gmail? On Sat, Jul 24, 2010 at 3:16 PM, Mark Lawrence wrote: > On 24/07/2010 18:01, Dennis Lee Bieber wrote: > >> On Sat, 24 Jul 2010 07:32:30 -0700 (PDT), "be.krul" >> declaimed the following in gmane.comp.python.general: >> >> But maybe owner of this group do no care in that case we *all* get >>> spammed! >>> >> >>There is NO OWNER of comp.lang.python; and turning a comp.* group >> into moderated takes a fairly long time assuming you can find someone >> willing to be the moderators -- what would likely happen is that >> comp.lang.python.moderated would be created and then take a few months >> to be picked up by the servers, and a few more months for the real users >> to leave comp.lang.python to use it. >> >>Oh, and also the hassle of the mailing-list<>usenet gateway (does >> it >> pass traffic to both groups, drop the existing one, etc.). And readers >> on Google may still see spam if Google takes posts stuff before it >> passes through the moderation board. >> > > For the benefit of those who might have missed it, I'll repeat that I'm > reading this from gmane.comp.python.general and see little or no spam. > > Regards. > > Mark Lawrence. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: understanding the mro (long)
On Jul 23, 7:42 pm, Rolando Espinoza La Fuente wrote: > TL;DR: if you want to stay sane, don't inherit two classes that share > same inheritance graph [snip rest] If you want to stay sane, don't inherit from ANY class unless A. you own it, or B. it's explicitly documented as supporting inheritance Furthermore, if you want to stay sane, don't mulitply inherit from any class unless A. you own it, or B. it's explicitly documented as supporting MULTIPLE inheritance Inheritance is always risky if you don't know what you're inheriting from. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
I subscribe for this mailing list at http://mail.python.org/mailman/listinfo/python-list On Sat, Jul 24, 2010 at 3:22 PM, Jia Hu wrote: > Hi, can I subscribe this by gmail? > > On Sat, Jul 24, 2010 at 3:16 PM, Mark Lawrence wrote: > >> On 24/07/2010 18:01, Dennis Lee Bieber wrote: >> >>> On Sat, 24 Jul 2010 07:32:30 -0700 (PDT), "be.krul" >>> declaimed the following in gmane.comp.python.general: >>> >>> But maybe owner of this group do no care in that case we *all* get spammed! >>> >>>There is NO OWNER of comp.lang.python; and turning a comp.* group >>> into moderated takes a fairly long time assuming you can find someone >>> willing to be the moderators -- what would likely happen is that >>> comp.lang.python.moderated would be created and then take a few months >>> to be picked up by the servers, and a few more months for the real users >>> to leave comp.lang.python to use it. >>> >>>Oh, and also the hassle of the mailing-list<>usenet gateway (does >>> it >>> pass traffic to both groups, drop the existing one, etc.). And readers >>> on Google may still see spam if Google takes posts stuff before it >>> passes through the moderation board. >>> >> >> For the benefit of those who might have missed it, I'll repeat that I'm >> reading this from gmane.comp.python.general and see little or no spam. >> >> Regards. >> >> Mark Lawrence. >> >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > -- http://mail.python.org/mailman/listinfo/python-list
Re: 'as' keyword - when/how to use it
On Jul 24, 3:44 am, Steven D'Aprano wrote: > On Fri, 23 Jul 2010 23:33:55 -0700, Dummey wrote: > > I am having the hardest time trying to find documentation on proper use > > of the 'as' keyword (aside from . I initially thought that I would be > > allowed to do something such as: > > > import shared.util as util > > > The as statement seems to be causing a lot of ''module' object has no > > attribute'. Is it safe to assume that this is not the way to use it? > > It works for me. > > >>> import math as spam > >>> spam > > >>> import > email.mime.text as ham > >>> ham > > > > My guess is that you are trying to import individual objects from a > module using the package dot notation: > > >>> import math.sin as eggs > > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named sin > > -- > Steven I was being an idiot and doing a circular import. I erroneously thought it was the "as" part of the statement. For some reason, removing the "as" part of the statement remove/delayed the error from popping up which made me thought it was the culprit. Thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Where is the man page of python library
rantingrick writes: > On Jul 23, 9:49 am, Steven D'Aprano In the land of the blind, the one eyed man is king! ;-) "... And across the way, in the country of the witless, the half-wit is king." Richard Mitchell (a/k/a The Undeground Grammarian.) http://www.sourcetext.com/grammarian/graves-of-academe/01.htm -- Chris Jewell chr...@puffin.com PO Box 1396 Gualala CA USA 95445-1396 -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode error
dirknbr gmail.com> writes: > I have kind of developped this but obviously it's not nice, any better > ideas? > > try: > text=texts[i] > text=text.encode('latin-1') > text=text.encode('utf-8') > except: > text=' ' As Steven has pointed out, if the .encode('latin-1') works, the result is thrown away. This would be very fortunate. It appears that your goal was to encode the text in latin1 if possible, otherwise in UTF-8, with no indication of which encoding was used. Your second posting confirmed that you were doing this in a loop, ending up with the possibility that your output file would have records with mixed encodings. Did you consider what a programmer writing code to READ your output file would need to do, e.g. attempt to decode each record as UTF-8 with a fall-back to latin1??? Did you consider what would be the result of sending a stream of mixed-encoding text to a display device? As already advised, the short answer to avoid all of that hassle; just encode in UTF-8. -- http://mail.python.org/mailman/listinfo/python-list
Re: A portable LISP interpreter that includes all the major list-processing functions is described. A complete, annotated listing of the program's code, written in PASCAL, is included.
On Jul 23, 9:27 pm, TheFlyingDutchman wrote: > On Jul 23, 12:06 pm, Emmy Noether wrote: > > > > > Title Portable LISP interpreter > > Creator/Author Cox, L.A. Jr. ; Taylor, W.P. > > Publication Date 1978 May 31 > > OSTI Identifier OSTI ID: 7017786 > > Report Number(s) UCRL-52417 > > DOE Contract Number W-7405-ENG-48 > > Resource Type Technical Report > > Research Org California Univ., Livermore (USA). Lawrence Livermore > > Lab. > > Subject 99 GENERAL AND MISCELLANEOUS//MATHEMATICS, COMPUTING, AND > > INFORMATION SCIENCE; COMPUTER CODES; L CODES; COMPUTERS; PROGRAMMING; > > PROGRAMMING LANGUAGES > > Description/Abstract A portable LISP interpreter that includes all the > > major list-processing functions is described. A complete, annotated > > listing of the program's code, written in PASCAL, is included. > > Country of Publication United States > > Language English > > Format Medium: X; Size: Pages: 21 > > Availability Dep. NTIS, PC A02/MF A01. > > System Entry Date 2008 Feb 12 > > Is this available online? If only in hardcopy form, do they lend it > out? I am glad to share with everyone. However its useless without the ability to compile and run. Also with text, its easy to read and discuss the code which has a listing of 900 lines. I have already spent 4 hours scanning/processing to a stage where I got a decent OCR which needs hand-verification of pages. I need 4 or 8 volunteers depending on whether one want to do two pages each or 1 page each. Its an hour of joyful work each for two pages. Explanation are good quality. We will re-write to C, python etc. It must be edited in emacs in fundamental mode to override pascal mode indentation. Go to pascal mode periodically to colorize to indicate errors, and then revert before inserting anything. Stay close to the original page. Email me to receive image and initial ocr and lots of fixes I did by hand for more than 4hrs. Send only plain text message or it goes to spam. Then we share with everyone here or put it on some site. E.N. -- http://mail.python.org/mailman/listinfo/python-list
Re: A portable LISP interpreter that includes all the major list-processing functions is described. A complete, annotated listing of the program's code, written in PASCAL, is included.
On Jul 23, 9:27 pm, TheFlyingDutchman wrote: > On Jul 23, 12:06 pm, Emmy Noether wrote: > > > > > Title Portable LISP interpreter > > Creator/Author Cox, L.A. Jr. ; Taylor, W.P. > > Publication Date 1978 May 31 > > OSTI Identifier OSTI ID: 7017786 > > Report Number(s) UCRL-52417 > > DOE Contract Number W-7405-ENG-48 > > Resource Type Technical Report > > Research Org California Univ., Livermore (USA). Lawrence Livermore > > Lab. > > Subject 99 GENERAL AND MISCELLANEOUS//MATHEMATICS, COMPUTING, AND > > INFORMATION SCIENCE; COMPUTER CODES; L CODES; COMPUTERS; PROGRAMMING; > > PROGRAMMING LANGUAGES > > Description/Abstract A portable LISP interpreter that includes all the > > major list-processing functions is described. A complete, annotated > > listing of the program's code, written in PASCAL, is included. > > Country of Publication United States > > Language English > > Format Medium: X; Size: Pages: 21 > > Availability Dep. NTIS, PC A02/MF A01. > > System Entry Date 2008 Feb 12 > > Is this available online? If only in hardcopy form, do they lend it > out? Are you willing to do some work on this ? On Jul 23, 9:27 pm, TheFlyingDutchman wrote: > On Jul 23, 12:06 pm, Emmy Noether wrote: > > > > > Title Portable LISP interpreter > > Creator/Author Cox, L.A. Jr. ; Taylor, W.P. > > Publication Date1978 May 31 > > OSTI Identifier OSTI ID: 7017786 > > Report Number(s)UCRL-52417 > > DOE Contract Number W-7405-ENG-48 > > Resource Type Technical Report > > Research OrgCalifornia Univ., Livermore (USA). Lawrence Livermore > > Lab. > > Subject 99 GENERAL AND MISCELLANEOUS//MATHEMATICS, COMPUTING, AND > > INFORMATION SCIENCE; COMPUTER CODES; L CODES; COMPUTERS; PROGRAMMING; > > PROGRAMMING LANGUAGES > > Description/AbstractA portable LISP interpreter that includes all the > > major list-processing functions is described. A complete, annotated > > listing of the program's code, written in PASCAL, is included. > > Country of Publication United States > > LanguageEnglish > > Format Medium: X; Size: Pages: 21 > > AvailabilityDep. NTIS, PC A02/MF A01. > > System Entry Date 2008 Feb 12 > > Is this available online? If only in hardcopy form, do they lend it > out? I am glad to share with everyone. However its useless without the ability to compile and run. Also with text, its easy to read and discuss the code which has a listing of 900 lines. I have already spent 4 hours scanning/processing to a stage where I got a decent OCR which needs hand-verification of pages. I need 4 or 8 volunteers depending on whether one want to do two pages each or 1 page each. Its an hour of joyful work each for two pages. Explanation are good quality. We will re-write to C, python etc. It must be edited in emacs in fundamental mode to override pascal mode indentation. Go to pascal mode periodically to colorize to indicate errors, and then revert before inserting anything. Stay close to the original page. Email me to receive image and initial ocr and lots of fixes I did by hand for more than 4hrs. Send only plain text message or it goes to spam. Then we share with everyone here or put it on some site. E.N. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
On 24/07/2010 20:28, Jia Hu wrote: I subscribe for this mailing list at http://mail.python.org/mailman/listinfo/python-list I read through Thunderbird on Windows direct to gmane.comp.python.general. I'm no expert on such things, but assume that they are simply better [or less profitable :)] at filtering spam than the diabolical google groups. I'm unsure as to how the main mailing list that is given above works, I'm sure that someone more knowledgable than myself will soon let us know. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Multiprocessing zombie processes
Hi, I have been meddling around with forking and multiprocessing. Now both of them spawn new processes from parent (atleast from what I have understood). I have been able to reproduce a zombie state in a fork with: import os,time print('before fork',os.getpid()) pid = os.fork() if pid: print('child: ',pid) time.sleep(120) Now doing a ps ax | grep I can find a zombie child process, but I am not being able to reproduce the same with multiprocessing. Am I missing something? Or multiprocessing does not have the zombie problem? Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
OK I wanted zombie processes and have been able to regenerate them with multiprocessing. Now lets see how I can handle them. Nav On 25-Jul-2010, at 4:37 AM, Navkirat Singh wrote: > Hi, > > I have been meddling around with forking and multiprocessing. Now both of > them spawn new processes from parent (atleast from what I have understood). I > have been able to reproduce a zombie state in a fork with: > > import os,time > > print('before fork',os.getpid()) > > pid = os.fork() > > if pid: > print('child: ',pid) > time.sleep(120) > > Now doing a ps ax | grep I can find a zombie child process, but I am > not being able to reproduce the same with multiprocessing. Am I missing > something? Or multiprocessing does not have the zombie problem? > > Regards, > Nav -- http://mail.python.org/mailman/listinfo/python-list
Re: Are those features still the same?
On 7/24/2010 8:45 AM, francogrex wrote: Hi, I'm not a Python programmer but I'm interested in it and I found this table from Norvig that dates for some years (I re-posted it temporarily on my site below to take it out of context a little). I'm not interested in any comparisons only in the Python features ( last column), can someone whether the information in the Python features column is still correct today. Thanks http://francoatgrex.tripod.com/ As other have said, mostly, but I would change the following: Number of implementations should be "Many, one main' add Set ?? set() before Hashtable/dict change Function entry to def f(x): return x+x \n lambda x: x+x or even remove mention of lambda. Anyone who thinks the table is the whole story and tries Python without knowing about def will think Python braindead. Other loops: '## works on any sequence ' change sequence to iterable. Assignment: add x,*y = 1,2,3 Add augmented assignment: x += 1 "No other control structures" is simply wrong. 'and' and 'or' are control structures as much as if-else expressions. Ditto for list/set/dict comprehensions and generator expressions. Comments "## hash mark to end of line" just one hash mark Someone mentioned apply, execfile is now(3.x) exec(open()) "No other higher-order functions built-in" wrong. func.partial, decorators, others mentioned 'No keywords on map/reduce/filter' ?? I do not know what these are, but I suspect Python can produce the same effect somehow. this looks like some lisp detail picked out as something Python does not directly have. Someone mention nonlocal to write enclosed vars. Compilation is an implementation, not a language feature. There have been lisp inerpreters in the past, if not now, and there are Python compilers now, if not in the past. Declarations Standard Python has 2, the Cython dialect has 'declarations for efficiency' just as do some lisp dialects. Quotation: lambda quotes an entire expression, and is used for one of the same purposes as list quotation, to suppress immediate execution. Lisp has one The Python equivalent of (cons x y) should just be the direct equivalent y.append(x). Python grows and shrinks list as the 'tail', lisp at the 'head'. Or, the lisp column should include the O(n) lisp code equivalent to [x]+y. The python equivalent (car x) is x.pop(). That for (cdr x) is x.pop();x, which is O(1), not O(n). Again, if the table ha the O(n) way to operate on a Python list as the 'wrong' end, it should have the same slow way to operate on the 'wrong' end of a lisp list. What that would show is that it is a lot easier to operation on the 'wrong' end of a Python list that the 'wrong' end of a Lisp list. Comparing the wrong Python way with the right Lisp way is unfair if not dishonest. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
On Sat, Jul 24, 2010 at 4:11 PM, Navkirat Singh wrote: > OK I wanted zombie processes > Now lets see how I can handle them. "Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr. Frankenstein." Cheers, Chris -- Most people try to /avoid/ making zombies. -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
I want to kill Zombiesso first I have to create them...simple law of nature On 25-Jul-2010, at 5:08 AM, Chris Rebert wrote: > On Sat, Jul 24, 2010 at 4:11 PM, Navkirat Singh wrote: >> OK I wanted zombie processes > >> Now lets see how I can handle them. > > "Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr. > Frankenstein." > > Cheers, > Chris > -- > Most people try to /avoid/ making zombies. -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
"be.krul" writes: > On Jul 17, 10:01 pm, "be.krul" wrote: >> why is this group being spammed? > > What I was asking is why not moderate the group. this is the only > Python group I could find.. Controlling spam starts by you! Report it. And certainly don't reply to spam by qouting the entire (religious) spam message. Moron. -- John Bokma j3b Hacking & Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl & Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
On 07/25/2010 01:43 AM, Navkirat Singh wrote: > I want to kill Zombiesso first I have to create them...simple law of > nature You can't kill a zombie. That's why we call them zombies, as opposed to, say, daemons. > > > On 25-Jul-2010, at 5:08 AM, Chris Rebert wrote: > >> On Sat, Jul 24, 2010 at 4:11 PM, Navkirat Singh wrote: >>> OK I wanted zombie processes >> >>> Now lets see how I can handle them. >> >> "Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr. >> Frankenstein." >> >> Cheers, >> Chris >> -- >> Most people try to /avoid/ making zombies. > -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
[ Please don't top post. Post below so that things read like a conversation. (And trim excess quoted junk.) It doesn't take long and makes things a lot easier for your readers. ] On 25Jul2010 04:41, Navkirat Singh wrote: | On 25-Jul-2010, at 4:37 AM, Navkirat Singh wrote: | > I have been meddling around with forking and multiprocessing. Now | > both of them spawn new processes from parent (atleast from what I have | > understood). I have been able to reproduce a zombie state in a fork with: | > | > import os,time | > print('before fork',os.getpid()) | > pid = os.fork() | > if pid: | > print('child: ',pid) | > time.sleep(120) | > | > Now doing a ps ax | grep I can find a zombie child process, | > but I am not being able to reproduce the same with multiprocessing. Am | > I missing something? Or multiprocessing does not have the zombie problem? | | OK I wanted zombie processes and have been able to regenerate them with multiprocessing. Now lets see how I can handle them. A zombie process is a fairly common thing and nothing to panic about usually. When you have a normal, running process it has an entry in the system process table (that "ps" shows) that points at it and shows its state. When a process exits, its exit status (exit code, whether it exited normally or from a signal, and if so which signal, some stats) _remain_ in the process table as a record of the exit status. This is shown as a "zombie" process in "ps" - a process which has exited and whose exit status is hanging around waiting to be collected. After the process' parent has issued a wait() call to collect the status the process slot if released and the :zombie" is gone. In your fork() example above, if that's the whole program, the child exits immediately and the parent has not waited for it. If the parent exits without waiting for all its children, the init process (process 1) inherits them, and it collects the statuses. Having a few zombies lying around isn't a disaster provided your program does get around to waiting for them at some point (or if your main program is short lived, so they get reaped by init after it exits). It's only a process table slot after all - little memory is needed for it. A program that spawns a lot of children and never waits for them _is_ bad in the long run. Process ids are often 2-byte integers on many systems for it's quite feasible to fill the table, and depending on the kernel's process table implementation a big process table might have other performance side effects. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I'm behind a corporate Exchange Server which seems to have changed recently to converting everything it sees to HTML. How embarrassing. - Dan Espen -- http://mail.python.org/mailman/listinfo/python-list
Re: A portable LISP interpreter that includes all the major list-processing functions is described. A complete, annotated listing of the program's code, written in PASCAL, is included.
On Sat, Jul 24, 2010 at 3:43 PM, Emmy Noether wrote: > On Jul 23, 9:27 pm, TheFlyingDutchman wrote: >> On Jul 23, 12:06 pm, Emmy Noether wrote: >> >> >> >> > Title Portable LISP interpreter >> > Creator/Author Cox, L.A. Jr. ; Taylor, W.P. >> > Publication Date 1978 May 31 >> > OSTI Identifier OSTI ID: 7017786 >> > Report Number(s) UCRL-52417 >> > DOE Contract Number W-7405-ENG-48 >> > Resource Type Technical Report >> > Research Org California Univ., Livermore (USA). Lawrence Livermore >> > Lab. >> > Subject 99 GENERAL AND MISCELLANEOUS//MATHEMATICS, COMPUTING, AND >> > INFORMATION SCIENCE; COMPUTER CODES; L CODES; COMPUTERS; PROGRAMMING; >> > PROGRAMMING LANGUAGES >> > Description/Abstract A portable LISP interpreter that includes all the >> > major list-processing functions is described. A complete, annotated >> > listing of the program's code, written in PASCAL, is included. >> > Country of Publication United States >> > Language English >> > Format Medium: X; Size: Pages: 21 >> > Availability Dep. NTIS, PC A02/MF A01. >> > System Entry Date 2008 Feb 12 >> >> Is this available online? If only in hardcopy form, do they lend it >> out? > > Are you willing to do some work on this ? > > On Jul 23, 9:27 pm, TheFlyingDutchman wrote: >> On Jul 23, 12:06 pm, Emmy Noether wrote: >> >> >> >> > Title Portable LISP interpreter >> > Creator/Author Cox, L.A. Jr. ; Taylor, W.P. >> > Publication Date 1978 May 31 >> > OSTI Identifier OSTI ID: 7017786 >> > Report Number(s) UCRL-52417 >> > DOE Contract Number W-7405-ENG-48 >> > Resource Type Technical Report >> > Research Org California Univ., Livermore (USA). Lawrence Livermore >> > Lab. >> > Subject 99 GENERAL AND MISCELLANEOUS//MATHEMATICS, COMPUTING, AND >> > INFORMATION SCIENCE; COMPUTER CODES; L CODES; COMPUTERS; PROGRAMMING; >> > PROGRAMMING LANGUAGES >> > Description/Abstract A portable LISP interpreter that includes all the >> > major list-processing functions is described. A complete, annotated >> > listing of the program's code, written in PASCAL, is included. >> > Country of Publication United States >> > Language English >> > Format Medium: X; Size: Pages: 21 >> > Availability Dep. NTIS, PC A02/MF A01. >> > System Entry Date 2008 Feb 12 >> >> Is this available online? If only in hardcopy form, do they lend it >> out? > > I am glad to share with everyone. However its useless without the > ability to compile and run. Also with text, its easy to read and > discuss the code which has a listing of 900 lines. > > I have already spent 4 hours scanning/processing to a stage where I > got a decent OCR which needs hand-verification of pages. I need 4 or 8 > volunteers depending on whether one want to do two pages each or 1 > page each. Its an hour of joyful work each for two pages. Explanation > are good quality. We will re-write to C, python etc. > > It must be edited in emacs in fundamental mode to override pascal mode > indentation. Go to pascal mode periodically to colorize to indicate > errors, and then revert before inserting anything. Stay close to the > original page. > > Email me to receive image and initial ocr and lots of fixes I did by > hand for more than 4hrs. Send only plain text message or it goes to > spam. > > Then we share with everyone here or put it on some site. Why is this on python-list? Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiprocessing zombie processes
On 25-Jul-2010, at 5:25 AM, Cameron Simpson wrote: > [ Please don't top post. Post below so that things read like a > conversation. (And trim excess quoted junk.) It doesn't take long and > makes things a lot easier for your readers. ] > > On 25Jul2010 04:41, Navkirat Singh wrote: > | On 25-Jul-2010, at 4:37 AM, Navkirat Singh wrote: > | > I have been meddling around with forking and multiprocessing. Now > | > both of them spawn new processes from parent (atleast from what I have > | > understood). I have been able to reproduce a zombie state in a fork with: > | > > | > import os,time > | > print('before fork',os.getpid()) > | > pid = os.fork() > | > if pid: > | > print('child: ',pid) > | > time.sleep(120) > | > > | > Now doing a ps ax | grep I can find a zombie child process, > | > but I am not being able to reproduce the same with multiprocessing. Am > | > I missing something? Or multiprocessing does not have the zombie problem? > | > | OK I wanted zombie processes and have been able to regenerate them with > multiprocessing. Now lets see how I can handle them. > > A zombie process is a fairly common thing and nothing to panic about > usually. > > When you have a normal, running process it has an entry in the > system process table (that "ps" shows) that points at it and shows its > state. > > When a process exits, its exit status (exit code, whether it exited > normally or from a signal, and if so which signal, some stats) _remain_ > in the process table as a record of the exit status. This is shown as a > "zombie" process in "ps" - a process which has exited and whose exit > status is hanging around waiting to be collected. > > After the process' parent has issued a wait() call to collect the status > the process slot if released and the :zombie" is gone. > > In your fork() example above, if that's the whole program, the child > exits immediately and the parent has not waited for it. > > If the parent exits without waiting for all its children, the init > process (process 1) inherits them, and it collects the statuses. > > Having a few zombies lying around isn't a disaster provided your program > does get around to waiting for them at some point (or if your main > program is short lived, so they get reaped by init after it exits). > It's only a process table slot after all - little memory is needed for > it. > > A program that spawns a lot of children and never waits for them _is_ > bad in the long run. Process ids are often 2-byte integers on many > systems for it's quite feasible to fill the table, and depending on the > kernel's process table implementation a big process table might have other > performance side effects. > > Cheers, > -- > Cameron Simpson DoD#743 > http://www.cskk.ezoshosting.com/cs/ > > I'm behind a corporate Exchange Server which seems to have > changed recently to converting everything it sees to HTML. > How embarrassing. - Dan Espen Thanks a lot for all the information. It cleared a lot of my doubts. Nav -- http://mail.python.org/mailman/listinfo/python-list
pyqt Error with qtdesigner button groups
Hi, I have have a layout with qt designer, which contains radio buttons. Now I want to add three buttons into a button group. doing this manually works fine with manually I mean adding a few lines in my widget class. example: bg = self.buttongroup = Qg.QButtonGroup() bg.addButton(self.radioButton, 1) bg.addButton(self.radioButton_2, 2) bg.addButton(self.radioButton_3, 3) When I try to create a button group from qt designer, then python code is created which fails when running: How I create a button group with qtdesigner. - I select my three radio buttons - I right click in the object inspector and select "Assign to Button Group" -> "New Button Group" I create my python file with pyuic4 -o mywidget.py -x mywidget.ui When I try to use my widget I receive follwoing error: Traceback (most recent call last): . . . line 37 self.QtGui.QApplication.translate("FormGridState", "buttonGroup", None, QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(FormGridState) SyntaxError: can't assign to function call The generated code lines for the buttongroup look like: self.QtGui.QApplication.translate("Form1", "buttonGroup", None, QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(Form1) self.QtGui.QApplication.translate("Form1", "buttonGroup", None, QtGui.QApplication.UnicodeUTF8).setObjectName("QtGui.QApplication.translate(\"Form1\", \"buttonGroup\", None, QtGui.QApplication.UnicodeUTF8)") self.QtGui.QApplication.translate("Form1", "buttonGroup", None, QtGui.QApplication.UnicodeUTF8).addButton(self.radioButton) Am I doing something wrong or is this a bug? I'm running ubuntu 10.4 , and python 2.6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Socket performance
In message , Navkirat Singh wrote: > I had a question, programming sockets, what are the things that would > degrade performance and what steps could help in a performance boost? Remember the old saying, “premature optimization is the root of all evil”. Have you actually got some code working properly first, before worrying about how good or bad its performance is? -- Lawrence trying not to say “performant” :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
Lacrima wrote: But what if SuperClass1 is from third party library? If it hasn't been designed for super(), then you can't use super() with it. super() only works when *every* class in the hierarchy has been designed with it in mind. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Socket performance
On 25-Jul-2010, at 6:45 AM, Lawrence D'Oliveiro wrote: > In message > , Navkirat Singh wrote: > >> I had a question, programming sockets, what are the things that would >> degrade performance and what steps could help in a performance boost? > > Remember the old saying, “premature optimization is the root of all evil”. > > Have you actually got some code working properly first, before worrying > about how good or bad its performance is? > > -- > Lawrence > trying not to say “performant” :) > -- > http://mail.python.org/mailman/listinfo/python-list I agree with you, it was just for the sake of knowledge. Its always good to have a map right? -- http://mail.python.org/mailman/listinfo/python-list
numpy installation
Hello: I tried to install numpy 1.4.1 from source under ubuntu following instruction at http://docs.scipy.org/doc/numpy/user/install.html I type "" python setup.py build –help-fcompiler "" and it says gnu95 is found. Then I run ""python setup.py build –fcompiler=gnu95"". There is error. Does anyone know how to fix it?? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
On Sun, 25 Jul 2010 13:58:00 +1200, Gregory Ewing wrote: > Lacrima wrote: > >> But what if SuperClass1 is from third party library? > > If it hasn't been designed for super(), then you can't use super() with > it. > > super() only works when *every* class in the hierarchy has been designed > with it in mind. That incorrect. You can certainly use super() with classic classes in the hierarchy, and super() didn't even exist when they were created. >>> class Parent: ... def method(self, arg): ... return repr(arg) ... >>> class Classic(Parent): ... def method(self, arg): ... return "argument was %s" % Parent.method(self, arg) ... >>> class New(object, Classic): ... def method(self, arg): ... return super(New, self).method(arg).upper() ... >>> x = New() >>> x.method('spam') "ARGUMENT WAS 'SPAM'" The problem isn't super(), and people who give glib advise "don't use super()" are just compounding the problem. The problem is with multiple inheritance where methods have different method signatures. If you don't change the method signatures, super() will work fine. Advising people not to use super() might make people feel virtuous, but it doesn't do anything to help the reader write non-buggy MI hierarchies. It pushes the effort of dealing with multiple inheritance onto them, forcing them to re-implement the MRO, probably badly. Can you re- implement the C3 algorithm? Have you even heard of it? If you answer No to either of those questions, chances are high that trying to deal with the MRO manually will lead to worse bugs than using super(). Should you use super()? 1. If you're doing multiple inheritance with metaclasses, you MUST use super(). 2. If you're using single inheritance only, and never modify method signatures, there is no reason not to use super(). 3. If you're using mixins, you should use super(). 4. If you never modify method signatures, then you should use super(). 5. If you do modify method signatures, you shouldn't do that (except possibly in constructors, and even there only cautiously). But if you do it anyway, then you should use super() *except* in the methods where you modify the signature. 6. If you don't use super(), chances are that your class hierarchy is still buggy, but instead of failing loudly and noisily with an exception, it's silently giving the wrong results. 7. If you can avoid multiple inheritance in favour of another technique (such as composition), you should strongly consider that. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: non-blocking IO EAGAIN on write
- Original message - > In article , > Kushal Kumaran wrote: > > > In general, after select has told you a descriptor is ready, the > > first write after that should always succeed. > > > > Consider, for example, a write on a TCP connection. You are sitting in > a select(), when the other side closes the connection. The select() > should return, and the write should then immediately fail. If you're > tempted to say that the select() should return some sort of error, > consider the case where the remote end closes the connection after the > select() returns but before your process gets to execute the following > write() call. > > We also saw a case where (due to what we consider a kernel bug), a > received UDP packet with a checksum error would cause the select() to > wake up, *then* notice the checksum error and discard the packet, and > thus the following read() would block. > > Thanks Roy. That was educational. -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple versions of Python coexisting in the same OS
On 7/24/2010 6:25 AM, Mark Lawrence wrote: On 24/07/2010 04:17, Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to look out for ? I have already run into a number of them. I installed Python 2.7 and 3.1.2 into completely folders, but immediately ran into serious problems executing a Python script. The first problem is that just invoking Python will start whichever version is first in the PATH, and this is true from the command line or internally in a Python script. The second problem is that invoking a script ( some xxx.py ) will start whichever version of Python is associated with the .py extension. The third problem is if some software expects its scripts, which it puts in some Python subdirectory to be in the PATH. There may be other considerations but overall having to versions coexisting has turned out to be a big headache involving both changes in the PATH and in the .py association. Does anybody know of other things to look out for ? I found this only yesterday and found it extremely helpful, find the post by Gabriel Genellina. http://www.eggheadcafe.com/software/aspnet/35716114/maintain-2-versions-of-py.aspx I found the solutions too exotic for actual use, and completely ineffectual for the cases I originally cited. The people in that thread seem to have completely forgotten that Python can be invoked externally and internally both through executing 'python(w) xxx' and through executing a file with the file extension(s) associated with Python. They seem to have forgotten this can be within scripts or any other program using Python, both written by themselves and by others, and not just by their typing 'python(w) xxx' somewhere. Their solutions seem to believe that only they will externally be i9nvoking Python and only for their own written scripts, as opposed to the many libraries using Python as well as the Python distribution itself. The best solution is some program which changes the PATH and the Python file type associations depending on which version of Python one wants to use on one's own system when more than one Python version must coexist with others. I will probably write such a program for myself. Are the .py and .pyc extensions the only ones which are associated with Python or are there others, for a normal Python installation in Windows ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple versions of Python coexisting in the same OS
On 7/24/2010 6:25 AM, Mark Lawrence wrote: On 24/07/2010 04:17, Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to look out for ? I have already run into a number of them. I installed Python 2.7 and 3.1.2 into completely folders, but immediately ran into serious problems executing a Python script. The first problem is that just invoking Python will start whichever version is first in the PATH, and this is true from the command line or internally in a Python script. The second problem is that invoking a script ( some xxx.py ) will start whichever version of Python is associated with the .py extension. The third problem is if some software expects its scripts, which it puts in some Python subdirectory to be in the PATH. There may be other considerations but overall having to versions coexisting has turned out to be a big headache involving both changes in the PATH and in the .py association. Does anybody know of other things to look out for ? I found this only yesterday and found it extremely helpful, find the post by Gabriel Genellina. http://www.eggheadcafe.com/software/aspnet/35716114/maintain-2-versions-of-py.aspx I found the solutions too exotic for actual use, and completely ineffectual for the cases I originally cited. The people in that thread seem to have completely forgotten that Python can be invoked externally and internally both through executing 'python(w) xxx' and through executing a file with the file extension(s) associated with Python. They seem to have forgotten this can be within scripts or any other program using Python, both written by themselves and by others, and not just by their typing 'python(w) xxx' somewhere. Their solutions seem to believe that only they will externally be i9nvoking Python and only for their own written scripts, as opposed to the many libraries using Python as well as the Python distribution itself. The best solution is some program which changes the PATH and the Python file type associations depending on which version of Python one wants to use on one's own system when more than one Python version must coexist with others. I will probably write such a program for myself. Are the .py and .pyc extensions the only ones which are associated with Python or are there others, for a normal Python installation in Windows ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple versions of Python coexisting in the same OS
On Sat, Jul 24, 2010 at 7:40 PM, Edward Diener wrote: > On 7/24/2010 6:25 AM, Mark Lawrence wrote: >> On 24/07/2010 04:17, Edward Diener wrote: >>> Are there any documents about multiple versionsof Python coexisting in >>> the same OS ( Windows in my case ) and what pitfalls to look out for ? I >>> have already run into a number of them. I installed Python 2.7 and 3.1.2 >>> into completely folders, but immediately ran into serious problems >>> executing a Python script. > The best solution is some program which changes the PATH and the Python file > type associations depending on which version of Python one wants to use on > one's own system when more than one Python version must coexist with others. > I will probably write such a program for myself. > > Are the .py and .pyc extensions the only ones which are associated with > Python or are there others, for a normal Python installation in Windows ? There's also .pyw Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: Socket performance
On 7/23/2010 5:06 PM, Navkirat Singh wrote: Hey Everyone, I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost? I would also appreciate being pointed to some formal documentation or article. 1. When writing to a TCP socket, write everything you have to write with one "send" or "write" operation if at all possible. Don't write a little at a time. That results in sending small packets, because sockets are "flushed" after each write. 2. Wait for input from multiple sources by using "select". (But be aware that "select" doesn't work for Windows pipes.) John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple versions of Python coexisting in the same OS
On Sat, 24 Jul 2010 22:03:48 -0700, Chris Rebert wrote: >> Are the .py and .pyc extensions the only ones which are associated with >> Python or are there others, for a normal Python installation in Windows >> ? > > There's also .pyw Also .pyo .py = Python source code, usually associated with command line Python .pyc = Python byte code .pyo = Python optimized byte code .pyw = is Windows only, and shouldn't open a console window. -- Steven -- http://mail.python.org/mailman/listinfo/python-list