Re: append on lists

2008-09-16 Thread Maric Michaud
Le Tuesday 16 September 2008 15:57:53 Grant Edwards, vous avez écrit : On 2008-09-16, Maric Michaud [EMAIL PROTECTED] wrote: all expressions that return something, return a new object, That's not _quite_ true: a=1 b=a.__add__(0) a is b True ;) This is implementation specific

Re: literals optimization (was Re: append on lists)

2008-09-16 Thread Maric Michaud
Le Tuesday 16 September 2008 16:57:26 Grant Edwards, vous avez écrit : On 2008-09-16, Maric Michaud [EMAIL PROTECTED] wrote: Le Tuesday 16 September 2008 15:57:53 Grant Edwards, vous avez écrit : On 2008-09-16, Maric Michaud [EMAIL PROTECTED] wrote: all expressions that return something

Re: literals optimization (was Re: append on lists)

2008-09-16 Thread Maric Michaud
to the original problem. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string compare?

2008-09-16 Thread Maric Michaud
Le Friday 05 September 2008 19:36:56 Fredrik Lundh, vous avez écrit : Maric Michaud wrote: I suspect you are coming to conclusions a bit quickly, without taking the pain of understanding the whole discussion. I'm pretty sure I was the first one to post an answer in this thread, and I

Re: Gateway to python-list is generating bounce messages.

2008-09-16 Thread Maric Michaud
Le Monday 15 September 2008 16:45:12 Maric Michaud, vous avez écrit : This is not sufficient for auto-responses, and given the following rfcs, it would smart to both : ... - add or modify the Return-Path and/or Reply-To header for badly implemented auto-responders to point to list maintainer

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 08:30:44 Fredrik Lundh, vous avez écrit : Maric Michaud wrote: You''ll often see for loops written like this : for i in (e for e in iterable if predicate(e)) : ... luckily, I don't. most people, when faced with that problem, writes it in the obvious

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 08:24:29 Fredrik Lundh, vous avez écrit : Maric Michaud wrote: premature optimization is the root of all evil So is use by that statement by people who don't have the slightest idea about what it actually means. The full version is We should forget about small

Re: Core dumped while interacting with OpenOffice.org via pyuno

2008-09-05 Thread Maric Michaud
to find which function call exactly provoke the exception, the simplest way is to trace execution flow with some print statments and using non forking zope instance (runzope -d if I remember well). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
is to index upon insertion all keys in another dict, so you get in final : d = { kEy1 : 1, Key1 : 2} indexes = { key1 : [kEy1, Key1 ] } Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 16:00:39 J. Cliff Dyer, vous avez écrit : Please keep the discussion on-list. Sorry for the private email, I sent it again to the list.. On Fri, 2008-09-05 at 15:36 +0200, Maric Michaud wrote: Le Friday 05 September 2008 14:33:22 J. Clifford Dyer, vous avez écrit

Re: Retrieving the name of the class calling an instance method

2008-09-05 Thread Maric Michaud
() f.someMethod() bar() again() --- -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle

2008-09-04 Thread Maric Michaud
in s.items() : print name, value ...: a 5 c ('foo', 'bar', 'baz') The sync method may not work on all platform, maybe you'll have to close and re-open the db file to write to disk. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: overwrite set behavior

2008-09-04 Thread Maric Michaud
.   class foo(set): ...  def __contains__(self, value): ...   print value ...   a = foo((1,2))   -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: why is self not passed to id()?

2008-09-04 Thread Maric Michaud
.py, line 9, in module _s_.add(bar()) TypeError: id() takes exactly one argument (0 given) -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 4 26 88 00 97 Mobile: +33 6

Re: why is self not passed to id()?

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 23:35:18 Terry Reedy, vous avez écrit : Maric Michaud wrote: Le Thursday 04 September 2008 22:26:53 Ruediger, vous avez écrit : class foo(list):     __hash__ = lambda x: id(x) Wow ! You are really going on trouble with this, believe me there is a real

