Re: bug or feature?

2005-10-05 Thread Fredrik Lundh
Steven D'Aprano wrote: > I suppose someone might be able to come up with code that deliberately > uses this feature for good use argument binding is commonly used for optimization, and to give simple functions persistent storage (e.g. memoization caches). more importantly, it's the standard pydi

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Antoon Pardon
Op 2005-10-05, Brian Quinlan schreef <[EMAIL PROTECTED]>: > Paul Rubin wrote: >> Brian Quinlan <[EMAIL PROTECTED]> writes: >> >>>Have those of you who think that the lack of required declarations in >>>Python is a huge weakness given any thought to the impact that adding >>>them would have on the

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Antoon Pardon
Op 2005-10-06, Bengt Richter schreef <[EMAIL PROTECTED]>: > On 5 Oct 2005 09:27:04 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >> >>> It also is one possibility to implement writable closures. >>> >>> One could for instace have a 'declare' have the effect that >>> if on a

RE: Simple prototype text editor in python

2005-10-05 Thread Letezo
Hello, > If anyone is interested in the > code or in giving some ideas or indeed has done something > similar I would love to heard from you. I'm interested in your code, since I'm going to learn ncurses. Please upload your code to a WEB page and post the link to python-announce (if you like you

Re: What encoding is used when initializing sys.argv?

2005-10-05 Thread Petr Prikryl
Thanks, Martin v. Löwis, Neil Hodgson, and Tim Roberts. I really appreciate your valuable comments. It simply works. Thanks again, Petr "Neil Hodgson" wrote... > Petr Prikryl: > > > I do not understand what encoding should be used > > to convert the sys.argv into unicode. > > Martin mentioned

Re: Python 2.4.2 HPUX-PARISC compile issues

2005-10-05 Thread Neal Norwitz
[EMAIL PROTECTED] wrote: > When compiling HPUX for PARISC with the following environemnt variables > I get the following errors. > > CFLAGS=+DD64 -fast > CC=aCC > LDFLAGS=+DD64 > > What do I need to do in order to get this to compile? This info should be in the README file for 2.4.2: + To b

Re: updating local()

2005-10-05 Thread Sybren Stuvel
Jp Calderone enlightened us with: > If I can call functions in your process space, I've already taken > over your whole program. That's true for standalone programs, but not for things like web applications, RPC calls etc. Sybren -- The problem with the world is stupidity. Not saying there shoul

_BLOCK_TYPE_IS_VALID error in MSVC 7.1 with Boost and Python

2005-10-05 Thread matt . keyes
Hey all, i'm trying to create an application that both embeds and extends python through boost. i've got a rough framework up and running, but now that i'm finally to the python part i'm having troubles. Here's a rough run-down of my code: Base class (pure): template InputHandler { public: /

Re: Can Python replace TCL/Expect

2005-10-05 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi > > I'm learning Python. I don't know whether Python can do something like > Expect can do. If yes, please show me how to do it. > I want to do something automatically: open connection to a ftp server, > get the welcome message on the screen (not in the packet). I can

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Bengt Richter
On 5 Oct 2005 09:27:04 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Antoon Pardon wrote: > >> It also is one possibility to implement writable closures. >> >> One could for instace have a 'declare' have the effect that >> if on a more inner scope such a declared variable is (re)bound it >> will

Can Python replace TCL/Expect

2005-10-05 Thread [EMAIL PROTECTED]
Hi I'm learning Python. I don't know whether Python can do something like Expect can do. If yes, please show me how to do it. I want to do something automatically: open connection to a ftp server, get the welcome message on the screen (not in the packet). I can do it easily with Expect but I still

Re: check html file size

2005-10-05 Thread Ray Dillinger
Richard Gration wrote: > ... fucking ... fucking ... fucking ... fucking ... Fucking ... fucking > ... fucking My friend, you can learn to use a far richer vocabulary of obscenities. If your creative flow is blocked by the fear that you can't spell more dirty words correctly, you can dispel th

Re: Thread's, async_chat and asyncore

2005-10-05 Thread Jos
I will take a look at it, thanks! jos -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Asyncore/chat for game server question.

2005-10-05 Thread Jos
Thanks to Matt Hammond and Jonathan LaCour for getting back to me! Jonathan sent me some code which took me several days to figure out, but does _exactly_ what i wanted. You can find the code he sent (dug out of the medusa distro) here: http://www.thethirdplace.org/grabbag/pyasynccpl/select_trigg

Re: Perl's documentation come of age

2005-10-05 Thread Mahesh Padmanabhan
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: While I don't like to feed the trolls, I do find his posts amusing. He is like a spoilt child seeking attention. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about smtplib

2005-10-05 Thread Tim Roberts
Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> Tim Roberts <[EMAIL PROTECTED]> (TR) wrote: > >>TR> [EMAIL PROTECTED] wrote: cool. so this line server = smtplib.SMTP(localhost) is when i connect ? > >>TR> Use the source, Luke. Source code for every standard module is included >

Re: New Python book

2005-10-05 Thread hrh1818
Dick Moores wrote: > Magnus Lie Hetland's new book, _Beginning Python: From Novice to > Professional_ was published by Apress on Sept. 26 (in the U.S.). My copy > arrived in the mail a couple of days ago. Very much worth a look, IMHO. > But what do the experts here think? > >

Re: Python eats gator.

2005-10-05 Thread Leif K-Brooks
Sam wrote: > http://www.wnbc.com/family/5060215/detail.html > > I know there's an on-topic joke in here somewhere, but I'm having some > problem finding it, at the moment. > > You may take a crack at it, if you'd like… Hmm... has anyone ever written a spyware removal tool in Python? -- http://m

return struct in ctypes

2005-10-05 Thread James Hu
hi,   I need to use ctypes to call the API function like   fun1(&list, listLen)  //here  list is struct { long id; long type; long isOpen;}  ListItem;   so I define class LIST_ITEM(Structure):    _fields_ = [("Id", c_ulong),    ("Type",c_ulong ),        (

Re: What documentation "standard" to use

2005-10-05 Thread Kenneth McDonald
This is, as far as I'm concerned, one of the great weaknesses of Python. (One of a relatively few, to be honest--I'm still an enthusiast after all!) There are numerous docstring-oriented tools; in my opinion, none of them are satisfactory, because docstrings only apply to certain entities, and

