Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Masklinn
On 3 Feb 2010, at 11:50 , Jean-Michel Pichavant wrote: > > >>> The reason is that log takes an *int* as first argument that defines the >>> logging level. You gave a string. So There is definitely a reason for it to >>> be incorrect. >>> >> That's not a reason, that's just what currently ha

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Masklinn
On 2 Feb 2010, at 17:52 , Jean-Michel Pichavant wrote: > > Masklinn wrote: >> Jean-Michel Pichavant wrote: >> >>> To add a custom level, I would proceed that way: >>> >>> logging.ALERT = 45 >>> logging.addLevelName(logging.ALERT, '

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Masklinn
Jean-Michel Pichavant wrote: >To add a custom level, I would proceed that way: > >logging.ALERT = 45 >logging.addLevelName(logging.ALERT, 'ALERT !!') >logging.getLogger().log(logging.ALERT, 'test') > >Passing a string to the log method as you did is incorrect. I know it's currently incorrect. My p

Logging oddity: handlers mandatory in every single logger?

2010-02-01 Thread Masklinn
When trying to load the following config file, I get an error ``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled configparser in 3.1): [loggers] keys=root,0 [handlers] keys

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Masklinn
On 5 Aug 2009, at 19:17 , Bearophile wrote: Have you tried Hachoir? (I think its name may be changed to Fusil, I don't know). Name hasn't been changed (I think fusil is a subproject, something like that) on the other hand the hachoir.org site is dead. But apparently Hachoir was moved to bitbu

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Masklinn
On 5 Aug 2009, at 16:46 , Martin P. Hellwig wrote: Hi List, On several occasions I have needed (and build) a parser that reads a binary piece of data with custom structure. For example (bogus one): BE +-+-+-+-+--++ | Version | Command | Ins

Re: Confessions of a Python fanboy

2009-08-04 Thread Masklinn
On 4 Aug 2009, at 11:28 , Steven D'Aprano wrote: So I'd ask, does Smalltalk's message passing model match the way human beings think? Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help understanding the decisions *behind* python?

2009-08-04 Thread Masklinn
On 3 Aug 2009, at 18:57 , John Nagle wrote: Dave Angel wrote: sturlamolden wrote: On 20 Jul, 18:27, Phillip B Oldham wrote: Tuples are used for passing arguments to and from a function. Common use of tuples include multiple return values and optional arguments (*args). That's from Mesa, th

Re: Python docs disappointing

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 22:34 , Emmanuel Surleau wrote: You have first-grade documentation on the Python website: http://docs.python.org/library/urllib.html I'm not really using pydoc, but I'd wager it's more used as a quick lookup than anything else. Another important documentary resource for the

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 20:48 , Emmanuel Surleau wrote: On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote: On Jul 20, 9:27 am, Phillip B Oldham wrote: Specifically the "differences" between lists and tuples have us confused and have caused many "discussions" in the office. We understand that

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 20:17 , Steven D'Aprano wrote: On Fri, 31 Jul 2009 18:15:15 +0200, Masklinn wrote: I know, I know, Ruby people swear by anonymous code blocks, and I've read Paul Graham too. But I'm really not so sure that the benefits of anonymous code blocks are great eno

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 18:24 , Terry Reedy wrote: Masklinn wrote: #each is simply a method that takes a function (called blocks in ruby). One could call it a higher-order method I guess. It's an implementation of the concept of internal iteration: instead of collections yielding ite

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 17:55 , Steven D'Aprano wrote: But seriously, while I admit that I have very little Ruby experience, and so aren't in a great position to judge, it seems to me that Ruby doesn't have anything like Python's over-riding design principles (the Zen). If there is a design prin

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 15:12 , Bruno Desthuilliers wrote: Masklinn a écrit : On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that "Ruby, unlike less flexibl

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 11:54 , Iain King wrote: On Jul 31, 8:28 am, Steven D'Aprano wrote: On Thu, 30 Jul 2009 18:06:31 -0500, Robert Kern wrote: On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleau wrote: 1.) No need to use "()" to call a function with no arguments. Python -->

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 10:25 , Chris Rebert wrote: On Fri, Jul 31, 2009 at 1:21 AM, Xavier Ho wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn wrote: ... but since Python doesn't have anonymous functions that usage tends to be a bit too verbose ... Sorry to interrupt, but wouldn

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 30 Jul 2009, at 23:57 , Luis Zarrabeitia wrote: I'd like to ask, what "container.each" is, exactly? It looks like a function call (as I've learned a few posts ago), but, what are its arguments? How the looping "works"? Does it receive a "code" object that it has to execute? Is .each some

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 30 Jul 2009, at 23:52 , Jan Kaliszewski wrote: Dnia 30-07-2009 o 22:41:57 Masklinn napisał(a): On 30 Jul 2009, at 22:23 , Jan Kaliszewski wrote: 30-07-2009 o 13:36:49 Masklinn wrote: On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r wrote: 2.) the .each method

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 22:23 , Jan Kaliszewski wrote: 30-07-2009 o 13:36:49 Masklinn wrote: On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r wrote: 2.) the .each method container.each{|localVar| block} This method can really cleanup some ugly for loops, although i really like

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 20:06 , Falcolas wrote: On Jul 30, 11:56 am, Masklinn wrote: On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: How do I know if foo.value is an attribute or if it is a method that returns the foo value ? It cannot be an attribute. Ruby doesn't

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 20:05 , superpollo wrote: r wrote: On Jul 30, 12:15 pm, Masklinn wrote: [snip] Furthermore Ruby has a pretty nice convention (sadly not used enough I think) taken from Scheme where it's possible to postfix a method name with "!" (note: the "!&

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:42 , Carsten Haese wrote: r wrote: Of course in python you would do... vector.reverse --> in-place vector.reversed --> in-place You do know that only one of those works in-place, right? Well mostly because the other one doesn't exist (as python has `lst.reverse()` bu

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: On Jul 30, 11:31 am, Falcolas wrote: On Jul 29, 9:06 pm, r wrote: 1.) No need to use "()" to call a function with no arguments. Python --> "obj.m2().m3()" --ugly Ruby --> "obj.m1.m2.m3" -- sweeet! Man, i must admit i reall

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:01 , Inky 788 wrote: On Jul 30, 12:04 am, alex23 wrote: On Jul 30, 1:06 pm, r wrote: 1.) No need to use "()" to call a function with no arguments. Python --> "obj.m2().m3()" --ugly Ruby --> "obj.m1.m2.m3" -- sweeet! Man, i must admit i really like this, and your code

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 18:31 , Falcolas wrote: On Jul 29, 9:06 pm, r wrote: 1.) No need to use "()" to call a function with no arguments. Python --> "obj.m2().m3()" --ugly Ruby --> "obj.m1.m2.m3" -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. I perso

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 14:03 , superpollo wrote: Masklinn wrote: ... That's an interesting point, but not relevant at the end of the day: `foo.length` and `length(foo)` have the same "practicality". On the other hand Ruby can be praised for the coherence: everything's a

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r wrote: 1.) No need to use "()" to call a function with no arguments. Python --> "obj.m2().m3()" --ugly Ruby --> "obj.m1.m2.m3" -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. How do you

Re: beautiful soup

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 09:30 , Diez B. Roggisch wrote: xubin.cz schrieb: hi, everyone Is there any pakage or module handling html document like beautiful soup? why don't you *use* beautiful soup? It is a module... Or lxml, which works a bit better than BF 3.1 (post parser change) nowadays. -- h