Re: Function parameter type safety?

2007-07-13 Thread George Sakkis
On Jul 12, 5:52 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? Yes; have a look at typecheck (http://oakwinter.com/code/typecheck/) and FormEncode (http://formencode.org/Validator.html).

Re: VB frontend to Python COM backend

2007-07-06 Thread Harry George
ook". You want "Python Programming on Win32" By Mark J.. Hammond, Andy Robinson. It covers exactly this case. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-05 Thread George Sakkis
x27;t know anything more about static typing than it does now. FWIW, there is already a typechecking module [1] providing a syntax as friendly as it gets without function annotations. If the number of its downloads from the Cheeshop is any indication of static typing's popularity among Pythonis

Re: try/finally in threads

2007-07-03 Thread George Sakkis
On Jul 3, 5:05 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I posted this on the Pyro list but I'm not sure if it's related > > specifically to Pyro. The "finally" clause below is not executed when > > f() r

try/finally in threads

2007-07-02 Thread George Sakkis
estLoop() finally: # nothing is printed if f() runs in a thread print "i am here!!" DAEMON.shutdown() print "i am over!!" Is "finally" not guaranteed to be executed in a non-main thread or is there something else going on ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: eggs considered harmful

2007-06-26 Thread Harry George
[EMAIL PROTECTED] (John J. Lee) writes: > Harry George <[EMAIL PROTECTED]> writes: >> [EMAIL PROTECTED] (John J. Lee) writes: > [...] >>> 2. You can run your own private egg repository. IIRC, it's as simple >>> as a directory of eggs and a plain old web

Re: Setuptools, build and install dependencies

2007-06-25 Thread Harry George
Robert Kern <[EMAIL PROTECTED]> writes: > Harry George wrote: > >> We need to know the dependencies, install them in dependency order, >> and expect the next package to find them. "configure" does this for >> hundreds of packages. cmake, scons, and other

Re: Inferring initial locals()

2007-06-24 Thread George Sakkis
(Function Signature Object) in place. What you claim about introspection code though I think holds for code in general. There are quite often edge cases which the programmer doesn't anticipate or care to handle. A tool that covers X% of real- world use cases for some large X and doc

Re: Setuptools, build and install dependencies (was: eggs considered harmful)

2007-06-22 Thread Harry George
Ben Finney <[EMAIL PROTECTED]> writes: > Harry George <[EMAIL PROTECTED]> writes: > > > Historically, python packages played well in this context. Install > > was a simple download, untar, setup.py build/install. > > > > Eggs and with other setupt

Re: eggs considered harmful

2007-06-22 Thread Harry George
Robert Kern <[EMAIL PROTECTED]> writes: > Harry George wrote: > > ...at least around here. > > > > I run a corporate Open Source Software Toolkit, which makes hundreds > > of libraries and apps available to thousands of technical employees. > > The

Re: eggs considered harmful

2007-06-22 Thread Harry George
[EMAIL PROTECTED] (John J. Lee) writes: > Harry George <[EMAIL PROTECTED]> writes: > [...] > > These are unacceptable behaviors. I am therefore dropping ZODB3, and > > am considering dropping TurboGears and ZSI. If the egg paradigm > > spreads, yet more packages

Re: Inferring initial locals()

2007-06-21 Thread George Sakkis
On Jun 21, 4:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 21, 8:51 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I wonder if there is a (preferably not too-hackish) solution to the > > following introspection problem: given

eggs considered harmful

2007-06-21 Thread Harry George
ll available as well. You can have dependencies, as long as they are documented and can be obtained by separate manual download. Thanks for listening. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Inferring initial locals()

2007-06-21 Thread George Sakkis
> get_init_locals(f, 3, 4, 5) {'a': (5,), 'k': {}, 'x': 3, 'y': 4} >>> get_init_locals(f, 3, q=-1) {'a': (), 'k': {'q': -1}, 'x': 3, 'y': 1} Any takers ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-06-20 Thread George Sakkis
e (and sometimes less) restrictive than necessary. Still, If you're addicted to manifest typing [1], the typechecking module [2] may give you a warm and fuzzy feeling: from typecheck import accepts @accepts(int, str) my_func(some_non_hungarian_notation_meaningful_name, othe

Re: The Modernization of Emacs

2007-06-19 Thread Harry George
-- code a bit, save, the other guy codes a bit. But when someone uses vi and then forgets how to do block moves, or uses eclipse and bogs down the session, or uses MS Notepad and can't enforce language-specific indents, I get frustrated. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-17 Thread George Sakkis
On Jun 17, 6:46 pm, Philipp Leitner <[EMAIL PROTECTED]> wrote: > Ever came to your mind that there are people (programmers and others) > who will not use emacs for their day-to-day work simply because they > have tools that suit them better for the work they have to do (Eclipse > for me, as an exa

Alternative logging packages

2007-06-17 Thread George Sakkis
g one) comment on how they compare to the standard logging ? George * among other shortcomings, such as unpickleable handlers, absurdly verbose config files, etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving items from list to list

2007-06-14 Thread George Sakkis
gt; value. I don't care which items I get so now I just use a couple of > pops or a for loop for more than two. > > Thanks > > jh >>> x = range(10) >>> y = [] >>> y.append(x.pop(4)) >>> print x, y [0, 1, 2, 3, 5, 6, 7, 8, 9] [4] >>> y

Re: Windows build of PostgreSQL library for 2.5

2007-06-13 Thread George Sakkis
gt; >http://stickpeople.com/projects/python/win-psycopg/ > > > It may well be, thanks. > > On second thoughts, is there one anywhere without an extra multi- > megabyte dependency? This seems to rely on the eGenix 'mx' library. > > -- > Ben Sizer IIRC v

Re: SimplePrograms challenge

2007-06-12 Thread George Sakkis
.com/ASPN/Cookbook/Python/Recipe/117119: from itertools import count, ifilter def sieve(): seq = count(2) while True: p = seq.next() seq = ifilter(p.__rmod__, seq) yield p I suspect that it violates your second rule though :) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 12 Jun., 14:57, Facundo Batista <[EMAIL P

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
eptable syntax for multiline lambdas; TOOWTDI is a secondary reason (as one can easily come up with a dozen TOOWTDI violations in other parts of the language). I agree though that in practice it's a very small limitation. George -- http://mail.python.org/mailman/listinfo/python-list

ANN: papyros 0.1

2007-06-11 Thread George Sakkis
allel version in a few lines, with minimal boilerplate code overhead. To get a copy, visit http://code.google.com/p/papyros/; also available from the Cheeseshop at http://www.python.org/pypi/papyros/. George Sample code == Here's a basic example; for more details go through the READ

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
On Jun 11, 10:37 am, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 3:38 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > >The boilerplate code can be minimal too with an appropriate > > decorator, something like: > > > class A(object): > > > d

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
are a better way to go. The boilerplate code can be minimal too with an appropriate decorator, something like: class A(object): def __init__(self,x,y): self.x = x self.y = y @cachedproperty def z(self): return self.x * self.y where cachedproperty is def

Dict naming, global vs local imports, etc. [was Re: *Naming Conventions*]

2007-06-03 Thread George Sakkis
a difference for tight loops). I usually go for (1), at least until the number of global imports in the top remains in single digits. After some point though I often localize the standard library imports that are used only once or twice (the third-party and local application imports are a

Re: Python rocks

2007-06-03 Thread George Sakkis
On Jun 2, 4:58 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > George Sakkis <[EMAIL PROTECTED]> wrote: > > > > >I had probably stumbled on many/most of the common pitfalls usually > >mentioned (e.g.http://www.ferg.or

Re: Python rocks

2007-06-02 Thread George Sakkis
enerators-itertools, not only for the productivity gains but perhaps even more for changing the way of thinking about programming, making Python worth learning [1]. But in general it's the overall design, making the right tradeoffs in most cases. George [1] "A language that doesn'

Re: file reading by record separator (not line by line)

2007-06-02 Thread George Sakkis
k > prototype implementation of this. I'm off to work > soon, so I can't do it today, but maybe Sunday. I'm afraid I beat you to it :) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 George -- http://mail.python.org/mailman/listinfo/python-list

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread George Sakkis
ing multiple processes in one or more hosts (through PYRO) and one singlethreaded (for the sake of completeness, probably not very useful). I'll write up some docs and I'll announce it, hopefully within the week. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Rats! vararg assignments don't work

2007-05-29 Thread George Sakkis
t suggested, > it isn't likely to be implemented. The first step would be to write a > PEP though. The time machine did it again: http://www.python.org/dev/peps/pep-3132/. George -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.groupby

2007-05-29 Thread George Sakkis
roupby(x, key=lambda div: div%n), [[] for _ in xrange(n)]) George -- http://mail.python.org/mailman/listinfo/python-list

setting environment from shell file in python

2007-05-29 Thread George Trojan
xists... George -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing tracebacks

2007-05-29 Thread George Sakkis
On May 29, 1:21 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 29 May 2007 13:51:09 -0300, George Sakkis > <[EMAIL PROTECTED]> escribió: > > > The traceback module is handy if you want a text representation of the > > traceback, not the a

Re: Storing tracebacks

2007-05-29 Thread George Sakkis
On May 29, 9:46 am, [EMAIL PROTECTED] wrote: > On May 28, 10:46 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm reading the docs on sys.exc_info() but I can't tell for sure > > whether I'm using it safely to get a snapshot of an exceptio

RE: Using python for a CAD program

2007-05-29 Thread George, Harry G
l Message- > From: Dan Fabrizio [mailto:[EMAIL PROTECTED] > Sent: Saturday, May 26, 2007 3:46 PM > To: python-list@python.org; George, Harry G > Subject: Using python for a CAD program > > Hello, > > I saw your post from last year about using python for a EE > CAD pr

Storing tracebacks

2007-05-28 Thread George Sakkis
ssedRequestError() class UnprocessedRequestError(RuntimeError): pass So far it seems it works as expected but I'd like to know if this is error-prone and why. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Struggling again 'map'

2007-05-26 Thread George Sakkis
eld next() except StopIteration: num_left[0] -= 1 nextfuncs[i] = next = repeat(default).next yield next() while True: t = tuple(iter_next_tuple_values()) if not num_left[0]: break yield t # example lista = [

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread George Sakkis
other way? > > W Yes; check out the following: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502243 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410698 George -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 4:22 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On May 23, 2:58 pm, [EMAIL PROTECTED] wrote: > > > > > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > I'm looking for any existing packages or ideas on how to implem

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 2:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, i.e. > >http://www.python.org/dev

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 2:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, i.e. > >http://www.python.org/dev

Parallel/distributed generator

2007-05-23 Thread George Sakkis
able to do something along the following lines: def iterprimes(start=1, end=None): # ... yield prime # rpc-related initialization ... rpc_proxy = some_rpc_lib(iterprimes, start=1e6, end=1e12) for prime in proxy: print prime Is there any module out there that does anything close to this

Re: Python assignment loop

2007-05-20 Thread George Sakkis
s does, lookup for "list comprehensions". By the way, I hope these were shortened examples and you're not actually using names such as 'Class' or 'ClassXYZ' in your actual code... George -- http://mail.python.org/mailman/listinfo/python-list

Re: converting strings to most their efficient types '1' --> 1, 'A' ---> 'A', '1.2'---> 1.2

2007-05-20 Thread George Sakkis
ew datasets with the same or similar structure but it soon gets tiring. I had a similar task recently so I wrote a general and efficient (at least as far as pure python goes) row transformer that does the repetitive work. Below are some examples from an Ipython session; let me know if this might be

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-16 Thread George Sakkis
es? No, and I would refuse to maintain code that did use them*. George * Unless I start teaching programming to preschoolers or something. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread George Sakkis
to it. Accepting this PEP would upset lots of people as it seems, and it's interesting that quite a few are not even native english speakers. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess with and without shell

2007-05-15 Thread George Sakkis
On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out why Popen captures the stderr of a specific > > command when it runs through the shell but not without it. IOW: > > &

Subprocess with and without shell

2007-05-14 Thread George Sakkis
PE, stdout=PIPE) else: # this captures only stdout pipe = Popen(cmd, shell=False, stderr=PIPE, stdout=PIPE) # this prints the empty string if not run through the shell print "stderr:", pipe.stderr.read() # this prints correctly in both cases print "stdout:", pipe.stdout.re

Re: Python ODBC

2007-04-30 Thread Harry George
bc are the main players. http://www.unixodbc.org/ http://www.iodbc.org/ 3. For *NIX you need python bindings. This is where mxODBC has operated (e.g., with iodbc). But there is an OSS effort at: https://sourceforge.net/projects/pyodb -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: Command-line option equiv of PYTHONPATH

2007-04-27 Thread Harry George
decisions you want. archtool_path= os.getenv('ARCHTOOL_PATH') archtool_cfg = os.getenv('ARCHTOOL_CFG') sys.path.insert(0,archtool_path) import archtool exec "import archtool.%s as cfg" % archtool_cfg -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread George Sakkis
e classobjs defined in there? Or finding any constant strings in the > caller's module would also be just fine. Or is there a completely > different way to do such a thing? Yes, there is: use an ORM to do the SQL generation for you. Check out SQLAlchemy, it will buy you much more than what you asked for. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread George Sakkis
took", secondsToStr(t2-t1),"seconds" > > and get nicely-formatted 0:00:12.345 style output. > > (I also posted this to the Python Cookbook.) > > -- Paul Cute... for obfuscated python contests :-) Whenever I needed this, a simple "Completed in %d minutes and %.1f seconds" % divmod(end-start, 60) was more than enough. George -- http://mail.python.org/mailman/listinfo/python-list

Re: is laziness a programer's virtue?

2007-04-17 Thread George Neuner
ably impossible. > >Perhaps somebody could ask the chinese government to put him in jail >for "hurting international society" :) That's going to be tough because, according to his web page, he's living in a Honda Civic somewhere in Illinois, USA. http://xahlee.org/PageTw

