Re: authentication project

2005-08-10 Thread Felix Schwarz
Hi, for some of the "ground work" you could use the Python Web Modules (www.pythonweb.org). fs -- http://mail.python.org/mailman/listinfo/python-list

Help with Regular Expressions

2005-08-10 Thread Harlin Seritt
I have been looking at the Python re module and have been trying to make sense of a simple function that I'd like to do. However, no amount of reading or googling has helped me with this. Forgive my stone-headedness. I have done this with .NET and Java in the past but damn if I can't get it done wi

Re: Python -- (just) a successful experiment?

2005-08-10 Thread Robert Kern
Michael Hudson wrote: > Michael Hudson <[EMAIL PROTECTED]> writes: > >>Robert Kern <[EMAIL PROTECTED]> writes: >> >>>What I'm trying to say is that posting to c.l.py is absolutely >>>ineffective in achieving that goal. Code attracts people that like >>>to code. Tedious, repetitive c.l.py threads a

Windows embedding problems with stdin and stdout

2005-08-10 Thread [EMAIL PROTECTED]
Hi, I have Python embedded with my other code, and when my other code opens a console and redirects stdout, stdin and stderr to it, then calls PyRun_InteractiveLoop, it immediately returns with an EOF. After some debugging the reason for this appears to be that the stdin and stdout that the ReadL

sorting question

2005-08-10 Thread Ksenia Marasanova
Hi, I have a list that contains nodes from a tree. Each node is a class instance, but I'll use dictionary here to simplify the example. So the list looks like this: [ {'id': 1, 'name': 'Parent node', 'ord_number': 1, 'parent_id': 0, 'url': '/parentnode/'}, {'id': 2, 'name': 'My node', 'ord_number'

Re: Adding and attribute to an instance

2005-08-10 Thread Gregory Bond
J wrote: > I have looked at some of the source code in PyObject_GenericGetAttr and > it turns out that the object has no dictionary. It seens that the > address of the dictionary is computed somehow via tp_dictoffset in the > type object. I asked this a few months ago.. Basically, you need a

Re: Module Extension C/CPI Question

2005-08-10 Thread Gregory Bond
Jeremy Moles wrote: > Or, perhaps, there's even a better way? I'm getting more and more > experienced with the Python/C API, so I don't need a walk-through or > anything. :) Just an experienced recommendation... > Better by far to create a new python type in C that has your struct inside it and

Re: Adding and attribute to an instance

