Re: efficient Python object count

2008-11-07 Thread Christian Heimes
darrenr wrote: Thanks for the quick reply. Could you provide a link to more information on the debug build you refer to? Here you are: http://svn.python.org/projects/python/branches/release25-maint/Misc/SpecialBuilds.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: C Module question

2008-11-10 Thread Christian Heimes
[EMAIL PROTECTED] wrote: Hello, I'm trying to write a Python extension module in C for the first time. I have two questions: I have a much better suggestion: Use Cython! Although I'm pretty experienced with the Python C API, I prefer Cython over hand written C code for most stuff. It's s

Re: best gcc version for Python

2008-11-16 Thread Christian Heimes
Robin Becker wrote: I've just been testing out Jakob Sievers' speedup of Python 2.5.2 by compiling on freebsd with gcc-4.3.3 (the standard freebsd 6.1 gcc is 3.4.4). I'm glad to say that his modification did improve pybench overall by about 12%, but during the testing I noticed that in fact s

Re: Win 98 --Is 2.4.x The last version of Python for It?

2008-11-16 Thread Christian Heimes
Python 2.5 is the last version for Win9x and NT. Starting with Python 2.6 and 3.0 at least Windows 2000 SP4 is required. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 __cmp__ semantic change?

2008-11-20 Thread Christian Heimes
Johannes Bauer wrote: Hello group, I'm porting some code of mine to Python 3. One class has the __cmp__ operator overloaded, but comparison doesn't seem to work anymore with that: __cmp__ is gone Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 __cmp__ semantic change?

2008-11-20 Thread Christian Heimes
Terry Reedy wrote: I was going to say "look in "What's New", but the __cmp__ removal is missing. So I filed http://bugs.python.org/issue4372 The whatsnew section of Python 3.0 is still empty. Guido didn't had time to write it. http://bugs.python.org/issue2306 -- http://mail.python.org/mail

Re: How to get the class instance of a passed method ?

2008-11-20 Thread Christian Heimes
Stef Mientki wrote: hello, if I pass a class method to a function, is it possible to determine the class instance in that function ? class test ( object ) : def My_Method ( self ) : return 22 def do_something ( parameter ) : # here I want to determine My_Instance My_Instance = test () d

Re: A tale of two execs

2009-02-23 Thread Christian Heimes
bieff...@gmail.com wrote > I checked, and, for windows platform subprocess.py uses the modules > mvscrt and _subprocess, which I ham unable to > locate on my windows XP python 2.6 installation. This make the whole > thing harder, even impossible if _subprocess has > been created especially for subp

Re: A tale of two execs

2009-02-23 Thread Christian Heimes
aha wrote > def runner(cmd, stdin, stdout, ...): > try: > import subprocess > sbm = 1 > except: > sbm = 0 > > # Now do something > if sbm: > process = subporcess(...) > else: > import popen2 > process = popen2.Popen4(...) > > Has anyone else run into a situation

Re: Reference or Value?

2009-02-23 Thread Christian Heimes
Denis Kasak wrote > You could, however, argue that the swap function doesn't work as > expected (e.g. from a Pascal or a C++ POV) simply because the > underlying objects aren't mutable. The objects *do* get passed by > reference; We are getting down the same road every couple of months. Please do

Re: Problem with os.system()

2009-02-24 Thread Christian Heimes
venutaurus...@gmail.com schrieb: > Hello, > I am facing problems while using os.system() of python for > copying a file from source to destination where the file name is in > unicode (multi lingual characters).My python interpreter is trying to > convert them to ascii and is failing. I tri

Re: single thread decrement a semaphore object more than once?

2009-02-24 Thread Christian Heimes
birdsong wrote: > I searched but didn't see this already discussed, sorry if I didn't > search hard enough. > > Can I decrement a semaphore's counter within the same thread more than > once? I'd like to set hard and soft limits in a server I'm writing. > The server upon initialization would creat

Re: Convert PySerial to python 3.0

2009-02-25 Thread Christian Heimes
Seth wrote: > I implemented "if isinstance(port, str): " that seems to work for now. > > Currently I am running into: > > err, n = win32file.WriteFile(self.hComPort, data, > self._overlappedWrite) > TypeError: expected an object with a buffer interface Unicode objects (in Py3k: str) don't implem

