Re: semantics of [:]

2009-11-20 Thread Stephen Hansen
> > The original list 'a', isn't changed in any of these cases right? And > modifying b, c or d would not change 'a' either - or am I not understanding > this correctly? > > ## 1 ## > > creates a new list and copies all elements from a to b > > Yes. > ## 2 ## > > take an already existing list (em

Re: Line Breaks

2009-11-23 Thread Stephen Hansen
On Mon, Nov 23, 2009 at 10:45 AM, Susan Day wrote: > Hi; > I have the following line of code I'm sending to postfix: > > msg = 'A Message From %s:\n\n %s' % (string.replace(customer, '_', ' '), > msg) > > Unfortunately, it ignores the line breaks. I also tried %0A but that was > ignored also. Pl

Re: Beginning Question about Python functions, parameters...

2009-11-23 Thread Stephen Hansen
On Mon, Nov 23, 2009 at 10:26 AM, j wrote: > What I am not totally sure about is when the store function callsthe > lookup function and does "return data[label].get(name)", that line > "trips" me up somethen the lookup function returns that back to > the store function, assigns the data to th

Re: Beginning Question about Python functions, parameters...

2009-11-23 Thread Stephen Hansen
rsory glance-- to be to categorize peoples names into lists where their names are common. The data dictionary contains three dictionaries; one for first names, one for middle names, one for last names. Each dictionary would, over time, contain the name-part as a key and then a list of full names

Re: Capturing output of os.system to a string

2009-11-23 Thread Stephen Hansen
On Mon, Nov 23, 2009 at 5:27 PM, gerry.butler wrote: > How do I capture output to a string? For example, the output of > os.system('whoami'). > > I guess I need to redirect stdout, but I'm a total beginner, and I > haven't been able to find out from the tutorials how to do this. > > You don't; os.

Re: How do I correctly download Wikipedia pages?

2009-11-25 Thread Stephen Hansen
2009/11/25 Steven D'Aprano > I'm trying to scrape a Wikipedia page from Python. Following instructions > here: > > Have you checked out http://meta.wikimedia.org/wiki/Pywikipediabot? Its not just via urllib, but I've scraped several MediaWiki-based sites with the software successfully. --S --

Re: How to guard against bugs like this one?

2010-02-01 Thread Stephen Hansen
> > (This is no mere Python "wart"; this is a suppurating chancre, and > the fact that it remains unfixed is a neverending source of puzzlement > for me.) > > How can the average Python programmer guard against this sort of > time-devouring bug in the future (while remaining a Python programmer)? >

Re: How to guard against bugs like this one?

2010-02-01 Thread Stephen Hansen
On Mon, Feb 1, 2010 at 7:33 PM, Tim Chase wrote: > Stephen Hansen wrote: > >> First, I don't shadow built in modules. Its really not very hard to avoid. >> > > Given the comprehensive nature of the batteries-included in Python, it's > not as hard to accidenta

Re: How to guard against bugs like this one?

2010-02-02 Thread Stephen Hansen
On Tue, Feb 2, 2010 at 6:13 AM, kj wrote: > In Steven > D'Aprano writes: > > >As for fixing it, unfortunately it's not quite so simple to fix without > >breaking backwards-compatibility. The opportunity to do so for Python 3.0 > >was missed. > > This last point is to me the most befuddling of a

Re: How to guard against bugs like this one?

2010-02-02 Thread Stephen Hansen
On Tue, Feb 2, 2010 at 1:38 PM, Roel Schroeven < rschroev_nospam...@fastmail.fm> wrote: > Apparently, contrary to my expectations, Python looks in the directory > containing the currently running script instead. That means that the > behavior of "import foo" depends very much on circumstances not

Re: python admin abuse complaint

2010-02-03 Thread Stephen Thorne
PM) eggy_: OhnoesRaptor: getting sockets (and event loops > etc) right is quite tricky > (12:12:21 PM) OhnoesRaptor: I know how to do sockets right eggy, just > wondering whats up with thepythonverison :D > (12:12:24 PM) mode (+o dash) by ChanServ > (12:12:30 PM) You have been kicked by d