Re: Case-insensitive string compare?

2008-09-04 Thread Maric Michaud
the straightforward, read as pseudo-code, python expression. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string compare?

2008-09-04 Thread Maric Michaud
://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: properties setting each other

2008-09-03 Thread Maric Michaud
): self._setvalue(val) self._setsquare=pow(val,2) Note that if one property can really be computed from another, this kind of thing could be considered as bad design (except if the computation is heavy). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 16:44:10 Maric Michaud, vous avez écrit :          def _setsquare(self, v) :                  # some extra logic here                  self._square = s          def fsetsquare(self,s):                  self._setsquare(s)                  self._setvalue

Re: properties setting each other

2008-09-03 Thread Maric Michaud
(fgetvalue, fsetvalue) def fgetsquare(self): return self.value ** 2 def fsetsquare(self,s): self.value = math.sqrt(s) square = property(fgetsquare, fsetsquare) -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python

Re: properties setting each other

2008-09-03 Thread Maric Michaud
is a caching mechanism, and should be done knowingly, in acceptance of all the complication it comes with. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple values for one key

2008-08-28 Thread Maric Michaud
/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: import error between 2 modules

2008-08-27 Thread Maric Michaud
Worker: def __init__(self, employer): from empmodule import Employer if not isinstance(employer, Employer): raise ValueError(Not an employer) self.emp=employer() -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple values for one key

2008-08-27 Thread Maric Michaud
be the syntax for modifying an existing value, for example, what should be the result of two consecutive assignements ? d[5] = None d[5] = 0 d[5] == [ None, 0 ] ?? What exactly are you trying to achieve ? -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: generate methods at runtime, but the wrong one gets called

2008-08-25 Thread Maric Michaud
is created by the class factory, as well and I unfortunately can't do that. Thank you very much, Steve -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: A variables variables

2008-08-24 Thread Maric Michaud
() *is* an already made dict, very convenient for use locally and read-only. [155]: var1 = easy [156]: var2 = proper [157]: var3 = locals [158]: print a %(var2)s and %(var1)s use of %(var3)s with %(var3)s() % locals() a proper and easy use of locals with locals() -- _ Maric

Re: Imports visibility in imported modules problem

2008-08-24 Thread Maric Michaud
modules name guess what , it will have to be renamed in every import to it in all modules -- (cf my previous comment). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: What is class method?

2008-08-24 Thread Maric Michaud
to module level functions, and we should always use classmethods in place of them. -- Thank you for your time. -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: recursively change values in list of lists

2008-08-24 Thread Maric Michaud
://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling in complex Python programs

2008-08-22 Thread Maric Michaud
the right way. This is hard to do in C because you have no way to trap an error which happen randomly in the program, ie. a segfault will interrupt the execution anyway. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling in complex Python programs

2008-08-22 Thread Maric Michaud
Le Friday 22 August 2008 15:03:21 Bruno Desthuilliers, vous avez écrit : Maric Michaud a écrit : Le Thursday 21 August 2008 09:34:47 Bruno Desthuilliers, vous avez écrit : The point is that EAFP conflicts with the interest of reporting errors as soon as possible (on which much has been

Re: Filling in Degrees in a Circle (Astronomy)

2008-08-22 Thread Maric Michaud
]: interpolate((0, 0), (180, 45)) ...[23]: [0.0, 0.25, 0.5, 0.75, 44.5, 44.75, 45.0] [29]: interpolate((80, 20), (180, 45)) [0.0, 0.25, 0.5, 0.75, 1.0, 1.25, ... 24.5, 24.75, 25.0] -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: print %s

2008-08-18 Thread Maric Michaud
') a z e r t y -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Maric Michaud
a login shell even in non-interactive session. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: help with parsing email