Re: Convert PySerial to python 3.0

2009-02-25 Thread Christian Heimes
Seth wrote: > I tried all three ways you guys listed nothing seems to convert the > string to bytes. > > It may have to do with the makeDeviceName function, but I can't find > where that is defined. > > Any thoughts?? > > Here is the whole block of code: > > if type(port) in (str, bytes):

Re: coding style - try, except

2009-02-25 Thread Christian Heimes
RGK wrote: > Any input appreciated :) How about: import logging try: # run your function some_function() except Exception: # except only the exceptions you *really* want to catch # at most you should except "Exception" since it doesn't # catch KeyboardInterrupt and SystemExit l

Re: class property not working in python 2.5.1

2009-02-25 Thread Christian Heimes
Dan Barbus schrieb: > Hi, > > I have a problem with setting a property to a class instance, in > python 2.5.1. The property is defined through get and set methods, but > when I set it, the setter doesn't get called. Instead, I believe the > property in the instance gets replaced with a new object

Re: subprocess module: execution of standard binaries without shell?

2009-02-26 Thread Christian Heimes
Visco Shaun schrieb: > hi all > > while getting used to with subprocess module i failed in executuing a) > but succeeded in running b). Can anyone explain me why as i am providing > absolute path? Is this has to do anything with shared library.. which > must be accessed based on system variables?

Re: How best to test functions which use date.today

2009-02-28 Thread Christian Heimes
Lie Ryan wrote: >> But this fails with: >> >> TypeError: can't set attributes of built-in/extension type >> 'datetime.date' > > This is because today is an attribute. In python, we can override > attribute access to become a function call. I don't have python right > now, but try this: > > del da

Re: OTish: convince the team to drop VBScript

2009-02-28 Thread Christian Heimes
Christian R. schrieb: > Hello, > > Brand new to this list, I've not found a quick way to search the > archives, and this is not a technical question. > > I've just been hired at a digital signage company. They use VBScript > for simple-to-medium scripting. I've abandoned it about 8 years ago. I >

Re: Email Program

2009-02-28 Thread Christian Heimes
Thomas Raef wrote: > What a great response. It's a correct, straight forward and short answer to the op's question. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of Python 3

2009-03-01 Thread Christian Heimes
Kless schrieb: > Does anybody has seen the performance of Python 3? > Respect to speed it's the last language together to Ruby 1.8, but Ruby > 1.9 has a lot of better performance. :( Python 3.0 is slower than Python 2.5 and 2.6. Lot's of code was added or modified -- code that hasn't been optimize

Re: TypeErrors

2009-03-01 Thread Christian Heimes
Benjamin Kaplan wrote: > cmp(e, string) is actually just a shortcut for e.__cmp__(string). FYI, cmp(e, string) does a lot more than just calling e.__cmp__(string). Check out Objects/object.c:do_cmp() Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: String Identity Test

2009-03-04 Thread Christian Heimes
Avetis KAZARIAN schrieb: > Gary Herron wrote: >> The question now is: Why do you care? The properties of strings do >> not depend on the implementation's choice, so you shouldn't care because >> of programming considerations. Perhaps it's just a matter of curiosity >> on your part. >> >> Gary H

Re: Python3 on the Web

2009-03-05 Thread Christian Heimes
Johannes Permoser wrote: > But what's the way to bring python3 to the Web? > mod_python isn't available, cgi is said to be slow, mod_wsgi looks > complicated... WSGI is the right way to go. It's *the* Python standard for web application interfaces. You don't need mod_wsgi and Apache to run a WSGI

Re: How to import Python files in the other directories?

2009-03-05 Thread Christian Heimes
Muddy Coder schrieb: > Hi Folks, > > If I have a python file foo.py in the current directory, I can simply > import it in the way below: > > import foo > > when a project keeps grow, more and more Python files are created, and > they are also needed to put into different directories. Then, a > p

Re: how to prevent python import from looking into the current directory

2009-03-06 Thread Christian Heimes
TP schrieb: > Hi everybody, > > I would like to prevent the loading of modules in the current directory. > For example, if I have a personal module in the current directory > named "os", when I do "import os", I would like Python to import os > standard module, not my personal module of the curren

Re: Windows install to custom location after building from source

