Re: Where to host a (Python) project?

2009-02-02 Thread andrew cooke
On Feb 1, 8:45 pm, a...@pythoncraft.com (Aahz) wrote: > [...] I for one won't participate in any list hosted on > Google because of the need for a Google login. hi, just fyi, i investigated this and you can join any publicly readable group by sending an email to the "-subscribe" address. you do

Re: what IDE is the best to write python?

2009-02-02 Thread andrew cooke
> Just to register a contrary opinion: I *hate* syntax highlighting you can use it in surprising ways, if the implementation is good enough. when i used intellij with java i had the "syntax" highlighting set so that everything was simple black+white, but mutable state (i can't remember the exact

Re: database wrapper ?

2009-02-01 Thread andrew cooke
> I wish all DB solutions were like this - my hope is that EmpireDB will > do the same for Java, but it's too early to tell... Hmmm - I should correct the above. I had assumed EmpireDB was new, because it's an Apache Incubator project, but now I look at their site I see it's actually been around

Re: Where to host a (Python) project?

2009-02-01 Thread andrew cooke
On Feb 1, 8:45 pm, a...@pythoncraft.com (Aahz) wrote: > Note that it's fairly easy to get a new list hosted at python.org, just > ask postmaster.  I for one won't participate in any list hosted on > Google because of the need for a Google login. ah well - i guess you can use pyparsing ;o) http://

Re: database wrapper ?

2009-02-01 Thread andrew cooke
> Is SQLalchemy the best / most popular database wrapper ? SQLAlchemy is the best SQL library I have ever used. But it may depend on who you ask. For me, what makes SQLAlchemy so good is the way it allows you to use SQL from within Python. I have used the ORM side, and that's fine, but it's the

Re: help me python

2009-01-31 Thread andrew cooke
On Jan 31, 5:36 pm, aolsu...@gmail.com wrote: > C:\Python26>vnc.py > Traceback (most recent call last): >   File "C:\Python26\vnc.py", line 4, in >     import PyD3DES > ImportError: DLL load failed: The specified module could not be found. i'm surprised no-one has replied here. what is happening

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 4:50 pm, "Giampaolo Rodola'" wrote: > Google Code. > > --- Giampaolohttp://code.google.com/p/pyftpdlib thanks - that's a nice example. i'm a bit concerned about the whole google corporation thing, but reading through the ideological check- sheet at savannah convinced me i wasn't worth

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 11:22 am, eliben wrote: > code.google.com provides all of these in a free and convenient manner. > Recommended. unfortunately google don't seem that reliable ;o) (have you tried a google search today?) -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to host a (Python) project?

2009-01-31 Thread andrew cooke
On Jan 31, 9:59 am, Martin wrote: > There's tigris.org, savannah (savannah.gnu.org, nongnu.org), > launchpad. All of them are fine to some extent, you might want to read > up on PyMotW about how Doug Hellmann decided where to host his stuff. all i can find is that he is writing his own! http://bl

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread andrew cooke
> Just a correction: according to the doc, NotImplemented is not an > error, but a returned value. curious, so it is. i wonder why there is both a special return value (NotIMplemented) and a related exception (NotImplementedError). seems very odd to have a value... andrew -- http://mail.python

Re: Why do operators and methods of built-in types differ

2009-01-31 Thread andrew cooke
On Jan 31, 8:51 am, Csaba Hoch wrote: > What is the reason behind this difference between the __add__ operator > and int.__add__? this is quite common in python. the special methods like __add__ are used to implement some functionality (like '+' in this case), but they are not all of it. for ex

Where to host a (Python) project?