Re: Numeric Soup

2007-03-28 Thread Harry George
and numarray. > scipy > > provides a bunch of computational routines (linear algebra, optimization, > > statistics, signal processing, etc.) built on top of numpy. > > Thank you. > > Also see gsl and its python binding. http://www.gnu.org/software/gsl/ http://

Re: Help in Placing Object in Memory

2007-03-27 Thread Harry George
o python script share a common object? > For the CPU to use the object, it needs to be in RAM. But it is possible to save the RAM image onto disk, and then bring it back later. The common approach is called "pickling", though there are several variants on this: http://docs.pyth

Re: list comprehension help

2007-03-18 Thread George Sakkis
RAM boxes and setting a big buffer (1GB or more) reduces the wall time by 30 to 50% compared to the default value. BerkeleyDB should have a buffering option too, make sure you use it and don't synchronize on every line. Best, George -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension help

2007-03-18 Thread George Sakkis
ne reverse: > > first_word = line.split(' ', 1)[0] > last_word = line.rsplit(' ', 1][-1] > db[first_word] = last_word I'd guess the following is in theory faster, though it might not make a measurable difference: first_word = line[:line.i

Re: Automagically log changes in table

2007-03-17 Thread George Sakkis
This information is part of the context (e.g. an http request), not stored persistently somewhere. It should be doable at the framework/orm level but I'm rather green on Turbogears/SQLAlchemy. George -- http://mail.python.org/mailman/listinfo/python-list

