Re: __call__ in module?

2005-09-27 Thread Steven D'Aprano
__call__(sys.argv) # instead of "main()" No major benefit there, we've just changed main to __call__. But then you can call the script as a stand-alone piece of code from within Python: import script result = script(my_args) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-28 Thread Steven D'Aprano
is a continuous variable, not a binary on/off state. Less control gives more flexibility. More control reduces opportunities. That's a minor quibble really, the essay is grand and should be read by all developers. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically adding and removing methods

2005-09-28 Thread Steven D'Aprano
turn TABLE % tuple(L) def type_test(inst1, inst2): L = ["Comparing object types:"] for obj in (ham, spam, eggs, inst1.ham, inst1.spam, inst1.eggs, \ inst2.ham, inst2.spam, inst2.eggs): L.append(get_type(obj)) return TABLE2 % tuple(L) def main(): inst1 =

Re: Will python never intend to support private, protected and public?

2005-09-28 Thread Steven D'Aprano
eloper "use these at your own risk", without preventing developers who need them from using them. You have most of the benefits of private variables with none of the disadvantages. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: 1 Million users.. I can't Scale!!

2005-09-28 Thread Steven D'Aprano
solved by throwing extra layers of software at it? There is a difference between one million users each who make one request once a month, and one million users who are each hammering the system with ten requests a second. Number of users on its own is a meaningless indicator of req

Re: Dynamically adding and removing methods

2005-09-28 Thread Steven Bethard
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Actually I think I'm getting more confused. At some point the function >>is wrapped. Is it when it's assigned, referenced, or called? > > > When it is referenced via the class. > If you lookup i

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread Steven D'Aprano
y to please change your class and turn that private attribute into a public one. What happens if you refuse? Can I have you taken out and shot and seize ownership of your class, or do I have to copy and paste your class into my code, creating a duplicate class I can modify as much as I like? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread Steven D'Aprano
On Wed, 28 Sep 2005 16:36:03 -0700, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> No, but that is precisely why Python's semi-private variables are >> usually better. Names like _X and class.__X are warnings to the developer >> "use t

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread Steven D'Aprano
On Thu, 29 Sep 2005 18:29:36 +0400, en.karpachov wrote: > On Fri, 30 Sep 2005 00:16:02 +1000 > Steven D'Aprano wrote: > >> Say you have written a class, with a private variable. I decide that I >> need access to that variable, for reasons you never foresaw. >

Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Steven D'Aprano
ote from "The Princess Bride" is too strong. Describing Guido's so-called haughtiness: "That word you keep using. I do not think it means what you think it means." -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parser suggestion

2005-09-29 Thread Steven Bethard
Jorge Godoy wrote: > From Google I found almost all of those. But do you have any suggestion on > which one would be better to parse Fortran code? Or more productive to use > for this task? > [snip] > >>PyParsing >> http://pyparsing.sourceforge.net/ Well, I've never had to parse Fortan code,

Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Steven D'Aprano
ional debate. Until we find a way to send electric shocks through the Internet, all we can do is ignore him. To argue with him just gives him the sick entertainment he wants. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: attribute error

2005-09-29 Thread Steven D'Aprano
;commands"] As I also said the first time I answered this, you may find the split() string method useful for creating that list. (Hint: if x is a string, you call x.split() and get back a list.) For future reference: any time you think you have found a bug in Python, the chances are about 999,999 in a million that you've found a bug in your code. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature Proposal: Sequence .join method

2005-09-29 Thread Steven Bethard
David Murmann wrote: > Hi all! > > I could not find out whether this has been proposed before (there are > too many discussion on join as a sequence method with different > semantics). So, i propose a generalized .join method on all sequences > with these semantics: > > def join(self, seq): >

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
n't you are taking a chance that your class name doesn't clash with one of the bases. In other words, this is a Gotcha, not a world-shattering disaster. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
o and the Timbot kicked down my front door and forced me at gun point to start programming in Python. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
ally worked up over language philosophies, but comparing lack of "real" private variables to rape is going overboard. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
quot;. What you are suggesting is that you have private variables that are only private by convention, since anyone can simply call use spy to treat them as public. In other words, no different from what Python already does, except it avoids underscores and introduces at least one new keyword (spy) and one new syntax element (something to flag a variable as private). Yeah, that will make a huge difference. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
On Fri, 30 Sep 2005 03:42:32 -0700, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> Still, [EMAIL PROTECTED]'s point that you must know the base classes >> is correct. It is *easy* to find them out (NotSoSecret.__bases__ should do >> i