2008-08-18 Thread Maric Michaud
by your environment. You won't need no extensions, just a standard python installation, and your code will work with most mail delivery agent and will run on all python supported platform. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread Maric Michaud
(the programer himself). I'd say that everywhere exec/eval are used in a application/function/lib that doesn't mean to interpret arbitrary and user provided python code, it is a bad usage. -- _ Maric Michaud namedtuple.py Description: application/python -- http://mail.python.org

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-15 Thread Maric Michaud
. Not that complex, strength of ZODB is right here, this entirely covered by the introduction to zodb (ZODB/ZEO programming guide), see userdb and chatter examples. Christian -- http://mail.python.org/mailman/listinfo/python-list -- _ Maric Michaud -- http://mail.python.org

Re: Why nested scope rules do not apply to inner Class?

2008-08-13 Thread Maric Michaud
with type('dynamic', (object,), {type_: type_}) def create_type(type_) : class dynamic(object) : type_ = type_ return dynamic -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Why nested scope rules do not apply to inner Class?

2008-08-13 Thread Maric Michaud
incompatibility with actual code. This is exactly this case which would be a problem (your example raise an error and is not exactly a running code): G = 1 class A(object) : G = 0 def f(self) : return G -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Why nested scope rules do not apply to inner Class?

2008-08-13 Thread Maric Michaud
Calvin Spealman a écrit : On Wed, Aug 13, 2008 at 7:41 PM, Maric Michaud [EMAIL PROTECTED] wrote: I was not aware of any nested classes are unsupported before and didn't consider nested classes as bad practice till now, even with the pickle limitation (not every class are intended to be pickled

Re: Why nested scope rules do not apply to inner Class?

2008-08-12 Thread Maric Michaud
) : : --- NameError Traceback (most recent call last) /home/maric/ipython console in module() /home/maric/ipython console in A() /home/maric/ipython console in genexpr((f,)) NameError: global name 'l' is not defined -- _ Maric Michaud -- http

Re: simple error i hope

2008-08-02 Thread Maric Michaud
what I think). The main point with open I think is to easy later evolution. While you could override file name as well as open by a custom funcion, it's a bad idea to override the name of the type because a simple isinstance(file_, file) won't work anymore if you do so. -- _ Maric

Re: Strong/weak typing

