Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
On 6/10/10 8:21 PM, rantingrick wrote: > On Jun 10, 9:38 pm, Stephen Hansen wrote: > >> Also-- you're just starting to get wrong. >> >> http://docs.python.org/library/tix.html >> >> They don't -call- them the things you are, but between ComboBox, a

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
ether is perfectly fine :) X11.app runs as a regular app on top of all of this. Regular users can't be allowed to see programs that run under X11. It will alarm and offend their sensibilities. We macophiles are a touchy bunch about user interface. -- Stephen Hansen ... me+list/pytho

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
ard library. > Wait a minute Steven, are you fighting *for* Tkinter now? I thought > you did not use those "graphical interfaces"? And I do not use tkinter (usually). People can recognize you're really, really, really wrong and really, really, really off your rocket without

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
other positives-- a good pythonic API, maybe some other carrots-- then maybe talk of replacing Tkinter is appropriate. As it is, it doesn't seem to me that its there yet. Not that I am deeply familiar with PyGUI, mind you. -- Stephen Hansen ... me+list/python (AT) ixokai (DOT) io signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
os may choose to cut up the standard Python library; that's their business if they wanna do it. But they also make it really easy to add back in. -- Stephen Hansen ... me+list/python (AT) ixokai (DOT) io P.S. Considering I almost never use tkinter, I'm confused how I

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
On 6/10/10 12:36 PM, rantingrick wrote: > On Jun 10, 1:56 pm, Stephen Hansen wrote: > >> So... uh, why again are we including it? Those people who need it, have >> ready access. > > But what if Mark decided one day he no longer wants to support Python > or Win32

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
ner, and the .ui files can be used in any language with a QT binding, PyQT included. But you gotta be GPL'd to use Python. (Although QT is now LGPL, the PyQT bindings continue the GPL/commercial split... and PySide isn't cross platform yet) -- Stephen Hansen ... me+list/python (AT) ixokai (DOT) io signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Deformed Form

2010-06-10 Thread Stephen Hansen
On 6/10/10 8:35 AM, Bruno Desthuilliers wrote: > Stephen Hansen (L/P) a écrit : >> On 6/10/10 7:14 AM, Victor Subervi wrote: > (snip) >> >> +1 for "absolutely worst framed question of the day" :) > > IMHO you're wasting your time. Some guys never lear

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
On 6/10/10 1:14 PM, Ethan Furman wrote: > Stephen Hansen wrote: >> Another thing you can look at is QT/PyQT. If you're doing GPL'd >> software, that might be a very good solution for you-- you can design >> your whole app in the beautiful QTDesigner, and the

Re: GUIs - A Modest Proposal

2010-06-10 Thread Stephen Hansen
will be obvious. PyGUI is indeed a solid project, and perhaps-- eventually-- a contender for replacing Tkinter, once it works the kinks out and matures. Maybe it is almost mature enough now? Maybe it needs more help? If so-- your time would be better spent downloading it, using it, and offering

Re: Deformed Form

2010-06-10 Thread Stephen Hansen
into thinking you're passing. The only way to pass variables between CGI scripts is to explicitly write them out to the form, and read them in from the form. You can't pass them around pythonically. -- Stephen Hansen ... me+list/python (AT) ixokai (DOT) io signature.asc

Re: Deformed Form

2010-06-10 Thread Stephen Hansen
On 6/10/10 10:11 AM, Victor Subervi wrote: > On Thu, Jun 10, 2010 at 10:30 AM, Stephen Hansen (L/P) pyt...@ixokai.io> wrote: >> >> But what does "cannot be called" mean? "Cannot" usually means "an error >> happened" -- in which case you should

Re: Problem with libxml2/libxlst

2010-06-10 Thread Stephen Hansen
and ISTM much easier to use then whatever direct wrapper you seem to be using. Check out: http://codespeak.net/lxml/xpathxslt.html#xslt -- Stephen Hansen ... me+list/python (AT) ixokai (DOT) io signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Deformed Form