Re: check html file size

2005-10-05 Thread Sherm Pendley
Richard Gration <[EMAIL PROTECTED]> writes: > Are you fucking seriously fucking expecting some fucking moron to > translate your tech geeking fucking code moronicity? Fucking try writing > it fucking properly in fucking Perl first. Good fucking job! That's the funniest fucking response I've ever

Re: check html file size

2005-10-05 Thread Sherm Pendley
Ulrich Hobelmann <[EMAIL PROTECTED]> writes: > Richard Gration wrote: >> Are you fucking seriously fucking expecting some fucking moron to >> translate your tech geeking fucking code moronicity? Fucking try writing >> it fucking properly in fucking Perl first. > > Fucking excuse me? > > Fucking ma

Re: catching all tracebacks

2005-10-05 Thread Timothy Smith
Timothy Smith wrote: >iw ant to use a singel try except statment with my main app loop in the >middle and catch all tracebacks and email them to myself as a bug >report. however it seems a little more tricky then i thought > >try: >Main.Main() >except Exception, err_o: >print err_o.__cla

catching all tracebacks

2005-10-05 Thread Timothy Smith
iw ant to use a singel try except statment with my main app loop in the middle and catch all tracebacks and email them to myself as a bug report. however it seems a little more tricky then i thought try: Main.Main() except Exception, err_o: print err_o.__class__.__name__, '//', err_o, '/

Python 2.4.2 HPUX-PARISC compile issues

2005-10-05 Thread brian . toal
When compiling HPUX for PARISC with the following environemnt variables I get the following errors. CFLAGS=+DD64 -fast CC=aCC LDFLAGS=+DD64 $ make aCC -Ae -DD64 -c -DNDEBUG -O -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c Error 119: "./Include/pyport.h", line 612 # #erro