Re: pywordnet install problems

2005-09-30 Thread Steven Bethard
vdrab wrote: > hello pythoneers, > > I recently tried to install wordnet 2.0 and pywordnet on both an ubuntu > linux running python 2.4 and a winXP running activePython 2.4.1, and I > get the exact same error on both when I try to "from wordnet import *" > : > > running install > error: invalid P

Re: Duplicating Modules

2005-09-30 Thread Steven D'Aprano
ss_is_an_idiot are merely different names for the same underlying module. Change one and you change the other. I'm curious... I don't expect you to comment on your boss' mental state, but how/why do you need to duplicate the module? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-09-30 Thread Steven D'Aprano
p noticed the extra crazy behaviour on this particular weekend, and manged to fool himself into thinking it matched a full moon. See here for more details, plus references to research: http://skepdic.com/fullmoon.html -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Phases of the moon

2005-09-30 Thread Steven D'Aprano
On Sat, 01 Oct 2005 00:18:44 -0400, Sherm Pendley wrote: > *whoosh* > > That, my friend, was the sound of a joke flying past and completely > missing you. ;-) Wouldn't be the first time, and surely not the last. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Steven D'Aprano
Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> > It's not easy if the base classes change after you check your code in. >> > You shouldn't need to know about that if it happens. Modularity, remember? >> >> Yes. An

Re: Class Help

2005-10-01 Thread Steven D'Aprano
nstance attribute def __str__(self): """Convert instance to a string for printing.""" holder = self.left_delimiter for item in self.data: holder = holder + str(item) + self.item_delimiter holder = holder + self.right_delimiter

Re: Python 3! Finally!

2005-10-02 Thread Steven D'Aprano
ed "Fred1" and find "Fred2" instead, oh no. I'm surprised that they don't just add Yet Another Secret Option to Firefox's preferences: FileCollision, with two possible values: "Do the wrong thing" and "Ask the user". After all, more prefere

Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Steven D'Aprano
re are always trade-offs to be made. Java makes the trade-off one way, Python the other. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Program help

2005-10-02 Thread Steven D'Aprano
There are lots of people who can do that. Are you asking them to do it for free, or are you looking to hire a Python developer to design, build and test your program? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Steven D'Aprano
he NASA employee who thought the compiler would catch errors. Declared variables have considerable labour costs, and only marginal gains. Since the steps you take to protect against other errors will also protect against mistyping variables, declarations of variables is of little practical benefit

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread Steven D'Aprano
er people rely on. That's why you have testing. You do test, don't you? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: pywordnet install problems

2005-10-03 Thread Steven Bethard
vdrab wrote: > I had WordNet 2.0 installed but just now I tried it with 1.7.1 as well > and the result was the same. It's a shame, glossing over the pywordnet > page really made me want to give it a try. > Are there any workarounds you can recommend ? What's your wordnet setup like? I have mine i

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Steven D'Aprano
time you modify the internal implementation of a function. Changing the unittests, or any other testing for that matter, only needs to be done when you change the interface. In principle, if you have an interface designed up front before you write any code, you could write all your tests at the start of the project and never change them again. You can't do that with variable declarations, since every time you change the implementation you have to change the declarations. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Steven D'Aprano
declarations aren't almost free, because they cost a lot in human labour, and that they give you practically nothing that your unit testing wouldn't give you anyway. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-03 Thread Steven D'Aprano
of consulting and development work.) How much money will you save by dropping MS SQL licence fees by migrating to MySQL or Postgres? Will that money saved be enough to hire a full-time developer to keep adodbapi updated? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python TNEF (winmail.dat attachment access) library?

2005-10-04 Thread Steven D'Aprano
oss-platform, while calling a Windows DLL will only work under Windows. The optimal solution will be to call the DLL when it is available, and fall back on pure Python if it is not. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Reply-To header

2005-10-04 Thread Steven D'Aprano
, do you mean "can't cope with long lines"? How curious -- that's precisely the opposite definition of well-behaved I use. > or why mail readers that wrap text/plain content are broken. Curiouser and curiouser. Again that's the exact opposite of my definition of broken. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Steven D'Aprano
Mike Meyer wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >>Declared variables have considerable labour costs, and only marginal >>gains. Since the steps you take to protect against other errors will also >>protect against mistyping variables, decla

Re: Jargons of Info Tech industry

2005-10-04 Thread Steven D'Aprano
l clients should support a subset of HTML so as to provide rich text. But even that comes at a serious cost (animated smileys, urgh) and in my opinion, the good things you can do with formatted text don't make that cost worth paying. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: While and If messing up my program?

