Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Ville Vainio
> "Arich" == Arich Chanachai <[EMAIL PROTECTED]> writes: Arich> From: "Richard Taytor" <[EMAIL PROTECTED]> Arich> To: <[EMAIL PROTECTED]> Arich> Sent: Thursday, February 17, 2005 4:28 PM Arich> Subject: [Uuu-devel] languages >> First, thank you for Unununium. I first lear

IDLE edit windows ignores tab settings

2005-02-17 Thread Lith
[Python/IDLE newbie here] I created a .py file in UltraEdit and saved it. I use (and always will, despite the FAQ's recommendation against it) tabs instead of spaces, set to 4 spaces per tab. When I open the file in IDLE, suddenly the tabs are 8 spaces wide. This is despite the fact that I've gon

Out of Office AutoReply: Mail Delivery (failure recruitment.it@mo torola.com)

2005-02-17 Thread Recruitment Italy-ZIT05
Grazie per avere inviato il suo CV. Stiamo per disattivare la presente casella di posta elettronica e pertanto non avremo la possibilità di archiviare la sua candidatura. Le suggeriamo di visitare il nostro portale di recruitment www.motorolacareers.com dove potrà, se interessato, informars

Re: Fuzzy matching of postal addresses

2005-02-17 Thread Tim Churches
McBooCzech wrote: Tim, do you think Ferbel can parse properly with non English data-sets? The official name for the project is "Febrl" (freely-extensible biomedical record linkage) but perhaps "Furball" would be better name, given its focus on fuzziness (if that is not a contradiction in terms).

Re: low-end persistence strategies?

2005-02-17 Thread Pierre Quentel
If a dozen people click the url in the next day, several of them will probably in the first minute or so after the email goes out. So two simultaneous clicks isn't implausible. More generally, I don't like writing code with bugs even if the bugs have fairly low chance of causing trouble. So I'm l

[OT]: Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread news.sydney.pipenetworks.com
Nick Vargish wrote: "news.sydney.pipenetworks.com" <[EMAIL PROTECTED]> writes: I always wished computer science was more engineering then philosophy. That way there'd always be an obvious answer. You don't have a lot of experience with philosophers, do you? No Most of them are quite willing to go

Re: low-end persistence strategies?

2005-02-17 Thread Michele Simionato
Ok, I have yet another question: what is the difference between fcntl.lockf and fcntl.flock? The man page of my Linux system says that flock is implemented independently of fcntl, however it does not say if I should use it in preference over fcntl or not. Michele Simionato -- http://mai

Re: How to I access the filename with TkFileDialog?

2005-02-17 Thread Vincent Wehren
imphasing wrote: I'm writing a python program to open a file, and display it onscreen, but I can't seem to find the var that "tkOpenFileName" returns to. It's not much use if you can't get the filename you just chose, so there must be a way to get it. Could anyone help me? Thanks, Alex openfilename

Re: win2k multiple versions config question

2005-02-17 Thread Vincent Wehren
[EMAIL PROTECTED] wrote: I currently have both 2.3 and 2.4 on my Win2k computer. For the most part, I've been able to run each version, but I'm not configured completely correctly and I've run into a snafu. I downloaded LGT to try it out today; it uses PyGame (which as far as I know doesn't work wi

Re: low-end persistence strategies?

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 09:02:37PM -0800, Michele Simionato wrote: > > John Lenton: > Also, if you use something where the process doesn't terminate between > calls (such as mod_python, I guess), you have to be sure to write the > try/finallys around your locking code, because the OS only cleans up

Re: low-end persistence strategies?

2005-02-17 Thread Michele Simionato
> John Lenton: Also, if you use something where the process doesn't terminate between calls (such as mod_python, I guess), you have to be sure to write the try/finallys around your locking code, because the OS only cleans up the lock when the process exits. This is what I feared. What happens in t

Re: Help needed for to build a CGI shell interface.

2005-02-17 Thread Tim Roberts
Slalomsk8er <[EMAIL PROTECTED]> wrote: > >What do I want to do? I am building an admintool (deamon and client) and >for this I need to script a interface to the shell, with the console >ansi escape sequences, whitch is fully transparent for the user. Do you honestly plan to expose a command shel

Re: How do I make my program start fullscreen ?

2005-02-17 Thread Tim Roberts
BOOGIEMAN <[EMAIL PROTECTED]> wrote: > >os = windows xp >How do I make "myprogram.py" start fullscreen at windows command prompt ? >Also I made it as "myprogram.exe" with py2exe,but how to start fullscreen ? Which GUI toolkit are you using? wxPython? tk? The answer depends on that. -- - Tim R

Re: namespace collisions

2005-02-17 Thread elbertlev
John Lenton wrote: > On Thu, Feb 17, 2005 at 06:20:36PM +, Will McGugan wrote: > > Hi, > > > > I'm accumulating a number of small functions, which I have sensibly put > > in a single file called 'util.py'. But it occurs to me that with such a > > generic name it could cause problems with other

Python, Matlab and AI question

2005-02-17 Thread dataangel
I'm a student who's considering doing a project for a Machine Learning class on pathing (bots learning to run through a maze). The language primarily used by the class has been Matlab. I would prefer to do the bulk of the project in python because I'm familiar with pygame (for the visuals) but

Re: Pausing a program - poll/sleep/threads?

2005-02-17 Thread Simon John
Jeff Shannon wrote: [snip] > The amount of bandwidth and server load that will be used by a > once-a-second query is probably pretty trivial (unless you're > expecting this to run over internet or dialup networks -- and even > then, it's probably not going to be worth worrying about). Even on an

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread news.sydney.pipenetworks.com
Jeremy Bowers wrote: By the way, just to be clear, my infinitesimal's dad can beat up your infinitesimal's dad any day of the week. Ouchit's getting personal :-). Your dad may be infinitesimal but my dad is a complex number (I'm not joking, he really has a real and imaginary part). (Looks li

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Nick Vargish
"news.sydney.pipenetworks.com" <[EMAIL PROTECTED]> writes: > I always wished computer science was more engineering then > philosophy. That way there'd always be an obvious answer. You don't have a lot of experience with philosophers, do you? Most of them are quite willing to go on at great lengt

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Jeremy Bowers
On Fri, 18 Feb 2005 14:14:55 +1100, news.sydney.pipenetworks.com wrote: > I always wished computer science was more engineering then philosophy. > That way there'd always be an obvious answer. I hear that! To be fair, computer *science* is more like mathematics than philosophy; once a correctly-

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread news.sydney.pipenetworks.com
Jeremy Bowers wrote: On Fri, 18 Feb 2005 01:19:44 +1100, news.sydney.pipenetworks.com wrote: Thanks for the pointer. Let's see how many zen points are for the OP's idea vs against Along with the fact that I agree with Nick that you've seriously miscounted (most of your "fors" are simply irrelevan

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread news.sydney.pipenetworks.com
Duncan Booth wrote: news.sydney.pipenetworks.com wrote: I'm not sure if this has been raised in the thread but I sure as heck always convert my join arguments using str(). When does someone use .join() and not want all arguments to be strings ? Any examples ? This has already been raised, but m

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Andy Dustman
Looking at the code, it seems that if it finds a unicode object on the first pass (the sizing pass), it punts and returns PyUnicode_Join(self, seq), which is the sequence from above and not necessarily the original object (orig), and starts over. In the worst-case scenario, you have a long sequence

Re: Probably over my head... Trying to get Font Names

2005-02-17 Thread Samantha
Thanks Mike. I must have not installed the ttfquery and font tools correctly. I get an error. This error: Traceback (most recent call last): File "C:\Python24\Lib\font-getter.py", line 1, in -toplevel- from ttfquery import _scriptregistry File "C:\Python24\Lib\site-packages\ttfquery\_scri

Re: MYSQL - how to install ?

2005-02-17 Thread Andy Dustman
There's a Windows package for MySQL-4.1.9 and Python-2.4 on SourceForge now, thanks to Michal Zylinski. https://sourceforge.net/project/showfiles.php?group_id=22307&package_id=15775&release_id=303257 -- http://mail.python.org/mailman/listinfo/python-list

Re: Using open() inside a subroutine

2005-02-17 Thread imphasing
DUH. Thanks. can't beleive I missed that one... Alex -- http://mail.python.org/mailman/listinfo/python-list

RE: how can i randomly choose keys in dictionary

2005-02-17 Thread Tony Meyer
> Hi,there. How can I choose a key in dictionary randomly? > > Say, random.choice() in lists, A dictionary's keys() are a list, so you already have the answer: >>> import random >>> d = {'a': 1, 'b': 2, 'c': 3} >>> random.choice(d.keys()) =Tony.Meyer -- http://mail.python.org/mailman/listinfo

how can i randomly choose keys in dictionary

2005-02-17 Thread neutrinman
Hi,there. How can I choose a key in dictionary randomly? Say, random.choice() in lists, or in lists: lists = [1,2,3,4] position = random.range(len(lists)) word = lists[position] -- http://mail.python.org/mailman/listinfo/python-list

Re: Using open() inside a subroutine

2005-02-17 Thread Grant Edwards
On 2005-02-18, imphasing <[EMAIL PROTECTED]> wrote: > Whenever I try to open a file inside a subroutine, like so: > > def open(): > filePath=askopenfilename() > > fileOpen = open(filePath, "r") > fileContent = fileOpen.read() > fileOpen.close() > > it tells me that "open() t

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Arich Chanachai
Mike Meyer wrote: Arich Chanachai <[EMAIL PROTECTED]> writes: Mike Meyer wrote: Arich Chanachai <[EMAIL PROTECTED]> writes: These last two points kind of diverge from the point, no? What I mean is that we want to present the argument of why Python is the best choice as THE built-in

Re: [perl-python] exercise: partition a list by equivalence

2005-02-17 Thread alex23
>For those of you unfamiliar with math lingoes, partition a list means > to create sublists, based on some criteria. Typical moronic mathematicians with their exclusionary lingoes...why can't they just say "create sublists based on some criteria" like normal people? - alex23 -- http://mail.pyth

having troubleing finding package for Twisted 1.3 for Mac OS X 10.3.x

2005-02-17 Thread fuzzylollipop
just got a Powerbook and need to do twisted development on it, but I can't find a simple straight foward instructions on installing Twisted 1.3 on it. Also the package manager at undefined.org has 1.1.0 and it doesn't work with 10.3.x ( pre-installed Python ) any help is welcome -- http://mail.

Using open() inside a subroutine

2005-02-17 Thread imphasing
Whenever I try to open a file inside a subroutine, like so: def open(): filePath=askopenfilename() fileOpen = open(filePath, "r") fileContent = fileOpen.read() fileOpen.close() it tells me that "open() takes no arguments (2 given)" Why is that? and how can I get a

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Mike Meyer
Arich Chanachai <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>Arich Chanachai <[EMAIL PROTECTED]> writes: >>>These last two points kind of diverge from the point, no? What I mean >>>is that we want to present the argument of why Python is the best >>>choice as THE built-in programming language

Re: Probably over my head... Trying to get Font Names

2005-02-17 Thread Mike C. Fletcher
If you don't have a GUI library to use, TTFQuery+Fonttools will retrieve this information: from ttfquery import _scriptregistry fonts = _scriptregistry.registry.fonts.keys() fonts.sort() for name in fonts: print name if you do have a GUI, your GUI library will almost certainly have a mechanis

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Arich Chanachai
Mike Meyer wrote: Arich Chanachai <[EMAIL PROTECTED]> writes: These last two points kind of diverge from the point, no? What I mean is that we want to present the argument of why Python is the best choice as THE built-in programming language for the revolutionary uuu operating system. A ne

Re: os.walk()

2005-02-17 Thread Mike Meyer
rbt <[EMAIL PROTECTED]> writes: > Could someone demonstrate the correct/proper way to use os.walk() to > skip certain files and folders while walking a specified path? I've > read the module docs and googled to no avail and posted here about > other os.walk issues, but I think I need to back up to

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Mike Meyer
Arich Chanachai <[EMAIL PROTECTED]> writes: > These last two points kind of diverge from the point, no? What I mean > is that we want to present the argument of why Python is the best > choice as THE built-in programming language for the revolutionary uuu > operating system. A new operating syst

Re: super not working in __del__ ?

2005-02-17 Thread Jeff Shannon
Christopher J. Bottaro wrote: Jeff Shannon wrote: Python's __del__() is not a C++/Java destructor. Learn something new everyday... What is it then? Excuse my ignorance, but what are you suppose to do if your object needs to clean up when its no longer used (like close open file handles, etc)? We

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Dima Dorfman
On 2005-02-18, Andy Dustman <[EMAIL PROTECTED]> wrote: > The reason it does this is exactly why you said: It iterates over the > sequence and gets the sum of the lengths, adds the length of n-1 > separators, and then allocates a string this size. Then it iterates > over the list again to build up t

Probably over my head... Trying to get Font Names

2005-02-17 Thread Samantha
I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts Any help or direction is appreciated. S -- http://mail.python.org/mailman/listinfo/python-

Re: global var

2005-02-17 Thread Steven Bethard
raver2046 wrote: How to have a global var in python ? You can, but you probably don't want to. What's your use case? Example code and what you'd like it to do would be helpful. STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Whats up with re module vs pre

2005-02-17 Thread pythonUser_07
Like I said, I don't have a lot of specifics. This is more of an over time experience. I do know that any problem I had with "re" was always resolved by "pre". Maybe they all had to do with recursion though. Thanks for the heads up on python2.4. Now all I have to do is get our admins to instal

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Andy Dustman
I did some timings of ''.join( ) vs. ''.join( ) and found that generator expressions were slightly slower, so I looked at the source code to find out why. It turns out that the very first thing string_join(self, orig) does is: seq = PySequence_Fast(orig, ""); thus iterating over your ge

Re: Help with research

2005-02-17 Thread Jeremy Bowers
On Thu, 17 Feb 2005 15:51:47 -0800, elena wrote: > I can go to my friends, however it occurred to me that it might be > better to post in a newsgroup and get a larger, more diverse, and > random sample. Larger, yes, more diverse, yes, more random, probably not in the statistical/scientific sense.

Re: Font size

2005-02-17 Thread Adam
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Adam" <[EMAIL PROTECTED]> wrote: > >> So we came up with the idea of using a random number generator to >> generate numbers from 0 to 36 and display them in large figures on my >> laptop. This is for the benefit of th

Re: MYSQL - how to install ?

2005-02-17 Thread Andy Dustman
For those of you who care, the latest stable version of MySQLdb is 1.2.0. Currently there is not a WIndows installer, however. I do not have the toolchain to build it, either; I depend on people to donate installers. If you have Python from the python.org packages and MySQL from the mysql.com pac

Help with research

2005-02-17 Thread elena
Apologies for this off-topic post. I'm a Java/C++ developer who is also studying psychology. I would really appreciate it if you would complete a survey that I'm using for a research project on programmers. It's easy [Yes/No answers] and takes about 5 minutes. I will be presenting the results a

[perl-python] exercise: partition a list by equivalence

2005-02-17 Thread Xah Lee
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes. For

Access to formatting controls from within __repr__ or __str__?

2005-02-17 Thread Dan Sommers
Hi, I have a class whose objects represent physical quantities including uncertainties and units, and I would like more control over the way they print. I have a __str__ method which outputs the quantity and its uncertainty, properly rounded (i.e. the uncertainty to one digit and the quantity to

Re: global var

2005-02-17 Thread Michael Hoffman
raver2046 wrote: How to have a global var in python ? "global var" will give you a global variable named "var". -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Postgres COPY Command with python 2.3 pg

2005-02-17 Thread gry
import pg db = pg.DB('bind9', '192.168.192.2', 5432, None, None, 'named', None) db.query('create temp table fffz(i int,t text)') db.query('copy fffz from stdin') db.putline("3\t'the'") db.putline("4\t'rain'") db.endcopy() db.query('commit') Note that multiple columns must be separated by tabs ('\t

global var

2005-02-17 Thread raver2046
hello, How to have a global var in python ? thank you. raver2046 http://raver2046.ath.cx -- http://mail.python.org/mailman/listinfo/python-list

Re: msnp, friends list

2005-02-17 Thread Mark Rowe
On Feb 18, 2005, at 11:35 AM, jr wrote: Sorry, I guess what I meant to ask was the status of the friends in the friends list begin updated. Right now we have a friends list which is being populated with the correct users, but their status (online, offline) is never getting set. For some reason the

Re: Fuzzy matching of postal addresses

2005-02-17 Thread McBooCzech
Tim, do you think Ferbel can parse properly with non English data-sets? I mean do you think it will work properly with data they include non English characters as well? As we live in Europe, we have to solve such a problems here : If the software needs some changes, I am ready, according to yo

Re: Whats up with re module vs pre

2005-02-17 Thread Dennis Benzinger
pythonUser_07 wrote: > This is a very generic observation as I don't have a lot of specifics > with me right now. I have noticed over the past two years that the > python "re" module is somewhat unreliable. What do you mean with unreliable? Can you show an example where re does not work as expe

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread pythonUser_07
I see your point. Consider points 2 and 3 a nice side effect. The language I favor actually ties into the environment I am working in: Python for rapid prototyping, java for larger projects where the eclipse IDE comes in very handy. -- http://mail.python.org/mailman/listinfo/python-list

Re: msnp, friends list

2005-02-17 Thread jr
Sorry, I guess what I meant to ask was the status of the friends in the friends list begin updated. Right now we have a friends list which is being populated with the correct users, but their status (online, offline) is never getting set. For some reason the events aren't being fired?? -- http://

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Arich Chanachai
pythonUser_07 wrote: Some quick thoughts. 1- Python is not new relatively speaking. Quite true, good point. 2)- Python is a natural language for learning basic scripting, but can carry you through to object oriented program. 3)- Knowing python, instantly gets you access to jython. I've found jy

Re: error in non-existing code?

2005-02-17 Thread Michael Hoffman
Thomas Newman wrote: I wanted to look at the code that gives me the error, but there is no line 447 in /usr/lib/python2.3/pyclbr.py: Try deleting pyclbr.py[co]. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread pythonUser_07
Some quick thoughts. 1- Python is not new relatively speaking. 2)- Python is a natural language for learning basic scripting, but can carry you through to object oriented program. 3)- Knowing python, instantly gets you access to jython. I've found jython incredibly helpful in learning java. F