2009-03-06 Thread Christian Heimes
dan.erik.peter...@gmail.com schrieb: > I suppose that what I am looking for is the Windows version of "make > install" as we know it after running configure with -- > prefix=custom_location --exec-prefix=custom_location flags and make on > the Linux platform. The Windows build system doesn't have

Re: create boolean

2009-03-06 Thread Christian Heimes
Fencer schrieb: > Hi, I need a boolean b to be true if the variable n is not None and not > an empty list, otherwise b should be false. > I ended up with: > b = n is not None and not not n > which seems to work but is that normally how you would do it? > It can be assumed that n is always None or a

Re: "/a" is not "/a" ?

2009-03-06 Thread Christian Heimes
Emanuele D'Arrigo wrote: > So, it appears that in the first case a and b are names to the same > string object, while in the second case they are to two separate > objects. Why? What's so special about the forward slash that cause the > two "/a" strings to create two separate objects? Is this an >

Re: "/a" is not "/a" ?

2009-03-07 Thread Christian Heimes
Steven D'Aprano wrote: > Yes. Floating point NANs are required to compare unequal to all floats, > including themselves. It's part of the IEEE standard. As far as I remember that's not correct. It's just the way C has interpreted the standard and Python inherited the behavior. But you may proof me

Re: RELEASED Python 3.1 alpha 1

2009-03-07 Thread Christian Heimes
bearophileh...@lycos.com wrote: > Are the computed gotos used in the future pre-compiled Windows binary > (of V.3.1) too? No, the MS Visual C compiler doesn't supported labels as values [1]. The feature is only supported by some compilers like GCC. Christian [1] http://gcc.gnu.org/onlinedocs/gcc

Re: Callback from c thread with ctypes

2009-03-08 Thread Christian Heimes
Victor Lin wrote: > Hi, > > I am going to develop a c library binding with ctypes. That c library > will call callback from worker threads it created. Here comes the > problem : Will the GIL be acquired before it goes into Python > function? > > I got a little try.. > > DSPPROC = WINFUNCTYPE(Non

Re: Callback from c thread with ctypes

2009-03-08 Thread Christian Heimes
Victor Lin wrote > I know I have to call PyEval_InitThreads if my module create threads > that will contact python stuff, for example, call a python callback > function from threads. But however, it is ctypes. I have no idea > should I do that for the imported dll? If it is, how? You have to initi

Re: Visual Studio 2005 build of Python 2.4, 2.5 or 2.6

2009-03-11 Thread Christian Heimes
Terry Reedy wrote: > Are you looking for pre-built binaries or the build files to make your > own? PSF distributes 2.? to 2.5 binaries built with VS2003 and 2.6+ > binaries built with VS2008 (I believe) and the corresponding build > files. People have built with VS2005, but you will have to sear

Re: Minimilistic Python on Linux?

2009-03-11 Thread Christian Heimes
Royce Wilson schrieb: > I'm working on a minimilistic linux project and would like to include > Python. However, since Python is around 17MB (compressed) and previous > releases of this linux distro are under 100MB (compressed) standard Python > releases are much to large. I just need the runtime

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Christian Heimes
Vlastimil Brom wrote: > def path_from_pardir(path): > return > os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), > os.pardir, path))) > # __file__ is substituted with sys.path[0] if not present > > real_path = path_from_pardir("txt/text_1.txt") > > The above seems to

Re: Minimilistic Python on Linux?

2009-03-12 Thread Christian Heimes
Royce Wilson schrieb: > Thanks, much better. What exactly do I lose when I launch python without > site.py? Why do you want to strip Python off everything useful? A bare interpreter without the standard library isn't useful for anything. Christian -- http://mail.python.org/mailman/listinfo/pytho

Re: "import" not working?

2009-03-13 Thread Christian Heimes
Scott David Daniels wrote: > Aahz wrote: >> In article , >> Rhodri James wrote: ... >>> sys.path.append("C:\\DataFileTypes") >> >> My preference: >> sys.path.append(r"C:\DataFileTypes") >> This doesn't work if you need to add a trailing backslash, though. > > Also my preference (except, due to ag

Re: How to interface with C# without IronPython