2005-10-05 Thread Steven D'Aprano
xes are within the valid range for the list, but (s)he makes that check *after* attempting to use the indexes. So the code fails before it reaches the test. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused with module and .py files

2005-10-05 Thread Steven D'Aprano
y to prevent that is to use Python's namespaces: instead of "from module import name", use "import module", and then call module.name. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: bug or feature?

2005-10-05 Thread Steven D'Aprano
that deliberately uses this feature for good use, but in general it is something you want to avoid. Instead of: def spam(obj, L=[]): L.append(obj) do this: def spam(obj, L=None): if L is None: L = [] L.append(obj) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: While and If messing up my program?

2005-10-05 Thread Steven D'Aprano
cal, without being too specific. You started with the problem "How can I count the number of times each item in list ttllst exists in ttllst?" A more general question is "How do I count the number of items *any* object exists in *any* list?", and then use that code to answer your first question. Hope this helps, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about output

2005-10-05 Thread Steven D'Aprano
t;10944800e" but then x will be a string, not a number. If none of these answers is what you need, you will need to explain your problem a little better. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Steven D'Aprano
. Instead of pulling our hair out that Python has no type checking ("that's a bug in the language design, woe woe woe!!!") we can just say that Python does JIT type checking, which not only is a feature, but also satisfies the Pointy Haired Bosses who demand buzzwords they c

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Steven D'Aprano
ssible -- not forbidden, impossible -- in Latin is no reason to forbid them in English. The linguist Steven Pinker calls the sort of people who claim split infinitives are bad English "language mavens", and he doesn't mean it as a compliment. See, for example, chapter 12 in his book &

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Steven D'Aprano
It because using mixins looks like subclassing to me. Can anyone help me understand what's going on? Thanks, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Steven D'Aprano
e child "being a kind of" the parent. [end quote] from http://c2.com/cgi/wiki?MixIn Is that all they are? It is amazing how you can take the simplest concept, and by using appropriate terminology, make it as confusing and opaque as you want... *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Objects with different data views

2005-10-07 Thread Steven D'Aprano
s? Thanks, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Steven D'Aprano
well. Vimes could see the flaw there straight away. -- The Fifth Elephant -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythoncard mental block

2005-10-07 Thread Steven D'Aprano
ome else if the result is userpassword: # we have a match! go to card "Secret card" else: # password doesn't match go to card "Password failure" Hope this is of some help to you, and I haven't led you too far astray. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Steven D'Aprano
n its own (e.g. "y" or "n") to mean the same as the entire word. Using this simpler method: def yesno(s): s = s.strip().lower() if s in ('yes', 'y'): return 1 elif s in ('no', 'n'): return 0 else: return -1 def query: print "Start process? (y/n)" choice = yesno(raw_choice("> ")) if choice == -1: print "Please type Yes or No." return query() else: return choice Hope this is helpful. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Steven D'Aprano
'E', 'e'): > #do second option Is it *really* a good idea if the user types "STOP!!!" and it has the same effect as if they typed "Start please"? I've heard of "Do what I mean, not what I said" systems, which are usually a really bad i

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Steven D'Aprano
s spoke in very polished English accents, while the Macedonians (who by their own admission had been goat herders only to generations before) spoke in broad Irish/Scottish accents, and the lower class they were, the thicker the accent. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Steven D'Aprano
command(commands[cmd]) This should accept any combination of: 1 "start" 2 "end" "e" 3 "scratch head" 4 "burp" "b" in any mix of upper and lower case. Hope this works for you. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Steven D'Aprano
On Sat, 08 Oct 2005 13:19:48 +1000, Steven D'Aprano wrote: > > def count_matches(s, words): > temp = [word.lower().startswith(s) for word in words] > return len(temp) Oops! A *serious* bug in that code :-( Replace "return len(temp)" with "return len(f

Re: noob question Letters in words?

2005-10-07 Thread Steven D'Aprano
nt > get it to work. I tryed if choice1 == None it would loop and ask for a new > input but that didnt seem to work. . .Any ideas for that? Test for choice1 == "" (the empty string) instead of None. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
de. You may also find that you could get a slight performance increase by using the idiom try: return cache[args] except: # calculate the result and store it in the cache. instead of testing for membership. As always, timing some test functions is your friend... -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-09 Thread Steven D'Aprano
rash, reboot, and just pick up the calculations from the last one that completed. Try doing that with Wintel! :-) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Weighted "random" selection from list of lists