Automagically log changes in table

2007-03-17 Thread George Sakkis
;modified_by", and every write operation on it would automatically record the time and the id of the user who did the addition or change (I'm not sure how to deal with deletions let's leave this for now). Has anyone done something like that or knows where to start from ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Debugging segmentation faults

2007-03-07 Thread George Sakkis
ial problem in general, but in my case every thread is exclusively responsible for the subprocesses it forks; no subprocess is inherited from the main thread or is shared in among the worker threads. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
be the worst of both worlds. The main alternative to the > present behavior is re-computing the default value every time the > function is entered. One can do this is today's Python if he's so inclined, albeit with a more verbose syntax: http://aspn.activestate.com/ASP

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
table values from defaults. The fact that an object is mutable doesn't mean that the function will try to mutate it: def paintWall(ind, colormap={1:'red', 2:'blue', 5:'green'}): print "Let's paint the wall %s" % colormap[ind] George -- http://mail.python.org/mailman/listinfo/python-list

Debugging segmentation faults

2007-03-07 Thread George Sakkis
I have a pure python program (no C extensions) that occasionally core dumps in a non-reproducible way. The program is started by a (non- python) cgi script when a form is submitted. It involves running a bunch of other programs through subprocess in multiple threads and writing its output in severa

Re: Descriptor/Decorator challenge