2005-08-10 Thread Martin v. Löwis
Gregory Bond wrote: > Make sure you init this member to 0 (tp_init), and make sure you > PyXDECREF() it when the object is deleted (tp_dealloc). As this may cause your objects to appear in cycles, you may also have to add support for cyclic GC (unless you already did this before, and unless you ca

Re: Help with Regular Expressions

2005-08-10 Thread Devan L
Harlin Seritt wrote: > I have been looking at the Python re module and have been trying to > make sense of a simple function that I'd like to do. However, no amount > of reading or googling has helped me with this. Forgive my > stone-headedness. I have done this with .NET and Java in the past but >

Re: Python -- (just) a successful experiment?

2005-08-10 Thread EP
Robert Kern <[EMAIL PROTECTED]> > Michael Hudson wrote: > > Michael Hudson <[EMAIL PROTECTED]> writes: > > > >>Robert Kern <[EMAIL PROTECTED]> writes: > >> > >>>What I'm trying to say is that posting to c.l.py is absolutely > >>>ineffective in achieving that goal. Code attracts people that like >

Re: sorting question

2005-08-10 Thread Devan L
Ksenia Marasanova wrote: > Hi, > > I have a list that contains nodes from a tree. Each node is a class > instance, but I'll use dictionary here to simplify the example. > So the list looks like this: > [ > {'id': 1, > 'name': 'Parent node', > 'ord_number': 1, > 'parent_id': 0, > 'url': '/parentnod

Re: What are modules really for?

2005-08-10 Thread N.Davis
Thanks very much for your helpful replies. I totally accept my C++/Java background is a lot of this, and I need to make the shift to Python's way of thinking. As for multiple inheritance, yes I've always been aware of it being available in C++, but I learned C++ at a company which banned multiple

Re: What are modules really for?

2005-08-10 Thread N.Davis
Thanks very much for your helpful replies. I totally accept my C++/Java background is a lot of this, and I need to make the shift to Python's way of thinking. As for multiple inheritance, yes I've always been aware of it being available in C++, but I learned C++ at a company which banned multiple

Re: What are modules really for?

2005-08-10 Thread Dan
> Functions existing in a module? Surely if "everything is an object" (OK > thats Java-talk but supposedly Python will eventually follow this too) > then there should be nothing in a module thats not part of a class. No, it's a bit the other way around. In Python, functions are objects: >>> d

Re: Syntax error after upgrading to Python 2.4

2005-08-10 Thread Michael Hudson
Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: > Michael Hudson wrote: >> [EMAIL PROTECTED] writes: >> >>> On Sat, Aug 06, 2005 at 05:15:22PM -0400, Terry Reedy wrote: In any case letting developers add new features is part of the price of getting unpaid bug fixes for free software.

Re: namespaces

2005-08-10 Thread Paolino
Scott David Daniels wrote: > Well, an entry in the dictionary "sys.modules" is what is returned by > imports, so you could either pre-replace or post-replace a module by > an object which uses the descriptor technique to get to some (but not > necessarily all) of the attributes. Think of this tec

searching a list of dictionaries for an element in a list.

2005-08-10 Thread Odd-R.
If input is ['red','blue'], list1 is [ {'primarycolor':'red', 'secondarycolor':'burgundee'}, {'primarycolor':'red', 'secondarycolor':'wine'}, {'primarycolor':'yellow','secondarycolor':'plain'}, {'primarycolor':'blue','secondarycolor':'ocean'}] I

Re: What are modules really for?

2005-08-10 Thread Tito
N.Davis wrote: > Functions existing in a module? Surely if "everything is an object" (OK > thats Java-talk but supposedly Python will eventually follow this too) > then there should be nothing in a module thats not part of a class. Well, all data in a Python program are objects, in the sense tha

Re: namespaces

2005-08-10 Thread Paolino
Bengt Richter wrote: > Another thought/bf would be a way to extend the attribute namespace of an > arbitrary object > by chaining the attribute name spaces of a sequence of objects (this would be > a language mod) > e.g., (sort of a dynamic instance attribute mixin) > > obj ..= a, b, c #

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> class Node: > def __init__(self, name, url, order, pid, id): > self.name = name > self.url = url > self.order = order > self.pid = pid > self.id = id > def __repr__(self): > return self

Re: searching a list of dictionaries for an element in a list.

2005-08-10 Thread Dan
> I want to search list1, and the result should be all dictionaries where > primarycolor is in input. I can do this using a double for-loop, but is > there a more efficent way? Of course.:-) L = [dict for dict in list1 if dict['primarycolor'] in input] In older versions of Python, we would u

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi Bryan, Thanks for your reply. I tried to test your solution, but it doesn't work, hence threading.Semaphore object hasn't method to get value of semaphore. I looked to source code of semaphore.py and find out that value is private variable. Best regards, /Gelios "Bryan Olson" <[EMAIL PRO

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
Example of the wrong sort: class Node: def __init__(self, name, url, order, pid, id): self.name = name self.url = url self.order = order self.pid = pid self.id = id def __repr__(self): return '%s [order: %s]' % (self.url, self.order) def

Re: sorting question

2005-08-10 Thread Peter Otten
Ksenia Marasanova wrote: > I want to sort this list with the following rules: > 1. The parent must always come before the children in the list > 2. Nodes with the same parent must be sorted by 'ord_number' > > The first rule is easy, cause I can use 'url' for it. List with nodes > is coming from

Re: Help with Regular Expressions

2005-08-10 Thread Fredrik Lundh
Harlin Seritt wrote: > I am trying to find some matches and have them put into a list when > processing is done. I'll use a simple example like email addresses. > > My input is the following: > wordList = ['myname1', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', > '[EMAIL PROTECTED]', '[EMAIL PROTECTE

Why is this?

2005-08-10 Thread Jiri Barton
Hi everyone, I have a problem with initialization. >>> a, b = [[]]*2 >>> a.append(1) >>> b [1] Why is this? Why does not this behave like the below: >>> a, b = [[], []] >>> a.append(1) >>> b [] And, just to add to my confusion: >>> [[]]*2 [[], []] >>> [[], []] == [[]]*2 True Thanks in advance

What is Python?!

2005-08-10 Thread Robert Wierschke
hi I'm learning python since 3 days. I' ve some programming experience in BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting language to this repertoire (I have virtually no experience with scripting). Having read that python is object orientated, I start wondering if python i

Re: What is Python?!

2005-08-10 Thread Adriano Varoli Piazza
Robert Wierschke ha scritto: ... Reading the FAQ at the python website too difficult? I don't think you missed any of the most frequently asked... Good job. -- Adriano Varoli Piazza The Inside Out: http://moranar.com.ar MSN: [EMAIL PROTECTED] ICQ: 4410132 -- http://mail.python.org/mailman/listi

Re: Why is this?

2005-08-10 Thread Paolino
Jiri Barton wrote: > Hi everyone, > > I have a problem with initialization. > a, b = [[]]*2 a.append(1) b > [1] > > Why is this? Why does not this behave like the below: > >>> a, b = [[]]*2 >>> a==b True > > And, just to add to my confusion: > > [[]]*2 > > [[], []] > >>>

Re: What are modules really for?

2005-08-10 Thread Neil Benn
Tito wrote: >N.Davis wrote: > > >>Functions existing in a module? Surely if "everything is an object" (OK >>thats Java-talk but supposedly Python will eventually follow this too) >>then there should be nothing in a module thats not part of a class. >> >> > >Well, all data in a Python progr

Re: Help with Regular Expressions

2005-08-10 Thread Harlin Seritt
Ahh that's it Frederik. That's what I was looking for. The regular expression problems I will take care of, but first wanted to walk before running. ;) Thanks, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is this?

