Re: consistency: extending arrays vs. multiplication ?

2005-07-23 Thread Dan Bishop
Soeren Sonnenburg wrote: > Hi all, > > Just having started with python, I feel that simple array operations '*' > and '+' don't do multiplication/addition but instead extend/join an > array: > > a=[1,2,3] > >>> b=[4,5,6] > >>> a+b > [1, 2, 3, 4, 5, 6] > > instead of what I would have expected: > [5

Re: Getting a dictionary from an object

2005-07-23 Thread Steven D'Aprano
On Sun, 24 Jul 2005 02:09:54 +0300, Thanos Tsouanas wrote: > On Sat, Jul 23, 2005 at 11:22:21PM +1000, Steven D'Aprano wrote: >> On Sat, 23 Jul 2005 11:48:27 +0300, Thanos Tsouanas wrote: >> > Hello. >> > >> > I would like to have a quick way to create dicts from object, so that a >> > call to fo

Re: [path-PEP] Path inherits from basestring again

2005-07-23 Thread Steven D'Aprano
On Sat, 23 Jul 2005 17:51:31 -0600, John Roth wrote: > I also like to know the number of elements, which seems to make > sense as len(path). Again, the number of characters in the path seems > to be utterly useless information - at least, I can't imagine a use for > it. There are (were?) operatin

Re: "Aliasing" an object's __str__ to a different method

2005-07-23 Thread Bengt Richter
On Sat, 23 Jul 2005 10:59:56 -0400, "Jeffrey E. Forcier" <[EMAIL PROTECTED]> wrote: >Thanks for all the additional replies thus far! > >Apparently the issue, as stated implicitly or explicitly by most of >you, is that new-style class instances essentially defer their magic >methods to the cla

Re: Filtering out non-readable characters

2005-07-23 Thread Bengt Richter
On 17 Jul 2005 18:32:28 -0700, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: >[George Sakkis] >> It's only obvious in the sense that _after_ you see this idiom, you can go >> back to the docs and >> realize it's not doing something special; OTOH if you haven't seen it, it's >> not at all the ob

Re: Filtering out non-readable characters

2005-07-23 Thread Bengt Richter
On Sat, 16 Jul 2005 23:28:02 -0400, "George Sakkis" <[EMAIL PROTECTED]> wrote: >"Peter Hansen" <[EMAIL PROTECTED]> wrote: > >> George Sakkis wrote: >> > "Peter Hansen" <[EMAIL PROTECTED]> wrote: >> Where did you learn that, George? >> > >> > Actually I first read about this in the Cookbook; t

Re: Filtering out non-readable characters

2005-07-23 Thread Bengt Richter
On Sun, 17 Jul 2005 15:42:08 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> Thanks for the nudge. Actually, I know about generator expressions, but >> at some point I must have misinterpreted some bug in my code to mean >> that join in particular didn't like generator ex

How do i do this

2005-07-23 Thread Amit Regmi
For some commad Linux like (pdbedit) its not possible to supply password in the command line itself while we add a samba user account into the SAM database .. Now I want' to design an AddAccount() method in Python i.e when we can't do "pdbedit -adduser x%password" How do I ma

Re: is this pythonic?

2005-07-23 Thread Eric Pederson
"Caleb Hattingh" <[EMAIL PROTECTED]> wrote: >In another > newsgroup, I could have been flamed for letting Simon know he helped > more > than just the OP with his post :) +1 OP asks, thousands are educated (perhaps). The group's generosity is greatly appreciated, even if that appreciation

Re: dictionary that discards old items

2005-07-23 Thread Bengt Richter
On Sat, 23 Jul 2005 20:07:25 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: >[Raymond Hettinger] >>>class Cache(dict): >>> def __init__(self, n, *args, **kwds): >>> self.n = n >>> self.queue = collections.deque() >>> dict.__init__(self, *args, **kwds) > >[Bengt Richter] >> Mi

<    1   2