Re: Is email package thread safe? (fwd)

2005-02-09 Thread Diez B. Roggisch
Usually, oo-style apis are thread-safe as long as each thread uses its own objects. Shared global state is _very_ uncommon, and if it's most probably documented. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: probably weird or stupid newbie dictionary question

2005-02-09 Thread Diez B. Roggisch
y, values) is stored, and for a passed key, each key in that list is additionally compared for being equal to the passed one. So another requirement of hashable objecst is the comparability. In java, this is done using the equals method. So in the end, the actual mapping of key, value looks like this:

Re: PyQt documentation

2005-02-11 Thread Diez B. Roggisch
re easy? There is an python-based ide which has the same name as your first name - try that. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Diez B. Roggisch
> I know its easy (string.replace()) but why does UTF-16 do > it on its own then? Is that according to Unicode standard or just > Python convention? BOM is microsoft-proprietary crap. UTF-16 is defined in the unicode standard. -- Regards, Diez B. Roggisch -- http://mail.python.or

Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Diez B. Roggisch
ic ASCII characters at the beginning, such as the use of "#!" of at the beginning of Unix shell scripts. [AF] & [MD] """ So they admit that it makes no sense - especially as decoding a utf-8 string given any 8-bit encoding like latin1 will succeed. So in the end, I st

Re: PyQt documentation

2005-02-11 Thread Diez B. Roggisch
s its a keyword in python). All I had to do to make e.g. examples given in C++ work was to strip curly braces and type declarations. So again: I don't see the need for that doc. But that's IMHO, of course. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Diez B. Roggisch
ür" and so on for a heuristic. But that is no guarantee. > Using a BOM with UTF-8 makes it easy to indentify it as such AND it > shouldn't break any probably written Unicode-aware tools. As the faq states, that can very well happen. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Diez B. Roggisch
parameter in the lambda will keep the right value for each iteration. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Diez B. Roggisch
[lambda: foo(i) for i in xrange(5)] for f in fs: f() fs = [lambda x=i: foo(x) for i in xrange(5)] for f in fs: f() -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt documentation

2005-02-11 Thread Diez B. Roggisch
that it really makes sense to create full docs at a api level. It would be hard to be in sync with the qt development itself. Instead a wiki which captures the various pitfalls would be cool. And it appears it exists: http://www.diotavelli.net/PyQtWiki So maybe enhancing that would be an

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-13 Thread Diez B. Roggisch
> If this is "goodbye" I can't say I'm sorry. Don't feed the trolls - as tempting as it is -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread Diez B. Roggisch
mssql driver for unxi-odbc. Its called ftl or tls or something. As always: Google is your friend... -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin functions for and and or?

2005-02-13 Thread Diez B. Roggisch
e to see reduce, even if > it > is a common idiom like that. Also I don't believe it short circuits. It doesn't but so doesn't your loop example. Put a break in there once Result is False. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
on. Instead this can be done by companies - see activestate. So if you want it, step up and do it yourself so your work _becomes_ the official mingw port. Community gratitude would be guaranteed. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
lly haven't the need for. And I developed quite large python apps. >>> c) Why are the following efforts not _directly_ included in the >>> python source code base? >>> >>> http://jove.prohosting.com/iwave/ipython/pyMinGW.html Ask the author of the patch. We can't read minds here. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with nested lists as arrays

2005-02-14 Thread Diez B. Roggisch
f.getEmptySlot() > y = emptySlot[1] > x = emptySlot[0] make this: x,y = self.getEmptySlot() -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
eds. But as lots of people use python and python based solutions with great commercial success, you might think of reviewing your needs more critical. After all, there is no _perfect_ system for all needs. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: nested lists as arrays

2005-02-14 Thread Diez B. Roggisch
mx] elements[fromy][fromx] = dummy And use xrange instead of range. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
e.com/group/comp.lang.java.softwaretools/browse_frm/thread/837df2c1188e6e39/18b5dcfd54a6a902?q=Lazaridis+Ilias&_done=%2Fgroups%3Fq%3DLazaridis+Ilias%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#18b5dcfd54a6a902 -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Delivery Status Notification (Failure)

2005-02-15 Thread Diez B. Roggisch
administrata wrote: > Hello. I was about to use tutor-mailing But, When i send to > tutor@python.org That just means that somebody subscribed to that list isn't reachable. Ignore it. > Plz HELP me; Please start talking english. This is no l337-script-kiddie forum. -- Re

Re: Accessing Objects Based On Their ID

2005-02-15 Thread Diez B. Roggisch
to something accessible in the namespace... Why only the id? A list only stores a reference to the object anyway - no copy of it. So you don't gain anything by using the id. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing ASP/VBScript with Python

2005-02-15 Thread Diez B. Roggisch
does - e.g. for a CMS, I'd strongly recommend a zope based solution. Other apps might be better written in other frameworks. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: low-end persistence strategies?

2005-02-16 Thread Diez B. Roggisch
Maybe ZODB helps. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: low-end persistence strategies?

2005-02-16 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Maybe ZODB helps. > > I think it's way too heavyweight for what I'm envisioning, but I > haven't used it yet. I'm less concerned about object persistence > (just

Re: low-end persistence strategies?

2005-02-16 Thread Diez B. Roggisch
you should skim over the tutorial to get a grasp of how it works. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting milliseconds in Python

2005-02-16 Thread Diez B. Roggisch
ough name - so look there and be a happy camper. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Test for structure

2005-02-16 Thread Diez B. Roggisch
import types v = [] if type(v) is types.ListType: pass -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: ZODB performance (was Re: low-end persistence strategies?)

2005-02-16 Thread Diez B. Roggisch
laborate yaml/xml serializations to allow for im- and exports and use with xslt and currently I'm investigating a switch to postgres. This point is important, and future developments of mine will take that into consideration more than they did so far. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting milliseconds in Python

2005-02-16 Thread Diez B. Roggisch
accuracy than seconds, it is returned as fraction of a second. That is the whole point the result of time being a float and not an int. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

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

2005-02-17 Thread Diez B. Roggisch
thon to full fledged app servers like zope. As usual, google is your friend. No need to dig into the things you mentioned above - at least not for what you want to do right now. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-17 Thread Diez B. Roggisch
r Linux with frambuffer output (see freevo) or a "real" Windows that is capable of showing a graphical ui. Maybe somehow the pygame sdl wrapper can be used for gui-stuff. SDL has had a DOS mode. But it is discontinued. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between class methods and instance methods

2005-02-17 Thread Diez B. Roggisch
inding the created object as first argument to the method. Thus each instance of a class Foo with a method bar has its own instance of bar - the bound method bar. But only one per object. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between class methods and instance methods

2005-02-17 Thread Diez B. Roggisch
. It's really great. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-18 Thread Diez B. Roggisch
Thomas Heller wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >> Maybe somehow the pygame sdl wrapper can be used for gui-stuff. SDL has >> had a DOS mode. But it is discontinued. > > What exactly is discontinued? pygame? SDL? The dos mod

Re: difference between class methods and instance methods

2005-02-18 Thread Diez B. Roggisch
m the same unbound method and the same instance as you want: That did escape me so far - interesting. Why is it that way? I'd expect that creating a bound method from the class and then storing it in the objects dictionary is what happens. -- Regards, Diez B. Roggisch -- http://mail.pyth

Re: re.compile and very specific searches

2005-02-18 Thread Diez B. Roggisch
ddress): digits = address.split(".") if len(digits) == 4: for d in digits: if int(d) < 0 or int(d) > 255: return False return True -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: re.compile and very specific searches

2005-02-18 Thread Diez B. Roggisch
u > validate the result, with a cut-down validator that relies on the fact > that there are 4 segments and they contain only digits: The search case needs a regular expression. But the OP didn't say much about what he actually wants. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: help for xml parsing error

2005-02-18 Thread Diez B. Roggisch
show it to us, then we can comment on it. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: re.compile and very specific searches

2005-02-18 Thread Diez B. Roggisch
the components required > are: Damn. Certainly not my glory regular expression day. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-19 Thread Diez B. Roggisch
forms and compilers. Just not the compiler you perceive as being a necessity. But that dead horse has been beaten enough already. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-19 Thread Diez B. Roggisch
> Unnecessary and deliberately provoking question - python is taken > seriously, e.g. by multi-billion dollar companies like google and zope. Of course zope corporation is not amongst the multi-billion dollar companies - by now. But who knows :) -- Regards, Diez B. Roggisch --

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-19 Thread Diez B. Roggisch
Ilias Lazaridis wrote: > Diez B. Roggisch wrote: >>>Should a professional developer take python serious? > [...] - (ungentle babbling after disrupting coherence of writings) And that from you *lol* > I mean, if the team does not manage at least the foundation of a > m

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-19 Thread Diez B. Roggisch
d by all of us humble developers who actually _deal_ with problems. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Diez B. Roggisch
ll be pretty straightforward. As others (including me) have stated before: windows is a commercial product. You have to pay to use it, and you have to pay to develop for it. That's the way MS wants it. The alternatives are there - but you can't have your cake and eat it. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: introspection inquiry

2005-02-20 Thread Diez B. Roggisch
ated from that class. This works as expected: class ExistentialCrisis: def __init__(self, text): self.spam = text print 'In the constructor of the %s class' % self.__class__.__name__ ExistentialCrisis("egal") -- Regards, Diez B. Roggisch -- http:

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
http://www.zope.org/ But there are plenty of other python http frameworks. The mod_python is AFAIK the most basic and primitive one. But build on top of it or fully python-based you have plenty of options. Google is your friend - this NG features similar discussions every other week. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
ts main purpose. So you e.g. get session state handling "for free" - as more or less _all_ web-apps today need them. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Keyword Named Args

2005-02-21 Thread Diez B. Roggisch
Im not sure if I understand you fully, but if what you are after is how to pass named parameters analog to positional args, do it as dict: def foo(name=None): print name foo(**{name: "Fuzzy"}) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: functions and named keyword arguments

2005-02-21 Thread Diez B. Roggisch
re if I understand you fully, but if what you are after is how to pass named parameters analog to positional args, do it as dict: def foo(name=None): print name foo(**{name: "Fuzzy"}) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda closure question

2005-02-21 Thread Diez B. Roggisch
only recreate them and rebind them to new variables. This prevents whole classes of errors - but of course it also introduces all kinds of other constraints on your programming style, e.g. using monads and so on. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda closure question

2005-02-21 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> It's not only that way in python, but in java too. So it seems that there >> is a fundamental principle behind it: In a language that allows >> sideeffects, these will actually happen.

Re: lambda closure question

2005-02-21 Thread Diez B. Roggisch
d hopfully comprehending...) your post. Sorry. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-21 Thread Diez B. Roggisch
k the urls - so copy and pasting yields only start or end of the urls, depending on the browser/edit control your pasting into. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Unittest - testing properties (read-only attributes)

2005-02-21 Thread Diez B. Roggisch
lf, instance, attribute, value=1): """Value and multiplier must be readonly""" try: setattr(instance, attribute, value) self.fail("Value is not read only") except AttributeError: pass Then the testing becomes one line: self.test_readonly(self.combat, "value") -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: high resolution time needed

2005-02-21 Thread Diez B. Roggisch
rd unix is a millisecond. And time.time() actually delivers a float with sub-second precision. import time t = time.time() time.sleep(.25) print time.time() - t gives for me (also debian) 0.249767065048 secs. -- Regards, Diez B. Roggisch -- http://mail.python.org/mail

Re: Sequence of empty lists

2005-02-22 Thread Diez B. Roggisch
seq = [[] for i in xrange(10)] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: searching pdf files for certain info

2005-02-22 Thread Diez B. Roggisch
ght help. It has a free evaluation version, and python bindings. If it's only about text, maybe pdf2text helps. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Vectors in Visual Python

2005-02-25 Thread Diez B. Roggisch
e in effect flat 3 element Numeric arrays, and Numeric ararys can be constructed with Float64 specified as the datatype. """ It was embedded in some disgressing comments (he himself says so, btw.) so you might have missed it. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Trees