Re: New Python book

2005-10-05 Thread Jeremy Jones
Dick Moores wrote: >(Sorry, my previous post should not have had "Tutor" in the subject header.) > >Magnus Lie Hetland's new book, _Beginning Python: From Novice to >Professional_ was published by Apress on Sept. 26 (in the U.S.). My copy >arrived in the mail a couple of days ago. Very much worth

Re: Can't get pylibpcap extension to build under 2.4

2005-10-05 Thread Grant Edwards
On 2005-10-05, Grant Edwards <[EMAIL PROTECTED]> wrote: > I've been using the pylibpcap extension module for several > years, but I can't get it to build under 2.4: It turns out the .tar.gz file being distributed is missing the file doc.i and the entire build-tools subdirectory. If you grab the

Can't get pylibpcap extension to build under 2.4

2005-10-05 Thread Grant Edwards
I've been using the pylibpcap extension module for several years, but I can't get it to build under 2.4: $ python setup.py build /usr/lib/python2.4/distutils/dist.py:222: UserWarning: 'licence' distribution option is deprecated; use 'license' warnings.warn(msg) running build runn

Re: Extending Python

2005-10-05 Thread Brandon K
I own Python in a Nutshell, as one person pointed out. Alex Martelli does a great job of introducing the concepts, as long as your'e familiar with C. Additionally he covers wrapping (which is sounds like you're trying to do) with SWIG, Pyrex, and a few other options. It's a great book, I hav

Python eats gator.

2005-10-05 Thread Sam
http://www.wnbc.com/family/5060215/detail.html I know there's an on-topic joke in here somewhere, but I'm having some problem finding it, at the moment. You may take a crack at it, if you'd like… pgpWkRit76A0o.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-l

Re: How to prevent logging warning?

2005-10-05 Thread Vinay Sajip
s/without/with/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Excel library with unicode support

2005-10-05 Thread Mike Tammerman
Thanks, a lot. It helped me so much. Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: How to prevent logging warning?

