Re: unsigned 32 bit arithmetic type?

2006-10-25 Thread Martin v. Löwis
Robin Becker schrieb: > def add32(x, y): > "Calculate (x + y) modulo 2**32" > return ((x&0xL)+(y&0xL)) & 0xL That's redundant; it is sufficient to write return (x+y) & 0x > def calcChecksum(data): > """Calculates TTF-style

Re: unsigned 32 bit arithmetic type?

2006-10-25 Thread Martin v. Löwis
Robin Becker schrieb: > Of course the actual semantics is dependent on what C unsigned > arithmetic does so we're relying on that being the same everywhere. Assuming that ULONG has the same width on all systems, the outcome is actually mandated by the C standard: unsigned arithmetic is defined to

Re: Python's CRT licensing on Windows <-- FUD

2006-10-25 Thread Martin v. Löwis
sturlamolden schrieb: > Is further "distribution" okay if it is only accompanied by the python > runtime DLL (as is the case when using Py2Exe) or should the entire > python-2.4.4.msi from python.org be "distributed"? As Fredrik Lundh says: Ask your lawyer. We cannot really interpret the Microsoft

Re: unsigned 32 bit arithmetic type?

2006-10-25 Thread Martin v. Löwis
Robin Becker schrieb: > I can see the advantage in the summation case where all the numbers are > known positive, however the full problem includes cases where there's an > "adjustment" to the sum and that usually ends up like this > > adjustment = unpack('>l', table[8:8+4])[0] > checksum

Re: question about True values

2006-10-25 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > the string class's "nil" value. Each of the builtin types has such an > "empty" or "nil" value: > > string "" > list[] > tuple () > dict{} > int 0 > float

Re: Is there a python development site for putting up python libraries that people might be interest in working on?

2006-10-25 Thread Martin v. Löwis
Kenneth McDonald schrieb: > I would like to avoid putting this up on sourceforge as I think it would > do much better at a site aimed specifically at Python development. As somebody else said: you should put the code and announce the package at the Cheeseshop: cheeseshop.python.org. This doesn't

Re: question about True values

2006-10-25 Thread Martin v. Löwis
John Coleman schrieb: > Yes - it just seems that there isn't a principled reason for implicitly > converting 3 to 3.0 in 3.0 == 3 but not implicitly converting "cat" to > boolean in "cat" == true. Sure there is: equality should be transitive. So while we have 3 == 3L == 3.0 == 3.0+0j and can there

Re: How to identify generator/iterator objects?

2006-10-25 Thread Martin v. Löwis
Kenneth McDonald schrieb: > To do this, I need to determine (as fair as I can see), what are > Is there a way to do this? Or perhaps another (better) way to achieve > this flattening effect? itertools doesn't seem to have anything that > will do it. As others have pointed out, there is a proper te

Re: Embedded python loading .so files?

2006-10-25 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > However, I would like to be able to import this package dynamically > within the application running on the host machine. When I attempted > to import the package within the already loaded python modules, I would > get errors that the C portions of the package could no

Re: basic questions on cmp, < and sort

2006-10-25 Thread Martin v. Löwis
Schüle Daniel schrieb: > first question > > In [117]: cmp("ABC",['A','B','C']) > Out[117]: 1 > > against what part of the list is the string "ABC" compared? The names of the types are compared: py> cmp("string", "list") 1 > second question > > In [119]: class X(object): >.: pass >

Re: Embedded python loading .so files?

2006-10-26 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I realize that this should include a ('.so','rb',3) entry (should it > not? 3->imp.C_EXTENSION) if it were going to locate the c extension. > Thus, my revised question would be what sets the suffixes for import? > How do/Can I change this? It depends on the target supp

Re: gettext on Windows

2006-10-28 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Traceback (most recent call last): > File "panicbutton.py", line 36, in ? > lan = gettext.GNUTranslations (open (sLang, "rb")) > File "C:\Python24\lib\gettext.py", line 177, in __init__ > self._parse(fp) > File "C:\Python24\lib\gettext.py", line 280, in _p

Re: gettext on Windows