Re: Repeat an exception

2010-02-04 Thread Stephen Hansen
On Thu, Feb 4, 2010 at 4:59 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > What the hell is this 'for else' loop !! :D First time I see this statement > for years. > I'd never thought I'd still learn something that basic. > Its one of the least used constructs in Python, I think, an

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
On Feb 5, 8:26 am, Xah Lee wrote: > I appreciate that you taking this more seriously than normal > newsgroups postings. In fact, for this complaint, the response you > made is all i asked for. > > I am taking this as seriously as all the articles you have posted to usenet. St

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
ux has so few on their list is because they use chanserv's AKICK feature, which means the name isn't kept in the IRC client accessable banlist, and is only put there temporarily when the excluded user returns by chanserv. Stephen. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to guard against bugs like this one?

2010-02-05 Thread Stephen Hansen
On Fri, Feb 5, 2010 at 12:16 PM, John Nagle wrote: > kj wrote: > >> Through a *lot* of trial an error I finally discovered that the >> root cause of the problem was the fact that, in the same directory >> as buggy.py, there is *another* innocuous little script, totally >> unrelated, whose name ha

Re: Executing Commands From Windows Service

2010-02-07 Thread Stephen Hansen
On Sun, Feb 7, 2010 at 11:02 AM, T wrote: > I have a script, which runs as a Windows service under the LocalSystem > account, that I wish to have execute some commands. Specifically, the > program will call plink.exe to create a reverse SSH tunnel. Right now > I'm using subprocess.Popen to do s

Re: Possible? Python 2.6.x and PythonWin on 64-bit Windows 7

2010-02-07 Thread Stephen Hansen
On Sun, Feb 7, 2010 at 4:26 PM, escalation746 wrote: > I am having a heck of a time doing the simplest thing: installing > Python and the pywin extensions, including the PythonWin editor I have > always relied on, into my new Windows 7 Professional 64-bit OS. I > tried the Python package from pyth

Re: Modifying Class Object

2010-02-07 Thread Stephen Hansen
On Sun, Feb 7, 2010 at 5:51 PM, Alf P. Steinbach wrote: > Incorrect; Python uses neither. See >> http://effbot.org/zone/call-by-object.htm for a excellent explanation >> >> of what Python does use. >> > > Hm. While most everything I've seen at effbot.org has been clear and to > the point, that pa

Re: Modifying Class Object

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 4:44 PM, Alf P. Steinbach wrote: > No, one only needs an understanding of "pointer". > > "Pointer" is a mostly language independent concept. > > The reference to the Java language spec, where that term is used for this, > was just an unsuccessful attempt to keep out word-pl

Re: use strings to call functions

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 5:51 PM, Steven D'Aprano < ste...@remove.this.cybersource.com.au> wrote: > On Mon, 08 Feb 2010 14:43:46 -0800, Aahz wrote: > > >>> WARNING: eval() is almost always the wrong answer to any question > >> > >>warning : it works ! > > > > Works for what? > > Code injection secur

Re: Terminating threaded programs

2010-02-08 Thread Stephen Hansen
On Fri, Feb 5, 2010 at 7:25 AM, mk wrote: > Hello everyone, > > I have a problem with a threaded program: it frequently hangs on sys.exit. > I use threads all the time (well, for certain types of workloads) and have never seen this. Are your threads daemon threads? The only time I've seen sys.e

Re: timer for a function

2010-02-08 Thread Stephen Hansen
On Fri, Feb 5, 2010 at 9:23 AM, mk wrote: > On paramiko mailing list I got the suggestion to build a timer and then > quit this by myself: > > The timeout option in connect() is for the socket, not for the entire >> operation. You are connected, so that timeout is no longer relevant. >> You woul

Re: Modifying Class Object

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 6:42 PM, Steve Holden wrote: > Stephen Hansen wrote: > [...] > > P.S. I couldn't resist. :( > > > > And here I was, sitting on my hands ... but someone was wrong on the > Internet, so D'Aprano had to put them right. Your fatal weakne