2009-03-13 Thread Christian Heimes
Chris Rebert wrote: > Haven't used it, but Python for .NET sounds like it might be what you > want: http://pythonnet.sourceforge.net/ I've done some development for and with PythonDotNET. It's definitely the right thing. It works with .NET, Mono and Python 2.4 to 2.6. Christian -- http://mail.py

Re: multiprocessing module - isn't it a bug?

2009-03-14 Thread Christian Heimes
dmitrey wrote: > This doesn't work for > costlyFunction2 = lambda x: 11 > as well; and it doesn't work for imap, apply_async as well (same > error). > So, isn't it a bug, or it can be somehow fixed? > Thank you in advance, D. It's not a bug but a limitation of the pickle protocol. Pickle can't han

Re: what does 64-bit python mean?

2009-03-19 Thread Christian Heimes
Chris Rebert wrote: > It's been compiled for 64-bit processors, so it uses 64-bit pointers > and 64-bit small integers. And I would think it would only work w/ C > extension libraries also compiled for 64-bit CPUs. So, the same > meaning 64-bit has for anything else really. A 64bit build of Python

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Christian Heimes
Chris Rebert wrote: > There's no effect on attribute read-writes as they all take place > within the single __dict__ of the instance. As for method lookup, it > doesn't add an indirection per se, but rather the list of classes to > look thru to find a method gets longer, making base-class method >

Re: Unable to compile pyprocessing module on SUN solaris

2009-03-20 Thread Christian Heimes
Deepak Rokade wrote: > How can I get rid of this ? > Is this package not available for sun solaris ? Apparently Solaris doesn't support sem_timedwait(). You have to disable the feature in setup.py:: HAVE_SEM_TIMEDWAIT=0 Why are you using pyprocessing instead of multiprocessing? Christian --

Re: Unable to compile pyprocessing module on SUN solaris

2009-03-20 Thread Christian Heimes
Deepak Rokade wrote: > This did not wok. > I continued to get those warning and Import Error. > > I wanr through documentation of multiprocessing and it looks almost similar > to processing module. > Any advantages of multiprocessing module ? You may have to disable more features and recompile e

Re: Unable to compile pyprocessing module on SUN solaris

2009-03-20 Thread Christian Heimes
Deepak Rokade wrote: > I am trying to build package "pyprocessing" for python 2.5 > > I am using sun machine with Solaris 5.8 > > drok...@himalaya:~/modules_python/processing-0.52 > (Deepak:)uname -a > SunOS himalaya 5.8 Generic_117350-35 sun4u sparc SUNW,Sun-Fire > > While building the package

Re: Another of those "is" issues.

2009-03-20 Thread Christian Heimes
Terry Reedy wrote: > Compare that to MyClass.myMethod is MyClass.myMethod, which is True at > least in 3.0. It's true because Python 3.0 has no unbound methods. MyClass.myMethod returns the function object. It's possible to get the same behavior in 2.x: MyClass.myMethod.im_func is MyClass.my

Re: __init__ vs. __del__

2009-03-21 Thread Christian Heimes
Randy Turner wrote: > I was reading a book on Python-3 programming recently and the book stated > that, while there is an __init__ method for initializing objects, there was a > __del__ method but the __del__ method is not guaranteed to be called when an > object is destroyed. > > If there is c

Re: How Get Name Of Working File

2009-03-22 Thread Christian Heimes
Victor Subervi schrieb: > Hi; > If I am writing a script that generates HTML, how do I grab the name of the > actual file in which I am working? For example, let us say I am working in > test.py. I can have the following code: > > import os > dir = os.getcwd() > > and that will give me the workin

Re: Why am I getting "[10263 refs]"?

2009-03-24 Thread Christian Heimes
Russ P. wrote: > I am running 2.5.2 on Red Hat 5. I am getting many printouts of > reference counts, such as > > [10263 refs] > > I do not recall ever seeing this until recently. Why am I getting > this? Thanks. You are using a debug build of Python. Christian -- http://mail.python.org/mailman

Re: Iterating over readlines() and map()

2009-03-25 Thread Christian Heimes
W. Martin Borgert schrieb: > (Resend, because of funny error message: >> Your mail to 'Python-list' with the subject >> Iterating over readlines() and map() >> Is being held until the list moderator can review it for approval. > Whatever this means.) > > Hi, > > if I understand correctly, thi

Re: please include python26_d.lib in the installer