2006-10-28 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Leo Kislov wrote: > >> Try msgunfmt >> http://www.gnu.org/software/gettext/manual/html_node/gettext_128.html#SEC128 >> to see if it can convert your files back to text. > > Just tried it, and it was able to convert each of the .mo files back to > text without any prob

Re: ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

2006-10-28 Thread Martin v. Löwis
sébastien martini schrieb: > I don't know if it can hide some bugs or if the module has just never > been updated to support this bytecode but LIST_APPEND is never emitted. > In the module compiler, list comprehensions are implemented without > emitting this bytecode, howewer the current implementa

Re: CHM help file for Python 2.5

2006-10-30 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Can anyone point me to new location of this version of manual, > or tell me why this format is no longer supported ... ? It's on the download page itself: http://www.python.org/download/releases/2.5/ http://www.python.org/ftp/python/2.5/Python25.chm Regards, Martin -

Re: Compile Python With SSL On Solaris 10

2006-10-30 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I am trying to compile py2.4.3/2.5 on a Solaris 10x86 machine, but > cannot get it to build an SSL enabled version. I have added the > relevant sfw directories into the path/crle, with no success. I've > even explicitly added ssl via the --with-libs directive, yet an

Re: Missing _init_types in MS VisualStudio 2005 (PCBuild8)

2006-10-31 Thread Martin v. Löwis
Donovan Kolbly schrieb: > I was trying to build Python using MS VisualStudio 2005 (VC++ 8.0) > according to the instructions in PCBuild8/ and got a link error > in config.obj referencing _init_types. That's a known bug, and has been fixed in the subversion repository since. > I (barely) know enou

Re: Integrating Python with Fortran

2006-10-31 Thread Martin v. Löwis
unexpected schrieb: > I'm aware of resources like the F2Py Interface generator, but this only > lets me access the Fortran modules I need in Python. I'm wondering if > there's a way to generate the .o files from Python (maybe using > py2exe?) and then link the .o file with the rest of the Fortran p

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-03 Thread Martin v. Löwis
robert schrieb: > in combination with some simple locking (anyway necessary) I don't see a > problem in ref-counting. In the current implementation, simple locking isn't necessary. The refcounter can be modified freely since the code modifying it will always hold the GIL. > Question Besides:

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread Martin v. Löwis
robert schrieb: > PS: Besides: what are speed costs of LOCK INC ? That very much depends on the implementation. In http://gcc.gnu.org/ml/java/2001-03/msg00132.html Hans Boehm claims it's 15 cycles. The LOCK prefix itself asserts the lock# bus signal for the entire operation, meaning that the ot

Re: win32file.DeviceIoControl(FSCTL_GET_RETRIEVAL_POINTERS)

2006-11-04 Thread Martin v. Löwis
Jim schrieb: > I'm not sure how to perform this operation in Python. The difficulty is > in knowing the size of the output buffer: if it is too small, I get an > "insufficient buffer" exception; too large, and I get an "end of file" > exception. In neither case is any partial data available. What

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread Martin v. Löwis
Paul Rubin schrieb: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: >>> PS: Besides: what are speed costs of LOCK INC ? >> That very much depends on the implementation. In >> http://gcc.gnu.org/ml/java/2001-03/msg00132.html >> Hans Boehm claims it&

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-05 Thread Martin v. Löwis
Paul Rubin schrieb: > I dunno about x86 hardware signals but these instructions do > read-modify-write operaitons. That means there has to be enough > interlocking to prevent two cpu's from updating the same memory > location simultaneously, which means the CPU's have to communicate. > See

Re: Building C extensions