2005-08-10 Thread Matt Hammond
Hi Jiri, On Wed, 10 Aug 2005 11:40:54 +0100, Jiri Barton <[EMAIL PROTECTED]> wrote: > I have a problem with initialization. a, b = [[]]*2 a.append(1) b > [1] > > Why is this? Why does not this behave like the below: > a, b = [[], []] a.append(1) b > [] In the first

Re: python for microcontrollers

2005-08-10 Thread Peter Hansen
Evil Bastard wrote: > Peter Hansen wrote: >>grabbing >>an off the shelf Forth might be a more productive use of your time. > > Heh, methinks one might be misunderstanding the Forth culture. Lacking entirely in any knowledge of it whatsoever would be a more accurate description. "Ignorant of" is

Re: Help with Regular Expressions

2005-08-10 Thread Harlin Seritt
Forgive another question here, but what is the 'r' for when used with expression: r'\w+...' ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Bizarre error from help()

2005-08-10 Thread Peter Hansen
Ben Finney wrote: > Roy Smith <[EMAIL PROTECTED]> wrote: > >>I've got a directory where I keep all sorts of little snippets of >>python code for testing. When I start up python in that directory, >>I get the error I reported. It turns out, I've got a file called >>"string.py" in it [...] >> >>so

Re: Why is this?