2009-03-30 Thread Christian Heimes
Johan Compen wrote: > If Python doesn't include the _d.lib file, then why does the header > file reference it? I would prefer manual control over which lib file > to use. (And I don't want to disable _DEBUG for other reasons). > > Could the header file be changed so it alwas uses the release lib?

Re: please include python26_d.lib in the installer

2009-03-31 Thread Christian Heimes
> So I'm proposing: please use _PYTHON_DEBUG for this purpose. Would > this cause any problems? Python has its own debug flag: Py_DEBUG. The roles of _DEBUG and Py_DEBUG could easily be changed in PC/pyconfig.h. Any change needs a discussion on the Python ideas list. *wink* Christian -- http://m

Re: Detecting Binary content in files

2009-03-31 Thread Christian Heimes
Josh Dukes wrote: > Of course this would detect unicode files as being binary and maybe > that's not what you want. How are you thinking about doing it in > perl exactly? There is no such thing as a unicode file. You most likely mean UTF-8 or UTF-16 coded text. Christian -- http://mail.python.o

Re: Hash of None varies per-machine

2009-04-03 Thread Christian Heimes
Paul Rubin wrote: > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think of long ints), so obviously there must > be multiple values that hash to the same slot. No, hashs are C longs. On most 64bit platforms a C long has 64bits. As far as I know only 64b

Re: with open('com1', 'r') as f:

2009-04-03 Thread Christian Heimes
gert wrote: > I do understand, and I went looking into pySerial, but it is a long > way from getting compatible with python3.x and involves other libs > that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are still using Python 2.5 or 2.6. Christian -- http://mail.pyt

Re: Module caching

2009-04-03 Thread Christian Heimes
Aaron Scott wrote: > Yeah, I'd link to think I'm fairly experienced and not making any > stupid mistakes. That said, I'm fairly new to working with mod_python. > > All I really want is to have mod_python stop caching variables. This > seems like it should be easy enough to do, but I can't for the

Re: with open('com1', 'r') as f:

2009-04-04 Thread Christian Heimes
gert wrote: > On Apr 3, 10:10 pm, Christian Heimes wrote: >> gert wrote: >>> I do understand, and I went looking into pySerial, but it is a long >>> way from getting compatible with python3.x and involves other libs >>> that are big and non pyhton3.x compatib

Re: C API String Parsing/Returning

2009-04-06 Thread Christian Heimes
Gerhard Häring wrote: > char* buf = strdup(s); > if (!buf) { > PyErr_SetString(PyExc_MemoryError, "Out of memory: strdup failed"); > return NULL; > } > > /* TODO: your string manipulation */ Don't forget to free(buf). ;) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get back an object from its id() value

2009-04-08 Thread Christian Heimes
TP wrote: > If "di" is reliable, it seems a good solution for my initial constraint > which is the impossibility to store anything but strings in my data > structure. 'di' is dangerous and not reliable. When the original object is freed, then the memory address may be used by another Python object

Re: Detecting -i in a script

2009-04-13 Thread Christian Heimes
Marek Szuba wrote: > Is there any way of detecting in a script whether the interpreter > session running it has been launched with the -i option? My Google fu > has failed me on this subject... Thanks in advance. There is no direct way to detect the interactive flag. However sys.ps1 and sys.ps2 ar

Re: Python inside C++

2009-04-14 Thread Christian Heimes
Ken Seehart wrote: > Picky note: The phrase "statically compile pythonxx.dll into my C++ > application" is not quite correct. A DLL is dynamically linked, not > statically linked. All this means is that you ship pythonxx.dll with > your application along with any other DLLs and pyd files you migh

Re: Modifying the value of a float-like object

