Re: wxPython: GridBagSizer, EXPAND, and HtmlListBox

2005-06-07 Thread Adam Endicott
Just an update if anyone runs across this through google. It appears this was an issue fixed in 2.6.0.1 (or 2.6.1.0, I forget which exactly). I was using 2.6.0.0. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Pyrex] Allocating an array.array of a specific length in pyrex

2005-06-08 Thread Adam Langley
Size(NULL, length) buffer = PyString_AsString(temp_string) That's one way to do it. But it looks like you just want an area of memory so why not: cdef extern from "stdlib.h": ctypedef unsigned long size_t void *malloc(size_t size) void free(void *mem) ? AGL -- Adam Langley

"also" to balance "else" ?

2005-06-13 Thread Ron Adam
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a few weeks ago while trying to find the best way to form a if-elif-else block, that on a very general

Re: "also" to balance "else" ?

2005-06-13 Thread Ron Adam
Eloff wrote: > My first reaction was that this is terrible, else clauses on loops are > confusing enough. But if I think about it more, I'm warming up to the > idea. Also/Else for loops is clear, symmetrical, and would be useful. > > Reversing the meanign of else will break code, but it's not used

Re: "also" to balance "else" ?

2005-06-13 Thread Ron Adam
John Roth wrote: > > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> Currently the else block in a for loop gets executed if the loop is >> completed, which seems backwards to me. I would expect the else to >> compl

Re: "also" to balance "else" ?

