Re: Augument assignment versus regular assignment

2006-07-20 Thread Antoon Pardon
On 2006-07-19, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> So IMV those preparation before the attachment, belong to >> whatever the interpreter does before it actually att

Re: function v. method

2006-07-21 Thread Antoon Pardon
y shouldn't. >> > > > if you prefix with a single underscore, that tells the user, DON'T MESS > WITH ME FROM OUTSIDE! I AM AN IMPLEMENTATION DETAIL! Personnaly I don't like this convention. It isn't clear enough. Suppose I am writing my own module, I use an underscore, to mark variables which are an implementation detail for my module. Now I need to import an other module in my module and need access to an implementation variable from that module. So now I have variables with an underscore which have two different meanings: 1) This is an implemantation detail of this module, It is the users of my module who have to be extra carefull using it. 2) This is an implemantation detail of the other module, I should be extra carefull using it. And I find variable starting or ending with an underscore ugly. :-) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-21 Thread Antoon Pardon
On 2006-07-20, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 20 Jul 2006 08:50:44 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> Suppose I have the following kind of code: >> >> while True: >

Re: range() is not the best way to check range?

2006-07-21 Thread Antoon Pardon
l(3,13) >>> s1.start 3 >>> s2.start 3 >>> s1.stop 13 >>> s2.stop 13 >>> s1.step >>> s2.step >>> lst[s1] [3, 4, 5, 6, 7, 8, 9, 10, 11, 12] >>> lst[s2] Traceback (most recent call last): File "", line 1, in ? TypeError: list indices must be integers >>> -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-23 Thread Antoon Pardon
e? Is there any chance the start:stop:step notation will ever be considered an atom? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: function v. method

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-07-21, fuzzylollipop <[EMAIL PROTECTED]> wrote: >> >>>danielx wrote: >>> > (snip) >>> >>> >>>if you prefix with a single u

Re: function v. method

2006-07-23 Thread Antoon Pardon
On 2006-07-21, fuzzylollipop <[EMAIL PROTECTED]> wrote: > > Antoon Pardon wrote: > >> Suppose I am writing my own module, I use an underscore, to >> mark variables which are an implementation detail for my >> module. >> >> Now I need to import an other

Re: Coding style

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 21 Jul 2006 12:00:43 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> So we have code with certain shudder characteristics. And instead >> of trying to h

Re: Coding style

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-21 09:00:43, Antoon Pardon wrote: > >> So we have code with certain shudder characteristics. And instead >> of trying to help the OP with his problem, some people react >> to the shudder and come

Re: range() is not the best way to check range?

2006-07-25 Thread Antoon Pardon
On 2006-07-23, Paul Boddie <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> >> Except that if you write your own class from scratch, you can't use >> it as a slice. > > Correct, but we were actually discussing subclassing built-in classes > for use

Re: Coding style

2006-07-25 Thread Antoon Pardon
On 2006-07-23, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-23 06:24:09, Antoon Pardon wrote: > >>> In general, I'd say that in this case the example was not well-chosen. >>> After such a "shudder removal", a poster should IMO review

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
much more simple to understand when we didn't have nested > functions - we mostly had global and local scope. But having only a global an local scope, didn't prevent nested functions. The nested functions just didn't have nested scopes and that had it's own problems. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
sn't 'hold' anything - it's really nothing more > than a name. In a language like C the name doesn't hold anything either. The name is just a way for refering to a memory space which will hold something. > And the object doesn't know nothing about which names it's > bound to. In a language like C, the value '3' doesn't know which variables will hold it either. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> >>>danielx wrote: >>> >>>>Bruno Desthuilliers wrote: >>>> >>> >

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> > (snip) >>>>>It can only take you so far. Now it's time you know the truth: there are >&g

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
On 2006-07-27, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 27 Jul 2006 14:11:35 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> In a language like C the name doesn't hold anything either. >> The name is jus

Re: Simulate input to another program

2006-07-27 Thread Antoon Pardon
On 2006-07-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > So there is no easy built in way to do this? Depends on what you mean by easy. A look at the pty module may help. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-07-28 Thread Antoon Pardon
On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon a écrit : >> On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> >>>Antoon Pardon wrote: >>> >>>>On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTE

Re: Nested function scope problem