Re: How to wrap a class's methods?

2005-02-17 Thread Grant Edwards
On 2005-02-17, Michael Spencer <[EMAIL PROTECTED]> wrote: >> I'd usually put big fat warnings around this code, and explain exaclty >> why I need to do things this way... > > As a low-tech alternative, what about sourcecode generation, Interesting idea. It's almost like haveing a macro capability

error in non-existing code?

2005-02-17 Thread Thomas Newman
Hi all, I have added a few files to my project in eric3. When I want to open the tree that (supposedly) shows me the classes, I get an error: Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/UI/Browser

[Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-17 Thread Arich Chanachai
I consider this to be a good question. I just started to learn Python and I like it. I don't know about Lisp however... The problem, IMHO, in creating a new language is that we are losing code reusability... we will be able to port python applications very easily... I don't have a clear idea on

Re: How to wrap a class's methods?

2005-02-17 Thread Michael Spencer
John Lenton wrote: On Thu, Feb 17, 2005 at 07:32:55PM +, Grant Edwards wrote: I'd usually put big fat warnings around this code, and explain exaclty why I need to do things this way... As a low-tech alternative, what about sourcecode generation, since you are targetting a python module? Thi

Re: super not working in __del__ ?

2005-02-17 Thread Christopher J. Bottaro
Jeff Shannon wrote: > Python's __del__() is not a C++/Java destructor. Learn something new everyday... What is it then? Excuse my ignorance, but what are you suppose to do if your object needs to clean up when its no longer used (like close open file handles, etc)? Are you use supposed to make

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Jeremy Bowers
On Thu, 17 Feb 2005 14:00:59 -0700, Dave Benjamin wrote: > Jeremy Bowers wrote: >> I'd point out that the Zen that can be comprehended by checking off items >> in a list is not the true Zen. > > The Zen that can be imported is not the eternal Zen. =) Yes, there is that too. :-) -- http://mail.p

Whats up with re module vs pre

2005-02-17 Thread pythonUser_07
This is a very generic observation as I don't have a lot of specifics with me right now. I have noticed over the past two years that the python "re" module is somewhat unreliable. At the suggestion of someone quite some time ago, I started to use the deprecated "pre" module. "import pre as re". A

[ANN]: twander 3.195 Released And Available

2005-02-17 Thread Tim Daneliuk
'twander' Version 3.195 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release was 3.193. This release fixes one very minor bug and implements a single new feature: - It is now possible to hide "dotfiles" in the list of display

Re: low-end persistence strategies?

2005-02-17 Thread Paul Rubin
John Lenton <[EMAIL PROTECTED]> writes: > > Maybe you'll find this too naive, but why do you want to avoid > > concurrent accesses to a database that will be accessed 12 times a day ? > > because every sunday at 3am your boss and his wife will both try to > use the script at the same time, and de

Re: Convert a raw pointer to IDispatch

2005-02-17 Thread Roger That
Le Thu, 17 Feb 2005 19:22:16 +0100, Thomas Heller a écrit : >> I am trying to use the function "CreateStreamOnHGlobal" from python code >> (I need to pass an IStream object to MSXML, like I do in C++ code). >> >> I was able to retrieve a pointer on the IStream object in this way: >> >> from ctypes

Re: How to wrap a class's methods?

2005-02-17 Thread Dave Benjamin
Michael Spencer wrote: Grant Edwards wrote: Thanks. The stuff provided by the "new" module is what I was missing. No magic in the 'new' module - new.instancemethod is just a synonym for the method type: >>> import new, types >>> new.instancemethod is types.MethodType True (Assuming you're usin

Re: How to wrap a class's methods?

2005-02-17 Thread Grant Edwards
On 2005-02-17, Michael Spencer <[EMAIL PROTECTED]> wrote: >> Thanks. The stuff provided by the "new" module is what I was >> missing. > > No magic in the 'new' module - new.instancemethod is just a synonym for the > method type: > > >>> import new, types > >>> new.instancemethod is types.Metho

Re: How to wrap a class's methods?

2005-02-17 Thread Grant Edwards
On 2005-02-17, Mathias Waack <[EMAIL PROTECTED]> wrote: > How about using a delegator: > > class Wrapper: > funcs = ("login", "list", "search") > def __init__(self, classobj): > self.__wrapped = classobj() > def __getattr__(self, attr): > if attr in Wrapper.funcs: > def f(*arg

Re: How to wrap a class's methods?

2005-02-17 Thread Michael Spencer
Grant Edwards wrote: On 2005-02-17, Steven Bethard <[EMAIL PROTECTED]> wrote: py> class C(object): ... def f(self, *args): ... print "f:", args ... def g(self, *args): ... print "g:", args ... py> class D(C): ... pass ... py> class Wrapper(object): ... def __init__(

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Dave Benjamin
Jeremy Bowers wrote: I'd point out that the Zen that can be comprehended by checking off items in a list is not the true Zen. The Zen that can be imported is not the eternal Zen. =) -- http://mail.python.org/mailman/listinfo/python-list

Re: low-end persistence strategies?

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 12:42:55AM -0800, Michele Simionato wrote: > John Lenton: > > the operating system cleans up the lock. > > So, are you effectively saying than a custom made solution based on > flock can be quite reliable and it could be a reasonable choice to > use shelve+flock for small/h

Re: namespace collisions

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 06:20:36PM +, Will McGugan wrote: > Hi, > > I'm accumulating a number of small functions, which I have sensibly put > in a single file called 'util.py'. But it occurs to me that with such a > generic name it could cause problems with other modules not written by > my

Re: [EVALUATION] - E02 - ULTIMATE RECIPE TO RESOLVE ALL ISSUES

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 06:49:38PM +, Stephen Kellett wrote: > Next you'll be telling me the world is flat and held up by an infinite > array of tortoises. no, of course not! It's an iterator. -- John Lenton ([EMAIL PROTECTED]) -- Random fortune: Test-tube babies shouldn't throw stones. s

Re: low-end persistence strategies?

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 09:08:25PM +0100, Pierre Quentel wrote: > Maybe you'll find this too naive, but why do you want to avoid > concurrent accesses to a database that will be accessed 12 times a day ? because every sunday at 3am your boss and his wife will both try to use the script at the sam

Re: How to wrap a class's methods?

2005-02-17 Thread John Lenton
On Thu, Feb 17, 2005 at 07:32:55PM +, Grant Edwards wrote: > I want to subclass an IMAP connection so that most of the > methods raise an exception if the returned status isn't 'OK'. > This works, but there's got to be a way to do it that doesn't > involve so much duplication: > > class MyImap

Re: sampling items from a nested list

2005-02-17 Thread Felix Wiemann
Steven Bethard wrote: > py> data = [[('a', 0), > ... ('b', 1), > ... ('c', 2)], > ... > ... [('d', 2), > ... ('e', 0)], > ... > ... [('f', 0), > ... ('g', 2), > ... ('h', 1), > ... ('i', 0), > ... ('j', 0)]] > > I need

Re: How to wrap a class's methods?

2005-02-17 Thread Mathias Waack
Grant Edwards wrote: > I want to subclass an IMAP connection so that most of the > methods raise an exception if the returned status isn't 'OK'. > This works, but there's got to be a way to do it that doesn't > involve so much duplication: > > class MyImap4_ssl(imaplib.IMAP4_SSL): > > def lo

Re: How to wrap a class's methods?

2005-02-17 Thread Jeff Shannon
Steven Bethard wrote: Grant Edwards wrote: I want to subclass an IMAP connection so that most of the methods raise an exception if the returned status isn't 'OK'. This works, but there's got to be a way to do it that doesn't involve so much duplication: class MyImap4_ssl(imaplib.IMAP4_SSL): def

Re: namespace collisions

2005-02-17 Thread Dave Benjamin
Will McGugan wrote: I'm accumulating a number of small functions, which I have sensibly put in a single file called 'util.py'. But it occurs to me that with such a generic name it could cause problems with other modules not written by myself. Whats the best way of handling this? If I put it in a

Re: [EVALUATION] - E02 - ULTIMATE RECIPE TO RESOLVE ALL ISSUES

2005-02-17 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Jeremy Bowers <[EMAIL PROTECTED]> writes course he'd still have to read docs and learn how to use it. Yeah - one guy in c.l.ruby wrote a reply that must have taken minimum 30 minutes. Really detailed. Lots of people thanked him for it. Ilias dissed the whole post

RE: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Christophe Cavalaria
Delaney, Timothy C (Timothy) wrote: > John Roth wrote: > >> result = "".join([str(x) for x in list]) > > As of 2.4, you should use a generator expression here instead (unless > you require backwards-compatibility with 2.3). > > result = ''.join(str(x) for x in iterable) > > Easier to read,

Re: TypeError: send() argument 1 must be string or read-only buffer, not int

2005-02-17 Thread [EMAIL PROTECTED]
if you want to send the value '1000' over a socket connection in a socket object do something like sock.send(str(1000)) if socket is a socket.socket object. -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: send() argument 1 must be string or read-only buffer, not int

2005-02-17 Thread Fredrik Lundh
Manish Gupta wrote: > invoking something like following - > > sock.send(100) > > generates the following error - > > TypeError: send() argument 1 must be string or read-only buffer, not int > > > how can I work around this? I wish to write > msg-length on a stream socket. in what

Re: How to wrap a class's methods?

2005-02-17 Thread Grant Edwards
On 2005-02-17, Steven Bethard <[EMAIL PROTECTED]> wrote: > py> class C(object): > ... def f(self, *args): > ... print "f:", args > ... def g(self, *args): > ... print "g:", args > ... > py> class D(C): > ... pass > ... > py> class Wrapper(object): > ... def __init__

Re: Pausing a program - poll/sleep/threads?

2005-02-17 Thread Jeff Shannon
Simon John wrote: As far as querying the server every few seconds, it does make sense (you don't miss events) and is the recommended way of doing things with InetCtrl, but I'd prefer to save the bandwidth/server load than have realtime status updates. The amount of bandwidth and server load that wi

Re: msnp, friends list

2005-02-17 Thread Mark Rowe
On Feb 18, 2005, at 7:31 AM, jr wrote: I'm currently using the msnp.py code from Manish Jethani's project. I havn't been able to get the friends list to update like it should. it works once out of about every 25 times the program loads. Has anyone been able to implement his code and get the friends

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Jeremy Bowers
On Fri, 18 Feb 2005 01:19:44 +1100, news.sydney.pipenetworks.com wrote: > Thanks for the pointer. Let's see how many zen points are for the OP's > idea vs against Along with the fact that I agree with Nick that you've seriously miscounted (most of your "fors" are simply irrelevant and I think you

TypeError: send() argument 1 must be string or read-only buffer, not int

2005-02-17 Thread Manish Gupta (BBS)
Hello invoking something like following - sock.send(100) generates the following error - TypeError: send() argument 1 must be string or read-only buffer, not int how can I work around this? I wish to write msg-length on a stream socket. thanks in advance. manish -- http://mail.p

Re: How to wrap a class's methods?

2005-02-17 Thread Steven Bethard
Grant Edwards wrote: I want to subclass an IMAP connection so that most of the methods raise an exception if the returned status isn't 'OK'. This works, but there's got to be a way to do it that doesn't involve so much duplication: class MyImap4_ssl(imaplib.IMAP4_SSL): def login(*args):

Re: low-end persistence strategies?

2005-02-17 Thread Pierre Quentel
Maybe you'll find this too naive, but why do you want to avoid concurrent accesses to a database that will be accessed 12 times a day ? Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Local module installation

2005-02-17 Thread Gonzalo Sainz-Trápaga (GomoX)
Hi, I'm starting to develop a Web application in Python for the first time. I am considering some modules like SQLObject and Validators (by Ian Bicking). The problem is, i'm planning to host the site on a shared hosting provider with mod_python, and therefore I can't install the modules site-wide.

Re: namespace collisions

2005-02-17 Thread Jeremy Bowers
On Thu, 17 Feb 2005 18:20:36 +, Will McGugan wrote: > I'm accumulating a number of small functions, which I have sensibly put > in a single file called 'util.py'. But it occurs to me that with such a > generic name it could cause problems with other modules not written by > myself. Whats the

How to I access the filename with TkFileDialog?

2005-02-17 Thread imphasing
I'm writing a python program to open a file, and display it onscreen, but I can't seem to find the var that "tkOpenFileName" returns to. It's not much use if you can't get the filename you just chose, so there must be a way to get it. Could anyone help me? Thanks, Alex -- http://mail.python.org/

Re: Alternative to standard C "for"

2005-02-17 Thread John Machin
James Stroud wrote: > > It seems I need constructs like this all of the time > > i = 0 > while i < len(somelist): > if oughta_pop_it(somelist[i]): > somelist.pop(i) > else: > i += 1 > > There has to be a better way... > ! for i in xrange(len(somelist)-1, -1, -1): ! if oughta_pop_it

Re: [EVALUATION] - E02 - ULTIMATE RECIPE TO RESOLVE ALL ISSUES

2005-02-17 Thread Jeremy Bowers
On Thu, 17 Feb 2005 18:49:38 +, Stephen Kellett wrote: > Incorrect analysis. This thread proves that you have no concept of how > to interact with the community. If you had done what many people asked > you to do, which is do some work yourself, then ask questions about the > few answers you

  1   2   3   >