2010-06-10 Thread Stephen Hansen (L/P)
t somewhere). The latter is -- a class? A function? No idea, as you haven't shown us. Nor shown any errors or any tracebacks or *anything* to indicate what is possibly going on, let alone what is going wrong when you, I presume, attempt to "call .. something .. from the calling script". (?

Re: GUIs - A Modest Proposal

2010-06-09 Thread Stephen Hansen
On Wed, Jun 9, 2010 at 4:16 AM, ant wrote: > We are talking about the thing that the rest of the world sees as > Python's biggest missing piece Citation needed, or its just hyperbole. > - the thing that > beginning programmers look for and don't find - a decent, well- > supported and elegant

Re: GUIs - A Modest Proposal

2010-06-08 Thread Stephen Hansen
On Tue, Jun 8, 2010 at 6:55 AM, Kevin Walzer wrote: > I have no opinion on the merits of PyGUI itself, but after taking a quick > look at the site and the docs, it seems to be an abstraction API over three > different, platform-specific GUI toolkits--PyObjC (Mac), PyGtk (X11) and > Windows (pywin

Re: GUIs - A Modest Proposal

2010-06-07 Thread Stephen Hansen
On Mon, Jun 7, 2010 at 10:34 PM, Rick Johnson wrote: > Hi Stephen, > > Great to hear from you. You're right about the powers that be, and i agree! > I was just being a bit theatrical (i've been known to do that from time to > time...Sorry. ;-). > > I know one of at least is interested enough to

Re: GUIs - A Modest Proposal

2010-06-07 Thread Stephen Hansen
> > However as i have mentioned before there will NEVER be a crowd of us > marching in the streets behind one GUI. People are just too busy to > get involved. This has to be an executive decision. The powers that be > must make the change themselves or it will never happen -- i can > guarantee that

Re: Where's the List?

2010-06-05 Thread Stephen Hansen
On Sat, Jun 5, 2010 at 1:17 PM, Victor Subervi wrote: > option_values = [] > Here you create a list. You also can get option_values by slicing your 'order' variable, and I assume that is actually producing a tuple. Otherwise, you wouldn't get the error you're getting. Either way, you go

Re: Installing Lightweight Python

2010-05-17 Thread Stephen Hansen
On Mon, May 17, 2010 at 2:04 PM, Nima Mohammadi wrote: > On May 18, 12:30 am, geremy condra wrote: > > On Mon, May 17, 2010 at 1:05 PM, Nima wrote: > > > Well, I tried to run Python with -v option. It seems that python26.zip > is > > > partially loaded but can't be used, because zlib is "unavai

Re: Picking a license

2010-05-09 Thread Stephen Hansen
On Sun, May 9, 2010 at 2:22 AM, Martin P. Hellwig < martin.hell...@dcuktec.org> wrote: > Microsoft has indeed lost control of it in the same way, it is just because > we here in the 'western' world spend huge amount of money on prosecuting and > bringing to 'justice' does who, whether for commerci

Re: Picking a license

2010-05-09 Thread Stephen Hansen
On Sun, May 9, 2010 at 12:33 PM, Martin P. Hellwig < martin.hell...@dcuktec.org> wrote: > On 05/09/10 18:24, Stephen Hansen wrote: > >> >> >> Wait, what? Why shouldn't I profit repeatedly from the "same work already >> done"? *I* created, i

Re: Picking a license

2010-05-09 Thread Stephen Hansen
On Sun, May 9, 2010 at 10:23 AM, Paul Boddie wrote: > On 9 Mai, 07:09, Patrick Maupin wrote: > > Apple is ***not a "do no evil" corporation > > This being the same Apple that is actively pursuing software patent > litigation against other organisations; a company which accuses other > compa

Re: Picking a license

2010-05-06 Thread Stephen Hansen
On Thu, May 6, 2010 at 4:56 PM, Ben Finney > wrote: > a...@pythoncraft.com (Aahz) writes: > > > In article <4be05d75.7030...@msn.com>, > > Rouslan Korneychuk wrote: > > > > > >The only question I have now is what about licensing? Is that > > >something I need to worry about? Should I go with LG

Re: Default paranmeter for packed values