2006-07-28 Thread Antoon Pardon
On 2006-07-28, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 27 Jul 2006 18:09:37 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> It is irrelevant because the word "variable" is used in a lot of >>

Re: Nested function scope problem

2006-07-28 Thread Antoon Pardon
On 2006-07-28, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Hmmm, I've not followed the PEPs -- has any thought been given to > unifying class/instance and dictionary notation so that > > a['b'] > and > a.b If that is what you want, you could use the following

Re: Nested function scope problem

2006-07-29 Thread Antoon Pardon
On 2006-07-29, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 28 Jul 2006 17:48:03 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> That is no reason to say that python has no variables. If someone would >> ex

Re: Nested function scope problem

2006-07-29 Thread Antoon Pardon
On 2006-07-28, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-28 15:20:52, Antoon Pardon wrote: > >>> Typically, "variable" implies a data storage location that can take on >>> different values. Emphasis on "location" -- the name is fi

Re: Nested function scope problem

2006-07-29 Thread Antoon Pardon
On 2006-07-29, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 28 Jul 2006 18:20:52 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> That is not true. It may be the case in a number of languages but >> my experi

Re: Nested function scope problem

2006-07-30 Thread Antoon Pardon
On 2006-07-29, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-29 13:47:37, Antoon Pardon wrote: > >> I think the important thing to remember is that the assignment in Python >> is a alias maker and not a copy maker. In languages like C, Fortran, >> pascal, th

Re: Nested function scope problem

2006-07-30 Thread Antoon Pardon
On 2006-07-30, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-30 09:54:14, Antoon Pardon wrote: > >> Aren't you looking too much at implementation details now? > > Possibly, but at this point I'm still trying to understand how Python does > these th

Re: Nested function scope problem

2006-07-31 Thread Antoon Pardon
On 2006-07-30, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-30 12:45:50, Antoon Pardon wrote: > >>> [...] we'd have to use a common definition of "variable". This is a term >>> so widely used that I'm not sure there is a useful single de

Re: Nested function scope problem

2006-08-01 Thread Antoon Pardon
On 2006-07-31, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > (snip) >> Sure it is usefull. It may be not 100% formally correct, but often >> things that are not 100% formally correct can be better in bringing >> an idea accross. > > hea

Re: Nested function scope problem

2006-08-01 Thread Antoon Pardon
On 2006-08-01, danielx <[EMAIL PROTECTED]> wrote: > Gerhard Fiedler wrote: >> On 2006-07-30 09:54:14, Antoon Pardon wrote: >> >> > Aren't you looking too much at implementation details now? >> >> Possibly, but at this point I'm still trying to

Re: Nested function scope problem

2006-08-01 Thread Antoon Pardon
atement like "c = c + 100" into actions the interpreter would have to take in order to excute that statement. Something like: c-addr_p = GetAddress("c"); c-value = *c-addr_p; sum = c-value + 100; *c-addr_p = sum; That look different enough from just "c = c + 100". So maybe C has no variables either. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-02 Thread Antoon Pardon
On 2006-08-02, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 1 Aug 2006 17:44:54 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Suppose I write a C-interpreter and then would translate a statement >> like "c =

Re: Get age of a file/dir

2006-08-02 Thread Antoon Pardon
ere is no information stored somewhere from which you can calculate that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Antoon Pardon
s of that type and not as "protection". I find that a strange purpose because when you are working on a class, you don't necessarily know if you will ever know many instance of that class. So should I use __slots__ in all my classes, just to be sure for when someone wants many instances of one? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-02 Thread Antoon Pardon
On 2006-08-02, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 2 Aug 2006 13:09:26 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> And how is this all relevant in deciding that the source language for >> the

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Antoon Pardon
ssue, you might overcome it using > slots. Or a disk cache. Or buy new memory. Does that imply for you that you > buy new disks and memory each time you start coding? I would think that someone writing a class, shouldn't have his instances use more memory than they need. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-04 Thread Antoon Pardon
variable". It is not the variable that has an id. It is the object that is currently attached to the variable that has an id. Yes we can use "id of a variable" as a shortcut for the correct formulation as long as you keep in mind that it is not the variable itself that has an id. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-04 Thread Antoon Pardon
On 2006-08-04, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-08-04 12:12:44, Antoon Pardon wrote: > >>> That's possible. I wouldn't expect too many C programmers to have any >>> notion of "id of a variable". I, for example, never thought a