2005-10-09 Thread Steven D'Aprano
elif pr < 0.9: list_num = 1 else: list_num = 2 return random.choice(main_list[list_num]) or however you want to extract an item. On average, this will mean 60% of the items will come from list1 etc, but for small numbers of trials, you may have significant differences. -- Steven. --

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
the ability to format text. > Some people use email PRIMARILY for sharing photos. Which you can do by attaching the photo to the email. Even mutt or pine can attach binary files to an email. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
On Sat, 08 Oct 2005 20:44:12 +, Roedy Green wrote: > On Wed, 05 Oct 2005 09:38:49 +1000, Steven D'Aprano > <[EMAIL PROTECTED]> wrote or quoted : > >>Yes it is. HTML means that after I've specified my email client use my >>favourite font, in the size I

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
On Sat, 08 Oct 2005 20:44:44 +, Roedy Green wrote: > On Wed, 05 Oct 2005 09:38:49 +1000, Steven D'Aprano > <[EMAIL PROTECTED]> wrote or quoted : > >>Even more invariably, they set the point size directly rather than in >>relative terms, and they are on Windows

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
recipient can actually read the damn thing without having to get out a magnifying glass. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
a spam folder. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
27;t care what people will be using in 200 years. I don't care if in 200 years the default email format is so big and bloated that it takes three weeks to download even a single sentence, because I won't be around to suffer. If you think that people will be using the current data formats fo

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
again -- that's the dog on the left, in case it isn't clear. Just for a change, this is Johnny wearing a hat. It is blue with a feather in it, in case you couldn't tell from, oh I don't know, looking at the actual picture." -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
ll before I received my first spam. I still hate it, long after I've got my spam problem under control. If and when somebody comes up with a non-broken, non-dangerous way of allowing formatting in emails, I'll consider it. But HTML is not and never will be that format. -- Steven. -- http://ma

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
olete technology.) You may have noticed that even Microsoft have acknowledged the power and flexibility of text-based shells, and will be (if they get the technology right in time) building one into Vista. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
l? > > The photo doesn't have to be included (as in attached)? with the email? I'll repeat the question: what do attachments have to do with HTML emails? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
That assumes that cache can be seen in this way. If it can't, is this a way to create "really private" variables in Python? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Here I am again, same old arguments

2005-10-09 Thread Steven D'Aprano
hand. For instance, if you find yourself writing a loop like this: counter = 0 while counter < some_value: do_something_with(counter) counter = counter + 1 you almost always want to change that to: for counter in range(some_value): do_something_with(counter) If you find a loop like this: for indx in range(len(some_list)): obj = some_list[indx] do_something_with(obj) you almost always want to write it like this: for obj in some_list: do_something_with(obj) Don't fight the language -- you aren't programming in C or Java now, this is Python and there is usually an easier way to do something. *wink* Hope this is of use to you, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
On Sun, 09 Oct 2005 13:43:38 +0200, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> I notice that type(some_closure) and type(ordinary_function) both return >> the same result, . I also notice that both the closure >> and ordinary functions have an attribute &quo

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
On Sun, 09 Oct 2005 14:27:32 +0200, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> Yes I did. Did you read my post? > > given that the wikipedia page says > > "a closure is an abstraction representing a function, plus the > lexical environm

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
ectly there thank you very much. Yeah. Fine *and* sensible. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
ography - and a public key really *is* public. The term you want is "wrong", not "confusing". -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
r without needing to call up a search engine. Honestly, anyone would think that photos and photo albums never existed before Google. Why force one particular bad technological solution on everyone for the sake of something which many people don't even perceive as a problem? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
arning says, could cause Python to sigfault if you get the opcodes wrong. I think that this is close enough to "really private" to satisfy most people. Maybe even Paul Rubin *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
On Sun, 09 Oct 2005 18:00:13 +0200, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> "Each def or lambda expression that is executed will create a closure if >> the body of the function or any contained function has free variables." >> >> Pr

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
ey belonged to different classes. Python is not like that, which is why you can write a function to return functions (a factory function?). If the output function needs access to the namespace of the factory function, Python adds a closure to that output function, giving it access to the objects in that namespace. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Steven D'Aprano
. the namespace of the function which created it. Am I getting there now? -- Steven who is very grateful for the time folks have taken to explain this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
On Sun, 09 Oct 2005 19:28:31 +, Roedy Green wrote: > On Sun, 09 Oct 2005 20:54:32 +1000, Steven D'Aprano > <[EMAIL PROTECTED]> wrote or quoted : > >>Only if your photos are so obscure and confusing that they need captions. > > That is a hair shirt appro

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
isten to you go anyone would think that human communication was impossible before HTML email was invented. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python reliability