2005-02-25 Thread Diez B. Roggisch
def depth_first(self): if self.childs: for child in self.childs: for node in child.depth_first(): yield node yield self.payload tree = Node('root', [Node('child1'), Node('child2')]) for n in tree.depth_firs

Re: accessor/mutator functions

2005-02-25 Thread Diez B. Roggisch
e. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting strings - by iterators?

2005-02-25 Thread Diez B. Roggisch
tlines. > > Any ideas? Maybe [c]StringIO can be of help. I don't know if it's iterator is lazy. But at least it has one, so you can try and see if it improves performance :) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Whither datetime.date ?

2005-02-26 Thread Diez B. Roggisch
7;, 'timedelta', 'tzinfo'] >>> Maybe this is a clash between a custom datetime module and the python one? What does python2.4 -v -c "import datetime" give you? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing a method (function) among several objects.

2005-02-27 Thread Diez B. Roggisch
abuse. A module is a unit of code that (should) encapsulate a certain functionality. So it's perfect for your needs. There is no law or even rule of thumb that makes claims about module size (or the lack of, for this matter). So create a module - it doesn't cost you anything. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do descriptors (and thus properties) only work on attributes.

2005-02-28 Thread Diez B. Roggisch
don see why implicitly calling one > of these methods would be any more difficult when they are autonomous > objects than when they are attributes. I still don't see how that is supposed to work for "a lot of interesting things". Can you provide examples for one of these in

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Diez B. Roggisch
ming.html#id12 -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Diez B. Roggisch
all for some part of the code, then you'd most probably even go for a local variable binding to avoid the lookups in the different scopes - thus the issue of import format gets unimportant again :) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Trees