2007-03-05 Thread George Sakkis
self.m() > > m = B() > m.am() # prints 'A.m' > m.bm() # prints 'B.m' > > - > > P.S. Here's a link to the descriptor how-to: >http://users.rcn.com/python/download/Descriptor.htm What would the semantics be if m is decorated as local only in A or only in B ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Dialog with a process via subprocess.Popen blocks forever

2007-03-01 Thread George Trojan
ocess' stdin that causes it to somehow proceed, I can read > from its stdout. > > Thus a useful dialogue is not possible. > > Regards, > -Justin > > > Have you considered using pexpect: http://pexpect.sourceforge.net/ ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples vs Lists: Semantic difference (was: Extract String From Enclosing Tuple)

2007-02-28 Thread George Sakkis
or addition/removal/insertion of elements not making sense for a heterogeneous data structure, have you heard of database schema change ? Heterogeneous data structures are well known for several decades now; they are commonly spelled "records" though, not tuples, and have a more reasonable API to support their semantics. George -- http://mail.python.org/mailman/listinfo/python-list

Subprocess timeout

2007-02-28 Thread George Sakkis
ot on 2.4 print os.waitpid(p.pid, 0) What gives ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying a list while iterating through

2007-02-25 Thread George Sakkis
ly? seems like a big kludge. Unless I missed something, this is a simple string replacement: ''.join(packet).replace('01110', '011100') George -- http://mail.python.org/mailman/listinfo/python-list