2008-08-01 Thread Maric Michaud
= 0, 1 a += b a, b = b, a s = foo s = s.upper() -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
) : ...: def __repr__(self) : return type A ...: ...: [2]: A ...[2]: type A [3]: type('toto', (object,), {}) ...[3]: class '__main__.toto' -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
of type, their instances are new types. For all tjis work together you must admit the following recursivity : 'type' is both a subclass and an instance of 'object' while 'object' is an instance of 'type'. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
Le Thursday 31 July 2008 16:46:28 Nikolaus Rath, vous avez écrit : Maric Michaud [EMAIL PROTECTED] writes: Can someone explain to me the difference between a type and a class? If your confusion is of a more general nature I suggest reading the introduction of `Design Patterns' (ISBN-10

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
with builtin types (written in C) you coudn't do in pure python, exactly as you couldn't write recursive types like 'object' and 'type'. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Maric Michaud
quite clear if not amount : is testing the zero value of a numerical value. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Maric Michaud
. Without ABC, to explicitly ensure amount is a scalar, just doing a int(amount) or int(abs(amount)) if you want to deal with complex numbers too, at the begining of the function is a common idiom. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Pointers/References in Python?

2008-07-30 Thread Maric Michaud
for example). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard module for parsing emails?

2008-07-30 Thread Maric Michaud
about encoding)... -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard module for parsing emails?

2008-07-30 Thread Maric Michaud
Le Wednesday 30 July 2008 17:55:35 Aspersieman, vous avez écrit : For parsing the mails I would recommend pyparsing. Why ? email module is a great parser IMO. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard module for parsing emails?

2008-07-30 Thread Maric Michaud
Le Wednesday 30 July 2008 19:25:31 Diez B. Roggisch, vous avez écrit : Maric Michaud wrote: Le Wednesday 30 July 2008 17:55:35 Aspersieman, vous avez écrit : For parsing the mails I would recommend pyparsing. Why ? email module is a great parser IMO. He talks about parsing the *content

Re: multiple inheritance and __getattr__

2008-07-29 Thread Maric Michaud
of simplicity-efficiency. I said near the best one because your __getattr__ isn't collaborative yet ! :). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is the correct round() method? Use math.ceil

2008-07-28 Thread Maric Michaud
be just over or just down by a small quantity. On mine with 2.6 this typically give : [26]: 0.5 ...[26]: 0.5 [27]: 0.49 ...[27]: 0.48999 [29]: 0.51 ...[29]: 0.51001 [28]: 1.1 ...[28]: 1.1001 [35]: round(0.5) ...[35]: 1.0 -- _ Maric Michaud

Re: sub typing built in type with common attributes. Am I right?

2008-07-18 Thread Maric Michaud
() AttributeError: can't set attribute -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: (silly?) speed comparisons

2008-07-09 Thread Maric Michaud
. The signature should be : vectorstring move_slice(vectorstring vec, int start, int stop, int dest) or vectorstring* move_slice(vectorstring* vec, int start, int stop, int dest) -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: List Performance

2008-06-30 Thread Maric Michaud
... -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Borg design Pattern

2008-06-30 Thread Maric Michaud
waitinig for system to be operational and deliver them lazily. This is quite an easy thing to implement (hint : use stdlib data structures that support multi threading from the beginning). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: List Performance

2008-06-30 Thread Maric Michaud
] * expected_size # working with the datas while maintaining the effective currrently used size Of course one could even subclass list and redefine __len__, append, and some other methods to deal with this allocated by block list. -- _ Maric Michaud -- http://mail.python.org

Re: insertion sorts...

2008-06-30 Thread Maric Michaud
...[11]: True [12]: l[:] = [4] [13]: l == g ...[13]: True [14]: l is g ...[14]: True [15]: g ...[15]: [4] -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: List Performance

2008-06-30 Thread Maric Michaud
itertools.repeat(self.obj, len(self)) : : -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Email Bounce Detection

2008-06-27 Thread Maric Michaud
').read()) [50]: bounce.get_content_type() ...[50]: 'multipart/report' [51]: [52]: for i in bounce.get_payload() : :if i.get_content_type() == 'message/delivery-status' : : print i.get_payload()[1]['status'] : : 5.0.0 -- _ Maric Michaud

Re: using urllib2

2008-06-27 Thread Maric Michaud
: msg#00040', 'Cardiff Web Site Design, Professional web site design services ...', 'Python Properties', 'Frees lt; Programs lt; Python lt; Bin-Co', 'Torb: an interface between Tcl and CORBA', 'Royal Python Morphs', 'Python amp; Co'] -- _ Maric Michaud -- http://mail.python.org

Re: Use of the is statement

2008-06-27 Thread Maric Michaud
. if not f.tell() : print 'at the beginning of the file -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Do I need self and other?

2008-06-27 Thread Maric Michaud
like this : from itertools import izip ... def __add__(self, other) : return Vector(x + y for x, y in izip(self, other)) -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Borg design Pattern

2008-06-27 Thread Maric Michaud
. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: this is simple...

2008-06-27 Thread Maric Michaud
with the simpler : B = [ e for e in B if e*e not in A ] -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Mako vs. Cheetah?

2008-06-27 Thread Maric Michaud
breaking the logic of the template. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Freeze problem with Regular Expression

2008-06-25 Thread Maric Michaud
that regexp matching is the best tool for it. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: binary representation of an integer

2008-06-24 Thread Maric Michaud
with octal conversion :) [8]: oct2bin = {'0':'000', '1':'001', '2':'010', '3':'011', '4':'100', '5':'101', '6':'110', '7':'111'} [9]: ''.join(oct2bin[e] for e in %o%35).lstrip('0') ...[9]: '100011' -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004

Re: An idiom for code generation with exec

2008-06-23 Thread Maric Michaud
or callable instances, there are many way to achieve this. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: listcomprehension, add elements?

2008-06-23 Thread Maric Michaud
. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: listcomprehension, add elements?

2008-06-23 Thread Maric Michaud
Le Monday 23 June 2008 13:51:34 John Machin, vous avez écrit : On Jun 23, 9:16 pm, Maric Michaud [EMAIL PROTECTED] wrote: Le Monday 23 June 2008 11:39:44 Boris Borcic, vous avez écrit : John Machin wrote: Instead of sum(a + b for a, b in zip(foo, bar)) why not use sum(foo) + sum(bar

Re: Question: How do I format printing in python

2008-06-23 Thread Maric Michaud
it is better, a shorthand for split(os.sep). -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: xml to mysql (vice versa ) too

2008-06-23 Thread Maric Michaud
Text node -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: An idiom for code generation with exec

2008-06-23 Thread Maric Michaud
. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-16 Thread Maric Michaud
') may be preferred. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing inheritance (decorator pattern ?)

2008-06-16 Thread Maric Michaud
) ) etc... -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing inheritance (decorator pattern ?)

2008-06-16 Thread Maric Michaud
Le Tuesday 17 June 2008 05:10:57 Maric Michaud, vous avez écrit : The class complextiy problem is actually solved by : inst_with_alg1 = MyClassUsingStrategies((algo1_strategy,), (algo1_strategy,)) inst_with_alg1_alg2 = MyClassUsingStrategies

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
with dict, do(c_dict, u, v) The result is pretty close now : [EMAIL PROTECTED] 17:04:36:~$ ./test.py with list 1.40726399422 with dict 1.63094091415 So why use list where the obvious and natural data structure is a dictionnary ? -- _ Maric Michaud -- http://mail.python.org

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
Hello, Le Friday 13 June 2008 17:55:44 Karsten Heymann, vous avez écrit : Maric Michaud [EMAIL PROTECTED] writes: So, writing C in python, which has dictionnary as builtin type, should be considered more elegant ? IMO that's a bit harsh. harsh ? Sorry, I'm not sure to understand. You

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
Le Friday 13 June 2008 18:55:24 Maric Michaud, vous avez écrit : approximately the double amount of memory compared to the other. I don't see how you came to this conclusion. Are you sure the extra list take twice more memory than the extra dictionary ? twice less, I meant, of course

Re: catastrophic regexp, help!

2008-06-11 Thread Maric Michaud
', 'zlatan ibrahimovic '] -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: catastrophic regexp, help!

2008-06-11 Thread Maric Michaud
Le Wednesday 11 June 2008 09:08:53 Maric Michaud, vous avez écrit : this is zlatan example.' compare with 'this is zlatan example', 'z'=='.', false compare with 'this is zlatan ', 'z'=='e', false compare with 'this is zlatan', 'z'==' ', false compare with 'this is ', zlatan==zlatan, true Ah

Re: Why does python not have a mechanism for data hiding?

2008-06-11 Thread Maric Michaud
or not is not computable. Static analysis as they imply is just nonsense. AFAIK, the efforts needed to make good static analysis are proven, by experience, to be at least as time consuming than the efforts needed to make good unit and dynamic testing. -- _ Maric Michaud -- http://mail.python.org

Re: Can I find out (dynamically) where a method is defined?

2008-06-10 Thread Maric Michaud
! you're just right, my first writing of this was : for m in 'a', 'b', 'c' : print [ t for t in type(i).mro() if m in t.__dict__ ] which I carelessly ad wrongly rewrote using dir while posting. Sorry. -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find the first space?

2008-06-09 Thread Maric Michaud
/mailman/listinfo/python-list -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 4 26 88 00 97 Mobile: +33 6 32 77 00 21 -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I find out (dynamically) where a method is defined?

2008-06-09 Thread Maric Michaud
the reference on this and super, it worths the effort. -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 4 26 88 00 97 Mobile: +33 6 32 77 00 21 -- http://mail.python.org/mailman/listinfo/python-list

Re: Can this be done with list comprehension?

2008-06-09 Thread Maric Michaud
(itertools.chain((something,), (someMethod(i) for i in some_list))) -- _ Maric Michaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator metaclass

2008-05-22 Thread Maric Michaud
() -- _ Maric Michaud _ -- http://mail.python.org/mailman/listinfo/python-list

Problem with generator expression and class definition

2007-12-07 Thread Maric Michaud
I faced a strange behavior with generator expression, which seems like a bug, for both python 2.4 and 2.5 : class A : ... a = 1, 2, 3 ... b = 1, 2, 3 ... C = list((e,f) for e in a for f in b) ... Traceback (most recent call last): File stdin, line 1, in module File stdin, line

Re: How to clean a module?

2007-05-31 Thread Maric Michaud
ai a écrit : It assumes that there is a module A which have two global variables X and Y. If I run import A in the IDLE shell, then I can use A.X and A.Y correctly. But if I want to change the module A and then delete the variable Y, I find I can use A.Y just the same as before! It's unlikely

Re: Rats! vararg assignments don't work

2007-05-30 Thread Maric Michaud
samwyse a écrit : George Sakkis wrote: On May 29, 11:33 pm, Matimus [EMAIL PROTECTED] wrote: Your attemtp: [code] first, rest = arglist[0], arglist[1:] [/code] Is the most obvious and probably the most accepted way to do what you are looking for. As for adding the fucntionality you

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-29 Thread Maric Michaud
Steve Howell a écrit : --- Carsten Haese [EMAIL PROTECTED] wrote: On Sun, 2007-05-27 at 07:30 +, OKB (not okblacke) wrote: Underscores are harder to type than any alphanumeric character. This is a discussion about underscores versus capital letters denoting the word

Re: [B,IX] = sort(A,...) - Order for sort()-function

2007-05-29 Thread Maric Michaud
Orlando Döhring a écrit : ... A = [ 3 7 5 0 4 2 ]; # in Python: A = [[3,7,5],[0,4,2]] [B,IX] = sort(A,2) # sort by rows B = 3 5 7 0 2 4 IX = 1 3 2 1 3 2 # first line: 3 was formerly in the first position, 5

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Maric Michaud
Pierre Quentel a écrit : On 27 mai, 22:55, erikcw [EMAIL PROTECTED] wrote: Hi, I'm trying to turn o list of objects into a dictionary using a list comprehension. ... entries = dict([ (int(d.date.strftime('%m')),d.id) for d in links] ) With Python2.4 and above you can use a generator

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Maric Michaud
Ben Finney a écrit : Paul McGuire [EMAIL PROTECTED] writes: It is a bit reassuring that I am not the only one who turns a blind eye to this part of the PEP, that l_c_w_u bothers others as well. I see similar support for lower_case, and opposition to camelCase. It's nice that we're both

Re: os.path.walk not pruning descent tree (and I'm not happy with that behavior?)

2007-05-28 Thread Maric Michaud
I'm really sorry, for all that private mails, thunderbird is awfully stupid dealing with mailing lists folder. Gabriel Genellina a écrit : En Sun, 27 May 2007 22:39:32 -0300, Joe Ardent [EMAIL PROTECTED] escribió: - iterate backwards: for i in range(len(names)-1, -1, -1): fname =

Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-23 Thread Maric Michaud
Stef Mientki a écrit : hi Bruno, after study it carefully, it's much more complex than I thought (I can't understand it completely, which is of less importance). Your solution works great, but I need one little extension, which I can create, but just at the cost of a lot of code. Maybe

  1   2   3   >