2005-10-09 Thread Steven D'Aprano
restarts. I'm not saying that you will need to restart Python once an hour, or even once a month. But if you did, would it matter? What's more important is the state of the operating system. (I'm assuming that, with a year uptime the requirements, you aren't even thinking o

Re: Jargons of Info Tech industry

2005-10-09 Thread Steven D'Aprano
ood luck with it. I wish you every success, but don't ask me to buy shares in your startup. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-09 Thread Steven D'Aprano
what it is worth, Python is compiled AND interpreted -- it compiles byte-code which is interpreted in a virtual machine. That makes it an compiling interpreter, or maybe an interpreting compiler, in my book. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python reliability

2005-10-09 Thread Steven D'Aprano
George Sakkis wrote: > Steven D'Aprano wrote: > > >>On Sun, 09 Oct 2005 23:00:04 +0300, Ville Voipio wrote: >> >> >>>I would need to make some high-reliability software >>>running on Linux in an embedded system. Performance >>>

Re: Python reliability

2005-10-10 Thread Steven D'Aprano
then there is the question, can you trust the voting mechanism... But if this is so critical you are worried about cosmic rays, maybe it is the way to go. If it is not a secret, what are you monitoring with this device? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing lists

2005-10-10 Thread Steven D'Aprano
print "Time with loops:", t1 print "Time with sets:", t2 -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Looking for info on Python's memory allocation

2005-10-10 Thread Steven D'Aprano
e. Can anyone point me in the right direction? Thanks, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-11 Thread Steven D'Aprano
was considerably slower than the software Lisp solution of the time. On the other hand, there were Forth enthusiasts who hacked their Macintoshes with Forth chips, and they went like a rocket. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2005-10-11 Thread Steven D'Aprano
start with. If so, I see nothing morally wrong with putting it up on your website. (The law may disagree.) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for info on Python's memory allocation

2005-10-11 Thread Steven D'Aprano
smaller than an ordinary list of N integers, depending on how large N is. So it won't use *less* memory -- at best, it will use just slightly more. Is there a way from within Python to find out how much memory a single object uses, and how much memory Python is using in total? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Class property

2005-10-11 Thread Steven Bethard
Laszlo Zsolt Nagy wrote: > class A(object): >cnt = 0 >a_cnt = 0 >def __init__(self): >A.cnt += 1 >if self.__class__ is A: >A.a_cnt += 1 > class B(A): >pass > print A.cnt,A.a_cnt # 0,0 > b = B() > print A.cnt,A.a_cnt # 1,0 > a = A() > print A.c

Re: Jargons of Info Tech industry

2005-10-11 Thread Steven D'Aprano
of our sys admins accidentally turned off the blacklisting at the mail server. In the ten minutes it took to get it turned back on, the CEO of our company received eight hundred spams. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionnaries and lookup tables

2005-10-11 Thread Steven D'Aprano
or if you use an older version, or a version on a different platform, or even because you've deleted an item from a dict and then put it back in. (And if you know anything about typical implementations of hash tables, you will understand why that last one is quite reasonable.) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: are there internal functions for these ?

2005-10-11 Thread Steven D'Aprano
black wrote: > anyone could figure me out ? No, I suspect people would have to be a trained psychologist to figure you out. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: non descriptive error

2005-10-11 Thread Steven D'Aprano
the modules being used, and search them for the string "error"? Ignore any hits which are in a comment. One of the others is almost certainly responsible. You can test that by changing the string to "this is a PITA" and see if your mysterious error message changes or not. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-12 Thread Steven D'Aprano
mazon this month..."). If you think this is too ridiculous for words, think of this: how valuable to Steve Ballmer and Bill Gates do you think Google's internal emails would be? Information is power, and power makes money. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Here I am again, same old arguments

2005-10-13 Thread Steven D'Aprano
here are fewer places for bugs to hide. > 3) Where do I find a command list, with syntax and all that fun stuff > for Python? I've explored the python site to no end, but I can't seem to > find a list. Have you looked here? http://docs.python.org/index.html -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding methods to an object

2005-10-13 Thread Steven D'Aprano
nction with a "cls" argument, you must add it to the class with a classmethod() call, and then call it from either the class or an instance. This method cannot access the instance that calls it, only the class. If you write the function without a "self" or "cls" argument, you must add it to the class with a staticmethod() call. This method cannot access either the class or the instance object. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

<    34   35   36   37   38   39   40   41   42   43   >