2005-06-13 Thread Ron Adam
Andrew Dalke wrote: > Ron Adam wrote: > >>It occurred to me (a few weeks ago while trying to find the best way to >>form a if-elif-else block, that on a very general level, an 'also' >>statement might be useful. So I was wondering what others woul

Re: "also" to balance "else" ?

2005-06-13 Thread Ron Adam
Terry Hancock wrote: > On Monday 13 June 2005 11:09 pm, Ron Adam wrote: >>My suggestion is to use, also as the keyword to mean "on normal exit" >>'also' do this. > > > Unfortunately, "also" is also a bad keyword to use for this, IMHO. &

Re: "also" to balance "else" ?

2005-06-14 Thread Ron Adam
Sion Arrowsmith wrote: > Fredrik Lundh <[EMAIL PROTECTED]> wrote: >>nope. else works in exactly the same way for all statements that >>support it: if the controlling expression is false, run the else suite >>and leave the statement. > > > For example, consider the behaviour of: > > condition =

Re: "also" to balance "else" ?

2005-06-14 Thread Ron Adam
Andrew Dalke wrote: > As someone else pointed out, that problem could be resolved in > some Python variant by using a different name, like "at end". > Too late for anything before P3K. It was pointed out to me the logic of the else is consistant with the if in reguard to the loop test it self, i

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Fredrik Lundh wrote: > Ron Adam wrote: > > >>So the (my) confusion comes from the tendency to look at it in terms of >>overall program flow rather than in terms of the specific conditional >>logic. >> >>In a for loop the normal, as in terminating normally

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Terry Hancock wrote: > On Wednesday 15 June 2005 03:57 am, Fredrik Lundh wrote: > >>where your "abnormal behaviour" is, of course, the expected >>behaviour. if you insist on looking at things the wrong way, >>things will look reversed. > > Unfortunately, the converse is true, too: no matter how

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Nicolas Fleury wrote: > Ron Adam wrote: > >> It occurred to me (a few weeks ago while trying to find the best way >> to form a if-elif-else block, that on a very general level, an 'also' >> statement might be useful. So I was wondering what others would thin

Thread-safety of dict

2007-05-31 Thread Adam Olsen
conditions I outlined, letting the attack succeed. So there you have it: if you're using a dict with custom classes (or anything other than str) across multiple threads, and without locking it, it's possible (though presumably extremely rare) for a lookup to fail even through the key wa

Re: Thread-safety of dict

2007-06-01 Thread Adam Olsen
. That could be fixed with with a before/after check of ma_mask. And if you're *really* feeling paranoid you could add reference counting to ma_table. I doubt anybody cares quite that much though. ;) -- Adam Olsen, aka Rhamphoryncus -- http://mail.python.org/mailman/listinfo/python-list

`yield` in a `try/finally` block, pre-Python 2.5

2007-06-03 Thread Adam Atlas
I'm trying to emulate the Python 2.5 behaviour (PEP 342) of generator functions where the `yield` statement is in a `try/finally` block. Basically, where the `finally` block is guaranteed to run even if the generator doesn't finish running: it simply runs when the generator is garbage-collected. Do

Re: `yield` in a `try/finally` block, pre-Python 2.5

2007-06-04 Thread Adam Atlas
On Jun 4, 1:49 am, yuce <[EMAIL PROTECTED]> wrote: > I had the same problem, you can > see:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/130004 > for a solution. > > Happy hacking, > > Yuce Thanks. I thought of doing something like that, but in my program, it's important that the order

Re: How do you htmlentities in Python

2007-06-04 Thread Adam Atlas
As far as I know, there isn't a standard idiom to do this, but it's still a one-liner. Untested, but I think this should work: import re from htmlentitydefs import name2codepoint def htmlentitydecode(s): return re.sub('&(%s);' % '|'.join(name2codepoint), lambda m: name2codepoint[m.group(1)], s

RE: Who uses Python?

2007-06-04 Thread Adam Pletcher
mer or sysadmin would use Python, I suppose. -- Adam Pletcher Senior Technical Artist Volition / THQ www.volition-inc.com > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of walterbyrd > Sent: Monday, June 04, 2007 2:37 PM > To: pyth

retrieve / find out an image's dimensions

2007-06-16 Thread Adam Teale
le to pass my script around to people without them needing any additional modules Any help would be fantastic! Cheers Adam python 2.3.5 osx 10.4.9 -- http://mail.python.org/mailman/listinfo/python-list

RE: copy locked files

2007-06-18 Thread Adam Pletcher
;C:\\new_folder\\test.dll') Although you can't move or delete an in-use file, AFAIK. - Adam > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of [EMAIL PROTECTED] > Sent: Monday, June 18, 2007 9:50 AM > To: python-list@python

Type of __builtins__ changes from module import to execution?

2007-06-21 Thread Adam Hupp
", hasattr(__builtins__, 'str') The output differs depending on how it is run: $ python ~/testmod.py has str True vs. $ python -c 'import testmod' has str False Anyone know if there a reason for this behavior?Is it a bug? I've seen this in 2.4 and 3.0. -Adam --

PyKQueue

2007-06-26 Thread Adam Atlas
Does anyone have a copy of PyKQueue 2.0 around? The site it's supposed to be on (http://python-hpio.net/trac/wiki/PyKQueue) is down. -- http://mail.python.org/mailman/listinfo/python-list

Writing TGA image files?

2007-06-28 Thread Adam Pletcher
Does anyone have Python code for writing Targa (TGA) image files? Ideally, with options for bit-depth/alpha channel, and RLE compression, but I'm probably reaching there. PIL is read-only for TGAs, unfortunately, and so far I'm striking out on Google. Thanks. -- Adam Pletcher Tec

RE: Writing TGA image files?

2007-06-29 Thread Adam Pletcher
Sorry, I was replying via the email list and didn't realize it would thread that way. - Adam From: [EMAIL PROTECTED] on behalf of Ben Finney Sent: Fri 6/29/2007 2:55 AM To: python-list@python.org Subject: Re: Writing TGA image files? "Adam Pletche

Plugging a pseudo-memory leak

2007-07-03 Thread Adam Atlas
I have a program that seemed to be leaking memory, but after debugging, it seemed it just wasn't getting around to collecting the objects in question often enough. The objects are very long-lived, so they probably end up in generation 2, and don't get collected for a long time. Is there any way I c

RE: Time A Script

2007-07-11 Thread Adam Pletcher
Try: --- import time start_time = time.time() run_time = time.time() - start_time print 'Run time: %f seconds' % run_time --- Also have a look at the timeit module for more timing functionality. - Adam From: [EMAIL PROTECTED] [mai

Re: Break up list into groups

2007-07-17 Thread Ron Adam
Matimus wrote: > I did some more experimenting and came up with the code below. It > shows several methods. When run, the script tests the robustness of > each method (roughly), and profiles it using timeit. The results from > running on my laptop are shown below the code. Try this one... def g

Re: Break up list into groups

2007-07-17 Thread Ron Adam
Matt McCredie wrote: > That certainly is fast, unfortunately it doesn't pass all of the tests. > I came up with those tests so I don't know how important they are to the > original poster. I modified it and came up with a generator and a > non-generator version based (roughly) on your algorith

Re: Break up list into groups

2007-07-20 Thread Ron Adam
Matimus wrote: > Excellent work! One more modification and I get below 10us/pass: > > def getgroups(seq): > groups = [] > push = groups.append > iseq = iter(xrange(len(seq))) > for start in iseq: > if seq[start] & 0x80: > for stop in iseq: >

Re: Better dict of dicts

2007-04-19 Thread Adam Atlas
On Apr 19, 5:24 pm, Bill Jackson <[EMAIL PROTECTED]> wrote: > I have a dictionary of dictionaries where the keys are typically very > long tuples and repeated in each inner dictionary. The dictionary > representation is nice because it handles sparseness well...and it is > nice to be able to look

Python's handling of unicode surrogates

2007-04-19 Thread Adam Olsen
is forcing you to use characters above 0x". This is a strawman. Unicode goes beyond 0x because real languages need it. Software should not break just because the user speaks a different language than the programmer. Thoughts, from all you readers out there? For/against? If there

Re: Python for Vcard Parsing in UTF16

2007-04-24 Thread Adam Atlas
On Apr 21, 7:28 pm, R Wood <[EMAIL PROTECTED]> wrote: > I know nothing about Python except that it interests me and has interested me > since I first learned the Rekall database frontend (Linux) runs on it. I just > ordered Learning Python and if that works out satisfactorily I'm going to go > bac

Re: Python for Vcard Parsing in UTF16

2007-04-24 Thread Adam Atlas
On Apr 21, 7:28 pm, R Wood <[EMAIL PROTECTED]> wrote: > To me this was a natural task for Perl. Turns out however, there's a catch. > Apple exports the file in UTF-16 to ensure anyone with Chinese characters in > their addressbook gets a legitimate Vcard file. Here's a function that, given a `s

Re: pydoc and imported modules

2007-04-25 Thread Ron Adam
[EMAIL PROTECTED] wrote: > When I "from foo import *" in my __init__.py, sometimes module foo's > docs will be expanded in the pydocs. It seems to depend in what > language foo was implemented. > > For example, if you "from math import *" in your __init__.py, you will > see math's members will app

Tracebacks for `exec`ed code?

2007-04-28 Thread Adam Atlas
Is it possible to make more traceback information available for exceptions code dynamically run via `exec`? Normally it just says things like "File '', line 3, in ?", which is not very helpful. I'm looking for a way for it to show the line of source code below it, like it would for an exception in

Re: editing scripts on a mac

2007-04-29 Thread Adam Atlas
On Apr 27, 12:08 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Now, frankly, I don't think this answer is correct, since I know OS X is > a UNIX derivative, but I am loathe to involve a programming noob with vi > or something similar. So I wondered if one of the c.l.py mac users could > give brief

__dict__s and types and maybe metaclasses...

2007-05-02 Thread Adam Atlas
Suppose I want to create a type (i.e. a new-style class via the usual `class blah(...)` mechanism) but, during the process of creating the type, I want to replace its __dict__ so I can override some behaviors during the initial assignment of its members. That is, I have `class blah(...): a = 123; b

Re: Can I use Python instead of Joomla?

2007-05-02 Thread Adam Atlas
On May 2, 4:48 pm, walterbyrd <[EMAIL PROTECTED]> wrote: > If I wanted to build a website with forums, news feeds, galleries, > event calander, document managment, etc. I do so in Joomla easily. > > But, I would perfer to use django/python, if that would be at all > practical. > > I suppose I could

Re: __dict__s and types and maybe metaclasses...

2007-05-02 Thread Adam Atlas
On May 2, 5:24 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > I think that most people accomplish this by: > > class blah: > __initial_values={'a': 123, 'b': 456} > > def __init__(self): > self.__dict__.update(self.__initialvalues) That's not really what I'm talking about... I'm talk

Sorting attributes by catagory

2007-05-09 Thread Ron Adam
This is for a new version of pydoc if I can get the class attributes sorted out. The module level attributes aren't too difficult to categorize. (I might be just too tired to see the obvious.) The original pydoc did this a somewhat round about way, so I would like to find a more direct method

WSGI spec clarification regarding exceptions

2007-05-09 Thread Adam Atlas
I'm trying to figure out if there's any defined behaviour in PEP 333 for instances where an application returns an iterable as usual without error, but that iterable's next() method eventually raises an exception. Since any data theretofore returned by the iterable must be assumed to have already b

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-09 Thread Ron Adam
Nick Vatamaniuc wrote: > Ron, > > Consider using epydoc if you can. Epydoc will sort the methods and it > will also let you use custom CSS style sheets for the final HTML > output. Check out the documentation of my PyDBTable module. > http://www.psipy.com/PyDBTable > > -Nick Vatamaniuc Hi Nick

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-10 Thread Ron Adam
Nick Vatamaniuc wrote: > Thanks for the info, Ron. I had no idea pydoc was that powerful! > -Nick Change *was* to *will be*. It really needed to be re factored. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about string(passing by ref)

2007-05-10 Thread Adam Atlas
On May 10, 5:43 pm, lazy <[EMAIL PROTECTED]> wrote: > I want to pass a string by reference. Don't worry, all function parameters in Python are passed by reference. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about string(passing by ref)

2007-05-10 Thread Adam Atlas
On May 10, 5:47 pm, Adam Atlas <[EMAIL PROTECTED]> wrote: > On May 10, 5:43 pm, lazy <[EMAIL PROTECTED]> wrote: > > > I want to pass a string by reference. > > Don't worry, all function parameters in Python are passed by reference. Actually, just to clarify a

Re: Newbie question about string(passing by ref)

2007-05-10 Thread Adam Atlas
On May 10, 6:19 pm, lazy <[EMAIL PROTECTED]> wrote: > So, just to make sure even if I return a value, there is no copy done. > Is it correct? > For eg: > > def blah: >long_str="" >return long_str > > my_str=blah() <=== So here there is no copy done but, my_str points to > the same memor

Re: How to cleanly pause/stop a long running function?

2007-05-12 Thread Adam Atlas
On May 12, 4:51 pm, Basilisk96 <[EMAIL PROTECTED]> wrote: > Suppose I have a function that may run for a long time - perhaps from > several minutes to several hours. An example would be this file > processing function: > > import os > def processFiles(startDir): > for root, dirs, files in os.wa

webbrowser module bug?

2007-05-24 Thread Ron Adam
Is anyone else having problems with the webbrowser module? Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open('http://www.python.o

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
[EMAIL PROTECTED] wrote: > On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >> Is anyone else having problems with the webbrowser module? >> >> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 >>

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Brian van den Broek wrote: > Ron Adam said unto the world upon 05/25/2007 12:28 PM: >> [EMAIL PROTECTED] wrote: >>> On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> Is anyone else having problems with the webbrowser module? >>>> >>

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: >> [EMAIL PROTECTED] wrote: >>> On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> Is anyone else having problems with the webbrowser module? >>>> >>>> Python 2.5.1c1 (release25-maint, A

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Paul Boddie wrote: > On 25 May, 00:03, Ron Adam <[EMAIL PROTECTED]> wrote: >> Is anyone else having problems with the webbrowser module? >> >> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 >> Type &qu

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Ron Adam wrote: > Paul Boddie wrote: >> On 25 May, 00:03, Ron Adam <[EMAIL PROTECTED]> wrote: >>> Is anyone else having problems with the webbrowser module? >>> >>> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >>> [GCC 4.1.2 (Ubuntu 4.1

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Ron Adam wrote: > Got it. > > It looks like the problem started when I told firefox to make itself > the default browser. That changed the way webbrowser.py figured out the > browser to use. So instead of trying them in order, it asked the gnome > configure too

Re: webbrowser module bug?

2007-05-26 Thread Ron Adam
Paul Boddie wrote: > Ron Adam wrote: >> Reseting the default browser with the gnome default application window >> confirmed this. The browser selection can either have the quotes around >> the args "%s" paremteter, or not depending on how and what sets it. >&g

Equivalent to gzinflate() function in PHP.

2007-08-01 Thread Adam Kubica
Hellou. Anybody know about code that work equivalent to gzinflate() function used in PHP? I search via google but I don't found anything sensible :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent to gzinflate() function in PHP.

2007-08-01 Thread Adam Kubica
On Wed, 01 Aug 2007 13:54:21 +, kyosohma wrote: > On Aug 1, 8:44 am, Adam Kubica <[EMAIL PROTECTED]> wrote: >> Hellou. >> >> Anybody know about code that work equivalent to gzinflate() >> function used in PHP? >> >> I search via google but I don&#x

Re: Equivalent to gzinflate() function in PHP.

2007-08-01 Thread Adam Kubica
On Thu, 02 Aug 2007 08:17:13 +0200, Adam Kubica wrote: > On Wed, 01 Aug 2007 13:54:21 +, kyosohma wrote: > >> On Aug 1, 8:44 am, Adam Kubica <[EMAIL PROTECTED]> wrote: >>> Hellou. >>> >>> Anybody know about code that work equivalent to gzinflate

Who told str() to round my int()'s!!!

2007-08-11 Thread Adam W.
After a fair amount of troubleshooting of why my lists were coming back a handful of digits short, and the last digit rounded off, I determined the str() function was to blame: >>> foonum 0.0071299720384678782 >>> str(foonum) '0.00712997203847' >>> Why in the world does str() have any business ro

Re: Who told str() to round my int()'s!!!

2007-08-11 Thread Adam W.
On Aug 11, 12:53 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > If `str()` would not round you would get very long numbers because of the > inaccuracies of floating point values. I know Python is lying when 0.1 > prints as 0.1, but do you really want to see > 0.155511151

Is LOAD_GLOBAL really that slow?

2007-08-29 Thread Adam Olsen
my question: does somebody have a globals benchmark that shows a really significant slowdown vs local variables? -- Adam Olsen, aka Rhamphoryncus -- http://mail.python.org/mailman/listinfo/python-list

Pylons, SQLAlchemy, too many connections problem.

2007-08-31 Thread Adam Kubica
Hello. I have pylons 0.96 (SVN) and current SQLAlchemy (0.3.10), and I have bug that doesn't exist earlier. My connection code: import sqlalchemy.mods.threadlocal from sqlalchemy import DynamicMetaData, objectstore metadata = DynamicMetaData( case_sensitive = False ) def db_connect( dsn ):

Re: Pylons, SQLAlchemy, too many connections problem.

2007-08-31 Thread Adam Kubica
On Fri, 31 Aug 2007 14:03:48 +0200, Adam Kubica wrote: > Hello. > > I have pylons 0.96 (SVN) and current SQLAlchemy (0.3.10), and I have bug > that > doesn't exist earlier. > > My connection code: > > import sqlalchemy.mods.threadlocal > from sqlalchemy

Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-04 Thread Adam Atlas
I wrote this little program called Squisher that takes a ZIP file containing Python modules and generates a totally self-contained .pyc file that imports a specified module therein. (Conveniently, Python's bytecode parser ignores anything after an end marker, and the zipimport mechanism skips any n

Re: Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-05 Thread Adam Atlas
This could be easily made into a distutils extension (which was my intention all along, though that's not implemented yet). That's not the point. This is not intended as a "way to package source code". It's analogous to bdist, not sdist. The convenience gain is for the users, not (primarily) the de

Re: Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-05 Thread Adam Atlas
Ah... heh, sorry, I misread your message as "a much more convenient way" rather than "much more than a convenient way". Anyway, I understand that, and I do indeed find setuptools useful and use it on a regular basis. But my other points still stand. This would be a moot point if setuptools were pa

Re: Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-05 Thread Adam Atlas
Okay, here's the prototype... It's meant to be run as a command line program (pass it a directory or a zip file as an argument). By default it will save the new file to the argument's base name plus '.pyc'. You can override this with -o. Obviously it'

Re: Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-06 Thread Adam Atlas
Doesn't seem to work. I guess zipimport doesn't support that by default... but if I remember correctly, Setuptools adds that. Maybe I'll take a look at how it does it (I think by extracting the .so to / tmp?) and see how easy it would be to integrate it here. -- http://mail.python.org/mailman/lis

Re: Squisher -- a lightweight, self-contained alternative to eggs?

2007-03-06 Thread Adam Atlas
I updated it. http://adamatlas.org/2007/03/Squisher-0.2.py New Things: - It supports C extensions within squished packages. - It supports including squished packages within other squished packages. (That is, you can have a package that includes a .pyc generated by this, and turn that whole package

Pb with __del__ and inheritence

2007-03-07 Thread Erwan Adam
Hello all, Can someone reproduce this bug ... I use : [EMAIL PROTECTED] /home/adam/Work/Python]> python Python 2.4.3 (#2, Sep 18 2006, 21:07:35) [GCC 4.1.1 20060724 (prerelease) (4.1.1-3mdk)] on linux2 Type "help", "copyright", "credits" or "license&q

Pb with descriptor and super ...

2007-03-09 Thread Erwan Adam
.__get__ : class_name is A, obj is <__main__.B object at 0xb7b1f8ec> and typ is --- I expected that when getting super(B, b).attr, typ is A, but it is not the case ... python used : [EMAIL PROTECTED] /home/adam/Work/Python]> python Python 2.4.3 (#2, Sep 18 2006, 21:07:35) [GCC 4.1.1

Re: Pb with descriptor and super ...

2007-03-09 Thread Erwan Adam
Erwan Adam a écrit : > Hi all, > > I have a problem with the use of descriptors > and super. The file is : > > # --- > > class Desc(object): > def __init__(self, class_name): > self.class_name = class_name > return

Re: Pb with descriptor and super ...

2007-03-09 Thread Erwan Adam
Gabriel Genellina a écrit : > En Fri, 09 Mar 2007 06:25:08 -0300, Erwan Adam <[EMAIL PROTECTED]> > escribió: > >> I have a problem with the use of descriptors >> and super. The file is : > > Descriptors for "super" behave a bit different than f

[ANN] squisher 0.3

2007-03-17 Thread Adam Atlas
http://cheeseshop.python.org/pypi/squisher/0.3 I've posted the third version of my experimental packaging program Squisher. Squisher can take a directory representing a Python package (i.e. a directory with __init__.py) and "squish" it into a single .pyc file that you can import, or run on the com

Python C extension providing... Python's own API?

2007-03-26 Thread Adam Atlas
Does anyone know if it would be possible to create a CPython extension -- or use the ctypes module -- to access Python's own embedding API (http://docs.python.org/api/initialization.html &c.)? Could a Python program itself create a sub-interpreter, and work with it with all the privileges and capab

Re: Python C extension providing... Python's own API?

2007-03-26 Thread Adam Atlas
On Mar 26, 4:55 pm, "Matimus" <[EMAIL PROTECTED]> wrote: > I think that is what the "code" module is for. Maybe not exactly what > you were expecting, but the capability you describe is already there. > Being able to access its own interpreter is one of the things that > makes Python a dynamic lan

Re: Python C extension providing... Python's own API?

2007-03-26 Thread Adam Atlas
Wow! I'll have to read through that tomorrow when I'm (hopefully) less tired. :D Anyway, I somehow already managed to get this working. I'm calling it DoublePy. Here's the alpha or proof-of-concept or whatever we're to call it. http://adamatlas.org/2007/03/doublepy-0.1.tar.gz Not bad for an 0.1 w

Easy question: More items in a For loop?

2007-04-05 Thread Adam W.
I'm trying to write a script that will parse IRC chat logs and color code them if it finds certain characters. I was able to make this work with one character, but to make it even more accurate I would like to use two identifying characters. Here is my code : import urllib2 response = urllib2.u

Re: RFC: Assignment as expression (pre-PEP)

2007-04-09 Thread Adam Atlas
Hasn't this been discussed many many times before? I think Guido has been favourable to the idea of allowing :=, but that was a long time ago, and I don't think anything ever came of it. Personally, if anything, I'd like to see more use of the 'as' keyword as in Python 2.5's new 'with' statement.

Re: Breaking up Strings correctly:

2007-04-09 Thread Adam Atlas
;, 15]], [['IP', '=', '127.1.2.4'], ['AY', '! =', 0]]] (for the example you gave). Note that this example uses several features that won't be available until the next release, but it's coming soon. So Michael, though you'd still be able to parse this with the current version, the code wouldn't look as nice as this or the Pyparsing version. Maybe just add it to your watchlist. :) - Adam -- http://mail.python.org/mailman/listinfo/python-list

Pydoc Rewrite Discussion at doc-sig list.

2007-04-13 Thread Ron Adam
an be submitted and a final discussion can take place on the python-dev list at a later date. Thanks and Regards, Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Pydoc Rewrite Discussion at doc-sig list.

2007-04-14 Thread Ron Adam
Colin J. Williams wrote: > Ron Adam wrote: >> If anyone is interested in participating in discussing the details of the >> PyDoc rewrite/refactoring I've been working on, a discussion is being >> started on the doc-sig list. >> >> [EMAIL PROTECTED] >

Re: Compare regular expressions

2007-04-16 Thread Adam Atlas
On Apr 16, 1:50 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > It's not. For the simplest of expressions one might come up with a > relation between them, but even that would be hard. General case? No chance. I wouldn't say there's 'no chance'. It would require external parsing, for sure, but

Re: Python 3K or Python 2.9?

2007-09-21 Thread Ron Adam
TheFlyingDutchman wrote: > I am not talking about the way it does it, but rather, the way it > could do it or... could have done it. That requires no knowledge of > how the interpreter currently does it unless I am proposing something > that no interpreter in the world could ever do. Yes, there

Re: Python 3K or Python 2.9?

2007-09-21 Thread Ron Adam
Bruno Desthuilliers wrote: > Ron Adam a écrit : >> >> TheFlyingDutchman wrote: >> >>> I am not talking about the way it does it, but rather, the way it >>> could do it or... could have done it. That requires no knowledge of >>> how the int

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > My hope is to subtly reinforce the notion that functions are data > and can be passed around. The current function declaration doesn't > help with this. Creating a function and assigning it to a name is > exactly what Python does, why not have it come out in the syntax? It's > n

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > >> I think key may be to discuss names and name binding with your friend. How >> a name is not the object it self, like a variable is in other languages. >> For example show him how an

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-22 Thread Ron Adam
Scott David Daniels wrote: > Cristian wrote: >> On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >> >>> I think key may be to discuss names and name binding with your friend. > > Here's an idea: > > import math > > def sin_inte

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-23 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> >> Scott David Daniels wrote: >>> Cristian wrote: >>>> On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> >>>>> I think key may be to discuss names and name binding

Re: Factory function with keyword arguments

2007-09-23 Thread Ron Adam
Steven D'Aprano wrote: > I'm writing a factory function that needs to use keywords in the produced > function, not the factory. Here's a toy example: > I thought of doing this: > > def factory(flag): > if flag: kw = 'spam' > else: kw = 'ham' > def foo(obj, arg): > kwargs =

Re: Factory function with keyword arguments

2007-09-23 Thread Ron Adam
Steven D'Aprano wrote: > On Sun, 23 Sep 2007 03:55:45 -0500, Ron Adam wrote: > >> Steven D'Aprano wrote: >>> I'm writing a factory function that needs to use keywords in the >>> produced function, not the factory. Here's a toy example: > >

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-23 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Scott David Daniels wrote: >>> Ron Adam wrote: >>>> How about this? >>>> def integrate(fn, x1, x2, n=100):... >>> The point was a pedagogic suggestion, ... >> I understood your point.

Class design question

2007-10-03 Thread Adam Lanier
Relatively new to python development and I have a general question regarding good class design. Say I have a couple of classes: Class Foo: params = [ ] __init__( self, param ): ... Class Bar: data = None __init__( se

Re: Class design question

2007-10-03 Thread Adam Lanier
On Wed, 2007-10-03 at 18:47 +, George Sakkis wrote: > > > > I would use variable argument list for this; it's also consistent with > > your example Foo( 'baz', Bar( 'something else' )), otherwise you need > > to call it as Foo([ 'baz', Bar( 'something else' ) ]) Good point, this is what was tr

Re: RegEx question

2007-10-04 Thread Adam Lanier
On Thu, 2007-10-04 at 10:58 -0500, Robert Dailey wrote: > It should also match: > > @param[out] state Some description of this variable > > > On 10/4/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > The following regex (Not including the end quotes): > >

RE: howto kill a windows process by name ?

2007-10-05 Thread Adam Pletcher
Take a look at "killProcName.py", in the win32 extension package. - Adam > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of stef mientki > Sent: Friday, October 05, 2007 4:40 PM > To: python-list@python.org > Subject:

Python process automatically restarting itself

2007-10-11 Thread Adam Atlas
What is the best way for a Python process (presumed to be a script run by the interpreter binary, not embedded in some other program) to restart itself? This is what I've been trying: import __main__ for path in sys.path: path += '/' + __main__.__file__ if os.access(path,

Re: Python on imac

2007-10-13 Thread Adam Atlas
On Oct 13, 7:21 pm, John Velman <[EMAIL PROTECTED]> wrote: > I'm considering moving from Linux to imac. I've recently returned to > Python (was never very expert) to develop a small gui application. At > present I plan to use PyGTK with Pango and Cairo. > > What surprises may I be in for :-) > >

Re: Noob questions about Python

2007-10-17 Thread Adam Atlas
On Oct 17, 3:37 pm, Ixiaus <[EMAIL PROTECTED]> wrote: > I have recently (today) just started learning/playing with Python. So > far I am excited and impressed (coming from PHP background). > > I have a few questions regarding Python behavior... > > val = 'string' > li = list(val) > print li.reverse

Re: Convert string to command..

2007-10-18 Thread Adam Atlas
On Oct 18, 10:23 am, Abandoned <[EMAIL PROTECTED]> wrote: > I want to convert a string to command.. > For example i have a string: > a="['1']" > I want to do this list.. > How can i do ? Use the builtin function "eval". -- http://mail.python.org/mailman/listinfo/python-list

<    4   5   6   7   8   9   10   11   12   13   >