2009-01-31 Thread andrew cooke
Hi, I have a new project, that I just released in beta (http:// www.acooke.org/lepl - a recursive decent parser with full backtracking). At the moment I am using pypi and setuptools for distribution (it's a pure python package) and I am happy with hosting static web pages (the manual and api doc

Re: SimpleXMLRPCServer question

2009-01-31 Thread andrew cooke
On Jan 30, 11:59 pm, flagg wrote: > I am working on a very basic xmlrpc server, which will expose certain > functions for administering BIND zone files.  The big problem I am > having is parsing the incoming xmlrpc request.  Basically part of the [...] at the risk of repeating what the other guy

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
On Jan 24, 2:32 pm, Benjamin Peterson wrote: > I would suggest that you use the 2.6 syntax, and run "2to3 -f metaclass" on > your > code. (ABCs have been backported to 2.6.) Thanks - with that hint I found this - http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/#using-the-metaclass-in

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
On Jan 24, 10:39 am, Benjamin Peterson wrote: > andrew cooke acooke.org> writes: > > > > > Hi, > > > I have some 3.0 code, which I would like to make work with 2.6. > > However, there does not seem to be support for the new super() (no > > args) via __

Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
Hi, I have some 3.0 code, which I would like to make work with 2.6. However, there does not seem to be support for the new super() (no args) via __future__. Is that correct? If so, what's the best way to handle this? Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: function argument dependent on another function argument?

2009-01-18 Thread andrew cooke
>     sentinel = object() >     ... > >     def foo(x, y=sentinel): >       if y is sentinel: >           y = self.a it just struck me you could also do: def foo(self, x, *y_args) y = y_args[0] if y_args self.a which more directly checks whether an argument was passed, but has the do

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
Improved link - http://docs.python.org/3.0/reference/datamodel.html#object.__iadd__ -- http://mail.python.org/mailman/listinfo/python-list

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
http://bugs.python.org/issue4986 Sorry for the noise, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
On Jan 18, 9:56 am, andrew cooke wrote: > either i have misundertstood you ah, i see your point. sorry, andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
On Jan 18, 9:40 am, Marc 'BlackJack' Rintsch wrote: > On Sun, 18 Jan 2009 04:24:04 -0800, andrew cooke wrote: > > my argument was that *= is not treated as = and *, but as a completely > > new operator (the docs even say that the implementation need not return > >

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
On Jan 18, 9:01 am, Chris Rebert wrote: > Indeed. Python happens to in this case draw the line at using the > augmented assignment operators for non-assignment. I personally see > this as reasonable because the = symbol has a consistent meaning in > Python (assignment) whereas the other plain oper

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
Not sure if you were saying this, but the underlying technical reason for this issue is that they are treated as assignment rather than operators in the language spec - http://docs.python.org/3.0/reference/simple_stmts.html#augmented-assignment-statements I think this explains why they are not li

Re: what's the point of rpython?

2009-01-18 Thread andrew cooke
Since this is a PyPy bashing thread, maybe it's an appropriate place to suggest that the project has got a little bit waylaid by exploring cool things instead of releasing a useful final result? I am not questioning rpython directly - the case for something like that is obvious. But there's a que

Re: Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
> Therefore, Python requires you to rewrite the code in some other way > that makes your intentions more clear. For instance, why not use the > << operator instead? Right, but you're guessing what the context is. Within a DSL it often makes a lot of sense to use operators for reasons that weren't

Relax Syntax for Augmented Arithmetic?

2009-01-18 Thread andrew cooke
Context - http://docs.python.org/3.0/reference/datamodel.html?highlight=data model#object.__iadd__ Just a suggestion I thought I'd throw out... There's a restriction in the language implementation on exactly what can go the left of an augmented arithmetic expression. For example: >>> a = 3 >>> a

Re: Pythonic way to handle coordinates

2009-01-17 Thread andrew cooke
although james's idea is quite neat (especially the idea of heritable classes), my initial reaction was that it's too over-engineered. so here's a different approach. there are two "tricks" that can help make using tuples easier: (1) unpacking the return value. (x, y) = returns_a_point() x +

Re: ABCs, functions, and __call__ (Python3)

2009-01-16 Thread andrew cooke
On Jan 16, 10:13 pm, Christian Heimes wrote: > Any callable in Python 3.0 has a "__call__" attribute. Aha! Thanks! Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: *Advanced* Python book?

2009-01-16 Thread andrew cooke
not direct answers, but reading through the recipes can be interesting - http://code.activestate.com/recipes/langs/python/ also, reading any good computing book and then wondering how you can do that in python can help shed a new light on things. andrew -- http://mail.python.org/mailman/lis

ABCs, functions, and __call__ (Python3)

2009-01-16 Thread andrew cooke
I think I'm missing something obvious here, so apologies in advance. I'd like to be able to test whether something is a function or implements __call__. Now obviously I can do that as two separate tests, but I though this was what ABCs were for. However, for the life of me I cannot find what the

method-wrapper?

2008-05-31 Thread andrew cooke
Hi, Within Python (2.5): >>> help("__str__") Help on method-wrapper object: __str__ = class method-wrapper(object) | Methods defined here: | | __call__(...) | x.__call__(...) <==> x(...) | | __cmp__(...) | x.__cmp__(y) <==> cmp(x,y) [...] What is "method-wrapper"?

Re: Logging ancestors ignored if config changes?

2008-04-26 Thread andrew cooke
One way to handle this is to make creation of module-level Loggers lazy, and make sure that logging initialisation occurs before any other logging is actually used (which is not so hard - just init log at the start of the application). Of course, there's a performance hit... For example: class L

Logging ancestors ignored if config changes?

2008-04-25 Thread andrew cooke
Hi, I am seeing some odd behaviour with logging which would be explained if loggers that are not defined explicitly (but which are controlled via their ancestors) must be created after the logging system is configured via fileConfig(). That's a bit abstract, so here's the problem itself: I defi

Re: Metaprogramming Example

2008-04-19 Thread andrew cooke
On Apr 18, 4:48 am, Bruno Desthuilliers wrote: [...] > Practically, this means that (amongst other niceties) : > - you can define functions outside classes and use them as instance or > class methods > - you can add/replaces methods dynamically on a per-class or > per-instance basis > - you can ac

Re: Metaprogramming Example

2008-04-17 Thread andrew cooke
bruno: > Ho, and yes : one day, you'll get why it's such a good thing to unite > functions and methods !-) me: > PS Is there anywhere that explains why Decorators (in the context of > functions/methods) are so good? I've read lots of things saying they > are good, but no real justification of why

Re: Metaprogramming Example

2008-04-17 Thread andrew cooke
On Apr 17, 7:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: [...] Thanks very much! These are useful pointers. I'll update my code accordingly. At one point you pointed out I didn't need parentheses and I agree - I was using them to avoid having a line continuation backslash (I think I r

Metaprogramming Example

2008-04-16 Thread andrew cooke
Hi, Thanks for the help a couple of days ago. I completed what I was doing and wrote a summary which I've posted at http://acooke.org/cute/PythonMeta0.html (it's kind of long to post here). I hope it might be useful to someone else - it's complete code for a simple metaprogramming task that us

Re: Dynamic use of property() fails

2008-04-15 Thread andrew cooke
OK, fixed my bug - it does work. Now sleep... Thanks again, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic use of property() fails

2008-04-15 Thread andrew cooke
ignore that - i was mistaken (my test was too complex). the problem seems to be that the attribute is deleted even though __delete__ is defined. i'll look at it tomorrow. thanks again, andrew On Apr 15, 4:50 am, andrew cooke <[EMAIL PROTECTED]> wrote: > i tried code very similar

Re: Dynamic use of property() fails

2008-04-15 Thread andrew cooke
On Apr 15, 4:06 am, Bruno Desthuilliers wrote: > The canonical solution is to use a custom descriptor instead of a property: > > class Field(object): >def __init__(self, name, onchange): > self.name = name > self.onchange = onchange > >def __get__(self, instance, cls): > if

Re: Dynamic use of property() fails

2008-04-14 Thread andrew cooke
[Gabriel:] > The "magic" happens when the descriptor is found in the *class*, not in > the instance. I think it's detailed in Hettinger's document. > Do you actually want "per-instance" defined properties? ah! ok. yes, you're right: i want instance values but class properties, so i'll rethink th

Dynamic use of property() fails

2008-04-14 Thread andrew cooke
Hi, This is my first attempt at new classes and dynamic python, so I am probably doing something very stupid... After reading the how-to for descriptors at http://users.rcn.com/python/download/Descriptor.htm I decided I would make an object that returns attributes on read, but on setting calls an

<    1   2   3   4