Re: So what exactly is a complex number?

2007-09-07 Thread El Pitonero
On Sep 5, 7:27 am, El Pitonero [EMAIL PROTECTED] wrote: I am a bit surprised that today, September 2007, in a thread about complex numbers, no one has mentioned about geometric algebra. Here is a good reference for whoever is interested. It's quite accessible to general audience. http

Re: So what exactly is a complex number?

2007-09-05 Thread El Pitonero
On Sep 1, 3:54 am, Grzegorz S odkowicz [EMAIL PROTECTED] wrote: You're mixing definition with application. You didn't say a word about what complex numbers are, not a word about the imaginary unit, where does it come from, why is it 'imaginary' etc. ... I'd also like to see a

Re: Subprocess with a Python Session?

2006-12-07 Thread El Pitonero
Paul Boddie wrote: Shane Hathaway wrote: Make sure the pipes are unbuffered. Launch the process with python -u and flush() the streams after writing. (That's the issue I've encountered when doing this before.) The -u option is critical, yes. I wrote some code recently which

Re: updating local()

2005-10-06 Thread El Pitonero
Flavio wrote: I wish all my problems involved just a couple of variables, but unfortunately the real interesting problems tend to be complex... def fun(**kw): a = 100 for k,v in kw.items(): exec('%s = %s'%(k,v)) print locals() fun(**{'a':1,'b':2}) {'a': 1, 'k':

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

2005-10-04 Thread El Pitonero
Paul Rubin wrote: Let's see, say I'm a bank manager, and I want to close my cash vault at 5pm today and set its time lock so it can't be opened until 9am tomorrow, including by me. Is that handcuffs? It's normal procedure at any bank, for good reason. It's not necessarily some distrustful

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

2005-10-02 Thread El Pitonero
Bengt Richter wrote: I decided to read this thread today, and I still don't know exactly what your requirements are for private whatevers. No name collision in subclassing. Notice that even if you use self._x = 3 in a parent class, it can be overriden in a sub-sub-class accidentally. Or

Re: how can I sort a bunch of lists over multiple fields?

2005-04-30 Thread El Pitonero
googleboy wrote: I am reading in a csv file that documents a bunch of different info on about 200 books, such as title, author, publisher, isbn, date and several other bits of info too. ... I really want to be able to sort the list of books based on other criterium, and even multiple

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread El Pitonero
Bengt Richter wrote: I still don't know what you are asking for, but here is a toy, ... But why not spend some time with the tutorials, so have a few more cards in your deck before you try to play for real? ;-) Communication problem. All he wanted is automatic evaluation a la spreadsheet

Re: Puzzling OO design problem

2005-04-09 Thread El Pitonero
It may be useful to separate the code into version-independent part and version-dependent part. Also, one can try to implement the higher-level logic directly in the class definition of A, B, etc., and then use the version objects only as patches for the details. That is, one can use place-holder

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread El Pitonero
Bengt Richter wrote: On 5 Apr 2005 19:28:55 -0700, El Pitonero [EMAIL PROTECTED] wrote: Scott David Daniels wrote: Ron_Adam wrote: ... def tweakdoc(name): def decorator(function): function.__doc__ = 'Tweak(%s) %r' % (name, function.__doc__) return

Re: Docorator Disected

2005-04-03 Thread El Pitonero
Martin v. Löwis wrote: Ron_Adam wrote: No, I did not know that you could pass multiple sets of arguments to nested defined functions in that manner. Please read the statements carefully, and try to understand the mental model behind them. He did not say that you can pass around multiple

Re: Docorator Disected

2005-04-02 Thread El Pitonero
Ron_Adam wrote: # (0) Read defined functions into memory def decorator(d_arg): # (7) Get 'Goodbye' off stack def get_function(function): # (8) Get func object off stack def wrapper(f_arg):# (9) Get 'Hello' off stack new_arg = f_arg+'-'+d_arg

Re: Decorator Dissection

2005-04-02 Thread El Pitonero
Ron_Adam wrote: On 2 Apr 2005 08:39:35 -0800, Kay Schluehr [EMAIL PROTECTED] wrote: There is actually nothing mysterious about decorators. I've heard this quite a few times now, but *is* quite mysterious if you are not already familiar with how they work. Or instead of mysterious, you

Re: Docorator Disected

2005-04-02 Thread El Pitonero
Ron_Adam wrote: So I didn't know I could do this: def foo(a1): def fee(a2): return a1+a2 return fee fum = foo(2)(6) -- !!! Ah, so you did not know functions are objects just like numbers, strings or dictionaries. I think you may have been influenced by other

Re: static variables in functions (was: Version Number Comparison Function)

2005-03-29 Thread El Pitonero
Christos TZOTZIOY Georgiou wrote: One of the previous related threads is this (long URL):

Re: Python for a 10-14 years old?

2005-03-24 Thread El Pitonero
Lucas Raab wrote: [EMAIL PROTECTED] wrote: I am blessed with a *very* gifted nine-years old daughter... Now, I would like to teach her programming basics using Python Let her mess around with it on her own. I'm 15 and have been using Python for 2-3 years and had nothing to really go on.

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread El Pitonero
On Sat, 19 Mar 2005 01:24:57 GMT, Raymond Hettinger [EMAIL PROTECTED] wrote: I would like to get everyone's thoughts on two new dictionary methods: def count(self, value, qty=1): try: self[key] += qty except KeyError: self[key] = qty

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread El Pitonero
Dan Sommers wrote: On Sat, 19 Mar 2005 01:24:57 GMT, Raymond Hettinger [EMAIL PROTECTED] wrote: The proposed names could possibly be improved (perhaps tally() is more active and clear than count()). Curious that in this lengthy discussion, a method name of accumulate never came up. I'm

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread El Pitonero
Raymond Hettinger wrote: Separating the two cases is essential. Also, the wording should contain strong cues that remind you of addition and of building a list. For the first, how about addup(): d = {} for word in text.split(): d.addup(word) import copy class

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread El Pitonero
Raymond Hettinger wrote: As written out above, the += syntax works fine but does not work with append(). ... BTW, there is no need to make the same post three times. The append() syntax works, if you use the other definition of safedict (*). There are more than one way of defining safedict,

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread El Pitonero
George Sakkis wrote: Aahz [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Raymond Hettinger [EMAIL PROTECTED] wrote: The proposed names could possibly be improved (perhaps tally() is more active and clear than count()). +1 tally() -1 for count(): Implies an accessor, not a

Re: importing two modules with the same name

2005-03-19 Thread El Pitonero
Francisco Borges wrote: There are 2 foo named modules, 'std foo' and 'my foo'. I want to be able to import 'my foo' and then from within my foo, import 'std foo'. Anyone can help?? In other words, you would like to make a patch on third-party code. There are many ways to do it. Here is just

Re: importing two modules with the same name

2005-03-19 Thread El Pitonero
Tim Jarman wrote: But if your foo is under your control, why not do everyone a favour and call it something else? His case is a canonical example of a patch. Often you'd like to choose the patch approach because: (1) the third-party may eventually incorporate the changes themselves, hence you

Re: Python becoming less Lisp-like

2005-03-15 Thread El Pitonero
Fernando wrote: The real problem with Python is ... Python is going the C++ way: piling feature upon feature, adding bells and whistles while ignoring or damaging its core design. I totally agree. Look at a recent thread Compile time evaluation (aka eliminating default argument hacks)