2006-11-06 Thread Martin v. Löwis
Paolo Pantaleo schrieb: > Well I'm just courious: if I want to buid a C extension, I shoul use > the same compiler that has been used to build python (right?). Since > python has been built using Visual C, how can I build an extension if > I don't have Visual Studio? If you don't have mingw32, eit

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Paul Rubin schrieb: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: >> Ah, but in the case where the lock# signal is used, it's known that >> the data is not in the cache of the CPU performing the lock operation; >> I believe it is also known that the da

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > The thread that shares it increments the reference count before passing > its address to directly another thread or indirectly through a shared > container. To make a specific example, consider this fragment from Objects/fileobject.c: static PyObject * file_repr(PyFileObject

Re: os.path.exists and unicode filenames

2006-11-07 Thread Martin v. Löwis
Peter Bienstman schrieb: > UnicodeEncodeError: 'ascii' codec can't encode characters in position 24-29: > ordinal not in range(128) > > I could try encoding the string in utg-8, but then it wouldn't work under > Windows. > > Is there an elegant cross-platform solution for this? I assume you ar

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > Martin v. Löwis wrote: >> How would you propose to fix file_repr to prevent such >> a race condition? > > The race condition you describe is different from the one Joe Seigh > described. It's caused because without GIL access to the file obje

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > So give an example where reference counting is unsafe. Nobody claimed that, in that thread. Instead, the claim was "Atomic increment and decrement instructions are not by themselves sufficient to make reference counting safe." I did give an example, in <[EMAIL PROTECTED]>. E

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-08 Thread Martin v. Löwis
Ross Ridge schrieb: > The problem your describing isn't that reference counting hasn't been > made safe. What you and Joe seem to be trying to say is that atomic > increment and decrement instructions alone don't make accessing shared > structure members safe. All I can do is to repeat Joe's word

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-09 Thread Martin v. Löwis
robert schrieb: >>> what about speed. Is it true that IronPython is almost as fast as >>> C-Python meanwhile? > > thus there would be crash if 2 threads use the global variables > (module.__dict__) of a module? IronPython uses the .NET virtual machine. That, in itself, gives consistency guarantee

Re: Localized (international) informations on WXP

2006-11-10 Thread Martin v. Löwis
durumdara schrieb: > I want to get localized informations like month names, format > parameters, etc. Month names are available through calendar.month_name. Format parameters are available through locale.localeconv. > Have the Python a way to get these informations in uniformed way (like > php) t

Re: Python 2.5 Core Dump on Solaris 8

2006-11-10 Thread Martin v. Löwis
Melissa Evans schrieb: > I've modified grappy.py, > http://www.stacken.kth.se/~mattiasa/projects/grappy/, a postfix policy > daemon for greylisting. to use LDAP as a backend instead of SQL (with > python-ldap.) The daemon runs fine when testing but when I put it under > load it core dumps quickly.

Re: Python-2.5.exe?

2006-11-15 Thread Martin v. Löwis
John Salerno schrieb: > Is it safe to assume that if you do this, Python first looks in > C:\Python25 for the dll file, before trying to find the non-existent (on > the USB drive) C:\Windows\System32? python25.dll is found through mechanisms of the operating system, not through code in Python. The

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-16 Thread Martin v. Löwis
gabor schrieb: > so basically i'd like to ask here: am i reading something incorrectly? You are reading it correctly. This is how it behaves. > or am i using os.listdir the "wrong way"? how do other people deal with > this? You didn't say why the behavior causes a problem for you - you only exp

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-16 Thread Martin v. Löwis
gabor schrieb: >> All this code will typically work just fine with the current behavior, >> so people typically don't see any problem. >> > > i am sorry, but it will not work. actually this is exactly what i did, > and it did not work. it dies in the os.path.join call, where file_name > is convert

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-16 Thread Martin v. Löwis
Jean-Paul Calderone schrieb: >> How would you propose listdir should behave? > > Umm, just a wild guess, but how about raising an exception which includes > the name of the file which could not be decoded? There may be multiple of these, of course, but I assume that you want it to report the firs

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-16 Thread Martin v. Löwis
gabor schrieb: > i also recommend this approach. > > also, raising an exception goes well with the principle of the least > surprise imho. Are you saying you wouldn't have been surprised if that had been the behavior? How would you deal with that exception in your code? Regards, Martin -- http:

Re: Large Dictionaries

2006-05-29 Thread Martin v. Löwis
Roy Smith wrote: > My guess would be that each resize grows the table by a constant > factor, which IIRC, works out to amortized O(n). Right. For <5 entries, the size is multiplied by 4 each time, and doubled each time for large dictionaries. > It's not as good as > creating the dict the rig

Re: Python less error-prone than Java

2006-06-05 Thread Martin v. Löwis
Ilpo Nyyssönen wrote: >> Buggy library code is what prompted that article. > > Yes, but it is an error type that happens very rarely still. And so it > seems that very few programs even notice that bug in that library. That's certainly the case. The bug went unnoticed in the Java library for nea

Re: Python less error-prone than Java

2006-06-05 Thread Martin v. Löwis
Christoph Zwerschke wrote: > Anyway, in Python, you would first define: > > def wrap(x, at=1<<31): > if x < -at: > x += at*2 > elif x >= at: > x -= at*2 > return x > > Then, the Python program would be as simple: > > Distance = lambda t1,t0: wrap(t1-t0) In Python 2.4

Re: Where is the ucs-32 codec?

2006-06-05 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Python seems to be missing a UCS-32 codec, even in wide builds (not > that it the build should matter). > Is there some deep reason or should I just contribute a patch? The only reason is that nobody has needed one so far, and because it is quite some work to do if done

Re: Where is the ucs-32 codec?

2006-06-05 Thread Martin v. Löwis
Erik Max Francis wrote: >> The only reason is that nobody has needed one so far, and because >> it is quite some work to do if done correctly. Why do you need it? > > Why would it be "quite some work"? Converting from UTF-16 to UTF-32 is > pretty straightforward, and UTF-16 is already supported.

Re: strategy pattern and non-public virtual functions

2006-06-05 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Just translating this code to python won't work, due to the name > mangling of private functions: > class B(object): > def f(self): > self.__f() > > class D(B): > def __f(self): > pass > > d = D() > d.f() > > So my questions are: > 1. Is there a

Re: Where is the ucs-32 codec?

2006-06-09 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: >> I would like to see it correct, unlike the current UTF-16 codec. Perhaps >> whoever contributes an UTF-32 codec could also deal with the defects of >> the UTF-16 codec. >> > Now this is interesting, as I hoped to base my code on UTF-16 (and > perhaps UTF-8 for combining

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

2006-06-15 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > the problem is not the ABI, but the runtime libraries. From what you're > saying, it looks like we will have to standardize on VS2003. As I said, > we need to buy VS anyway because of the MFC support. On the other hand, > I really worry about all those people that want to

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

2006-06-16 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > thanks for the tip, I wasn't fully aware of that. OTOH, though GCC > might be a theoretical alternative, it isn't a practical one for many > situations: > > * In a professional environment, it opens up another can of potential > problems, where one would rather like to s

Re: msvcr71.dll necessary? - Re: Which compiler will Python 2.5 / Windows (Intel) be built with?

2006-06-16 Thread Martin v. Löwis
robert wrote: > For me the great great problem with Python2.4's lib geometry was that > the size of distributable app installers swelled suddenly by many megs > with msvcr71.dll and mfc71 and codecs in core and all. codecs are in python24.dll, mscvr71, mfc71 and all are not. However, they are not

Re: msvcr71.dll necessary? - Re: Which compiler will Python 2.5 / Windows (Intel) be built with?

2006-06-17 Thread Martin v. Löwis
robert wrote: > hmm, yet msvcrt4 is obviously preinstalled on each Windows - and its in > Windows Update Process. Its tagged: "4.20 - OS use only. DO NOT > DISTRIBUTE") > Think, in principle its possible to compile against that with > VS2003/2005... ? > ( think msvcrt4 is not delivered extra even

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

2006-06-17 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Bottom Line: As I said before, I don't have a problem using VC2003 or > anything. It's by far the cheapest and easiest way just to buy VC2003 > and be done with it, than to fiddle around with GCC or anything. I just > think that Python should use the best technology avail

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

2006-06-18 Thread Martin v. Löwis
Scott David Daniels wrote: > I musunderstood you. I thought you were advocating that Python itself > be built on gcc, obviating many compiler access issues. That wouldn't > work because gcc cannot, by itself (as I understand it) get to all the > nooks and crannies a windows developer may need to

Re: documentation for the change of Python 2.5

2006-06-28 Thread Martin v. Löwis
bussiere wrote: > I've read thsi documentation n: > http://docs.python.org/dev/whatsnew/whatsnew25.html > is there a way to have it in a more printable form ? Yes. Download http://www.python.org/ftp/python/doc/2.5b1/pdf-a4-2.5b1.tar.bz2 and extract whatsnew25.pdf. Regards, Martin -- http://mai

Re: handling unicode data

2006-06-28 Thread Martin v. Löwis
Fredrik Lundh wrote: > looks like the DB-API driver returns 8-bit ISO-8859-1 strings instead of > Unicode > strings. there might be some configuration option for this; see > Where did you want to point the OP here? > in worst case, you could do something like > > def unicodify(value): >

Re: String Question

2006-06-28 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > mac_string = '001485e55503' (This is the mac address of a computer.) > Since the MAC adddress are hexadecimal, how should I go about it here. > > Please help, every help is appreciated. Thanks I could not quite understand what you are trying to achieve, but it appears

Re: handling unicode data

2006-06-29 Thread Martin v. Löwis
Filipe wrote: >> Also, it appears that DB-Library (the API used by pymssql) always >> returns CP_ACP characters (unless ANSI-to-OEM conversion is enabled); >> so the "right" encoding to use is "mbcs". > > do you mean using something like the following line? > term = unicode(row[1], "mbcs") Correc

Re: Interprocess communication on multi-user machine

2006-06-29 Thread Martin v. Löwis
Michael Butscher wrote: > I'm wanting a method for interprocess communication which is OS- > independent (sockets would be the normal way to go), but which works if > multiple users use the machine at the same time so that one user has no > access to the communication of programs of another user.

Re: handling unicode data

2006-06-30 Thread Martin v. Löwis
Filipe wrote: > output --- > u'Fran\xd8a' > FranØa > > > > What do you think? Might it be Pymssql doing something wrong? I think the data in your database is already wrong. Are you sure the valu

Re: handling unicode data

2006-07-04 Thread Martin v. Löwis
Filipe wrote: > term = row[1] > print repr(term) > > output I got in Pyscripter's interpreter window: > 'Fran\x87a' > > output I got in the command line: > 'Fran\xd8a' > > I'd expect "print" to behave differently according with the console's > encoding, but does this mean this happens with repr(

Re: handling unicode data

2006-07-05 Thread Martin v. Löwis
Filipe wrote: > They do, in fact, output different values. The value outputed by > pyscripter was "135" (x87) while the value outputed in the command line > was "216" (xd8). I can't understand why though, because the script > being run is precisely the same on both environments. That's indeed surp

Re: urllib2 on Windows Vista

2006-07-10 Thread Martin v. Löwis
Sriram Krishnan wrote: > I'm running Python 2.4.3 on Windows Vista June CTP. I'm not able to > open any site using the urllib2 and related family of modules I think you need to break the error further down. Try httplib instead of urllib, and see what connect does. Then break this down into socket

Re: unicode "table of character" implementation in python

2006-08-28 Thread Martin v. Löwis
Nicolas Pontoizeau schrieb: > I am handling a mixed languages text file encoded in UTF-8. Theres is > mainly French, English and Asian languages. I need to detect every > asian characters in order to enclose it by a special tag for latex. > Does anybody know if there is a unicode "table of characte

Re: libcurses.so & installing Python 2.4.3

2006-08-28 Thread Martin v. Löwis
dmulcahy schrieb: > I am trying to build the binaries for Python 2.4.3 on a Sun E6900 > running SPARC Solaris 9 and using gcc 3.4.2. > > When the makefile tries to build the _curses extension it fails with a > symbol referencing error on "mvwgetnstr", which it appears should exist > in libcurses.s

Re: M$ windows python libs installed in arbitrary directories forcustomized python distributions

2006-08-28 Thread Martin v. Löwis
Fredrik Lundh schrieb: >> Is there any way to force the actual python site-lib for M$ installers > > it's spelled "Windows installers" I want to second this. It was me who created the installer, and I don't like to see my name abbreviated as M$ (if you think you should write out the name of t

Re: how to get the os file icon for a given content-type?

2006-08-28 Thread Martin v. Löwis
Paul Boddie schrieb: > neoedmund wrote: > > [File icons for a given content type] > >> So what? Java 5.0 has the method, why python has not? > > I'd be generally surprised if whichever Java API responsible for this > managed to work it out correctly for the different free desktop > environments

Re: unicode "table of character" implementation in python

2006-09-09 Thread Martin v. Löwis
Tim Roberts schrieb: >> 0530..058F; Armenian >> 0590..05FF; Hebrew >> ... > > This is a fabulously useful list, Martin. Did you get this from a web > page? Can you tell me where? It's part of the Unicode Consortium's database (UCD, Unicode Character Database). This specific table is called "cod

Re: ANN: GMPY binaries for Windows 2.5

2006-09-09 Thread Martin v. Löwis
Marc 'BlackJack' Rintsch schrieb: > Interesting subject line. I think I still have a set of "Win 3.11 for > workgroups" disks lying around somewhere, but where do I get Windows 2.5? ;-) IIRC, there was no Windows 2.5 release. There was a Windows 2.1 release; it was released in May '88, but then t

Re: os.name under Win32

2006-09-09 Thread Martin v. Löwis
Igor Kravtchenko schrieb: > My question is whether that is supposed to be totally impossible. > Under Win32, we are indeed supposed to have os.name = "nt". Is that value > hardcoded in Win32 binaries distribution themself? Can it potentially > change? I can't test it right now, but I would expec

Re: How to build extensions on Windows?

2006-09-09 Thread Martin v. Löwis
Kevin D. Smith schrieb: > Then there is Mike Fletcher's web page > (http://www.vrplumber.com/programming/mstoolkit/) that describes in > detail how to build extensions, but most of the links to external > software are no longer valid. I think it's safe to say that I am > completely lost, as there

Re: Can I make unicode in a repr() print readably?

2006-09-10 Thread Martin v. Löwis
Terry Hancock schrieb: > Is it possible to define some combination of __repr__, __str__, > and/or __unicode__ so that the unicode() wrapper isn't necessary > in this statement: I'm not aware of a way of doing so. > Or, put another way, what exactly does 'print' do when it gets > a class instance

Re: OT: What encoding is this?

2006-09-10 Thread Martin v. Löwis
Neil Hodgson schrieb: >> http://www.loppen.dk/side.php?navn=getin > > More pages without declarations are produced on Windows so > I'd guess that its Windows-1252. To tell, look for prices in Euros ("€") > on the site. Ah, but they still use krones in Denmark :-) Regards, Martin -- http://ma

Re: Can I make unicode in a repr() print readably?

2006-09-11 Thread Martin v. Löwis
Terry Hancock schrieb: > I don't know about the backwards compatibility issue. I'm not sure > what would be affected. But "print" frequently generates encoded > Unicode output if the stream supports it, so there is no guarantee > whether it produces unicode or string output now. I'm not worried a

Re: How to write UNIX daemons in Python?

2006-09-13 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > What should I use to do something like that? Do I have to use > distutils? Do I have to use third party packages? Do I have to write a > "setup.py" and solve the problem manually? > This last solution is problematic becouse, for (dumb) example, Debian > wants executable

Re: os.name under Win32

2006-09-13 Thread Martin v. Löwis
Igor Kravtchenko schrieb: > Recently, someone advised me to use instead: > platform.system() > > that returns only 3 different strings: Java, Linux or Windows. End of > story. That's not true: ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#1, Jun 20 2005, 17:18:51) [C]

Re: pickle and instancemethod objects

2006-09-13 Thread Martin v. Löwis
Steven Bethard schrieb: > Does this approach seem sound? Am I going to run into some weird > problems doing it this way? It's good, but I think rebuilding the object through new.instancemethod should be even better. py> class A: ... def f(self):print "A" ... py> class B(A): ... def f(self):p

Re: How to build extensions on Windows?

2006-09-13 Thread Martin v. Löwis
John Machin schrieb: > Any support for the radical notion of the error message giving the full > path of the file that it's complaining about? If so, I'll lob in an > enhancement request in the morning ... A patch would be appreciated much more so. Regards, Martin -- http://mail.python.org/mailm

Re: How to build extensions on Windows?

2006-09-13 Thread Martin v. Löwis
Fuzzyman schrieb: > More interestingly, someone reported on Python-dev recently a speed > improvement of around 30% (from memory) by compiling with VC 8. I know > the grumble (almost certainly correctly) about Microsoft's 'odd' > interpretation of the C standards in VC 8, but it looks like there ar

Re: How to build extensions on Windows?

2006-09-13 Thread Martin v. Löwis
John Machin schrieb: > Hi Martin, I do hope you don't regret opening Pandora's box :-) > > Does the following look about right? Technically, yes. I wonder whether it will generate unreadable error messages, though (one would have to try). > I was somewhat bemused by the limit of 200 bytes on the

Re: How to build extensions on Windows?

2006-09-14 Thread Martin v. Löwis
Fuzzyman schrieb: >> You may or may not know that it is futile arguing about compiler >> switching for released versions of Python, i.e. 2.3, 2.4, and 2.5. >> Whether or not it might be a good idea: it can't be done, for >> compatibility with prior releases. > > Of course, but Python development c

Re: high level, fast XML package for Python?

2006-09-17 Thread Martin v. Löwis
Gleb Rybkin schrieb: > I searched online, but couldn't really find a standard package for > working with Python and XML -- everybody seems to suggest different > ones. > > Is there a standard xml package for Python? Preferably high-level, fast > and that can parse in-file, not in-memory since I h

Re: Hardlinks on NTFS

2006-09-17 Thread Martin v. Löwis
Calvin Spealman schrieb: >> I'm thinking of letting my program create hardlinks (or symlinks). I >> know python allows doing this for ext, reiser and the like, but >> apparently not for ntfs systems. >> Is there any package out there that lets me create links in a platform >> independent way? >> >

Re: Installing Python on a 64-Bit OS

2006-09-19 Thread Martin v. Löwis
Nico Grubert schrieb: > Is there anything special I have to care about or is installing Python > on a 64 Bit OS just as easy as installing it on a 32-Bit OS? Despite what everybody else said: most likely, special care is necessary. However, nobody probably knows what precisely you need to be aware

Re: high level, fast XML package for Python?

2006-09-20 Thread Martin v. Löwis
Paul Boddie schrieb: >> It seems that everybody is proposing libraries that use in-memory >> representations. There is a standard xml package for Python, it's >> called "xml" (and comes with the standard library). It contains a >> SAX interface, xml.sax, which can parse files incrementally. > > Wh

Re: byte count unicode string

2006-09-20 Thread Martin v. Löwis
willie schrieb: > Thank you for your patience and for educating me. > (Though I still have a long way to go before enlightenment) > I thought Python might have a small weakness in > lacking an efficient way to get the number of bytes > in a "UTF-8 encoded Python string object" (proper?), > but I've

Re: Python 2.5 WinXP AMD64

2006-09-21 Thread Martin v. Löwis
Bjoern Schliessmann schrieb: >> To be exact, you need a 64bit Windows OS on a 64bit cpu. > > Is there a reason that can be explained in a less-than-2-KB > posting? :) I mean why Python depends on the processor type that > much. In the AMD-64 package, python.exe, python25.dll etc are declared (by

Re: distutils on Windows with VC++ 8

2006-09-21 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I'm trying to install two different packages which wrap C or C++ code > and which make use of distutils.build_ext, which barfs because my only > compiler is too new. Trying this both on Python 2.4.3 and 2.5. > Evidently there is a requirement that the compiler used to

Re: Building things with setup.py

2006-09-21 Thread Martin v. Löwis
James Stroud schrieb: > This is annoying. I am trying to build scipy right now but every .so > file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared" > to the ld flags. That shouldn't be necessary. Linking without this should work just fine. That way, since you made libpython2.5.

Re: Building things with setup.py

2006-09-22 Thread Martin v. Löwis
James Stroud schrieb: >> What happens if you omit these flags? > > Please see my last message to Robert Kern. If you don't want me to help you, that's fine, then I won't. I couldn't find an answer to this question in any of your messages in this thread. Still, it *should* work out of the box. I

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Martin v. Löwis
Rob Williscroft schrieb: > Download the 1.1 SDK: > > http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6- > 3647-4070-9F41-A333C6B9181D&displaylang=en> > > yes it does have 90 odd megabytes of stuff you don't want but the C/C++ > compiler is in there. That's yet another option. Som

Re: no-installation version of python

2006-09-22 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Is there a stand-alone version of python out there that I can package > with my scripts so that I don't have to bother with something like > py2exe? Yes, google for "movable Python". Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Building things with setup.py

2006-09-22 Thread Martin v. Löwis
James Stroud schrieb: > I think I would like to know how to avoid or correct these sort of > issues in the future, which seem to be limited, for me at least, to > scipy and numpy, with the possible exception of MySQLdb and its > dependency on zlib. Ideally, I would like to understand exactly what >

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Martin v. Löwis
Rob Williscroft schrieb: > Having read Noel Byron's reply also, I'm tempted to say there is > some confusion here between a Visual *Studio* toolkit (VS 2003) > and a Visual *C++* toolkit (VC 2003). Ah, that could well be. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 Installation and Tkinter

2006-09-22 Thread Martin v. Löwis
milan_sanremo schrieb: > cc -shared > build/temp.solaris-2.10-i86pc-2.5/tmp/Python-2.5/Modules/_tkinter.o > build/temp.solaris-2.10-i86pc-2.5/tmp/Python-2.5/Modules/tkappinit.o > -L/usr/openwin/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o > build/lib.solaris-2.10-i86pc-2.5/_tkinter.so > > Yet, t

Re: Building things with setup.py

2006-09-23 Thread Martin v. Löwis
James Stroud schrieb: > Though great for self development, I'm not so sure such > lessons should be necessary to build these tools. Yes. The lesson you should take from this is: don't try to be smarter than the authors of the software. It should build out of the box, if you follow the build instru

Re: anybody using python 2.5 that raises error while importing?

2006-09-23 Thread Martin v. Löwis
Dennis Lee Bieber schrieb: > On 23 Sep 2006 09:24:09 -0700, "daniel" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> so the implementation rules of python extension module must have been >> changed, for now, I have to wait for the new release of that module and > > N

Re: Problems with Python 2.5 installer.

2006-09-25 Thread Martin v. Löwis
paw schrieb: > Google turned up nothing useful that I could find, is anyone else > seeing this problem? I haven't heard of it before. Please run the file with msiexec /i python-2.5.msi /l*v python.log and post the resulting python.log in a bug report at sf.net/projects/python. Rega

Re: installation of python-dev

2006-09-25 Thread Martin v. Löwis
Diez B. Roggisch schrieb: > I guess it is some linuxish system, as he talks about dev-packages. > Unfortunately, quite a few distros (debian based ones and Suse to my > knowledge) in fact remove distutils from the core and make it available as > extra devel package. For whatever reason... I guess

Re: Python extensions on Win32

2006-09-25 Thread Martin v. Löwis
Cliff Wells schrieb: > 1) Is VC++ 2005 compatible with VC++ 2003? No. If you know very well how the extension module is written, and what precisely the incompatibilities are, you may get away with linking to msvcr8.dll, anyway. > If not, how can someone > acquire VC++ 2003 (aside from thepirate

Re: Python 2.5 Installation and Tkinter

2006-09-27 Thread Martin v. Löwis
milan_sanremo schrieb: > gcc -shared > build/temp.solaris-2.10-i86pc-2.5/export/home/rhancock/download/install/Python-2.5/Modules/_tkinter.o > build/temp.solaris-2.10-i86pc-2.5/export/home/rhancock/download/install/Python-2.5/Modules/tkappinit.o > -L/usr/openwin/lib -L/usr/local/lib -ltk8.4 -ltcl8.

Re: Why don't optional mutable objects show up in vars(func)?

2006-09-27 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > So I just got bitten by the "don't use a mutable object as an optional > argument" gotcha. I now realize that for this function: > def func(x, y=[]): > ... y.append(x) > ... print y > ... > > y is initialized when the function is imported, not when the f

Re: Python and Win95B

2006-09-28 Thread Martin v. Löwis
Ciarán Ó Duibhín schrieb: > I've just installed Python 2.5 under Win95B, and when run it says "The > PYTHON25.DLL file is linked to missing export > KERNEL32.DLL.GetFileAttributesExA". > > Does Python 2.5 not run under Win95? Apparently not. I knew this would be a problem when I wrote the code

<    4   5   6   7   8   9   10   11   12   13   >