2005-10-05 Thread Vinay Sajip
Thomas Heller wrote: > I get the behaviour that I want when I add a 'NULL' handler in the > library, but is this really how logging is intended to be used? > The reason for the one-off message is that without it, a misconfiguration or a failure to configure any handlers is notified to a user (wh

Re: Build spoofed IP packets

2005-10-05 Thread Eric Nieuwland
billie wrote: > Traceback (most recent call last): > File "C:\test\client.py", line 156, in ? > send_pkt() > File "C:\test\client.py", line 96, in send_pkt > s.sendto(ip.get_packet(), (dst, 0)) # send packet to server > socket.error: (10004, 'Interrupted system call') > > Note: this onl

Re: Replacing utf-8 characters

2005-10-05 Thread Martin v. Löwis
Mike wrote: > So it seems link.replace() function reads whether the first option is > utf-8 and converts the second option automatically to utf-8? How do I > prevent that? Not sure what an option is... if you are talking about parameters, rest assured that .replace does not know or care whether

New Python book

2005-10-05 Thread Dick Moores
(Sorry, my previous post should not have had "Tutor" in the subject header.) Magnus Lie Hetland's new book, _Beginning Python: From Novice to Professional_ was published by Apress on Sept. 26 (in the U.S.). My copy arrived in the mail a couple of days ago. Very much worth a look, IMHO. But what do

[Tutor] New Python book

2005-10-05 Thread Dick Moores
Magnus Lie Hetland's new book, _Beginning Python: From Novice to Professional_ was published by Apress on Sept. 26 (in the U.S.). My copy arrived in the mail a couple of days ago. Very much worth a look, IMHO. But what do the experts here think?

Re: check html file size

2005-10-05 Thread Ulrich Hobelmann
Richard Gration wrote: > Are you fucking seriously fucking expecting some fucking moron to > translate your tech geeking fucking code moronicity? Fucking try writing > it fucking properly in fucking Perl first. Fucking excuse me? Fucking maybe you should fucking go fucking fuck your fucking self.

Re: Replacing utf-8 characters

2005-10-05 Thread David Bolen
Mike <[EMAIL PROTECTED]> writes: > What you and I typed was ascii. The value of link came from importing > that utf-8 web page into that variable. That is why I think it is not > working. But not sure what the solution is. Are you sure you're asking what you think you are asking? Both the ampe

Re: replacments for stdio?

2005-10-05 Thread Martin Miller
Ido, I tried Bryan Olson's code [on Windows] from his last post to the "Catching stderr output from graphical apps" thread http://groups.google.com/group/comp.lang.python/msg/d61f1d5e02d84178>, and it seemed to work for stdout as well as stderr output. To enable its use with stdout, all I had to

Re: dictionary interface

2005-10-05 Thread Tom Anderson
On Tue, 4 Oct 2005, Robert Kern wrote: > Tom Anderson wrote: >> On Tue, 4 Oct 2005, Robert Kern wrote: >> >>> Antoon Pardon wrote: >>> Anyone a reference? >>> >>> The function dict_compare in dictobject.c . >> >> Well there's a really helpful answer. > > Well, *I* thought it was. And indeed

Re: Using command line args on Windows

2005-10-05 Thread k8
Thank you thank you thank you- The windows command line sol worked. -k8 -- http://mail.python.org/mailman/listinfo/python-list

Re: Using command line args on Windows

2005-10-05 Thread Diez B. Roggisch
k8 wrote: > Hello- > > I'm stuck on a Windows machine today and would love to fully play with > and test a simple python script. I want to be able to type "python > myscript myarg" somewhere. Is there anything out there to help me? My > main concern is playing with the myarg in the sys.argv lis

Re: Python Newbie

2005-10-05 Thread James
1. What toolkit is best for Windows development? "Best" depends on your needs. wxPython seems to be the most popular one. 2. Which toolkits can I exclude from consideration? You haven't given enough exclusion criteria. But here are the possible issues to consider. Fox - Hasn't been updated with

Re: What documentation "standard" to use

2005-10-05 Thread Micah Elliott
On Oct 05, Kalle Anke wrote: > I'm confused of how I should document my code, I've always liked being > able to document my code directly in my source file and then to use > some tool to extract the documentation to some other format. > My problem with Python is that there are so many tools and fo

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > >>> Read the comments. What you say is essentially the same - the data >>> matters, after all. What do you care if there are several instances >>> around? >>> >> In my case it matters more that the objects are the same. >> >> For example I want set([Spam(1), Spam(2), >>

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Diez B. Roggisch
>>Read the comments. What you say is essentially the same - the data >>matters, after all. What do you care if there are several instances >>around? >> > In my case it matters more that the objects are the same. > > For example I want set([Spam(1), Spam(2), > Spam(3)]).intersect(set([Spam(1), Sp

Re: Replacing utf-8 characters

2005-10-05 Thread Mike
In playing with this I found link.replace does work but when I use link.replace('&','&') it replaces it with & instead of just &. link.replace is working for me since if I changed the second option from & to something else I see the change. So it seems link.replace() function reads whether th

Re: check html file size

2005-10-05 Thread Richard Gration
On Tue, 04 Oct 2005 17:44:02 -0700, Xah Lee wrote: > would anyone like to translate the following perl script to Python or > Scheme (scsh)? Are you fucking seriously fucking expecting some fucking moron to translate your tech geeking fucking code moronicity? Fucking try writing it fucking properl

Re: Using command line args on Windows

2005-10-05 Thread Larry Bates
1) Start a command prompt window (Start-Programs-Accessories-Command Prompt) 2) Change to directory where the python program is stored (cd \) 3) Type python myscript.py myarg -Larry Bates k8 wrote: > Hello- > > I'm stuck on a Windows machine today and would love to fully play with > and t

RE: Using command line args on Windows

2005-10-05 Thread Michael . Coll-Barth
I'll assume that you are not familiar with Windows, so forgive me if you know this. 1) Go to a command prompt. The location of this depends on which OS you are running. But, you can go to Start / Run... and type in cmd or command. This will give you a window with a 'DOS' prompt. 2) Type pat

Using command line args on Windows

2005-10-05 Thread k8
Hello- I'm stuck on a Windows machine today and would love to fully play with and test a simple python script. I want to be able to type "python myscript myarg" somewhere. Is there anything out there to help me? My main concern is playing with the myarg in the sys.argv list. I've been mucking

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Paul Rubin
Brian Quinlan <[EMAIL PROTECTED]> writes: > OK. The Python compiler would check that the name is declared but it > would not check that it is defined before use? So this would be > acceptable: > > def foo(): > local x > return x Come on, you are asking silly questions. Any reasonable C

What documentation "standard" to use

2005-10-05 Thread Kalle Anke
I'm confused of how I should document my code, I've always liked being able to document my code directly in my source file and then to use some tool to extract the documentation to some other format. My problem with Python is that there are so many tools and formats ... I don't know which one I

Java pretty formatter

2005-10-05 Thread Kalle Anke
Does a Java "pretty formatter" exist? I would like to use a Python based web building tool but would like to pretty format Java code (for example adding color to keywords, etc). I haven't managed to find one but have probably been looking in the wrong places. -- http://mail.python.org/mailma

Re: epydoc, variables and encoding

2005-10-05 Thread Kenneth Pronovici
> I found a "problem" on epydoc. If I specify an encoding, epydoc not find > my global variables, and if I remove it, it work well. > > code.py: > > #!/usr/bin/env python > # -*- coding: utf-8 -*- > > MY_VAR = None > > class foo(object): > def __init__(self, foo):

Re: Python, Mysql, insert NULL

2005-10-05 Thread Thomas Bartkus
"Python_it" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I know how to insert values in a database. > That's not my problem! > My problem is how i insert NULL values in de mysql-database. > None is een object in Python and NULL not. > None is not converted to NULL? > Table shows No

Re: Replacing utf-8 characters

2005-10-05 Thread Klaus Alexander Seistrup
Mike wrote: > Hi, I am using Python to scrape web pages and I do not have problem > unless I run into a site that is utf-8. It seems & is changed to > & when the site is utf-8. > > [...] > Any ideas? How about using the universal feedparser from feedparser.org to fetch and parse the RS

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread marduk
On Wed, 2005-10-05 at 19:24 +0200, Peter Otten wrote: > Use a weakref.WeakValueDictionary as the cache instead of a normal > dict. > > Peter Thanks for the reference to the weakref module. Until now I've never had a use for it, but it sounds like what I'm looking for. -m -- http://mail.pytho

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread marduk
On Wed, 2005-10-05 at 19:37 +0200, Diez B. Roggisch wrote: > > What I wanted is multiple calls to create a new object with the same > > parameters points to the "original" object instead of creating a new > > one. > > Read the comments. What you say is essentially the same - the data > matters, a

Re: Class methods

2005-10-05 Thread Gerrit Holl
Laszlo Zsolt Nagy wrote: > >Oh man, it has been a long time I have read such an disturbing question. > > > >RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 > > > > > I feel I was a bit harsh. Of course, those posts do keep the Google count for the famous four-letter-abbreviatio

Swig and pointers

2005-10-05 Thread Java and Swing
I've tried sending a email to the swig mailing list 3 times...but it never seems to get it...not sure what is going on, still looking into it. Until then... I now have a C function such as... int doIt(char *a, MY_DIGIT **digit) { ... } so I am trying to figure out how to pass in that "digit"

Re: Replacing utf-8 characters

2005-10-05 Thread Mike
Steve Holden wrote: >>> > You must be doing *something* wrong: > > >>> link = > "/news/newsArticle.aspx?type=businessNews&storyID=2005-10-05T151245Z_01_HO548006_RTRUKOC_0_UK-AIRLINES-BA.xml" > > > >>> link = link.replace('&','&') > >>> link > '/news/newsArticle.aspx?type=businessNe

Re: Does python support the expression "a = b | 1"???

2005-10-05 Thread Grant Edwards
On 2005-10-05, Wenhua Zhao <[EMAIL PROTECTED]> wrote: > a = b | 1 Yes, Python supports that expression. > a = b if b != nil > else a =1 But that's not what it means. > Is there such expression in python? >>> b=0 >>> b = 0 >>> a = b | 1 >>> a 1 >>> b = 1 >>> a = b | 1 >>> a 1 >>> b = 2 >>> a =

Re: Replacing utf-8 characters

2005-10-05 Thread Steve Holden
Unknown wrote: > For example this is what I am trying to do that is not working. > > The contents of link is the reuters web page, containing > > "/news/newsArticle.aspx?type=businessNews&storyID=2005-10-05T151245Z_01_HO548006_RTRUKOC_0_UK-AIRLINES-BA.xml" > > link = link.replace('&','&'

Re: Class methods

2005-10-05 Thread Fredrik Lundh
Class methods"Hughes, Chad O" wrote: > Is there any way to create a class method? somewhat ironically, the first google hit for that sentence is a chapter in the python tutorial that *doesn't* explain how to create class methods... as others have pointed out, the classmethod wrapper/descriptor i

[ANN] PyXMPP build for Python 2.3 for Win32

2005-10-05 Thread Jarek Zgoda
Unofficial binary installer for Pytnon 2.3 of latest SVN snapshot of PyXMPP is available for download at http://pywarriors.haa.pl/varia.php#pyxmpp_win32 (the page is in Polish, but clicking in HTML link is language-independent). It was build with MinGW against libxml2-2.6.20. To get more informat

Re: Does python support the expression "a = b | 1"???

2005-10-05 Thread Paul Rubin
Wenhua Zhao <[EMAIL PROTECTED]> writes: > Is there such expression in python? Not in the current version but one is being added. -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacing utf-8 characters

2005-10-05 Thread Mike
For example this is what I am trying to do that is not working. The contents of link is the reuters web page, containing "/news/newsArticle.aspx?type=businessNews&storyID=2005-10-05T151245Z_01_HO548006_RTRUKOC_0_UK-AIRLINES-BA.xml" link = link.replace('&','&') But if I now view the the

Re: Class methods

2005-10-05 Thread Laszlo Zsolt Nagy
>> >> >Oh man, it has been a long time I have read such an disturbing question. > >RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 > > I feel I was a bit harsh. class A(object): x = 0 @classmethod def f(cls): cls.x += 1 print "x is",cls.x >>> A.

Re: Class methods

2005-10-05 Thread Laszlo Zsolt Nagy
Hughes, Chad O wrote: > Is there any way to create a class method? I can create a class > variable like this: > ... > Any ideas? > Oh man, it has been a long time I have read such an disturbing question. RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 Les -- http://mail

Re: MS Word mail merge automation

2005-10-05 Thread Steve M
I was finally able to get things working right, so I thought I'd stick an example here for posterity. """An example of a MS Word mail merge using the COM interface. In order for this script to work you must first run the COM Makepy utility and select "Microsoft Word 10.0 Object Library (8.2)" or w

Class methods

2005-10-05 Thread Hughes, Chad O
Title: Class methods Is there any way to create a class method?  I can create a class variable like this: class Foo:   classVariable = None   def __init__(self, classVariable):     Foo.classVariable = classVariable A = Foo('a') B = Foo('b') Print 'The class variable for A is "%s" a

Re: updating local()

2005-10-05 Thread jepler
I'm surprised you found any example of 'locals().update' that worked. Here's one that doesn't work: def f(y): locals().update({'x': y}) return x print f(3) # prints 3? Jeff pgpLVe48NBWmT.pgp Description: PGP signature -- http://mail.python.org/mailm

Re: Extending Python

2005-10-05 Thread Fredrik Lundh
"Tuvas" wrote: >I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. http://docs.python.org/ext/ext.html -- http://mail.python.org/mailman/listinfo/python-list

Antsoft Best domain software

2005-10-05 Thread Vasilisa
Find expired domains with the best software: http://www.antssoft.com The best domain names are already taken. But with expired domain software you can find the best domain names like: http://www.beyx.com http://www.c6d.de http://www.fyq.us http://www.gv0.net ht

Re: Extending Python

2005-10-05 Thread Micah Elliott
On Oct 05, Tuvas wrote: > I am looking for a good tutorial on how to extend python with C > code. I have an application built in C that I need to be able to use > in Python. I have searched through various sources, starting of > course with the Python site itself, and others, but I felt a bit > lac

Extending Python

2005-10-05 Thread Tuvas
I am looking for a good tutorial on how to extend python with C code. I have an application built in C that I need to be able to use in Python. I have searched through various sources, starting of course with the Python site itself, and others, but I felt a bit lacking from the Python site, it seem

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Diez B. Roggisch
> > I looked at the Borg Pattern, but I don't think it was exactly what I > want. > > The Borg patten appears to be if you want multiple instances that point > to the same "data". > > What I wanted is multiple calls to create a new object with the same > parameters points to the "original" objec

Re: how to keep collection of existing instances and return one oninstantiation

2005-10-05 Thread Fredrik Lundh
"marduk" wrote: > Do I have to implement my own garbage collecting is or there some "magical" > way of doing this within Python? http://docs.python.org/lib/module-weakref.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Laszlo Zsolt Nagy
>I've removed all references to the object, except for the cache. Do I >have to implement my own garbage collecting is or there some "magical" >way of doing this within Python? I pretty much want to get rid of the >cache as soon as there are no other references (other than the cache). > Store we

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Peter Otten
marduk wrote: > On Wed, 2005-10-05 at 12:56 -0400, Jonathan LaCour wrote: >> > class Spam(object): >> > cache = {} >> > def __new__(cls, x): >> > if cls.cache.has_key(x): >> > return cls.cache[x] >> > def __init__(self, x): >> > self.x = x >> > self.

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread marduk
On Wed, 2005-10-05 at 12:56 -0400, Jonathan LaCour wrote: > > class Spam(object): > > cache = {} > > def __new__(cls, x): > > if cls.cache.has_key(x): > > return cls.cache[x] > > def __init__(self, x): > > self.x = x > > self.cache[x] = self > > > > a

Re: How to prevent logging warning?

2005-10-05 Thread Peter Otten
Thomas Heller wrote: > I want the script by default to be agnostic about the libraries > logging.  When I want to see the log messages, I can always do > > logging.basicConfig() > > in the script to see the log messages. > > I get the behaviour that I want when I add a 'NULL' handler in the > l

Re: updating local()

2005-10-05 Thread Jp Calderone
On Wed, 5 Oct 2005 18:47:06 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >Flavio enlightened us with: >> Can anyone tell me why, if the following code works, I should not do >> this? >> >> def fun(a=1,b=2,**args): >> >> print 'locals:',locals() >> locals().update(args) >> print

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread marduk
On Wed, 2005-10-05 at 18:28 +0200, Diez B. Roggisch wrote: > Use the BORG-pattern. See > > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531 > > Together with your caching, that should do the trick. > I looked at the Borg Pattern, but I don't think it was exactly what I want. Th

Re: Python Newbie

2005-10-05 Thread UrsusMaximus
I like wxPython, which also can be improved (made more Pythonic) by using Hans Nowak's Wax http://www.zephyrfalcon.org/labs/wax.html and also has a great visual framework in PythonCard. You might check out my links to many Python gui toolkits and related resources at http://www.awaretek.com/plf.ht

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread marduk
On Wed, 2005-10-05 at 12:56 -0400, Jonathan LaCour wrote: > Oops, you forgot to return object.__new__(cls, x) in the case the > object isn't in the cache. That should fix it. Ahh, that did it. I didn't even think of calling object... so the new class looks like: class Spam(object): cach

Re: How to prevent logging warning?

2005-10-05 Thread Trent Mick
[Thomas Heller wrote] > I'm about to add some logging calls to a library I have. How can I > prevent that the script that uses the library prints > 'No handlers could be found for logger "comtypes.client"' when the > script runs? > > I would like to setup the logging so that there is no logging w

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Peter Otten
marduk wrote: > What I *really* want is to keep a collection of all the Spam instances, > and if i try to create a new Spam instance with the same contructor > parameters, then return the existing Spam instance. I thought new-style > classes would do it: > > class Spam(object): > cache = {}

Re: how to keep collection of existing instances and return one on instantiation

2005-10-05 Thread Jonathan LaCour
> class Spam(object): > cache = {} > def __new__(cls, x): > if cls.cache.has_key(x): > return cls.cache[x] > def __init__(self, x): > self.x = x > self.cache[x] = self > > a = Spam('foo') > b = Spam('foo') > > Well, in this case a and b are identical.

Re: updating local()

2005-10-05 Thread Duncan Booth
Flavio wrote: > Can anyone tell me why, if the following code works, I should not do > this? > > # > # Extending Local namespace > # > > def fun(a=1,b=2,**args): > > print 'locals:',locals() > locals().update(args) > print locals() > > e = {'s':3,'e':4} > fun(k=10,v=32,**e) > Be

Re: Posix return or exit

2005-10-05 Thread Sybren Stuvel
M.N.A.Smadi enlightened us with: > my script must return codes which are based on the POSIX spec of > returning a positive value. A work perl version of my code uses > exit(code_num). Use sys.exit(code_num). Sybren -- The problem with the world is stupidity. Not saying there should be a capita

Re: updating local()

2005-10-05 Thread Fredrik Lundh
"Flavio" <[EMAIL PROTECTED]> wrote: > Can anyone tell me why, if the following code works, I should not do > this? because it doesn't work: # # Extending Local namespace, now with Local namespace # def fun(a=1,b=2,**args): k="K" v="V" print 'locals:',locals() locals().update(arg

Re: updating local()

2005-10-05 Thread Sybren Stuvel
Flavio enlightened us with: > Can anyone tell me why, if the following code works, I should not do > this? > > def fun(a=1,b=2,**args): > > print 'locals:',locals() > locals().update(args) > print locals() Because it's very, very, very insecure. What would happen if someone found

RE: change a value to NULL?

2005-10-05 Thread Bell, Kevin
Just tested it. Access does recognize None as null/blank/etc when None is passed in from python. Kevin Bell -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bell, Kevin Sent: Wednesday, October 05, 2005 10:33 AM To: python-list@python.org Subject: RE: c

Re: updating local()

2005-10-05 Thread Steve Holden
Flavio wrote: > Hi, > > I heard time and again that you are not _supposed_ to update the > locals dictionary. > > Can anyone tell me why, if the following code works, I should not do > this? > > # > # Extending Local namespace > # > > def fun(a=1,b=2,**args): > > print 'locals:',locals(

Re: change a value to NULL?

2005-10-05 Thread Steve Holden
Brett Hoerner wrote: > I'm not sure what you mean, really, do you need an official Python > "Null" value? Try None? > > In [6]: myCells = ['Mary', 'Bob', None, 'Joe'] > > In [7]: for cell in myCells: >...: if cell: >...: print cell >...: else: >...: print "

Posix return or exit

2005-10-05 Thread M.N.A.Smadi
hi; my script must return codes which are based on the POSIX spec of returning a positive value. A work perl version of my code uses exit(code_num). I am not sure if the equivilant in python is also: exit(code_num) or return code_num any ideas? thanks moe smadi -- http://mail.python

updating local()

2005-10-05 Thread Flavio
Hi, I heard time and again that you are not _supposed_ to update the locals dictionary. Can anyone tell me why, if the following code works, I should not do this? # # Extending Local namespace # def fun(a=1,b=2,**args): print 'locals:',locals() locals().update(args) pr

  1   2   3   >