Re: Modifying Class Object

2010-02-08 Thread Stephen Hansen
27;s though I'm used to being one of many; I was 'number 5' at the office for quite awhile, since I worked directly for (and next to) a Stephen, with another Stephen, and frequently at to ask two other Stephen's for advice. So we all went by numbers. Time to take up the habit on the internet! Anyways. Ahem. --Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying Class Object

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 8:01 PM, Alf P. Steinbach wrote: > * Stephen Hansen -> Alf P. Steinbach: > >> >> [snip] >> >> To say, "pass by value" implies things to people. It describes a sort of >> world where I'm a function about to do some work,

Re: use strings to call functions

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 10:00 PM, OdarR wrote: > On 9 fév, 02:50, Jean-Michel Pichavant wrote: > > Aahz wrote: > > > In article < > 0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>, > > > OdarR wrote: > > > > >> and with eval(), did you try ? > > > > > WARNING: eval() is almos

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 10:35 PM, Alf P. Steinbach wrote: > Right. > > "pass by value" is a lower level notion. > > And as you show below, in the paragraph marked [1], it can be used to > describe call by sharing very succinctly and precisely, just as I did... ;-) No. There's nothing at all succ

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 4:40 AM, Steve Holden wrote: > Stephen Hansen wrote: > > This is getting out of hand. > > > > First, someone thought I was you. > > > > Now you think I'm D'Aprano. > > > > I'm just gonna go by Bob for now on. &

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:03 AM, Gabriel Genellina wrote: >After a false start, finally we get our first "Is it Call-By-Value or >Call-By-Reference?" thread of the year! >http://groups.google.com/group/comp.lang.pythonfd36962c4970ac487ea/ LOL. Can we set up some sort of "argh" fi

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 12:54 AM, George Sakkis wrote: > So I'm wondering if there is a consensus on when it's better to (hard) > patch, monkey patch or just try to work around a third party package > that doesn't do exactly what one would like. Does it have mainly to do > with the reason for the p

Re: Programing family

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 5:39 PM, AON LAZIO wrote: > I have thought funny things > If we think all languages are like a family > I could draft them like this (Python base) > > C is Python's Mom > I can see this. > C++ : Dad > Ick, no. C++ is the dirty Uncle who gets touchy with us in inappropriat

Re: Socket Error: Permission Denied

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 7:38 PM, W. eWatson wrote: > I'm using McAffee. I see it was pythonw.exe blocked in red. There are > several choices: Allow Access, Allow Outboubnd only > Block (current), Remove Prgrm permission, Learn More. > > Outbound only seem reasonable, but why does the blocking keep

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:53 AM, Steve Holden wrote: > > [several paragraphs-worth of bothering further] > > So you didn't believe me when I said > > > Of course this won't make the slightest difference. "'When I use a > > word,' said Humpty ..." > It was early, I was barely awake. That paragraph

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:07 AM, Gnarlodious wrote: > To extract the list I am saying this: > > ordered=plistlib.readPlist(path) > print(list(ordered)) # only a list of keys > print(ordered[list(ordered)[0]]) > > However this seems too laborious. is there an easier way? > I'm not familiar with p

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:10 AM, Grant Edwards wrote: > However on multi-processor machines that doesn't work. > Sometimes I get negative values for delta. According to > google, this is due to a bug in Windows that causes the value > of time.clock() to be different depending on which core in a >

Re: Problem Regarding Queue

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 2:06 PM, mukesh tiwari wrote: > Could some one please tell what is wrong with this code. I am trying > to use Queue in this program but i am getting error > Traceback (most recent call last): > File "/home/user/NetBeansProjects/NewPythonProject2/src/ > Pollard_rho.py", line

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:58 PM, Daniel Stutzbach < dan...@stutzbachenterprises.com> wrote: > On Tue, Feb 9, 2010 at 9:36 PM, Tim Chase > wrote: > >> removing the "not" from the condition. I admit I choose one over the >> other based on some gut-feeling aesthetic that I can't really nail down. I