2005-08-10 Thread Paolino
Paolino wrote: > Jiri Barton wrote: > >>Hi everyone, >> >>I have a problem with initialization. >> >> >a, b = [[]]*2 >a.append(1) >b >> >>[1] >> >>Why is this? Why does not this behave like the below: >> > > >>> a, b = [[]]*2 > >>> a==b > True Ooops I should write 'a is b' > > >>A

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
I had future investigation and as I understand in POSIX compliant threads, getting value of semaphore should be exist. As the matter of fact Python threads is not fully POSIX compliant. Pitty! Contining looking for another solution. "Nodir Gulyamov" <[EMAIL PROTECTED]> wrote in message news:[EMA

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Tried to rewrite using Event() just as experiment, but unfortunately MainThread will blocking all others. Code below: import threading class class1: def __init__(self): self.myEvent = threading.Event() result = doSomeJob() def increaseCounter(self): self.myEvent.

Re: What are modules really for?

2005-08-10 Thread Peter Hansen
Dan wrote: > You might think of modules in Python as like packages in Java. However, > putting classes in the same module doesn't give them any additional > powers to interact with each other. (At least, not that I know of.) Use of "global" to rebind shared module-scope names... -Peter -- http:/

Re: What is Python?!

2005-08-10 Thread Robert Wierschke
Adriano Varoli Piazza schrieb: > Robert Wierschke ha scritto: > ... > Reading the FAQ at the python website too difficult? I don't think you > missed any of the most frequently asked... Good job. > sorry I 've forgetten the FAQ -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching stderr output from graphical apps

2005-08-10 Thread Peter Hansen
Bryan Olson wrote: > Here's a module to show stderr output from console-less Python > apps, and stay out of the way otherwise. I plan to make a ASPN > recipe of it, but I thought I'd run it by this group first. For what it's worth, I believe you've basically duplicated the functionality available

Re: What is Python?!

2005-08-10 Thread Peter Hansen
Robert Wierschke wrote: > Having read that python is object orientated, I start wondering if > python is the right choice and what it is... > > a scripting language or a "normal" language like C++ etc. Ignore the "scripting language" label and just treat Python as a general purpose "normal"

Re: Help with Regular Expressions

2005-08-10 Thread Benjamin Niemann
Harlin Seritt wrote: > Forgive another question here, but what is the 'r' for when used with > expression: r'\w+...' ? r'..' or r".." are "raw strings" where backslashes do not introduce an escape sequence - so you don't have to write '\\', if you need a backslash in the string, e.g. r'\w+' == '\

Re: Why is this?

2005-08-10 Thread Jiri Barton
Yes, now it is clear! As always, I should have RTFM, the operator* is not just a syntactic sugar and thus does not make copies. You know, my actual scenario was with four variables at the time: a, b, c, d = [], [], [], [] so I was even more tempted to use the previous and wrong approach:-) Than

Re: What is Python?!

2005-08-10 Thread Roy Smith
Robert Wierschke <[EMAIL PROTECTED]> wrote: > a scripting language or a "normal" language like C++ etc. It is difficult to define exactly what a "scripting language" is and isn't, but I think most people would classify it as a scripting language. > So please tell me what python is, what ar

Re: Syntax error after upgrading to Python 2.4

2005-08-10 Thread nicolas_riesch
[EMAIL PROTECTED] wrote: > additive = self.additive, > ^ > SyntaxError: invalid syntax > I'm using Windows XP and Python 2.4.1 > > Any ideas? O:-) I had a similar problem with python 2.4.1. When I imported some module, I got a Sy

Re: Recommendations for CVS systems

2005-08-10 Thread Neal Becker
[EMAIL PROTECTED] wrote: > I was wondering if anyone could make recomendations/comments about CVS > systems, their experiences and what perhaps the strengths of each. > > Currently we have 2 developers but expect to grow to perhaps 5. > > Most of the developement is Python, but some C, Javascrip

Re: MultiFile object does not iterate

2005-08-10 Thread Fuzzyman
It has no __iter__ method either. I guess 'next' is just a historical accident. Should be easy enough to wrap it in your own class though and resolve this ? Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
2005/8/10, Peter Otten <[EMAIL PROTECTED]>: > I think you cannot get away with your first rule, but have to operate on the > full path instead. Otherwise the position of inner nodes would sometimes be > determined by their url and sometimes by their ord_number *during* *the* > *same* *sort*. Rrr.

Re: Why is this?

2005-08-10 Thread Fredrik Lundh
Paolino wrote: > This confuses me also, looks like empty lists share same object. nope. see Matt Hammonds reply for the full story. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does any one recognize this binary data storage format