Re: Python open a named pipe == hanging?

2006-08-04 Thread Antoon Pardon
t the echo in the background, because otherwise your script would block. Nothing stops you from starting a thread in python to open the fifo in write mode, the thread would block but the main program could still continue. There also is the os.pipe and os.popen calls that may be more usefull in specific cases. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-05 Thread Antoon Pardon
alking about variables in general and not about int variables or pointer variables, that doesn't matter much. If int variables in Python resemble pointer variables in C then there is something in C deserving the term variable which behaves like variables do in Python. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-06 Thread Antoon Pardon
On 2006-08-05, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-08-05 09:30:59, Antoon Pardon wrote: > >>> But this means that C variables are not analog to Python variables, >>> [...] >> >> Yes they are. > > Nobody so far has been able

Re: Python open a named pipe == hanging?

2006-08-07 Thread Antoon Pardon
d the files in parralel. Since you first feed the whole first file before you start the second, a deadlock could occur if s1 was sufficiently large. Something like the following instead of the two print statements would be better IMO (not tested): def cat(fn, st): fl = file(fn, 'w') fl.write(st) fl.close() Threading.Thread(target = cat, args = ('fifo1', s1)).start() Threading.Thread(target = cat, args = ('fifo2', s2)).start() -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Curried class methods?

2006-08-17 Thread Antoon Pardon
<http://mail.python.org/pipermail/python-list/2004-July/229478.html>, I > think I understand why this is - "i" doesn't actually get added to each > new function's context; they just reference the global one. Even if I > do this: Try this instead as the for loop for i in ['a','b','c']: setattr(Foo, i, lambda self, a=i: self.generalized(a)) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

callable to disappear?

2006-08-23 Thread Antoon Pardon
this still has problems because the TypeError could be raised because lst is an unsubscriptable object. Is there a chance this will be reconsidered? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-05 Thread Antoon Pardon
y worked fine. It wouldn't surprise me if this was true for the complete threading documentation. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread Antoon Pardon
for treating the documentation as if it is talking about python functions. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread Antoon Pardon
On 2006-10-06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> Is this general rules documeted somewhere? My impression is that readers >> of the documentation will treat arguments as keyword arguments unless >> this is explicitly contradicted.

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread Antoon Pardon
On 2006-10-06, hanumizzle <[EMAIL PROTECTED]> wrote: > On 6 Oct 2006 09:21:11 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> On 2006-10-06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> > Antoon Pardon wrote: >> > >> >> Is this general

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread Antoon Pardon
iting about Python stuff. Others have > other priorities, it seems. I just think you shouldn't assume the readers of the documentation are aware of best practices. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread Antoon Pardon
On 2006-10-06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> IMO this is a very natural thought process for a python programmer. >> So a python programmer seeing the first will tend to expect that >> last call to work. > > on the other

Re: Names changed to protect the guilty

2006-10-09 Thread Antoon Pardon
gt;> > >> > Please consider whether you should be writing "(blah is False) is >> > True", that would be more explicit. >> >> Puh-lease! Get it right! >> >> It should be "((blah is False) is True) is True". > > Yes, but it stops af

Re: Names changed to protect the guilty

2006-10-09 Thread Antoon Pardon
ing 1/0 instead of True/False). I think it's safest to > simply ban this idiom. No exceptions, never. The problem is there is also ground for bugs if you don't use "blah is True". If some application naturally seems to ask for a variable that can be valued False, True or a positive integer then things like "if var" or "if not var" may very well be a bug too. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: operator overloading + - / * = etc...

2006-10-09 Thread Antoon Pardon
ble" inappropiate to use. And since the word variable originally comes from mathematics and IMHO the mathematical semantics are closer to the lisp/smalltalk/python semantics than the C/algol/pascal/ada semantics I don't see why "variable" is seen as "sloppy talk" -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Names changed to protect the guilty