2005-02-28 Thread Diez B. Roggisch
PEP, an implementation and a > champion with some persuasive ability :) Go wild :) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32 drive mapping... aka "net use"

2005-03-05 Thread Diez B. Roggisch
t you want to have as delimiter for splitting is written '\x00' So do this: b = a.split('\x00') Read the python docs about strings and raw strings and escaping of characters to understand the subtle details here. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Impersonating other broswers...

2005-03-05 Thread Diez B. Roggisch
le are supported; both are needed to actually retrieve a resource at an https: URL. ''' -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: how to execute Python in VIM

2005-03-05 Thread Diez B. Roggisch
DENG wrote: > ok > > i find it > > map :!d:\python24\python.exe % > > > but it comes with a new pop-up windowsdame~ I'm no windows expert - but maybe pythonw.exe helps here? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding an option on the fly (Tkinter)

2005-03-06 Thread Diez B. Roggisch
> widget["filename"] > > Is this possible to do? Yes. Use dicts to store these buttons so that you can later refer to them. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a method in one class change an object in another class?

2005-03-06 Thread Diez B. Roggisch
o(self): self.l.append(100) a = A() b = B(a.a_list) b.foo() print a.a_list -> [0, 100] There are some resources on the web that explain this in more thourough detail - but curretntly I have trouble finding them. Search this newsgroup. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using for... for multiple lists

2005-03-06 Thread Diez B. Roggisch
> Both filelist and self.checkbox are the same size (4 items btw). Is > there any way to get this done? Use zip: a, b = [1,2,3], ['a', 'b', 'c'] for i,j in zip(a,b): print i,j Or from itertools izip - which should be slightly more performant and less mem

Re: Adding an option on the fly (Tkinter)

2005-03-06 Thread Diez B. Roggisch
fig(enabled=False) Of course this means that cbs has to be a global var. But there exist other options of course - as part of a object or whatever. that depends on your code. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding help...very basic

2005-03-06 Thread Diez B. Roggisch
Hi, people here usually tend not to be too helpful when asked to do an obvious homework task. So if you really want help, provide some code you've already written and that has actual problems. Then we're glad to help. But don't expect others to do your work. -- Regards, D

Re: Error on xpath-ing a DOM with namespaces

2005-03-06 Thread Diez B. Roggisch
S) Evaluate(u'wsdl:description/wsdl:documentation', context=ctx) """ Should give you a start. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: IndexedCatalog and ZEO

2005-03-06 Thread Diez B. Roggisch
n conjunction with zeo as it has no idea of whatever storage is needed - all it does is indexing zodb objects - which you get from zeo as well. Of course that means that you have to keep a catalog for every thread/process that accesses the objects. Alternatively, you maybe can make the IndexedCata

Re: os.system()

2005-03-07 Thread Diez B. Roggisch
what commands actually fail would certainly help. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to make a list unique?

2005-03-08 Thread Diez B. Roggisch
inserted.add(e) listA = res Or, with a little helperfunction: inserted = set() def foo(e): inserted.add(e) return e listA = [foo(e) for e in listA if not e in inserted] But ist's not really much better. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread Diez B. Roggisch
problem - e.g. DNS is often a candidate than can slow down network experience a lot. So maybe thats causing your trouble? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Good variable names (Was: Re: Best way to make a list unique?)

2005-03-08 Thread Diez B. Roggisch
; :-) I usually use much more telling variable names - from the source I just wrote a minute ago: self.selection_color_map = {} self.selection_color = (255,255,0) self.assigned_color_map = {} self.default_color = (0,0,0) self.known_names = sets.Set() As you can see

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Diez B. Roggisch
f __init__(self, my_vals): self.__dict__.update(my_vals) foo = Foo(my_vals) print foo.a -> 1 Hope this helps, -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Diez B. Roggisch
'size': 367415L, > 'orientation' : (0x0112) Short=1 @ 42} You can't sort dicts - they don't impose an order on either key or value. There are ordered dict implementations out there, but AFAIK the only keep the keys sorted, or maybe the (key,values) in t

Re: determine directories with wildcard

2005-03-08 Thread Diez B. Roggisch
o is to convert your pattern to a regex: rex = re.compile(r"/dir/dir/.*/dir/.*/dir/.*") Then create a list of dirs with os.walk: dirs = [dirpath for dirpath, foo, bar in os.walk(topdir) if rex.match(dirpath)] This is untested, but should do the trick. -- Regards, Diez B. Roggisch

Re: Format strings that contain '%'

2005-03-08 Thread Diez B. Roggisch
> Will anything else work here? Use %% print "%%s %s" % "foo" -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: split a string with quoted parts into list

2005-03-10 Thread Diez B. Roggisch
> is there another way to convert a string with quoted sub entries into a > list of strings? try the csv-module. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: thread end and make main program end also?

2005-03-10 Thread Diez B. Roggisch
l end immediately after the main thread terminated. Read the threading modules docs. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie : prune os.walk

2005-03-10 Thread Diez B. Roggisch
Untestet: def foo(base, depth=2): for root, dirs, files in os.walk(base, True): if len(root.split(os.sep)) < depth: yield root, dirs, files for root, dirs, files in foo("/tmp"): print root, dirs, files -- Regards, Diez B. Roggisch -- http://ma

Re: newbie: dictionary - howto get key value

2005-03-10 Thread Diez B. Roggisch
phone = {'mike':10,'sue':8,'john':3} print [key for key, value in phone.items() if value == 3] -> ['john'] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: char buffer

2005-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello all, > > I need to create 6 buffers in python and keep track of it. > I need to pass this buffer, say buffer 1 as an index to a test app. Has > any one tried to do this. Any help with buffer management appreciated. Use the module array. -- R

Re: Confused with classmethods

2005-03-11 Thread Diez B. Roggisch
u observe seems to be a result of your "abuse" of classmethod outside a class scope. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused with classmethods

2005-03-11 Thread Diez B. Roggisch
rrent frame of execution, so def foo(): bar = "baz" makes the bar part of the frames local variables. Scopes just exchange or stack the dicts for name lookup. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Safe Local XMLRPC

2005-03-12 Thread Diez B. Roggisch
n't be much more than a few lines of code, more or less only subclassing your server from Pyro.core.ObjBase instead of SimpleXMLRPCServer. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: head for grouped data - looking for best practice

2005-03-12 Thread Diez B. Roggisch
t "--data--", data[key_size:] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Bitmap Newbie question

2005-03-12 Thread Diez B. Roggisch
"C:\\somedir\\test.xbm" -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Safe Local XMLRPC

2005-03-12 Thread Diez B. Roggisch
the network than soap/xmlrpc. So while the local loopback _might_ be slower (I'm not even sure about that) than the unix socket, marshalling data as xml has its own cost overhead. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Safe Local XMLRPC

2005-03-13 Thread Diez B. Roggisch
Stephen Waterbury wrote: > Diez B. Roggisch wrote: >> ... corba is 10-100 times faster over >> the network than soap/xmlrpc. ... > > I'm not challenging these statistics (because I don't know), > but I would be interested in the source. Are you referring >

Re: Extending and Embedding

2005-03-13 Thread Diez B. Roggisch
rap the module - which is possible in several ways, including hand-written code, pyrex, swig and sip. Maybe even more, I don't know. Or you access it using the module ctypes that allows to invoke arbitrary methods/funtctions of C-libs. google for it. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Web framework

2005-03-13 Thread Diez B. Roggisch
> accessible with normal development tools since it's stuck in the ZODB. Plain wrong. You can access them via FTP and WEBDAV. In kde under linux, all file-io can be done through these protocols, so you can operate on them as if they were local files. -- Regards, Diez B. Roggisch -- http://

Re: Web framework

2005-03-14 Thread Diez B. Roggisch
tly using ftp as storage backend. (x)emacs for example. > Besides, how to have the > source code under source control if it's stuck in the ZODB? You can still fetch it using webdav and ftp and stick it into CVS/SVN. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

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