Re: "Decoding unicode is not supported" in unusual situation

2012-03-07 Thread Diez B. Roggisch
John Nagle writes: > I think that somewhere in "suds", they subclass the "unicode" type. > That's almost too cute. > > The proper test is > > isinstance(s,unicode) Woot, you finally discovered polymorphism - congratulations! Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: pypi and dependencies

2012-03-21 Thread Diez B. Roggisch
Andrea Crotti writes: > When I publish something on Pypi, is there a way to make it fetch the > list of dependencies needed by my project automatically? > > It would be nice to have it in the Pypi page, without having to look > at the actual code.. > Any other possible solution? I don't understa

Re: configobj validation

2012-03-21 Thread Diez B. Roggisch
Andrea Crotti writes: > On 03/19/2012 12:59 PM, Andrea Crotti wrote: >> I seemed to remember that type validation and type conversion worked >> out of the box, but now >> I can't get it working anymore. >> >> Shouldn't this simple example actually fail the parsing (instead it >> parses perfectly

Re: Python 2.7.3, C++ embed memory leak?

2012-06-02 Thread Diez B. Roggisch
Qi writes: > Hi guys, > > Is there any known memory leak problems, when embed Python 2.7.3 > in C++? > I Googled but only found some old posts. > > I tried to only call Py_Initialize() and Py_Finalize(), nothing else > between those functions, Valgrind still reports memory leaks > on Ubuntu? > >

Re: ctypes callback with char array

2012-06-02 Thread Diez B. Roggisch
ohlfsen writes: > Hello. > > Hoping that someone can shed some light on a tiny challenge of mine. > > Through ctypes I'm calling a c DLL which requires me to implement a callback > in Python/ctypes. > > The signature of the callback is something like > > void foo(int NoOfElements, char Elements[

Re: Wrapping classes

2005-09-23 Thread Diez B. Roggisch
Jeremy Sanders wrote: > Peter Hansen wrote: > > >>Almost anything is possible in Python, though whether the underlying >>design idea is sound is a completely different question. (Translation: >>try the following pseudo-code, but I have my suspicions about whether >>what you're doing is a good i

Re: Productivity and economics at software development

2005-09-23 Thread Diez B. Roggisch
I get this: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 136

Re: [RFC] Parametric Polymorphism

2005-09-25 Thread Diez B. Roggisch
Catalin Marinas wrote: > Hi, > > Sorry if this was previously discussed but it's something I miss in > Python. I get around this using isinstance() but it would be cleaner > to have separate functions with the same name but different argument > types. I think the idea gets quite close to the Lisp/

Re: New-style classes questions

2005-09-25 Thread Diez B. Roggisch
> What is the reason for allowing both styles? (backwards compatibility??) yes. > > When I make my own classes should they always be new-style objects or are > there reasons for using old-style object? No, use new style if you can - except from the rare cases where above mentioned backwards

Re: Memory stats

2005-09-25 Thread Diez B. Roggisch
Tarek Ziadé wrote: > Hi list, > > I am trying to find a general memory profiler that can measure the > memory usage in Python program > and gather some stats about object usages, and things like that. > > I am trying to find a simple python module to be able to customize it > and integrates it to

Re: Example of signaling and creating a python daemon

2005-09-25 Thread Diez B. Roggisch
Jon Monteleone wrote: > What I dont understand about daemonizing a python script is whether or not it > requires the > daemon creation, ie the signal handling and forking of the process, to be > part of the > daemon code or is this code in a separate program that acts like a wrapper to > turn a

Re: unittest setup

2005-09-25 Thread Diez B. Roggisch
paul kölle wrote: > hi all, > > I noticed that setUp() and tearDown() is run before and after *earch* > test* method in my TestCase subclasses. I'd like to run them *once* for > each TestCase subclass. How do I do that. Create a global/test instance flag. Diez -- http://mail.python.org/mailman/

Re: Struggling with this concept please help

2005-09-26 Thread Diez B. Roggisch
George wrote: > Not allowed to use Beautiful Soup because of the very important built > ins that is provides that makes it very simple to complete this > problem. Not my choice . This is a review question for our final in two > months and I just want to get things going so I can try to understand >

Re: What is "self"?

2005-09-26 Thread Diez B. Roggisch
> This still seems not quite right to me... Or more likely seems to be > missing something still. > > (But it could be this migraine I've had the last couple of days > preventing me from being able to concentrate on things with more than a > few levels of complexity.) > > Playing around with

Re: Most direct way to strip unoprintable characters out of a string?

2005-09-26 Thread Diez B. Roggisch
Steve Bergman wrote: > Fredrik Lundh wrote: > >> ("sanitizing" HTML data by running filters over encoded 8-bit data is >> hardly >> ever the right thing to do...) >> >> >> >> > I'm very much open to suggestions as to the right way to do this. I'm > working on this primarily as a learning proj

Dr. Dobb's Python-URL! - weekly Python news and links (Sep 26)

2005-09-26 Thread Diez B. Roggisch
QOTW: "This is Open Source. If you want an initiative, start one." -- Rheinold Birkenfeld "I've found jython incredibly helpful in learning java." -- pythonUser_07 The fourth annual "Free Software and Open Source Symposium" hosted by Canada's largest college includes a talk on "Python P

Dr. Dobb's Python-URL! - weekly Python news and links (Sep 26)

2005-09-27 Thread Diez B. Roggisch
QOTW: "This is Open Source. If you want an initiative, start one." -- Rheinold Birkenfeld "I've found jython incredibly helpful in learning java." -- pythonUser_07 The fourth annual "Free Software and Open Source Symposium" hosted by Canada's largest college includes a talk on "Python P

Re: Quick help needed: how to format an integer ?

2005-10-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi ! > > I need to convert some integer values. > > "1622" ->"1 622" > > or > > "10001234" -> ""10.001.234"" > > So I need thousand separators. > > Can anyone helps me with a simply solution (like %xxx) ? The module locale does what you need, look at ist docs, espe

Re: regarding python and c++ interaction

2005-10-05 Thread Diez B. Roggisch
> i am new to python.i hav to call function of c++ .so file(shared > library)on linux. > any how i am not able to do that. > i had made one zoo.so file.when i import it this gives the following error... > > import zoo > > Traceback (most recent call last): > File "", line 1, in ? > ImportE

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

2005-10-05 Thread Diez B. Roggisch
> This is naive. Testing doesn't guarantee anything. If this is what you > think about testing, then testing gives you a false impression of > security. Maybe we should drop testing. Typechecking is done by a reduced lamda calculus (System F, which is ML-Style), whereas testing has the full power

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

2005-10-05 Thread Diez B. Roggisch
Wenhua Zhao wrote: > a = b | 1 > > a = b if b != nil > else a =1 > > Is there such expression in python? Soon there will be, but currently: no. What you are after is a ternary operator like _?_:_ in C. There have been plenty of discussions about these - search this NG. Depending on your usecas

Re: How to create temp file in memory???

2005-10-05 Thread Diez B. Roggisch
Wenhua Zhao wrote: > I have a list of lines. I want to feed these lines into a function. > The input of this function is a file. > I want to creat a temp file on disk, and write the list of lines into > this temp file, then reopen the file and feed it to the function. > Can I create a this temp fi

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

2005-10-05 Thread Diez B. Roggisch
> 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: > So what is the best/preferred way to do this? Use t

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 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: 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.

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: Using command line args on Windows

2005-10-06 Thread Diez B. Roggisch
k8 wrote: > Thank you thank you thank you- The windows command line sol worked. It sure does. But it sucks.. bad tab-completion, few tools, short history, limited command-line-editing and so on. But if you want it the hard way, it's your choice :) Diez -- http://mail.python.org/mailman/listinf

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

2005-10-06 Thread Diez B. Roggisch
> Sure, But allow me this silly analogy. > > Going out on a full test-drive will also reveal your tires are flat. > So if you one has to be dropped, a full test drive or a tire check > it would certainly be the tired check. But IMO the tire check > is still usefull. But you could write it as test

Re: updating local()

2005-10-06 Thread Diez B. Roggisch
Flavio wrote: > Ok, > > I got it! > > Its vey insecure, and it is not guaranteed to work. Fine. > > Now what would you do if you wanted to pass a lot of variables (like a > thousand) to a function and did not wanted the declare them in the > function header? use a dict or list? This is almost c

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

2005-10-06 Thread Diez B. Roggisch
> > I can't help but feel that a lot of people have specific typechecking > systems in mind and then conclude that the limits of such a symtem > are inherent in typechecking itself. I've been writing a type-checker for my diploma thesis for a functionnal programmming language. And it _is_ limite

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

2005-10-06 Thread Diez B. Roggisch
> Suppose we have a typesystem which has the type ANY, which would mean > such an object could be any type. You could then have homogenous lists > in the sense that all elements should be of the same declared type and > at the same time mix all kind of type in a particular list, just > as python do

Re: dcop module under Python 2.4

2005-10-07 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi all, > at the end I upgraded to 2.4, but now I am not able to load dcop module > (part of the Python-KDE3 bindings). > Any help? Install PyKDE for 2.4 Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't extend function type

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > Oh well. I had wanted to be able to define two functions f and g, and > have f*g be the composition of f and g. > > >>> func_type = type(lambda: None) > >>> class composable_function(func_type): > ... def __mult__(f,g): > ... def c(*args, **kw): > ...

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

2005-10-07 Thread Diez B. Roggisch
> Why do you call this a JAVA Object or C void*? Why don't you call > it a PYTHON object. It is this kind of reaction that IMO tells most > opponents can't think outside the typesystems they have already > seen and project the problems with those type systems on what > would happen with python shou

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

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >>In other words, you want Python to be strongly-typed, but sometimes >>you want to allow a reference to be to any object whatsoever. In which >>case you can't possibly do any sensible type-checking on it, so this >>new Python+ or what

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

2005-10-07 Thread Diez B. Roggisch
Antoon Pardon wrote: > Then argue against my ideas, and not your makings of it. > > If I just use 'ANY' and you fill that in with C void* like > implementation and argue against that, then you are arguing > against your own ghosts, but not against what I have in mind. Well, you didn't tell us wha

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

2005-10-07 Thread Diez B. Roggisch
> It is not about falling back on generic declarartion, it is about > how such object will be treated. Diez seems to think that > strongly-typed language can only deal with generic declarations > by using something that allows circumventing the type system. No, I don't - now it's you who makes ass

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

2005-10-07 Thread Diez B. Roggisch
> Now some of the Python-is-perfect crowd seems to suffer from a "Blub > paradox" (http://c2.com/cgi/wiki?BlubParadox). They see annoying, > static typed languages like C and Java, and they see pleasant, > dynamically typed languages like Python, and conclude that static > types = annoying, when i

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

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > - FPs share their own set of problems - try writing a server. The > > have inherent troubles with event-driven programs. > > Erlang? Guess what, worked with that, too :) And let me

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

2005-10-07 Thread Diez B. Roggisch
> > You just said "let's > > introduce something like any". I showed you existing implementations of > > such a concept that have problems. > > But as far as I can see that is a problem of the implementation > not necessarily of the concept. Without any concept, sure there can't be problems with

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

2005-10-07 Thread Diez B. Roggisch
> How about Lisp? It seems to do some good there, without getting in > the way. I don't know much about lisp. But the thing is that one of the most important data structures in python (and basically the only one in LISP), lists, are a big problem to type-checking if they aren't homogenous. So I g

Re: Python, alligator kill each other

2005-10-07 Thread Diez B. Roggisch
infidel wrote: > By Denise Kalette > Associated Press > > MIAMI - The alligator has some foreign competition at the top of the > Everglades food chain, and the results of the struggle are horror-movie > messy. > > A 13-foot Burmese python recently burst after it apparently tried to > swallow a li

Re: Function decorator that caches function results

2005-10-09 Thread Diez B. Roggisch
>>def cache_function(fn): >> cache = {} >> def cached_result(*args, **kwargs): >> if args in cache: >> return cache[args] >> result = fn(*args, **kwargs) >> cache[args] = result >> return result >> return cached_result > > > I'm curious... w

Re: Question about StringIO

2005-10-09 Thread Diez B. Roggisch
Frank Millman wrote: > Hi all > > I understand that StringIO creates a file-like object in memory. > > Is it possible to invoke another program, using os.system() or > os.popen(), and use the < redirect operator, so that the other program > reads my StringIO object as its input? No. Processes do

Re: Function decorator that caches function results

2005-10-09 Thread Diez B. Roggisch
> If you create a closure, using a memoization technique as per the original > post, and then call type() on that closure, Python reports . Because it is. The closure is only sort of an extension to the locals() available to that function. Not more, not less. > > If you use dir() on that closur

Re: assigning in nested functions

2005-10-09 Thread Diez B. Roggisch
jena wrote: > Hi > I have code > > # BEGIN CODE > def test(): > def x(): >print a >a=2 # *** > > a=1 > x() > print a > > test() > # END CODE > > This code fails (on statement print a in def x), if I omit line marked > ***, it works (it prints 1\n1\n). It look like when I assign var

Re: What about letting x.( ... ? ... ) be equivalent to ( ... x ... )

2005-10-09 Thread Diez B. Roggisch
> There's something i don't understand : > > I've posted the original message you reply to yesterday, but I still > cannot see it in comp.lang.python, while I can see your reply, and my > reply to your reply. > > I tried with two different providers to get the messages, but with the > same res

Re: Function decorator that caches function results

2005-10-09 Thread Diez B. Roggisch
> Clearly there is no DISTINCT closure object. If there were, I wouldn't > need to ask how one can tell them apart, because type() would just report > that one was a function and one was a closure. I don't have a problem with > that. But read on... > > >>function objects always con- >>tain all th

Re: Function decorator that caches function results

2005-10-09 Thread Diez B. Roggisch
> > [penny drops] Now we're getting somewhere... a closure is something > _added_ to a function. So we should talk about functions-without-closures > and functions-with-closures. Yes. > > >>Speaking in >>terms of "is a" could be seen as some inheritance relation. > > > [penny rises again]

Re: What about letting x.( ... ? ... ) be equivalent to ( ... x ... )

2005-10-10 Thread Diez B. Roggisch
Daniel Delay wrote: > I agree the comparison to the mathematical o-operator is misleading, it > was just to say sometimes, it can be usefull introduce new syntax to > avoid too many nested parenthesis To replace them by the same amount of parentheses with a dot in front? Not very convincing. > T

Re: Python's Performance

2005-10-10 Thread Diez B. Roggisch
Mike Meyer wrote: > Donn Cave <[EMAIL PROTECTED]> writes: > >>I agree that there are many shades of grey here, but there's also a >>real black that's sharply distinct and easy to find -- real native >>code binaries are not interpreted. > > > Except when they are. Many machines are microcoded, wh

Re: Question about StringIO

2005-10-10 Thread Diez B. Roggisch
> Thanks, Steve and Diez, for the replies. I didn't think it was > possible, but it was worth asking :-) > > I will try to explain my experience with popen() briefly. > > I have some sql scripts to create tables, indexes, procedures, etc. At > present there are about 50 scripts, but this number w

Re: Question about StringIO

2005-10-11 Thread Diez B. Roggisch
> Thanks for this pointer. I have read it, but I don't think it applies > to my situation, as it talks about 'reading' from the child's stdout > while the child is 'writing' to stderr. But that is exactly the point: the psql blocks because you don't read away the buffered data. Start a thread, re

Re: Question about StringIO

2005-10-11 Thread Diez B. Roggisch
> My scripts are used to create the tables in the database. I didn't > think that DB-API covered that. The DB-Api covers executin arbirary SQL - either DDL or DML. It is surely centered around DML, but that doesn't mean that its not usabel to issue "create ..." statements. >However, even if i

Re: Wrapper function

2005-10-11 Thread Diez B. Roggisch
> PyObject *wrap_doStuff(PyObject *, PyObject *args) { ^ I guess you need a parameter name here Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Nicer way of strip and replace?

2005-10-11 Thread Diez B. Roggisch
> I replace commata with dots, then delete leading/trailing "s then add to > a sum after converting it to a float. > This looks ugly (I htink) and I wonder if there is a nicer way to strip > commata and change the comma to a dot already when reading in. It's not ugly - it's necessary. > Or sho

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Rune Strand wrote: > I Steve, > > I know it's several ways to isolate the filename. I just want to avoid > the overhead of importing sys or os to achieve it. What overhead? Besides: if you want to do python this, why don't we introduce the function solve_my_problems() that is the only thing a

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Rune Strand wrote: > Excuse me, do you suffer from a bad hair-day? I didn't say it is > platform independant. It's ok for my use on Linux and Windows. If you > cannot imagine any other usecase for a __filename__ attribute, that's > your problem, not mine. I think you are the one who wants __filen

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > And requesting random features built into the interpreter without even > specifying a usecase - as remote as it may be - isn't very likely > happen, don't you think? Which I wanted to express with my apparently > misunderstood solve_my_problem()

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread Diez B. Roggisch
Antoon Pardon wrote: > I don't know. The python dictionary type with its name, seem to refer > to how it is implemented, so I thought Tree was an appropiate name > here as it is implemented as a tree. I too had the impression you're talking about a tree-implementation, not a mapping based on key

Re: python server?

2005-10-12 Thread Diez B. Roggisch
> I was wondering if something similar already existed, to use as-is or > to adapt to my needs. > I did a little googling, which pointed me to interesting, but rather > different projects. Has anybody ever seen or heard something of this > kind? Or maybe there is something almost-ready in the amazi

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
Ron Garret wrote: > Is this a bug or a feature? > > class mydict(dict): >def __setitem__(self, key, val): > print 'foo' > dict.__setitem__(self, key, val) > > d=mydict() d[1]=2 > > foo > d.setdefault(2,3) Feature. If it wouldn't bypass __setitem__, how exactly would

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Diez B. Roggisch
Delaney, Timothy (Tim) wrote: > Tom Anderson wrote: > > >>Except that in smalltalk, this isn't true: in ST, every variable >>*appears* to contain a reference to an object, but implementations >>may not actually work like that. In particular, SmallTalk 80 (and >>some earlier smalltalks, and all su

Re: Perl-Python-a-Day: Sorting

2005-10-13 Thread Diez B. Roggisch
> In Perl, sort is a function, not some Object Oriented thing. It returns > the sorted result as another list. This is very simple and nice. And sometimes exteremely stupid - if your list is large, and making a copy just form sorting it (when you don't have to keep a referenece to the old list)

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >>AFAIK some LISPs do a similar trick to carry int values on >>cons-cells. And by this tehy reduce integer precision to 28 bit or >>something. Surely _not_ going to pass a regression te

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
> The implementation is certainly a design decision. setdefault() could be > implemented in terms of __set/getitem__() as > > def setdefault(self, key, value=None): > try: > return self[key] > except KeyError: > self[key] = value > return self[key] > > I guess it's

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
> Are we talking about the same setdefault()? > > > D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D > > There is no per-instance default value just on per call: Oh. You're right. I was somehow under the impression that setdefault is per-instance, so that I can avoid d.get(ke

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Diez B. Roggisch
> Yes, that would describe just about every cpu for the past 30 years > that's a plausible Python target. No. The later 68K (>68020) could address on odd adresses. And AFAIK all x86 can because of their 8080 stemming. Don't confuse this with 16Bit aligned addressing - _that_ is the minimum for

Re: wxPython & Cygwin

2005-10-13 Thread Diez B. Roggisch
Gilles DRIDI wrote: > Does someone has installed wxPython on the Cygwin platform, environment ? Why? Use windows python, wxPython for it - and put it in your path to use it inside cygwin. But maybe you _can_ compile it yourself - I didn't try, though. Diez -- http://mail.python.org/mailman/lis

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
Duncan Booth wrote: > Diez B. Roggisch wrote: > > >>So if setdefault >>was implemented as >> >>def setdefault(self, v): >> self["SOME_DEFAULT_KEY_NAME"] = v > > > if setdefault was implemented that way then all current uses of set

Re: Python's garbage collection was Re: Python reliability

2005-10-14 Thread Diez B. Roggisch
> Yeah, I noticed that, I could have been pedantic about it but chose to > just describe how these language implementations work in the real > world with zero exceptions that I know of. I guess I should have > spelled it out. You talked about CPU architectures: """ >And this presumes an archite

Re: wxPython & Cygwin

2005-10-16 Thread Diez B. Roggisch
>> Why? Use windows python, wxPython for it - and put it in your path to >> use it inside cygwin. >> > Don't think that'll work for an extension module. Sure it will. You can call whatever program you want from cygwin, as long as it is in the path. No difference to double-clicking an icon or so

Re: subtle side effect of generator/generator expression

2005-10-16 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > That is exactly what I meant, in fact. These IO thing are expected to > have side effects so they are not subtle. Generator on the other hand, > is sort of "clever iteratables". > > Now that I notice that, Of course I can be sure I would be careful. But > what about the

Re: wxPython & Cygwin

2005-10-16 Thread Diez B. Roggisch
> I'm sure the Cygwin world would be grateful if you or someone else were > to establish the correct build procedure. For Qt? I found it on the Qt free edition site, and followed the instructionbs. Not much to do there. But make sure you have _plenty_ of time. It took me _days_ to compile Qt. N

Re: TypeError: unbound method PrintInput() must be called with test instance as first argument (got test instance instead)

2005-10-16 Thread Diez B. Roggisch
arotem wrote: > Hi, > > I am trying to call an unbound method (PrintInput) with the object > instance as the first argument but getting the following error: > "TypeError: unbound method PrintInput() must be called with test > instance as first argument (got test instance instead)" > > Below is th

Re: Writing an immutable object in python

2005-10-17 Thread Diez B. Roggisch
> The change in the poision occurs becouse int() is an immutable object. > > if I will do the same with a user-defined object, This reference > manipulating will not happen. So, every entry in the array will refer > to the same instance. > > Is there a way to bypass it (or perhaps to write a self

Re: Installing Python at Work

2005-10-17 Thread Diez B. Roggisch
Nikola wrote: > I'm currently learning Python for my own use. > I'm considering installing it on a work laptop, knowing that it is > non-licensed, distributable software. Here comes a little bit nitpicking: Python is not "non-licensed" - it has a license, which makes it available for you free and

Re: ordered keywords?

2005-10-17 Thread Diez B. Roggisch
Ron Adam wrote: > > Is there a way to preserve or capture the order which keywords are given? > > >>> def foo(**kwds): > ...print kwds > ... > >>> foo(one=1, two=2, three=3) > {'three': 3, 'two': 2, 'one': 1} > > > I would love to reverse the *args, and **kwds as well so I can use kwds

Re: Repost: Text not showing up

2005-10-17 Thread Diez B. Roggisch
>> Hi all, I am new to python and trying to write a simple GUI that would >> call 2 growisofs processes (dvd burning) at the same time, and retrive >> the exit code to be printed on a text box (couldn't find any program >> that could use multiple dvd burners, not even k3b). Excuse me if this >>

Re: Repost: Text not showing up

2005-10-17 Thread Diez B. Roggisch
> The problem is that the changes take effect after gtk has reentered its > event-loop. Which won't happen until your programs terminate. With programs I mean of course the burning commandos. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP: Adding decorators for everything

2005-10-18 Thread Diez B. Roggisch
> @GuardedClass > class Foo: The functionality can be done using a meta-class, in a similarily declarative way. > @Transient > a = 'a transient field, ignored when serializing' > > @Const > PI = 22.0 / 7 > > @TypeSafe(int) > count = 10 These are tricky, as the implicit

Re: A little help with time calculations

2005-10-18 Thread Diez B. Roggisch
iminal wrote: > I am trying to make a very simple program and am very new to the whole > programming thing. my program is supposed to ask a user for any time in > the for format XX:XX:XX and then ask for a time corrrection to add or > subtract to this. my only problem is that once the user inputs t

Re: New Website

2005-10-20 Thread Diez B. Roggisch
I get a 404 - as Linux and MacOs-User, I'm pretty ignorant of Viruses/Malware. So, I'm not sure but I think it's possible that this site is spreading such malicious content. -- http://mail.python.org/mailman/listinfo/python-list

Re: A macro editor

2005-10-20 Thread Diez B. Roggisch
> My teammates and I were talking about to use one of Python, Ruby or > Groovy. But, we haven't decided which to use. > > What seems to be easier is to use Python, you know.. because of the > Jython thing. But, it is probably a mistake to take Jython without a > extensive analysis of the all po

Re: Set operations for lists: pythonic hints please!

2005-10-20 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Working with several thousand tagged items on a Tkinter Canvas, I want > to change different configurations of objects having a certain group of > tags. > > I've used the sets module, on the tuple returned by Tkinter.Canvas. > find_withtag() method. > > Since this metho

Re: Execute C code through Python

2005-10-20 Thread Diez B. Roggisch
Ernesto wrote: > What's the easiest and quickest way to execute a compiled C "command > line interface" program THROUGH Python? I don't know what you mean by THROUGH. But the subprocess, popen2 and os-modules deal with calling other programs. Try them in that order. Diez -- http://mail.python.o

Re: KeyboardInterrupt vs extension written in C

2005-10-20 Thread Diez B. Roggisch
Tamas Nepusz wrote: > Hi everyone, > > I have tried to do some googling before asking my question here, but I > haven't found any suitable answer. I am developing a Python API for a > graph library written in pure C. The library is doing an awful lot of > math computations, and some of them can ta

Re: Python variables are bound to types when used?

2005-10-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: > >>reset your brain: >> >>http://effbot.org/zone/python-objects.htm > > > Neat link. > > Can you expand on this: > > >>a type (returned by type(x)) > > ... > >>You cannot change the type. > > > Especially what's going on here: > > >>>

Re: PID and/or handle assistance. . .?

2005-10-22 Thread Diez B. Roggisch
Michael Williams wrote: > Hi All, > > Can anyone explain how to both spawn processes from PYTHON and acquire > their process IDs or a handle to them for use later? I'd also like to > acquire the stdout of each spawned process. Google dead today? Well, check out the modules subprocess, popen2

Re: Python/Apache Oddness On OSX

2005-10-24 Thread Diez B. Roggisch
John Abel wrote: > Hi, > > I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI > scripts using the builtin Apache. For ease, I've symlinked my custom > modules into the /Library/Python/2.3/site-packages directory, and they > import OK via command line python. However, when

Re: Newbie question: string replace

2005-10-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I have a config file with the following contents: > service A = { > params { > dir = "c:\test", > username = "test", > password = "test" > } > } > > I want to find username and replace the value with another value. I > don't know what the username value i

Re: Windows vs Linux [was: p2exe using wine/cxoffice]

2005-10-26 Thread Diez B. Roggisch
> Thanks to both of you. But that much I already knew. It's not > that I have *no* knowledge about readline: I did at least > read the manuals when I got stuck! But as far as I can tell > from my experience and from the docs -- and I'm not near a > Linux box at the mo -- having used ctrl-r to reca

Re: How do I sort these?

2005-10-28 Thread Diez B. Roggisch
KraftDiner wrote: > I have two lists. > I want to sort by a value in the first list and have the second list > sorted as well... Any suggestions on how I should/could do this? I guess you mean that you have two lists of same size where each index position pointing to corrsponding items - like two

Re: How do I sort these?

2005-10-29 Thread Diez B. Roggisch
KraftDiner wrote: > unzip doesn't seem to work for me... Mrmpf, my bad. The operation is called unzip, but implpemented by using zip - so unzip(l) == zip(*l) So the exchange unzip with zip in my example. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive generators and backtracking search

2005-10-30 Thread Diez B. Roggisch
>>for pos in qsearch( pos ): >> yield pos > Um - do you really want to reuse the variable pos here? Yeah, it > works, but this strikes me as very confusing. I'm not sure that it > might not be implementation dependent. Certainly not. pos is - and that

Re: cx_Oracle, is anything selected?

2005-10-31 Thread Diez B. Roggisch
Damjan wrote: > Is there a way to see if the SELECT in cx_Oracle didn't return anything? > I want to optimize the situation when the number of selected rows is zero. > Is select count(*) the only option, seems inefficient? I don't understand your problem - if your select doesn't return anything,

Re: cx_Oracle, is anything selected?

2005-11-01 Thread Diez B. Roggisch
> > I don't understand your problem - if your select doesn't return > > anything, the fetch* methods on the cursor will tell you if there is any > > data to expect at all. Additionally there is teh rowcount-property that > > holds the number of rows the last execute* yielded. > > This is a simplif

Re: python, mssql and unicode

2005-11-03 Thread Diez B. Roggisch
in - at least with oracle that's possible. Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: control webbrowser remotely?

2005-11-05 Thread Diez B. Roggisch
Martin Bless wrote: > Web browsers like Firefox have really cool abilities nowadays. Objects > in the current document can be addressed and manipulated by > Javascript. Not very comfortable and not easy to debug. > > Q: Is there a way to reach objects in the document from Python? > That would be c

  1   2   3   4   5   6   7   8   9   10   >