2006-10-10 Thread Antoon Pardon
On 2006-10-09, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Antoon Pardon <[EMAIL PROTECTED]> wrote: >>On 2006-10-08, Aahz <[EMAIL PROTECTED]> wrote: >>> In article <[EMAIL PROTECTED]>, John J. Lee <[EMAIL

Re: Names changed to protect the guilty

2006-10-10 Thread Antoon Pardon
On 2006-10-10, Ben Finney <[EMAIL PROTECTED]> wrote: > "Andy Salnikov" <[EMAIL PROTECTED]> writes: > >> "Aahz" <[EMAIL PROTECTED]> wrote: >> > Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >>The problem is there is a

Re: operator overloading + - / * = etc...

2006-10-10 Thread Antoon Pardon
On 2006-10-10, Paul Rubin wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> writes: >> or for the perhaps-overly-clever hackers, >> >> for x in iter(lambda: foo() or None, None): >> process(x) > > for x in takewhile(foo() for _ in repeat(None)): >process (x) >>> for x in takewhile(foo

Re: operator overloading + - / * = etc...

2006-10-10 Thread Antoon Pardon
On 2006-10-10, Paul Rubin wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> writes: >> or for the perhaps-overly-clever hackers, >> >> for x in iter(lambda: foo() or None, None): >> process(x) > > for x in takewhile(bool, (foo() for _ in repeat(None))): > process(x) > > Meh, both ar

Re: People's names

2006-10-12 Thread Antoon Pardon
es for easier searching in case you have doubts on how the name is actually written. > BTW, do Dutch/Flemish family names now follow the trend of dropping > declension, as seen in both languages (dialects?) in general: e.g., > 'de' instead of 'der'? Yes but not in names (at least in Flemish families) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: pygtk dynamic table

2006-10-13 Thread Antoon Pardon
ocs/pygtk/class-gtktable.html#method-gtktable--resize -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-13 Thread Antoon Pardon
On 2006-10-12, Magnus Lycka <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> Well maybe he didn't intend that, but how is the reader of the >> documentation to know that? The reader can only go by how >> things are documented. If those are not entirely cons

Re: question about True values

2006-10-27 Thread Antoon Pardon
as Something while 5 < 10 would be Nothing. So while the paradigma of the language may be the distinction of Something vs Nothing the programmer will often enough think in terms of True and False. So IMO it would have been better if python had made the distinction between True and False and so made the programmer code the Something/Nothing disctinction explicitly. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-27 Thread Antoon Pardon
implemented with the Nothing vs Something distinction in mind. > If you can see > "if" and "while" as constructs that respond to something-ness, > you will appreciate idiomatic Python better, because that > arguably is just what it's about. And how do I express that a number has to be greater than 100 into a Nothing vs Something dichotomy? Declare all greater numbers as Something and the rest as Nothing? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-27 Thread Antoon Pardon
small point. Enjoy Python the way it is, and the way you are. You and > Python will definitely come to an accommodation (and you will love the > combination of discipline and freedom that it brings to programming > style). Welcome to the language! I'll second that. Python has it warts

Re: question about True values

2006-10-27 Thread Antoon Pardon
On 2006-10-27, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> The latter will treat None and False the same as [], () and {}, >> which in most of my code is not what I want. > > since you never publish any code, This is not True. You

Re: question about True values

2006-10-27 Thread Antoon Pardon
On 2006-10-27, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >>> since you never publish any code, >> >> This is not True. You shouldn't confuse your lack of recollection >> with reality. > > pointers, please. Sorry, the an

Re: question about True values

2006-10-27 Thread Antoon Pardon
27;t see what is wrong with counting on the fact that an empty container has a length of zero. I can write a container class where the truth value of an object is independent of whether or not the object is empty and then the "if obj:" idiom will fail to provide true polymorphism to

Re: question about True values

2006-10-27 Thread Antoon Pardon
On 2006-10-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 09:16:57 +, Antoon Pardon wrote: > >>> I think it is a good time to remind people of some extremely well-thought >>> out opposition to the introduction of bools to Python

Re: question about True values

2006-10-27 Thread Antoon Pardon
On 2006-10-27, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Antoon Pardon <[EMAIL PROTECTED]> wrote: > ... >> I think you are incorrect. > > Thanks! I rest my case! > >> And how do I express that a number has to be

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 18:22:28 +, Antoon Pardon wrote: > >>>> And how do I express that a number has to be greater than >>>> 100 into a Nothing vs Something dichotomy? Declare all >>

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 17:35:58 +, Antoon Pardon wrote: > >> On 2006-10-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> So >> it seems that python has generalised the len

Re: question about True values

2006-10-30 Thread Antoon Pardon
thority, but this is one of > them. No offense, but when it comes to language design its a brave or > foolish programmer who bucks the language idioms that Guido chose. You don't have to be that brave to go against Guido's autority. It is only recently he introduced a ternary operator and then only after someone in the development group was hit by a bug introduced by the then supported idiom. Python is a nice enough language with a high quality in design. Yet it still has its warts. So I see no reason to blindly follow the autority of its designers. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: please help with optimisation of this code - update of given table according to another table

2006-11-08 Thread Antoon Pardon
gt; critical issue for me :( > > I will be grateful for any ideas One idea would be to precompute the list comprehensions in the if test. p2 = [[row_t2[i] for i in keyColums] for row_t2 in t2] for row_t1 in t1: proj1 = [row_t1[i] for i in keyColumns] for row_t1, proj2

Re: assigning values in __init__

2006-11-09 Thread Antoon Pardon
ics: chardict[char] = roll_dice(10) my_character = Character(chardict) This way you only have to keep your characteristics in one place. > If you happen to already have collected your character attributes in a > mapping object for some other reason, then well and good, pass it into the

Re: assigning values in __init__

2006-11-09 Thread Antoon Pardon
On 2006-11-09, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 09 Nov 2006 10:36:07 +, Antoon Pardon wrote: > >> On 2006-11-09, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> On Thu, 09 Nov 2006 12:27:12 +1100, Ben Finney wrote: >&

Re: range syntax

2006-11-10 Thread Antoon Pardon
... Just as you are supposed to use parthesis if you want a tuple as a function argument although normally a comma is enough to form a tuple. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Antoon Pardon
y surprised by that fact. At the risk of > starting another argument, to my mind that's like discovering that there > are professional butchers who don't think that using a sharp knife is a > good idea. Well I would think that if you would find out that many professional butchers would think so, you might consider the idea has some merrit. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

str.title question after '

2006-11-13 Thread Antoon Pardon
't Smidje na'ama Na'Ama Na'ama al pi tnu'atAl Pi Tnu'AtAl Pi Tnu'at Is there an easy way to get what I want? Should the current behaviour condidered a bug? My would be inclined to answer yes, but that may be because this behaviour would b

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Antoon Pardon
On 2006-11-14, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> Why not? My impression is that removing redundancy is considered >> a positive thing here in c.p.l. > > so why are you still here? Because I have a different opinion and I don'

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Antoon Pardon
ination of block structure like indentation does. IMO this works both ways. > Otherwise why > would people write indenting pretty printers for C and the like? Try to follow an indentation marked structure when the structure crosses a page boundary and you can't view the whole structure at once. Sensible placed markers can greatly assist in getting a feel for a structure even if the structure is already properly indented. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Antoon Pardon
Except if you argue for blockmarkers. Then you get the response that indentation is clear enough and such markers are redundant. And there have been other subjects where redundancy was seen as something negative. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: reduce to be removed?

2006-11-14 Thread Antoon Pardon
n that second one? > > No. numpy can make arrays of Python objects in addition to arrays of double, > unsigned int, etc. Does numpy still gain you much if you have arrays of Python objects? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Py3K idea: why not drop the colon?

2006-11-15 Thread Antoon Pardon
On 2006-11-15, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 14 Nov 2006 12:01:05 +, Antoon Pardon wrote: > >> On 2006-11-13, Ben Finney <[EMAIL PROTECTED]> wrote: >>> Michael Hobbs <[EMAIL PROTECTED]> writes: >>> >>>>

Re: Py3K idea: why not drop the colon?

2006-11-15 Thread Antoon Pardon
On 2006-11-15, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 15 Nov 2006 08:22:46 +, Antoon Pardon wrote: > >>> Redundancy is not something to be valued for its own sake. It is only >>> valuable when it actually gains you something. >> >

Re: how to clear up a List in python?

2006-05-29 Thread Antoon Pardon
s carefully, as Fredrik's use of language is precise: he > doesn't say you *shouldn't* post, he says you don't *need to*. This is > good advice, because posting a lame solution too quickly, while > reflecting an earnest and praiseworthy desire to help, can often lead to > trouble with some of the less patient members of our community. Maybe those less patient members should take the same advise: They don't need to react. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Antoon Pardon
> isn't a legal tuple outside of square braces Yes it is, it just is illegal notation outside square brackets. You could have approximate the same effect by I = 1, slice(2,3,4), Ellipsis, 5 x[I] > - in fact, it even isn't > legal inside parens: "x[(1, 2:3:4, ..., 5)]" isn't legal syntax. But what is illegal is the notation, not the value. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing a thread

2006-06-12 Thread Antoon Pardon
return alrm if __name__ == "__main__": import os from random import randint class Continue(Xthread): def run(self): self.id = os.getpid() print self.id, self._thrd_id, "Begin" i = 0 try: for _ in xrange(randint(0,20)): for e in xra

Re: Which compiler will Python 2.5 / Windows (Intel) be built with?

2006-06-16 Thread Antoon Pardon
g Window stuff for Python? If I understand the situation correctly, people who want to take up, writing C-extentions on windows now, may not be able to do so, because they can't find a compatible compilor for the moment. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: String negative indices?

2006-06-26 Thread Antoon Pardon
erstanding was that negative indexes were introduced to avoid things like seq[len(seq) - i] -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary .keys() and .values() should return a set [with Python 3000 in mind]

2006-07-04 Thread Antoon Pardon
e mapping a your dictionary d above, the code would be: # t is some tree for k in t: #blah And the keys will be treated in order. If you try it, let me know what you think of it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes, and augmented assignment

2006-07-05 Thread Antoon Pardon
ng like k = [0] def f(i): k[0] += i f(2) works but the following doesn't k = 0 def f(i): k += i f(2) Personnaly I see no reason why finding a name/identifier on the leftside of an assignment should depend on whether the name is the target or prefix for the target. But maybe that is just me. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes, and augmented assignment

2006-07-05 Thread Antoon Pardon
On 2006-07-05, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > (snip) >> Well no matter what explanation you give to it, and I understand how it >> works, > > I'm not sure of this. Should I care about that? >> I keep finding it st

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
On 2006-07-05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> Python could have chosen an approach with a "nested" keyword > > sure, and Python could also have been invented by aliens, powered by > space potatoes, and been illegal to inha

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> On 2006-07-05, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >>>> Antoon Pardon wrote: >>>> (snip) >&

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
e lefthand side is a simple variable or more complicated. Sure people may prefer to speak about (re)binding vs mutating variables, but just because I didn't use the prefered terms, starting to doubt my understanding of the language, seems a bit premature IMO. I'm sure there are areas where my understanding of the language is shaky, metaclasses being one of them, but understanding how names are searched doesn't seem to be one of them. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
On 2006-07-06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> >>>>>>It's not about "finding a name/identifier", it's about the difference &g

Re: Nested scopes, and augmented assignment

2006-07-07 Thread Antoon Pardon
On 2006-07-07, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> Could you maybe clarify what problem we are discussing? All I wrote >>AP> was that with an assignment the search for the left

Re: Nested scopes, and augmented assignment

2006-07-07 Thread Antoon Pardon
pologies. > have you even read the language > reference ? do you even know that it exists ? You mean this, I suppose: http://docs.python.org/ref/naming.html -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes, and augmented assignment

2006-07-07 Thread Antoon Pardon
On 2006-07-07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >>> have any of your "my mental model of how Python works is more important >>> than how it actually works" ever had a point ? >> >> Be free to correct me. But

Re: Nested scopes, and augmented assignment

2006-07-08 Thread Antoon Pardon
On 2006-07-07, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> And if Nested variables are harmfull, > > I don't know if anyone said that they were, but Guido obviously

Re: Nested scopes, and augmented assignment

2006-07-08 Thread Antoon Pardon
On 2006-07-07, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> On 2006-07-07, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>>>>> Antoon Pardon <[EMAIL P

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Antoon Pardon
On 2006-07-09, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> It is conceptually different. In the line 'a = b' you don't need to >>AP> search for the scope of a. You know it

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Antoon Pardon
On 2006-07-08, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 8 Jul 2006 18:52:56 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> >> I'm not fooled by that phrase. I just think the mutate vs rebind >>

<    10   11   12   13   14   15   16   17   18   19   >