Re: Creating formatted output using picture strings

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:45 PM, wrote: > Does Python provide a way to format a string according to a 'picture' > format? > > For example, if I have a string '123456789' and want it formatted like > '(123)-45-(678)[9]', is there a module or function that will allow me to do > this or do I need to

Re: New to Python

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:30 PM, Quin wrote: > Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to > PyScripter and will test tomorrow. > The chance of this being the case is vanishingly small. Provide real code, copy-pasted directly from a real file, and showing real res

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
em you don't have a fatuous answer for? >>>> >>> I thought the answer could help. >>> >>> You thought you cold do a bit of ad hominem attack. >>> >>> That's the difference between us. >>> >>> Well, the way I see it, you ass

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 12:13 AM, Alf P. Steinbach wrote: > You've dismissed at least one of my arguments with a simple hand-waving of, >> "That's invalid, cuz." >> > > That is not a quote of me. It is a lie. > > > > The thing is, there was no basis for 'cuz' beyond "In my own head this is >> wh

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
> > On Wed, Feb 10, 2010 at 12:13 AM, Alf P. Steinbach wrote: > >> I do offer unsolicited help now and then, as I gave you and for which >>> Steve Holden decided that a bit of personal attack would be suitable. >> >> Really, I do have to say. It's one thing to say, "Aren't you being rude?" (pleas

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 6:16 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > While it is true that quoted text is officially meant to indicate a > direct quote, it is also commonly used in informal text to indicate a > paraphrase. (There are other uses as well, but they don't

Re: Function attributes

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 6:36 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: > > What is the simplest way to access the attributes of a function from > > inside it, other than using its explicit name? In a function

Re: Creating formatted output using picture strings

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 1:45 AM, Peter Otten <__pete...@web.de> wrote: > A basic implementation without regular expressions: > > >>> def picture(s, pic, placeholder="@"): > ... parts = pic.split(placeholder) > ... result = [None]*(len(parts)+len(s)) > ... result[::2] = parts > ...

Re: New to Python

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 2:21 AM, Quin wrote: > Well, PyScripter works find with that code. Furthermore, the > un-intellisense in IronPython was problematic, inserting the wrong things, > which I had to erase. > I think you're confused and are comparing apples to oranges. To define a couple term

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 1:03 PM, kj wrote: > >What are y and z? > > x = "%s %s" % (table['id'], table.tr.renderContents()) > > where the variable table represents a BeautifulSoup.Tag instance. > > >Are they unicode or strings? > > The first item (table['id']) is unicode, and the second is str.

Re: SimpleXMLRPCServer and client address

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 5:36 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > I don't know exactly what you are trying to do, but if your server requires > informations from the client, it would be better to ask explicitly the > client for those informations. > For instance, if a metho

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 7:49 PM, Steve Holden wrote: > *The* standard general language independent definition? As defined where? > Wait, what happened here? This thread started a couple days ago; you pointed out its futility, and even knowing better, I jumped in the deep end. When I realized th

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Stephen Hansen
On Thu, Feb 11, 2010 at 9:32 AM, mk wrote: > Simon Brunning wrote: > >> Not as far as I know. Besides, the chances are that if you were to be >> able to turn off exception handling altogether your code wouldn't make >> it as far as the code you are interested in anyway. >> > > Sure, but I could d

Re: Please help with MemoryError

2010-02-11 Thread Stephen Hansen
On Thu, Feb 11, 2010 at 3:39 PM, Jeremy wrote: > My Python program now consumes over 2 GB of memory and then I get a > MemoryError. I know I am reading lots of files into memory, but not > 2GB worth. I thought I didn't have to worry about memory allocation > in Python because of the garbage col

Re: Modifying Class Object

2010-02-13 Thread Stephen Hansen
On Fri, Feb 12, 2010 at 6:23 PM, rantingrick wrote: [blah, blah, blah] First of all, we all know how D Aprano has such an unfettered ego > problem. [blah, blah, blah] And as always the roaches start > coming out of the woodwork in a most "pathetic puppy dog" way. What > would you puppets do if

Re: Modifying Class Object

2010-02-14 Thread Stephen Hansen
On Sat, Feb 13, 2010 at 7:59 AM, Michael Sparks wrote: > Hi Alf, > > > On Feb 12, 8:22 pm, "Alf P. Steinbach" wrote: > > Thanks for the effort at non-flaming discussion, it *is* > > appreciated. > > I would appreciate it if you tried to be non-flaming yourself, > since you can see I am not flami

Re: Modifying Class Object

2010-02-14 Thread Stephen Hansen
> paraphrase. (There are other uses as well, but they don't concern us > now.) > > > > Unfortunately, this means that in informal discussions like this it is > > sometimes difficult to distinguish a direct quote from a paraphrase, > > except by context. I

Re: TypeError Exception in email lib

2010-02-15 Thread Stephen Hansen
On Mon, Feb 15, 2010 at 10:53 AM, BJ Swope wrote: > File "/usr/lib/python2.5/email/_parseaddr.py", line 142, in mktime_tz >if data[9] is None: > TypeError: 'NoneType' object is unsubscriptable > > I'm parsing a bunch of spam and using the date field from the spams > for a date-time stamp. >

Re: Referring to class methods in class attributes

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 9:38 AM, mk wrote: > It works. But if I'd like to def print_internal_date in PYFileInfo body > like so: > > class PYFileInfo(FileInfo): >'python file properties' > >def print_internal_date(self, filename): >f = open(filename + 'c', "rb") >data = f.r

Re: Timer

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 10:14 AM, Victor Subervi wrote: > Obviously, the removeCSS isn't going to work in that last line. What can I > put there to remove the splash page after 5 seconds? > Even though you're generating this with python, it doesn't have anything to do with Python. You'll have to

Re: Referring to class methods in class attributes

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 10:38 AM, mk wrote: > Thanks, that worked. But in order to make it work I had to get rid of > 'self' in print_internal_date signature, bc all other functions in tagdata > have only a single argument: > Right, I should have caught that. You can make print_internal_date a

Re: Constraints on __sub__, __eq__, etc.

2010-02-18 Thread Stephen Hansen
On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov wrote: > It seems intuitive to me that the magic methods for overriding the +, -, <, > ==, >, etc. operators should have no sideffects on their operands. Also, > that == should be commutative and transitive, that > and < should be > transitive, and

How to make an empty generator?

2010-02-18 Thread Stephen Hansen
This has to be a stupid question, but :) I have some generators that do stuff, then start yielding results. On occasion, I don't want them to yield anything ever-- they're only really "generators" because I want to call them /as/ a generator as part of a generalized system. The only way I can fig

Re: How to make an empty generator?

2010-02-18 Thread Stephen Hansen
On Thu, Feb 18, 2010 at 2:56 PM, Robert Kern wrote: > class once(object): >def __init__(self, func, *args, **kwds): >self.func = func >self.args = args >self.kwds = kwds > >def __iter__(self): >return self > >def next(self): >self.func(*self.arg

Re: How to make an empty generator?

2010-02-18 Thread Stephen Hansen
On Thu, Feb 18, 2010 at 3:08 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On 2010-02-18 16:25 PM, Stephen Hansen wrote: > > The only way I can figure out how to make an empty generator is: > > > > def gen(): > >

Re: How to make an empty generator?

2010-02-18 Thread Stephen Hansen
On Thu, Feb 18, 2010 at 3:36 PM, Stephen Hansen wrote: > My motivation is clarity, I can just see a colleague a year from now asking > me, "... what the hell is return / yield?" and although this is more > expensive, its less clear to me. > MORE clear to me. A class / decor

Re: How to make an empty generator?

2010-02-19 Thread Stephen Hansen
On Fri, Feb 19, 2010 at 9:21 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Fri, 19 Feb 2010 09:51:54 -0600, Robert Kern wrote: > >> But he doesn't say anything about side-effects. > > > > "I have some generators *that do stuff*, then start yielding results." > > [emphasis

Re: The Disappearing Program?

2010-02-19 Thread Stephen Hansen
On Fri, Feb 19, 2010 at 1:42 PM, W. eWatson wrote: > >> Well, you are right. What proof do I have? In fact, I just tried to run a > program that was not converted, and left off py. It worked. > > So maybe the only way to execute the compiled code is to to to dist? Yes. You're meant to move eve

Re: lists of variables

2010-02-20 Thread Stephen Hansen
On Sat, Feb 20, 2010 at 7:25 PM, Michael Pardee wrote: > But what would be "the python way" to accomplish "list of variables" > functionality? > The problem is... Python doesn't have variables. At least not in the way that you may be used to from other languages. Yeah, it's got data, and data obv

getting rpy2 from repository

2010-02-28 Thread Stephen Tucker
repository: User Name: Is there a way to point to the original (non-Enthought) repository, or is there a better way? Thanks very much in advance! Stephen -- http://mail.python.org/mailman/listinfo/python-list

Re: isinstance(False, int)

2010-03-05 Thread Stephen Hansen
On Fri, Mar 5, 2010 at 9:14 AM, mk wrote: > >>> isinstance(False, int) > True > >>> > >>> isinstance(True, int) > True > > Huh? > > >>> > >>> issubclass(bool, int) > True > > Huh?! > Huh, what? http://www.python.org/dev/peps/pep-0285/ --S -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Stephen Hansen
On Sat, Mar 13, 2010 at 8:19 AM, Jon Clements wrote: > The name 'some_function' is completely redundant -- don't need it, > don't actually care about the function afterwards, as long as it > becomes a __call__ of a 'B' *instance*. > Special methods are looked up on the class, not the instance, s

Re: What does Error: 'module' object is not callable Mean?

2010-03-14 Thread Stephen Hansen
On Sun, Mar 14, 2010 at 10:20 AM, Cal Who wrote: > from ffnet.tools import drawffnet > import pylab > drawffnet(nn) #Error: 'module' object is not callable First and foremost, please please please: don't describe or paraphrase tracebacks when asking for help, show them. The whole thing. It doe

GIF89A and PIL

2010-03-26 Thread Stephen Hansen
Hi, all. Is it possible to get PIL to save GIF's in GIF89A format, instead of GIF87A? If not, are there any decent other image libraries out there that anyone's familiar with? The only one I could find was PythonMagick, which seems completely undocumented. Or I'm blind. Ahem. But the proble

Re: GIF89A and PIL

2010-03-26 Thread Stephen Hansen
On 2010-03-26 21:37:10 -0700, Lawrence D'Oliveiro said: In message <2010032618455468300-aptshan...@gmailinvalid>, Stephen Hansen wrote: Is it possible to get PIL to save GIF's in GIF89A format, instead of GIF87A? Why? What does GIF do for you that PNG doesn’t? If I take t

Re: GIF89A and PIL

2010-03-27 Thread Stephen Hansen
On 2010-03-27 08:17:46 -0700, Alain Ketterlin said: Stephen Hansen writes: If not, are there any decent other image libraries out there that anyone's familiar with? The only one I could find was PythonMagick, which seems completely undocumented. Or I'm blind. I don't kn

Re: Classes as namespaces?

2010-03-27 Thread Stephen Hansen
On 2010-03-26 07:49:02 -0700, kj said: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Granted, this is not the "intended use" for classes, and therefore could be viewed a

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Stephen Hansen
On 2010-03-30 13:16:00 -0700, Robert Fendt said: I find such a convoluted construct especially ugly in a language which I previously regarded as having a rather striking beauty of syntactical simplicity. The construct is superfluous, illogical, unelegant, and thus very un-pythonesque, IMHO. But

Re: decorators only when __debug__ == True

2010-03-31 Thread Stephen Hansen
On 2010-03-31 13:59:01 -0700, LX said: pass_decorator will be called when the decorated function is _defined_, but not when the decorated function is _called_. Why is it then that during runtime, with a breakpoint in some arbitrary main() in main.py, I get something similar to the following cal

Re: Is it possible to store data in a Python file in a way similar to Ruby's __END__ section?

2010-04-02 Thread Stephen Hansen
On 2010-04-02 13:08:00 -0700, Christopher Roach said: I have a script that I am working on to process a bunch of data. A good portion of the Tk-based GUI is driven by a large set of YAML data and I'd love to store that data inside of the script so that I can send just a single file to my colleag

Re: C-style static variables in Python?

2010-04-02 Thread Stephen Hansen
On 2010-04-02 19:42:29 -0700, Ethan Furman said: Terry Reedy wrote: In Duncan Booth writes: class Spam(object): mongo = None def __call__(self, x, y, z): if self.mongo is None: self.mongo = heavy_lifting_at_runtime() return frobnicate(x, y, z, self.mongo) Unless one wants the intializat

Re: C-style static variables in Python?

2010-04-03 Thread Stephen Hansen
On 2010-04-02 20:24:46 -0700, Patrick Maupin said: On Apr 2, 10:11 pm, Stephen Hansen wrote: I don't know if properties are really faster or slower then a __getattr__, but I find them a lot cleaner if I want to delay some calculation until needed like that. Well, the relative spe

Re: Incorrect scope of list comprehension variables

2010-04-04 Thread Stephen Hansen
On 2010-04-03 23:30:32 -0700, Steve Howell said: On Apr 3, 9:58 pm, Tim Roberts wrote: Alain Ketterlin wrote: I've just spent a few hours debugging code similar to this: d = dict() for r in [1,2,3]:    d[r] = [r for r in [4,5,6]] print d Yes, this has been fixed in later revisions, but

Re: Comparison with False - something I don't understand

2010-12-02 Thread Stephen Hansen
omises with regard to object identity. It may choose to make a whole new int object of value 2 every time you type 2, or use the same old int object each time: sure, presently it tends to only share "small" integers for re-use, but that's not a promise, not a documented feature, but a

Re: Comparison with False - something I don't understand

2010-12-02 Thread Stephen Hansen
going against the grain, though, and makes your code harder to deal with long-term if only because now there's two separate mechanisms that "errors" happen in it. You can't totally do away with exceptions in Python, even if you try very hard. So with that in mind, IMHO, the b

Re: O'Reilly Python Certification

2010-12-29 Thread Stephen Bunn
At Tue, 28 Dec 2010 20:07:29 + (UTC), J. Altman wrote: > > I have a general question. > > Does it seem odd that a certificate in Python, an Open Source > language; taught at O'Reilly, which offers an Open Source Programming > Certificate and is something like waist-deep in Open Source > publi

Re: O'Reilly Python Certification

2010-12-29 Thread Stephen Bunn
At Tue, 28 Dec 2010 20:07:29 + (UTC), J. Altman wrote: > > I have a general question. > > Does it seem odd that a certificate in Python, an Open Source > language; taught at O'Reilly, which offers an Open Source Programming > Certificate and is something like waist-deep in Open Source > publi

Re: O'Reilly Python Certification

2010-12-29 Thread Stephen Bunn
At Tue, 28 Dec 2010 20:07:29 + (UTC), J. Altman wrote: > > I have a general question. > > Does it seem odd that a certificate in Python, an Open Source > language; taught at O'Reilly, which offers an Open Source Programming > Certificate and is something like waist-deep in Open Source > publi

Re: WxPython versus Tkinter.

2011-01-24 Thread Stephen Hansen
the room that nothing new is going to go into 2.x at all, and wxPython doesn't presently support 3.x.) Robin actually has an unappealable veto over the whole idea, if he so chose to exercise it. Just thought I'd interject some reality into your delusion that there is some Python Ki

Re: WxPython versus Tkinter.

2011-01-24 Thread Stephen Hansen
On 1/24/11 8:32 PM, rantingrick wrote: > On Jan 24, 9:54 pm, Stephen Hansen wrote: >> On 1/24/11 2:16 PM, rantingrick wrote: > >> wxPython is open source, and technically anyone has the legal right to >> include it in whatever they want -- but no module goes into stdli

Re: WxPython versus Tkinter.

2011-01-25 Thread Stephen Hansen
devote man-years of development time to solve all of the above to make it fit the stdlib, all power to you. So far, it seems there maybe is two people who think it may be worth their time. I'm fine with installing wxPython as a third-party library. -- Stephen Hansen ... Also: Ixoka

Re: [Code Challenge] WxPython versus Tkinter.

2011-01-25 Thread Stephen Hansen
at you're responding to, you include the specific context needed to understand your statements, while minimizing the need for people to parse through noise. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signatu

Re: WxPython versus Tkinter.

2011-01-26 Thread Stephen Hansen
On 1/25/11 8:21 PM, Steven D'Aprano wrote: > TL;DR. The shorter version: stop being a dick, and people will treat you > seriously. I actually read the original list, and agreed with every point. But this concise summary spells it out perfectly. Stop being a dick, rick. -- Ste

Re: WxPython versus Tkinter.

2011-01-26 Thread Stephen Hansen
s to be weighed and taken into consideration. Maybe after that is done, on balance, its deemed to be not that big of a deal. But maybe when added up with other concerns, it is. > What do you think it is more important, to offer accessibility for most of > the users, or to create small appl

Re: Return Statement

2011-01-26 Thread Stephen Hansen
explicitly. But there's no built in affects. If you want it to alter the execution, you have to do so yourself, i.e.: def myfun(): return True def myfun2(): return False if myfun(): print "Something is true!" myfun2() print "I'm called. Cuz, the return value

Re: WxPython versus Tkinter.

2011-01-26 Thread Stephen Hansen
r various reasons discussed elsewhere. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: WxPython versus Tkinter.

2011-01-26 Thread Stephen Hansen
On 1/26/11 12:37 PM, rantingrick wrote: > On Jan 26, 2:07 pm, Stephen Hansen wrote: > >> And some people have absolutely no need-- no need at all-- for any sort >> of GUI programming at all. This group is actually really, really big. > > Stephen "Strawman&qu

Re: Need GUI pop-up to edit a (unicode ?) string

2011-01-26 Thread Stephen Hansen
ce is released under a rather liberal license, allowing you to do just about anything you want with it. Including fix it and even-- gasp-- submit those fixes to the bug-tracker for inclusion. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog:

Re: WxPython versus Tkinter.

2011-01-27 Thread Stephen Hansen
er happen again. If another happens, its years down the road. If ever. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: WxPython versus Tkinter.

2011-01-27 Thread Stephen Hansen
. But no more! Way to set the cause back, Octavian. :P You have -1 converts! -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ * Disclaimer: You are stupid if you think this is true. But seriously, Octavian makes it REAL

Re: Need GUI pop-up to edit a (unicode ?) string

2011-01-27 Thread Stephen Hansen
On 1/27/11 10:04 AM, Grant Edwards wrote: > On 2011-01-27, Stephen Hansen wrote: >> On 1/25/11 3:02 PM, rantingrick wrote: >>> This is a major flaw in the design and i would be >>> happy to fix the flaw. However our "friend" Fredrick decided to >>>

Re: WxPython versus Tkinter.

2011-01-27 Thread Stephen Hansen
On 1/27/11 10:11 AM, rantingrick wrote: > On Jan 27, 1:28 am, "Octavian Rasnita" wrote: >> But WxPython is their work and they decision is their. > Actually we The word "we" does not mean what you think it means. -- Stephen Hansen ... Also: Ixokai

Re: WxPython versus Tkinter.

2011-01-28 Thread Stephen Hansen
On 1/28/11 6:18 AM, rantingrick wrote: > On Jan 27, 12:13 pm, Stephen Hansen wrote: > >> Seriously. Octavian's attitude in this thread makes me want to go use >> Tkinter just to spite him. And I'm net-buds with Tyler, and I'm working >> on a project that I

<    3   4   5   6   7   8   9   10   11   12   >