Re: Bypassing __setattr__ for changing special attributes

2007-02-20 Thread George Sakkis
On Feb 20, 3:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 20 fév, 05:39, "George Sakkis" <[EMAIL PROTECTED]> wrote: > > > I was kinda surprised that setting __class__ or __dict__ goes through > > the __setattr__ mechanism, like a norm

Re: Bypassing __setattr__ for changing special attributes

2007-02-20 Thread George Sakkis
On Feb 20, 7:57 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 19 Feb 2007 23:18:02 -0800, Ziga Seilnacht wrote: > > George Sakkis wrote: > >> I was kinda surprised that setting __class__ or __dict__ goes through > >> the __setattr__ mechanism, lik

Bypassing __setattr__ for changing special attributes

2007-02-19 Thread George Sakkis
f.__class__ is Foo True Is there a way (even hackish) to bypass this, or at least achieve somehow the same goal (change f's class) ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: exec "def.." in globals(), locals() does not work

2007-02-19 Thread George Sakkis
is this a typo?). If you insist on using exec (which, again, you have no reason to for this example), take the union of d's globals and locals as f's globals, and store f in d's locals(): from math import * G = 1 def d(): L = 1 g = dict(globals()) g.update(locals()) exec "def f(x): return L + log(G) " in g, locals() return f(1) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Complex HTML forms

2007-02-18 Thread George Sakkis
On Feb 18, 4:44 am, Gregor Horvath <[EMAIL PROTECTED]> wrote: > George Sakkis schrieb: > > > I'd like to gather advice and links to any existing solutions (e.g. > > libraries, frameworks, design patterns) on general ways of writing > > complex web forms, as oppos

Complex HTML forms

2007-02-17 Thread George Sakkis
s the specific command, and only then they appear (typically by Javascript). When the form is submitted, the selected options are passed in the server in some form that preserves the hierarchy, i.e. not as a flat dict. Is there anything close to such a beast around ? George -- http://mail.python.org/ma

Re: Scripting Visio using Python

2007-02-14 Thread Harry George
se IronPython? An alternative might be to work (cross-platform) wit the vxd (XML) file format. A good reader/writer for that would be handy. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling J from Python

2007-02-09 Thread George Sakkis
rophile Here's another one, adapted from the example (in Java) in Wikipedia's entry (http://en.wikipedia.org/wiki/Sierpinski_triangle): N=15 for x in xrange(N,0,-1): print ''.join('* '[x&y!=0] for y in xrange(N+1-x)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling J from Python

2007-02-05 Thread George Sakkis
quot;similar to python" when the following is a program > written in it? Compared to that, even Perl is a wonder of readability... > > (cryptic gibberish snipped) > > http://www.jsoftware.com/jwiki/Essays/The_Ball_Clock_Problem > > Diez Please avoid posting code looking like garbled profanities in c.l.py. This was outright offensive. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking default arguments

2007-02-03 Thread George Sakkis
>>> f(1, y='bar') Supplied: {'y': 'bar', 'x': 1} Default: {'z': None} >>> f(1, z=None) Supplied: {'x': 1, 'z': None} Default: {'y': 'bar'} >>> f(1, 'bar', None) Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} >>> f(1, 'bar', z=None) Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} >>> f(1, z=None, y='bar') Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Where Does One Begin?

2007-02-02 Thread George Sakkis
On Feb 2, 3:39 pm, Mister Newbie <[EMAIL PROTECTED]> wrote: > I have no programming experience. I want to learn Python so I can make > simple, 2D games. Where should I start? Can you recommend a good book? > > Thank you. http://www.amazon.com/Game-Programming-Python-Development/dp/1584502584 --

Re: How much introspection is implementation dependent?