2009-04-14 Thread Christian Heimes
eric.le.bi...@spectro.jussieu.fr wrote: > Hello, > > Is there a way to easily build an object that behaves exactly like a > float, but whose value can be changed? The goal is to maintain a list > [x, y,…] of these float-like objects, and to modify their value on the > fly (with something like x.v

Re: print as a function in 2.5 ?

2009-04-19 Thread Christian Heimes
Stef Mientki wrote: > Now doesn't seem to be allowed, > nor is there an import from __future__ :-( > > What's the best solution (other than moving to 2.6 or up ? The word 'print' is a reserved word like is, class or def. You can't have a function named 'print' in Python 2.5. You have to call you

Re: The Python standard library and PEP8

2009-04-19 Thread Christian Heimes
Emmanuel Surleau wrote: > First off, it's pretty commonplace in OO languages. Secondly, given the > number of methods available for the string objects, it is only natural to > assume that dir("a") would show me a len() or length() or size() method. > Having to use a function for such a mundane o

Re: best "void" return of a member function

2009-04-20 Thread Christian Heimes
Andreas Otto wrote: > > well propable found the answer by my own ... > > Py_RETURN_NONE > > should be the best You have found the correct answer to your query. :) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: python command not working

2009-04-22 Thread Christian Heimes
David Cournapeau schrieb: > On Wed, Apr 22, 2009 at 4:20 PM, 83nini <83n...@gmail.com> wrote: >> Hi guys, >> >> I'm new to python, i downloaded version 2.5, opened windows (vista) >> command line and wrote "python", this should take me to the python >> command line, but it did not! i'm getting : py

Re: python command not working

2009-04-22 Thread Christian Heimes
David Cournapeau schrieb: > On Wed, Apr 22, 2009 at 6:24 PM, Christian Heimes wrote: > >> I highly recommend against adding C:\Python25 to your %PATH%. You can >> get the same effect by adding a simple bat file to C:\Windows\System32 > > I am curious, what's the di

Re: gethostbyname blocking

2009-04-22 Thread Christian Heimes
Jean-Paul Calderone wrote: > I'm not sure what the easiest way to determine whether Python has found > gethostbyname_r or not on your system is. The configure script used to > build Python will probably tell, but I doubt you have that lying around. > You could just assume this is the case, since y

Re: Memory problems (garbage collection)

2009-04-23 Thread Christian Heimes
Peter Otten wrote: > Like Gerhard says, in the long run you are probably better off with > ElementTree. In the long run it's even better to use lxml [1]. It's the fastest und most powerful XML library for Python. It also supports element tree. Christian [1] http://codespeak.net/lxml/ -- http://

Re: Python not importing mysqldb

2009-04-24 Thread Christian Heimes
83nini schrieb: > hi guys, > > i've been sweating the whole day trying to make python work with mysql > but in vain! > i'm doing the following: > 1. visiting http://sourceforge.net/projects/mysql-python > 2. dowloading mysql-python-test-1.2.3c1 > 3. extracting the files to C:\Python26\Lib\site-pac

Re: Finding partition containing a path?

2009-04-24 Thread Christian Heimes
s...@pobox.com schrieb: > This little shell script lists the partitions containing /var/opt on a set > of hosts: > > for h in host1 host2 host3 ; do > echo -n "$h " > ssh $h df -h /var/opt | egrep -v '^Filesystem' | awk '{print $6}' > done > > producing output like this: > >

Re: string Index for the last position

2009-04-28 Thread Christian Heimes
Clarendon schrieb: > I am trying to get the index for the last occurrance of a sub string. > > S = 'dab dab dab' > print S.find('ab') > 1 > > This gives me the index for the first position of 'ab'. > But I need to index the last position of 'ab' here. > Is there a quick option for find that will

Re: Python 2.6 worth the hassle?

2009-05-06 Thread Christian Heimes
Evan Kroske schrieb: > I'm planning on learning Python, and I'd like to know which version to > start with. I know that Python 3.0 isn't ready for production and it > doesn't have enough libraries yet, so I thought I should learn Python > 2.6. Unfortunately, installing Python 2.6 on my Linux distro

Re: Python 2.6 worth the hassle?

2009-05-06 Thread Christian Heimes
Steven D'Aprano wrote: > Are you saying that Intrepid uses Python3.0 as it's default Python? > > If not, then just use the default Python installed. Possibly Python 2.5. > The differences between 2.5 and 2.6 are minor. Ubuntu 9.04 has Python 2.6.2 as default Python interpreter. It's also shipped

Re: Unable to build libpython2.5.so on OS X 10.4

2009-05-07 Thread Christian Heimes
Eric Winter schrieb: > Hi all. I'm trying to build some internal code that needs to link > against libpython2.5.so on a OS X 10.4 (Tiger) machine. It seems that > no matter what combination of options and environment variables I give > to the configure script from python 2.5.1, all I get is the > l

Re: Python API Functions equivalent to ruby's rb_big2str() and rb_str2cstr()

2009-05-12 Thread Christian Heimes
rahul schrieb: > Is functions equivalent to ruby's rb_big2str() and rb_str2cstr() > available in Python. > I had search a lot in google but not able to find that. > If anybody know than please give me the name of those functions of > Python. Please don't assume that we know what the Ruby function

Re: x.abc vs x['abc']

2009-05-13 Thread Christian Heimes
Gunter Henriksen wrote: > but that seems like an arcane way to do something > which would ideally be transparent... if there is > a function in the standard library, that would be > good, even if I have to import it. I guess there is > collections.namedtuple... that would not look much > prettier.

Re: .pth in current directory: Why doesn't it work as the documentation says?

2009-05-18 Thread Christian Heimes
Philipp Hagemeister schrieb: > Where is the fault in my reasoning here? Python processes .pth files only in some directories. The directories are * the global site-packages directory * the user site-packages directory (starting with Python 2.6) * and any directory that is added by a .pth file

Re: PYTHONPATH on Windows XP module load problem

2009-05-19 Thread Christian Heimes
Andreas Otto wrote: > 1. on LINUX I create a "pymsgque.so" and I can load this library > with "import pymsgque" > > 2. in WINDOWS, I expect to create a "pymsgque.dll" and do the > same as on unix "import pymgque" > > -> is this behaviour is supported or not ??? > >

Re: 2d barcode library?

2009-05-20 Thread Christian Heimes
Trevor schrieb: > Is anyone aware of a good library for building 2d barcodes (any format > will work for me) and outputing them as some picture format, > presumably png or bmp to be used for html printing? For 1D barcodes a > simple barcode font will suffice, but obviously 2D is not so simple > and

Re: 4 hundred quadrillonth?

2009-05-21 Thread Christian Heimes
seanm...@gmail.com schrieb: > The explaination in my introductory Python book is not very > satisfying, and I am hoping someone can explain the following to me: > 4 / 5.0 > 0.80004 > > 4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end. > It bothers me. Welcom

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread Christian Heimes
Joana wrote: > I mantain Python on Windows, all installed packages are under c: > \Python25\Lib\site-packages. Now I have to build C libraries used by > python extensions and I am using cygwin, but I don't know how to > install the module in Windows directory. Are you sure you want to use Cygwin?

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread Christian Heimes
Joana wrote > hmm.. but the problem with mingw32 is that it does not have the > libraries I need. The module I want to install includes netinet/in.h. > So the answer is that I can't install that module in Windows? What's the name of the package? Perhaps it doesn't work on Windows. Or it hasn't bee

Re: How can I get access to the function called as a property?

2009-05-24 Thread Christian Heimes
Matthew Wilson schrieb: > I use a @property decorator to turn some methods on a class into > properties. I want to be able to access some of the attributes of the > original funtion, but I don't know how to get to it. > > Any ideas? Here you are: >>> class Example(object): ... @property ...

Re: Building mySQL-python with python 2.6

2009-05-27 Thread Christian Heimes
abolotnov schrieb: > Hi, I am trying to build mySQL-python with python 2.6 on windows and > can't figure what's wrong with it. > > D:\temp\mysqlPyC\MySQL–python–1.2.3c1>python setup.py build > running build > running build_py > copying MySQLdb\release.py –> build\lib.win32–2.6\MySQLdb > running bu

Re: Building mySQL-python with python 2.6

2009-05-27 Thread Christian Heimes
abolotnov schrieb: >> You need Visual Studio 2008. Other versions of VS aren't supported by >> Python 2.6. > > Aren't 2005, 2008+ versions all have same c compiler - it's just the > IDE versions that are different? There are important differences between the several versions of VC++. The most imp

Re: Building mySQL-python with python 2.6

2009-05-27 Thread Christian Heimes
abolotnov wrote: > say I obtain and install "an alternative" compiler. how do I tell > python which one to use? > > I am sorry for asking dumb questions. Can't find the answers in the > docs/mans. http://docs.python.org/install/index.html#gnu-c-cygwin-mingw Christian -- http://mail.python.org/

Re: How can 'type' be an instance of itself?

2009-05-28 Thread Christian Heimes
LittleGrasshopper wrote: > This is probably trivial, but it's driving me mad somehow. All (new > style) classes are instances of 'type' by default, unless a custom > metaclass is specified. I take this to mean that when a class > declaration is found in the code, an instance of 'type' representing

Re: Compiling Python using Microsoft Visual C++ 2008

2008-05-12 Thread Christian Heimes
Colin J. Williams schrieb: >> See PCbuild/readme.txt. > > I presume that this is PCbuild8.txt No, it's PCbuild/readme.txt in Python 2.6 and 3.0 By the way you can call Tools\buildbot\external.bat from the root directory of the 2.6 and 3.0. It checks out and build the dependencies. The script req

Re: execfile python3k

2008-05-12 Thread Christian Heimes
Odys schrieb: > Hi there, > > Since execfile() is removed in Python 3.0 > I have question about using exec. > > I know about > exec(open('filename').read()) > but from documentation the 1st arg of exec can be 'file object'. > However >exec(open('filename')) > does not work. > Does anybody h

Re: The 'is' identity operator checking immutable values caution

2008-05-13 Thread Christian Heimes
[EMAIL PROTECTED] schrieb: > We have to avoid the use of the 'is' identity operator with basic, > immutable values such as numbers and strings. The result is > unpredictable because of the way Python handles these objects > internally. You are confusing immutable objects with singletons. Never use

Re: usage of python

2008-05-13 Thread Christian Heimes
Rajarshi schrieb: > Hi, I teach an introductory programming course in Python. As part of > the introduction I'd like to highlight the usage of Python in > industry. The idea is to show that there are big players using Python > for a variety of tasks. Given that the students come from a variety of >

Re: Purpose of operator package

2008-05-13 Thread Christian Heimes
Eric Anderson schrieb: > Seems like unnecessary code but obviously I know nothing about Python. Correct, the truth example isn't a good example. "if argv" is better. But you can write interesting things with the operator module. For example >>> import operator >>> def fac(x): ... return reduc

Re: list.__len__() or len(list)

2008-05-13 Thread Christian Heimes
Ian Kelly schrieb: > The purpose of obj.__len__() is to implement len(obj), which simply > calls it. So obj.__len__() may be faster, but only marginally. The > reason to prefer len(obj) is that if you inadvertently pass an object > that does not implement __len__, you get the more appropriate > T

Re: Pass data from Python to C++

2008-05-15 Thread Christian Heimes
brad schrieb: > However, other components can be written in a more user friendly, more > easily maintained language. We've chosen Python for this. The main > question now is how to pass the computationally heavy info to c++ from > within Pyhton. os.system is not ideal. Just wondering how other folk

Re: class problem, NoneType obj has no attribute

2008-05-16 Thread Christian Heimes
globalrev schrieb: > cust1 = customer.__init__('12',['1','435','2332']) cust1 = customer('12',['1','435','2332']) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: help compiling Python on vs 2008!

2008-05-17 Thread Christian Heimes
inhahe schrieb: > what is going on here, and how do I compile these external libraries? I assume you are trying to compile Python 2.5 with VS 9.0. It's not supported. Some extensions don't compile under VS 9.0 Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: help compiling Python on vs 2008!

2008-05-17 Thread Christian Heimes
Matthieu Brucher schrieb: > Hi, > > I did not manage to build extension with distutils with Python compiled with > VS different than 2003. The need for 2003 was hard-coded in distutils. > You can try building extensions with VS2008 with Scons. This is what I do a > lot, and everything works fine a

Re: help compiling Python on vs 2008!

2008-05-17 Thread Christian Heimes
Matthieu Brucher schrieb: > Even if you compile Python 2.5 with VS2008, VS2003 is used for the > extensions, AFAIR. I didn't try Python 2.6 because I only have Visual C++ > Express 2008. You can compile 2.6 and 3.0 with the free Express Edition just fine. Christian -- http://mail.python.org/mail

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-19 Thread Christian Heimes
Luis Zarrabeitia schrieb: > Personally, I like to use "is" with singletons. I find it easier to type and > read "if param is None" than "if param == None", but some python developers > dislike the first one because of the "dark magic" involved in knowing that > None is a singleton. Testing for

<    1   2   3   4   5   6   7   8   9   10   >