2010-04-18 Thread Stephen Hansen
On Sun, Apr 18, 2010 at 4:23 PM, Xavier Ho wrote: > G'day Pythoneers, > > I ran into a strange problem today: why does Python not allow default > paranmeters for packed arguments in a function def? > >>> def t(a, *b = (3, 4)): > File "", line 1 > def t(a, *b = (3, 4)): > ^ >

Re: order that destructors get called?

2010-04-07 Thread Stephen Hansen
On 2010-04-07 15:08:14 -0700, Brendan Miller said: When doing this, I noticed some odd behaviour. I had code like this: def delete_my_resource(res): # deletes res class MyClass(object): def __del__(self): delete_my_resource(self.res) o = MyClass() What happens is that as the p

Re: Q about assignment and references

2010-04-06 Thread Stephen Hansen
On 2010-04-06 19:51:07 -0700, jdbosmaus said: Pretty new to Python, but I thought I understood what is meant by "an assignment is a reference." An assignment isn't really a reference, it binds a name to an object. Not quite the same thing. But, what's really the problem here is -- wxPython i

Re: Incorrect scope of list comprehension variables

2010-04-06 Thread Stephen Hansen
On 2010-04-06 09:34:04 -0700, Lie Ryan said: in python there is only a flat local namespace and the names resolver becomes a thousand times simpler (and faster). This hasn't been true for a long time. Yes, local variables are optimized to be indexed in an array, but Python has nested scopes f

Re: local variable referenced before assignment

2010-04-05 Thread Stephen Hansen
On 2010-04-05 10:08:51 -0700, John Nagle said: Yes. Functions with persistent state are generally a bad idea. Unfortunately, the "signal" module requires a callback parameter which is a plain function. So you have to send it a function, closure, or lambda. Here, it's being sent a clos

Re: Incorrect scope of list comprehension variables

2010-04-04 Thread Stephen Hansen
On 2010-04-04 14:50:54 -0700, Paul Rubin said: Alain Ketterlin writes: d[r] = [r for r in [4,5,6]] THe problem is that the "r" in d[r] somehow captures the value of the "r" in the list comprehension, and somehow kills the loop interator. Yes, this is a well known design error in Python 2.x.

Re: Incorrect scope of list comprehension variables

2010-04-04 Thread Stephen Hansen
On 2010-04-04 17:01:20 -0700, Steven D'Aprano said: On Sun, 04 Apr 2010 05:50:01 -0700, Ethan Furman wrote: Yes, this has been fixed in later revisions, but I'm curious to know what led you to believe that a list comprehension created a new scope. I don't that was ever promised. Common sens

Re: local variable referenced before assignment

2010-04-04 Thread Stephen Hansen
On 2010-04-04 15:22:48 -0700, Alf P. Steinbach said: * johngilbrough: I cannot make sense of what's happening here ... I'm getting the following error: (1) At least in Py3 you can declare the variable as 'global', like this: global lastModifiedTime within the function. Actually, what

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: 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: 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: 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: 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: (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: 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: 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: 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

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: 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

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: 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: 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

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: 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: 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-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 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

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: 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

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: 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 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: 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: Modifying Class Object

2010-02-14 Thread Stephen Hansen
On Sun, Feb 14, 2010 at 12:15 AM, Steve Howell wrote: > On Feb 10, 6:16 am, Steven D'Aprano cybersource.com.au> wrote: > > > > Alf, although your English in this forum has been excellent so far, I > > understand you are Norwegian, so it is possible that you aren't a native > > English speaker an

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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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 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-09 Thread Stephen Hansen
hining/. Just drop it. Its boring. Also... I'm not quite sure, given that, what the point of the advice was. >> > > There are many people who read just the Usenet group, e.g. via Google > groups. > > When you say you don't understand the point of the advice, you'

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: 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: "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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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: Modifying Class Object

2010-02-08 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 7:07 PM, MRAB 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. >> :) >> >> --B >> >> Bruce would be less confusing. :-) I've heard that, and can't fathom the claim.

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

<    1   2   3   4   5   6   7   8   >