2007-02-02 Thread George Sakkis
print >print '==== test 2 ' >print adict >print construct(C, adict) > > if __name__ == "__main__": >test() What's the point of this ? You can call C simply by C(**adict). Am I missing something ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not play well with others

2007-02-02 Thread George Sakkis
nd add Numpy, Zope, Django, PIL, pretty much everything actually. Even better, make CheeseShop just a frontend to a build system that adds and updates automatically submitted packages to the core. Problem solved ! . George -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixed length lists from .split()?

2007-02-02 Thread George Sakkis
chain(seq, repeat(fill, minlen-len(seq))) >>> list(ipad('one;two;three;four'.split(";"), 7, '')) ['one', 'two', 'three', 'four', '', '', ''] >>> tuple(ipad(xrange(1,5), 7)) (1, 2, 3, 4, None, None, None) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Overloading the tilde operator?

2007-02-01 Thread George Sakkis
ation isn't arbitrary. Indeed, and that's because it is arbitrary. Python has the arbitrary limitation that it's not Perl (or C, or Lisp or what have you). George -- http://mail.python.org/mailman/listinfo/python-list

[Boost.Graph] graph.vertices property creates new objects

2007-01-29 Thread George Sakkis
s that the vertices iterator creates new vertex objects every time instead of iterating over the existing ones. This essentially prevents, among other things, storing vertices as keys in a dictionary since the hashes of the stored and the new vertex differ although they compare equal. Is this real

Re: dict.keys() ?

2007-01-26 Thread George Sakkis
h the complexity and the error-proneness of having two new similar-but-not-quite-the-same APIs with sets. Not only iteration is arguably the most common operation on a view, but the cost (in extra keystrokes and runtime performance) of populating any container that the user may need from an iterator is pretty low. George -- http://mail.python.org/mailman/listinfo/python-list

Re: assertions to validate function parameters

2007-01-25 Thread George Sakkis
ions by running python with '-O' or '-OO'. Optimization flags should never change the behavior of a program, so using assertions for what's part of the normal program behavior (validating user-provided input) is wrong. George -- http://mail.python.org/mailman/listinfo/python-list

RE: Python does not play well with others

2007-01-24 Thread George, Harry G
other, using strictly Open Source Software, and enjoying the process. .NET/Mono and C# don't pass either the "lots" or the "enjoy" tests. > -Original Message- > From: egbert [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 24, 2007 10:05 AM > To: Ge

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Harry George
on" and any other kind, and I'm not aware of any > case law that does so either. This distinction is also not codified in > the GPL itself anywhere, so it's not a necessary condition of the > license - it is an interpretation by the FSF and that is all. [snip] It is

Re: Python does not play well with others

2007-01-24 Thread Harry George
ust works. Same scripts run on every platform. Bindings available to every C/C++/FORTRAN library I've needed so far. Often the bindings are not complete, but oddly enough the binding developers have chosen to do just the functions I need, so who cares. A clean architecture for adding more f

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Harry George
ey do not have the authority to actually define its legal ramifications. Check with your company legal staff. Having said that, I have been troubled by trolltech's approach from the beginning, and therefore stay away from it. PyGTK and wdxPython are solid GUIs, without the legal uncertainty. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy or _numpy or Numeric?

2007-01-24 Thread George Sakkis
(float, line.split()) for line in open('my_space_separated_file.txt')] This stores the values as a list of lists, each list corresponding to a row in the file. Depending on what you plan to do next with these numbers, this may or may not be the best way to go about it, but since you only mentioned the file reading part, we can't assume much. George -- http://mail.python.org/mailman/listinfo/python-list

Re: mmap caching

2007-01-22 Thread George Sakkis
Dennis Lee Bieber wrote: > On 21 Jan 2007 13:32:19 -0800, "George Sakkis" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > The file is written once and then opened as read-only, there's no > > flushing. So if cachi

Re: mmap caching

2007-01-21 Thread George Sakkis
Martin v. Löwis wrote: > George Sakkis schrieb: > > I've been trying to track down a memory leak (which I initially > > attributed erroneously to numpy) and it turns out to be caused by a > > memory mapped file. It seems that mmap caches without limit the chunks > &g

Re: mmap caching

2007-01-21 Thread George Sakkis
Nick Craig-Wood wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I've been trying to track down a memory leak (which I initially > > attributed erroneously to numpy) and it turns out to be caused by a > > memory mapped file. It seems that mmap caches withou

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