2005-08-10 Thread geskerrett
Thanks so much for this. It is exactly what I was looking for. If I am simply reading the bytes from disk, would I still need to convert the these values HEX characters first with Hexlify, or is there a more direct route ? ie. convert them to the double float directly from the byte values ? --

Re: issues with doctest and threads

2005-08-10 Thread Michele Simionato
Tim Peters wrote: > Because the program is buggy: synchronizing threads isn't a "do it if > you feel like it" thing, it's essential to correct threaded behavior. > If you're going to show students bad thread practice, they're going to > get mysteries a lot deeper and more damaging than this one <0

Re: Why is this?

2005-08-10 Thread Jan-Ole Esleben
For the sake of completeness (I didn't copy this message to the list): > I have a problem with initialization. > >>> a, b = [[]]*2 > >>> a.append(1) > >>> b > [1] > > Why is this? Why does not this behave like the below: You create a single list (inside your brachets) and duplicate a reference to

"Ordered" dicts

2005-08-10 Thread Chris Cioffi
Lots and lots of people want ordered dicts it seems.  Or at least, they want to be able to access their dictionary keys in order.  It's in the FAQ ( http://www.python.org/doc/faq/programming.html#how-can-i-get-a-dictionary-to-display-its-keys-in-a-consistent-order) and has recently shown up as a re

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> return [(node.id, node.ord_number) for node in self.get_path()] I meant: > return [(node.ord_number, node.id) for node in self.get_path()] -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching stderr output from graphical apps

2005-08-10 Thread Bryan Olson
Peter Hansen wrote: > Bryan Olson wrote: > >> Here's a module to show stderr output from console-less Python >> apps, and stay out of the way otherwise. I plan to make a ASPN >> recipe of it, but I thought I'd run it by this group first. > > For what it's worth, I believe you've basically du

Re: "Ordered" dicts

2005-08-10 Thread mekstran
> Lots and lots of people want ordered dicts it seems. Or at least, they > want > to be able to access their dictionary keys in order. > [snipped lots of examples, nice pro-con lists, etc.] > What do y'all think? I'll second the need for this. Although, what can also be useful as a further extens

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Hi Bryan, > Thanks for your reply. > I tried to test your solution, but it doesn't work, hence > threading.Semaphore object hasn't method to get value of semaphore. > I looked to source code of semaphore.py and find out that value is private > variable. Your code

how to write thread-safe module ? and pytz

2005-08-10 Thread nicolas_riesch
Does someone know if the module pytz (http://sourceforge.net/projects/pytz/) is thread-safe ? I have not seen it explicitely stated, and just wanted to be sure, as I want to use it. That's because in the file pytz/tzinfo.py, I see global variables _timedelta_cache, _datetime_cache, _ttinfo_cache,

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Tried to rewrite using Event() just as experiment, but unfortunately > MainThread will blocking all others. > Code below: > > import threading > > class class1: > def __init__(self): > self.myEvent = threading.Event() > result = doSomeJob() >

Re: searching a list of dictionaries for an element in a list.

2005-08-10 Thread Sion Arrowsmith
Dan <[EMAIL PROTECTED]> wrote: >> [ someone else wrote: ] >> I want to search list1, and the result should be all dictionaries where >> primarycolor is in input. I can do this using a double for-loop, but is >> there a more efficent way? > >Of course.:-) > >L = [dict for dict in list1 if dict[

Re: What are modules really for?

2005-08-10 Thread Sion Arrowsmith
infidel <[EMAIL PROTECTED]> wrote: >> [ somebody else wrote: ] >> To my mind, although one CAN put many classes in a file, it is better to >> put one class per file, for readability and maintainability. >Personally I find it easier to maintain a set of related classes when >they're all in the same

Re: Does any one recognize this binary data storage format

2005-08-10 Thread Bengt Richter
On 10 Aug 2005 05:30:37 -0700, [EMAIL PROTECTED] wrote: >Thanks so much for this. It is exactly what I was looking for. > >If I am simply reading the bytes from disk, would I still need to >convert the these values HEX characters first with Hexlify, or is there >a more direct route ? >ie. convert

Re: Why is this?

2005-08-10 Thread Bryan Olson
Jiri Barton wrote: > Yes, now it is clear! > > As always, I should have RTFM, the operator* is not just a syntactic sugar > and thus does not make copies. That issue bites, like, everyone. > You know, my actual scenario was with four > variables at the time: > > a, b, c, d = [], [], [],

Re: Help with Regular Expressions

2005-08-10 Thread Paul McGuire
If your re demands get more complicated, you could take a look at pyparsing. The code is a bit more verbose, but many find it easier to compose their expressions using pyparsing's classes, such as Literal, OneOrMore, Optional, etc., plus a number of built-in helper functions and expressions, inclu

Re: Does any one recognize this binary data storage format

2005-08-10 Thread Grant Edwards
On 2005-08-10, Bengt Richter <[EMAIL PROTECTED]> wrote: > On Tue, 09 Aug 2005 21:50:06 -, Grant Edwards <[EMAIL PROTECTED]> wrote: > >>On 2005-08-09, Scott David Daniels <[EMAIL PROTECTED]> wrote: >>> Grant Edwards wrote: >Ex #1) 333- >Hex On disk: 00 00 00 80 6a 6e 49 41 > >>

Re: Does any one recognize this binary data storage format

2005-08-10 Thread Grant Edwards
On 2005-08-10, John Machin <[EMAIL PROTECTED]> wrote: Perhaps the one bit is an exponent -- some kind of floating point based format? That matches the doubling of all digits. >>> >>>That would just be sick. I can't imagine anybody on an 8-bit >>>CPU using FP for a phone number. >> >>>

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi, Thanks your reply again. Please find my comments below. > Your code did not, and could not, use the value of counter for > anything but busy-waiting. You had: > > while counter != 1: > pass > # ... continue... > > If you replace this with the semaphore, you can

Re: "Ordered" dicts

2005-08-10 Thread Simon Brunning
On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote: > I have lots of code that looks like: > keys = mydict.keys() > keys.sort() keys = sorted(mydict.keys()) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/pyt

Re: how to write thread-safe module ? and pytz

2005-08-10 Thread Bryan Olson
nicolas_riesch wrote: > Does someone know if the module pytz > (http://sourceforge.net/projects/pytz/) is thread-safe ? On that, I don't know. > That's because in the file pytz/tzinfo.py, I see global variables > _timedelta_cache, _datetime_cache, _ttinfo_cache, which are > dictionnaries and

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi again, comments below: > > doSomeJob(self): > > # BLOCKING HERE ### > > if not self.myEvent.isSet(): > > self.myEvent.wait() > > The initial 'if' is superflous. Excuse me, please explain. > > self.myEvent.clear() > > # ... continue... > > >

mixins that don't down-call?

2005-08-10 Thread Joshua Spoerri
Anybody have an idea for how to do python mixins that don't down-call? Thanks ( Mixins from different vendors might use the same method names for unrelated features, but should continue to work sensibly. It's fine to have one mixin method override another in its "public" interface, but overridin

help in algorithm

2005-08-10 Thread Paolino
I have a self organizing net which aim is clustering words. Let's think the clustering is about their 2-grams set. Words then are instances of this class. class clusterable(str): def __abs__(self):# the set of q-grams (to be calculated only once) return set([(self+self[0])[n:n+2] for n in

PyOpenGL

2005-08-10 Thread matt . walsh
Hey I'm a programmer looking to port some of my opengl ...although limited into a python app I've made... I'd like to know where to find any python/opengl source or a tutorial etc.. whatever I'd like to get a series of points that represent a 3d slope presented to the user. Thanks Matt -- http:/

Re: how to write thread-safe module ? and pytz

2005-08-10 Thread Daniel Dittmar
nicolas_riesch wrote: > Does someone know if the module pytz > (http://sourceforge.net/projects/pytz/) is thread-safe ? > I have not seen it explicitely stated, and just wanted to be sure, as I > want to use it. > > That's because in the file pytz/tzinfo.py, I see global variables > _timedelta_cac

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Hi again, comments below: > > >>>doSomeJob(self): >>># BLOCKING HERE ### >>>if not self.myEvent.isSet(): >>>self.myEvent.wait() >> >>The initial 'if' is superflous. > > Excuse me, please explain. The code: if some_event.i

Re: PyOpenGL

2005-08-10 Thread Thomas Moore
> Hey I'm a programmer looking to port some of my opengl ...although > limited into a python app I've made... I'd like to know where to find > any python/opengl source or a tutorial etc.. whatever I'd like to get a > series of points that represent a 3d slope presented to the user. Try wxPython. -

Re: "Ordered" dicts

2005-08-10 Thread Chris Cioffi
On 10/08/05, Simon Brunning <[EMAIL PROTECTED]> wrote: On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote: > I have lots of code that looks like:> keys = mydict.keys()> keys.sort()keys = sorted(mydict.keys())   While the sorted() built in addressed (yet another) community desire, I don't th

wxPython and threads again

2005-08-10 Thread perchef
Hi, I have several files to download and a GUI to update. I know this is a frequently asked question but i can't find an appropriate solution. My Downloader extends threading.Thread and update a wx.Gauge in GUI during the process. for src in urls: downloader = Downloader( src, destination,

Re: "Ordered" dicts

2005-08-10 Thread Simon Brunning
On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote: > While the sorted() built in addressed (yet another) community desire, I > don't think this addresses the underlying expectation of getting dictionary > keys in some order. You do get them in *some* order. ;-) > It works, but it feel like a

Re: "Ordered" dicts

2005-08-10 Thread Martin Miller
[EMAIL PROTECTED] wrote: > > Lots and lots of people want ordered dicts it seems. Or at least, they > > want > > to be able to access their dictionary keys in order. > > [snipped lots of examples, nice pro-con lists, etc.] > > What do y'all think? > > I'll second the need for this. Although, what

FTP over SSL (explicit encryption)

2005-08-10 Thread David Isaac
I am looking for a pure Python secure ftp solution. Does it exist? I would have thought that the existence of OpenSSL would imply "yes" but I cannot find anything. ftplib does not seem to provide any secure services. I know about fptutil http://codespeak.net/mailman/listinfo/ftputil but that doe

Re: Help with Regular Expressions

2005-08-10 Thread Jeff Schwab
Harlin Seritt wrote: > I am trying to find some matches and have them put into a list when > processing is done. I'll use a simple example like email addresses. > > My input is the following: > wordList = ['myname1', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', > '[EMAIL PROTECTED]', '[EMAIL PROTECT

Bug in slice type

2005-08-10 Thread Bryan Olson
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would describe if applied to a sequence of length items. It returns a tuple of three int

Documentation

2005-08-10 Thread Jan Danielsson
Hello all, What is the proper way to document a class in Python? I have written a few python libraries that I would like to document. I'm doing a lot of this: class Foo(object): """ This is a class which blah, blah, blah... It's features are blah, blah, blah... """ def addStuf

Re: Recommendations for CVS systems

2005-08-10 Thread Aahz
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > >It also is free for personal use (up to 2 clients, 2 users) and open >soruce projects can get free licenses. Or at least it was so the last I >checked. For anything mission-critical, I wouldn't want to rely on a fre

Re: Documentation

2005-08-10 Thread Jason Drew
The standard pydoc module is very useful. A simple example of how you could use it: >>> import pydoc >>> mymodule = pydoc.importfile(r"C:\My Py\my_foo.py") >>> html = pydoc.html.page(pydoc.describe(mymodule), >>> pydoc.html.document(mymodule)) >>> open("foo.html", "w").write(html) Then you have

Re: Does any one recognize this binary data storage format

2005-08-10 Thread geskerrett
Thanks again. Sort of thru me off, but is working perfectly now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommendations for CVS systems

2005-08-10 Thread Aahz
In article <[EMAIL PROTECTED]>, Neal Becker <[EMAIL PROTECTED]> wrote: > >For a python newsgroup, you are required to consider mercurial. It's not >ready for production use yet, but is making rapid progress, and many >(including myself) are using it. Why do you say "required" when the next sente

Re: Why is this?

2005-08-10 Thread phil hunt
On Wed, 10 Aug 2005 12:40:54 +0200, Jiri Barton <[EMAIL PROTECTED]> wrote: >Hi everyone, > >I have a problem with initialization. a, b = [[]]*2 a.append(1) b >[1] > >Why is this? Why does not this behave like the below: > a, b = [[], []] a.append(1) b >[] In your 1st

Re: What is Python?!

2005-08-10 Thread phil hunt
On Wed, 10 Aug 2005 13:14:26 +0200, Robert Wierschke <[EMAIL PROTECTED]> wrote: >hi > >I'm learning python since 3 days. I' ve some programming experience in >BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting >language to this repertoire (I have virtually no experience with >scr

Re: Recommendations for CVS systems

2005-08-10 Thread Aahz
In article <[EMAIL PROTECTED]>, Terry Reedy <[EMAIL PROTECTED]> wrote: >"Jeffrey E. Forcier" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> >> Thirding the Subversion/SVN suggestions. It's generally a newer, better >> CVS with some new features and a lot less of the negative featu

Re: "Ordered" dicts

2005-08-10 Thread Scott David Daniels
Simon Brunning wrote: > On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote: > >>I have lots of code that looks like: >>keys = mydict.keys() >>keys.sort() > > > keys = sorted(mydict.keys()) > Or (often useful to get at contents): items = sorted(mydict.items()) as in: For k

Re: What are modules really for?

2005-08-10 Thread bruno modulix
N.Davis wrote: (snip) > Functions existing in a module? Surely if "everything is an object" (OK > thats Java-talk but supposedly Python will eventually follow this too) > then there should be nothing in a module thats not part of a class. Why ? The name of the paradigm is *object* oriented, not *c

"Compile time" checking?

2005-08-10 Thread Qopit
Hi there, I'm pretty new to Python and am trying to figure out how to get "will this code compile?"-like code checking. To me this is a pretty basic language/environment requirement, especially when working with large projects. It is *much* better to catch errors at "compile-time" rather than at

Re: What are modules really for?

2005-08-10 Thread bruno modulix
Neil Benn wrote: (snip) > If you don't have a class how can you combine functionality with data > and hold state In Python, functions can hold state in various ways: closures, generators, and - Python functions being instances of the function class - attributes. > - that is one of the points of

Re: python for microcontrollers

2005-08-10 Thread Magnus Lycka
Peter Hansen wrote: > (Not trying to argue, just understand, because it looks like you're > conflating Forth programs with Forth implementations, or perhaps I'm > even more ignorant than noted above and am missing a key point. :-) It's decades since I coded Forth, but I suspect that Forth compil

Re: Documentation

2005-08-10 Thread Paul McGuire
Get epydoc from SourceForge (http://epydoc.sourceforge.net/). It will auto-generate beautiful HTML doc pages for your Python classes, using the information you have inserted as the doc strings for your classes and methods. I use it to generate the pyparsing documentation, and it works very well f

Re: Python supports LSP, does it?

2005-08-10 Thread bruno modulix
Roy Smith wrote: > Andy Leszczynski writes: > (snip) >>It's not a true statement. Nothing in the language enforces LSP. In >>fact, there's not even a [way?] when a function/method is invoked to make >>sure the type passed in is a subtype of the type you expect > > > Well, that's not entirely t

interpreter frame

2005-08-10 Thread Leo
Why is it not possible to get the frame from the interpreter using the inspect library? IOW, why does this code: >>> from inspect import * >>> stack() produce: [(, '', 1, '?', None, None)] instead of: [(, '', 1, '?', '\tstack()', 0)] ? I must be missing something. The motivating question is:

  1   2   3   >