Extension module question

2012-01-14 Thread Evan Driscoll
As I hinted at in an earlier email, I'm working on a module which will allow calling readdir() (and FindFirstFile on Windows, hopefully pretty uniformly) from Python. The responses I got convinced me that it was a good idea to write a C-to-Python bridge as an extension module. What I'm not sure ab

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Steven D'Aprano
On Sat, 14 Jan 2012 21:27:32 -0800, Rick Johnson wrote: > On Jan 14, 10:23 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >> This is not Java, and we prefer Python terminology. >> >> A variable holding an int is an int variable. A variable holding a >> string is a string variable.

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Rick Johnson
On Jan 14, 10:23 pm, Steven D'Aprano wrote: > This is not Java, and we prefer Python terminology. > > A variable holding an int is an int variable. > A variable holding a string is a string variable. > A variable holding a list is a list variable. > A variable holding an instance is an instance v

Learn Chinese (Mandarin) faster by using flashcards with pictures

2012-01-14 Thread ichineseflashcards 3
http://www.ichineseflashcards.com will help you learn Chinese (Mandarin) faster by using flashcards with pictures, thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Steven D'Aprano
On Sat, 14 Jan 2012 14:58:26 -0600, Evan Driscoll wrote: > On 01/14/2012 02:11 PM, Devin Jeanpierre wrote: >> On Sat, Jan 14, 2012 at 2:23 PM, Rick Johnson >> wrote: >>> THAT PISSES ME OFF!!!>:( We should never be forced to guess if a name >>> is a callable or a variable! >>> >>> So how do we so

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Steven D'Aprano
On Sat, 14 Jan 2012 11:23:29 -0800, Rick Johnson wrote: > On Jan 14, 1:01 pm, Devin Jeanpierre wrote: > >> What's "horrendous" about the datetime module interface? Your listed >> complaints (OOP etc.) don't seem to have anything to do with it. > > Well my immediate complaint about date-time is

Re: Hash stability

2012-01-14 Thread Terry Reedy
On 1/14/2012 9:26 PM, Roy Smith wrote: Steven D'Aprano wrote: How many people rely on hash(some_string) being stable across Python versions? Does anyone have code that will be broken if the string hashing algorithm changes? I would never rely on something like that unless the docs unambiguo

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Steven D'Aprano
On Sat, 14 Jan 2012 10:54:57 -0800, Rick Johnson wrote: > The interface for these modules is not intuitive. Instead of creating > true OOP objects we have lists and strings. Lists and strings are true OOP objects. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

why i can get nothing?

2012-01-14 Thread contro opinion
here is my code : import urllib import lxml.html down='http://download.v.163.com/dl/open/00DL0QDR0QDS0QHH.html' file=urllib.urlopen(down). read() root=lxml.html.document_fromstring(file) tnodes = root.xpath("//a/@href[contains(string(),'mp4')]") for i,add in enumerate(tnodes): print i,add why

Re: scientific notation in legend (pylab)

2012-01-14 Thread Jason Friedman
> I I would like to have numbers expressed in scientific notation in > legend annotations. Does anybody know how to do that? > Not sure why legend annotations makes the problem different, but perhaps this is a start: $ python3 Python 3.2 (r32:88445, Jun 11 2011, 10:38:04) [GCC 4.4.3] on linux2 Ty

mechanize can't get address

2012-01-14 Thread contro opinion
here is my code # -*- coding: gbk -*- import mechanize import cookielib target="http://v.163.com/movie/2008/10/O/Q/M7F57SUCS_M7F5R3DOQ.html"; # Browser br = mechanize.Browser() # Cookie Jar cj = cookielib.LWPCookieJar() br.set_cookiejar(cj) # Browser options br.set_handle_equiv(True) br.set_handle

Re: Hash stability

2012-01-14 Thread Roy Smith
In article <4f1107b7$0$29988$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On the Python Dev mailing list, there is a discussion going on about the > stability of the hash function for strings. > > How many people rely on hash(some_string) being stable across Python > versions

Re: Two questions about logging

2012-01-14 Thread Matthew Pounsett
On Jan 12, 8:03 pm, K Richard Pixley wrote: > Here's the confusion.  Each log named __name__ is under the root logger. >   If you want them all, then catch them all with the root logger. Thanks! I knew I was missing something obvious. Between you and Jean- Michael Pichavant I've figured out wha

Re: defining class and subclass in C

2012-01-14 Thread Tim Roberts
Daniel Franke wrote: > >I'd like to implement the equivalent of this Python code in a C-extension: > class A(object): >... pass class B(A): >... pass A > B > B.__bases__ >(,) > >However, loading my C-code (quoted below) I get: > import ca ca > ca.ca > > >H

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Chris Angelico
On Sun, Jan 15, 2012 at 10:19 AM, Rick Johnson wrote: > On Jan 14, 2:58 pm, Evan Driscoll wrote: >> On 01/14/2012 02:11 PM, Devin Jeanpierre wrote: > >> It also has some problems. For instance, if an object has a member which >> is a type that implements __call__ but is also useful to access "on

Re: Hash stability

2012-01-14 Thread Chris Angelico
On Sat, Jan 14, 2012 at 3:42 PM, Steven D'Aprano wrote: > On the Python Dev mailing list, there is a discussion going on about the > stability of the hash function for strings. > > How many people rely on hash(some_string) being stable across Python > versions? Does anyone have code that will be b

Re: defining class and subclass in C

2012-01-14 Thread Daniel Franke
On Saturday 14 January 2012 22:15:36 Daniel Franke wrote: > Here I'd expect "" instead?! And I never managed a proper > subclass :| Found an explanation on type/class at [1]: "he difference between the two is whether the C-level type instance structure is flagged as having been allocated on the

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Rick Johnson
On Jan 14, 2:58 pm, Evan Driscoll wrote: > On 01/14/2012 02:11 PM, Devin Jeanpierre wrote: > It also has some problems. For instance, if an object has a member which > is a type that implements __call__ but is also useful to access "on its > own", is that a field or a function? Can you site a re

Re: Hash stability

2012-01-14 Thread Heiko Wundram
Am 14.01.2012 10:46, schrieb Peter Otten: Steven D'Aprano wrote: How many people rely on hash(some_string) being stable across Python versions? Does anyone have code that will be broken if the string hashing algorithm changes? Nobody who understands the question ;) Erm, not exactly true. The

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Evan Driscoll
On 01/14/2012 02:11 PM, Devin Jeanpierre wrote: On Sat, Jan 14, 2012 at 2:23 PM, Rick Johnson wrote: THAT PISSES ME OFF!!!>:( We should never be forced to guess if a name is a callable or a variable! So how do we solve this dilemma you ask??? Well, we need to "mark" method OR variable names (

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Chris Angelico
On Sun, Jan 15, 2012 at 6:23 AM, Rick Johnson wrote: > Observe: >  def $method(self):pass >  self.@instanceveriable >  self.@@classvariable Are you deliberately inverting what PHP does, with $variablename? (Incidentally, that's one of the things that irks me about PHP - adorned variable names.)

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Rick Johnson
On Jan 14, 1:23 pm, Rick Johnson wrote: >   def $method(self):pass >   self.@instanceveriable >   self.@@classvariable Actually, class level methods can be accessed through ClassIdentifier.method, and instance methods through instanceidentifier.instancemethod. So decorating methods becomes moot.

defining class and subclass in C

2012-01-14 Thread Daniel Franke
Hi all. I spent some days and nights on this already and my google-fu is running out. I'd like to implement the equivalent of this Python code in a C-extension: >>> class A(object): ... pass >>> class B(A): ... pass >>> A >>> B >>> B.__bases__ (,) However, loading my C-code (quoted below)

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Devin Jeanpierre
On Sat, Jan 14, 2012 at 2:23 PM, Rick Johnson wrote: > THAT PISSES ME OFF!!! >:( We should never be forced to guess if a name > is a callable or a variable! > > So how do we solve this dilemma you ask??? Well, we need to "mark" > method OR variable names (OR both!) with syntactic markers so there

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Rick Johnson
On Jan 14, 1:01 pm, Devin Jeanpierre wrote: > What's "horrendous" about the datetime module interface? Your listed > complaints (OOP etc.) don't seem to have anything to do with it. Well my immediate complaint about date-time is actually a problem with the syntactic quandaries of the Python lang

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 7:08 PM, Joshua Miller wrote: > I've looked there and it didn't worki may've made all the nesscary > changes manually anyways though i'm not sure... What about it didn't work? Have a read of this too - http://wiki.python.org/moin/PortingPythonToPy3k and if you're still

Re: PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Devin Jeanpierre
On Sat, Jan 14, 2012 at 1:54 PM, Rick Johnson wrote: > The interface for these modules is not intuitive. Instead of creating > true OOP objects we have lists and strings. Any calendar object should > expose string names of both: days of the week and months of the year. > It seems one (or possibly

PyWarts: time, datetime, and calendar modules

2012-01-14 Thread Rick Johnson
The interface for these modules is not intuitive. Instead of creating true OOP objects we have lists and strings. Any calendar object should expose string names of both: days of the week and months of the year. It seems one (or possibly more) of the three expose this important info however i cannot

Re: open office in another language?

2012-01-14 Thread Dotan Cohen
Enjoy this relevant article: http://developers.slashdot.org/story/12/01/14/008236/code-cleanup-culls-libreoffice-cruft Dotan Cohen http://what-is-what.com/what_is/open_office.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 5:06 PM, Joshua Miller wrote: > Ok i'm trying to convert https://github.com/rdeaton/spyral to python3 > but i'm at a loss on how to actually use 2to3. Can someone explain > it's proper use to me so i can do the conversion? prefereably where i > can take "C:\Python32\Lib\sit

Can someone explain 2to3?

2012-01-14 Thread Joshua Miller
Ok i'm trying to convert https://github.com/rdeaton/spyral to python3 but i'm at a loss on how to actually use 2to3. Can someone explain it's proper use to me so i can do the conversion? prefereably where i can take "C:\Python32\Lib\site-packages\spyral\" and put it in a new directory that i will n

scientific notation in legend (pylab)

2012-01-14 Thread simona bellavista
Hi, I I would like to have numbers expressed in scientific notation in legend annotations. Does anybody know how to do that? Cheers, S. -- http://mail.python.org/mailman/listinfo/python-list

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 2:39 AM, Terry Reedy wrote: > On 1/13/2012 3:42 PM, Noah Hall wrote: >> >> On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi >>  wrote: >>> >>> dear people! >>> I have just opened my MTU client, and figured out that through my >>> comment, i caused a complete NONSENSE discussio

Re: ERROR:root:code for hash md5 was not found

2012-01-14 Thread Marc Christiansen
Steven D'Aprano wrote: > On Fri, 13 Jan 2012 06:14:50 -0800, mike wrote: >> pysibelius is a lib that we use. >> >> I am not sure that is the problem since the python program works on SuSE >> but not on RH server. And AFAIK >> the only difference ( well that I can see) is the OpenSSL version. > >

Re: Hash stability

2012-01-14 Thread Peter Otten
Steven D'Aprano wrote: > On the Python Dev mailing list, there is a discussion going on about the > stability of the hash function for strings. > > How many people rely on hash(some_string) being stable across Python > versions? Does anyone have code that will be broken if the string hashing > al

Re: logging and httphandler

2012-01-14 Thread Peter Otten
Jason Friedman wrote: > I am logging to my Apache web server, using this Apache format: > > LogFormat "%{%Y-%m-%d %H:%M:%S}t %U %q" scriptlog > CustomLog /var/log/apache2/script.log scriptlog > > My code is as follows: > > #!/usr/bin/env python3 > import logging, logging.handlers, sys > logger

Re: SMTPHandler and Unicode

2012-01-14 Thread Chris Withers
On 13/01/2012 20:17, Chris Withers wrote: Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger(mailhost=('smtp.example.com', 25),fromaddr='t...@example.com',toaddrs=('t...@example.com',)) LO

Re: understanding a program project

2012-01-14 Thread Richard Shea
On Jan 14, 9:29 am, Tracubik wrote: > Hi all, > i hope not to be too much OT with this request. > I'ld like to modify/contribute some open source in python, but first i've > to read and understand the code. > So, is there some guide lines / procedure to follow to help me in this > process. > I rem

Re: SMTPHandler and Unicode

2012-01-14 Thread Chris Withers
Hi Norbert, On 05/07/2010 13:22, norbert wrote: On 5 juil, 13:17, Chris Withers wrote: try MailingLogger: If you have unicode problems with that, I'd be interested in fixing them! Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger im