Re: Decorator for Enforcing Argument Types

2006-12-22 Thread George Sakkis
%s)" % (args,kwds) class B(A): def foo(self, *args, **kwds): return "B.foo dispatcher(%s,%s)" % (args,kwds) d = TypeDispatcher() d[A] = lambda self,*args,**kwds: self.foo(*args,**kwds) d[int] = lambda self,*args,**kwds: "int dispatcher(%s, %s, %s)" % (self, args, kwds) for obj in A(), B(), 3: print d(obj, "hello", "world", x=3, y=3.5) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread George Sakkis
at if you select a single item from the select box, 'q' is binded to a string instead of a list of length 1, so instead of retrieving 'apple', she got back the results for 'a', 'p', 'p', 'l','e'. Bottom line, type checking is a tricky

Re: array of class

2007-01-02 Thread George Sakkis
gt; words = [] > for w in ['this', 'is', 'probably', 'what', 'you', 'want']: >words.append(Word(w)) > print words Or more compactly: words = [Word(w) for w in 'this is probably what you want'.split()] print words George -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread George Sakkis
tr.__lt__(self,other) L.sort(key=lambda i: (i.somestring, revstr(i.someotherstring), i.anotherkey)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-07 Thread George Sakkis
ing; just let it propagate up the call stack until the appropriate level. This might be the console, a GUI, a logfile, an automatically sent email or any combination of these or more. If it's a programmer's error (aka bug), it should propagate all the way up and end in printing the stack

Re: Fromatting an xml file

2006-02-03 Thread Harry George
"sir_alex" <[EMAIL PROTECTED]> writes: > Hi! I have a little problem writing xml files formatted in a way like > the following: > > > bla > bla > > > Every new node element should have a tabulation before it, but when I > use xml.dom.minidom I use writexml, which considers as

Accessing Windows Serial Port

2006-02-06 Thread George T.
missed an option? Can anyone provide me an example of how to access the serial port with pyserial? Thanks George T. -- http://mail.python.org/mailman/listinfo/python-list

Re: fairly large webapp: from Java to Python. experiences?

2006-02-06 Thread George Sakkis
on of your webapp and your lack of experience with a pythonic web framework. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python good for web crawlers?

2006-02-07 Thread George Sakkis
You may want to start from HarvestMan: http://harvestman.freezope.org/ George -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk() dirs and files

2006-02-08 Thread George Sakkis
download the path.py module (http://www.jorendorff.com/articles/python/path/): from path import path for fs_object in path(root).walk(): ADD fs_object to dictionary George -- http://mail.python.org/mailman/listinfo/python-list

Re: breaking from loop

2006-02-10 Thread George Sakkis
StopIteration: return False else: copy(first_match, dest_dir) return True I/O exceptions are left to propagate to the caller. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing a Web Robot in Python

2006-02-13 Thread George Sakkis
You'd probably get more results by searching for "web crawlers" or "web spiders". You may start from here: http://harvestman.freezope.org/faq.html HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: pyFltk-1.1

2006-02-22 Thread george williams
By god this sounds interesting I wish I knew what you are talking about George-- Original Message - From: "andreas" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python.announce To: <[EMAIL PROTECTED]> Sent: Wednesday, February 22, 2006 6:14 AM Subject: ANN: pyFltk-1.1

Rapid web app development tool for database

2006-03-01 Thread George Sakkis
of is Dabo, but it (currently) supports wxPython only for the UI. If there isn't anything like this out of the box, what would the best starting point be for implementing such a system ? Extending Dabo, a web framework (e.g. Django), or something different ? George -- http://mail.pytho

Re: How can I find the remainder when dividing 2 integers

2006-03-01 Thread George Sakkis
".split() for word_color in it.izip(word, it.cycle(colors)): print "%s" % word_color George -- http://mail.python.org/mailman/listinfo/python-list

Re: Roundup Issue Tracker release 1.1.1

2006-03-03 Thread george williams
This all looks interesting but I don't know what all this would do for me and I don't understand any of it george - Original Message - From: "Richard Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: ; <[EMAIL PROTECTED]> Sent: Thursday, March 0

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread George Sakkis
"Peter Otten" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > > What's the fastest and most elegant equivalent of zip() in > > Numeric/Numarray between two equally sized 1D arrays ? That is, how to > > combine two (N,)-shaped arrays to one (N,2)

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread George Sakkis
"Peter Otten" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > > Though not the fastest to execute; using concatenate instead of > > initializing an array from a list [a,a] is more than 2,5 time faster in > > my system (~4.6 vs 11.8 usec per loop a

Re: Using wildcards...

2005-05-02 Thread George Yoshida
tp://docs.python.org/lib/module-re.html - HOWTO http://www.amk.ca/python/howto/regex/ In your case, the code would go like this: >>> text = '{1:1} Random text here. {1:2} More text here. and so on.' >>> import re >>> pattern = re.compile('{\d+:\d+}'

Re: Inspect Python Classes for instance data information

2005-05-02 Thread George Sakkis
? > > cheers > --- > Tim Henderson > mail me: [EMAIL PROTECTED] Check out the gnosis.magic package of David Mertz ( http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html). Even if it's not exactly what you want, it will give you an idea of where to go from there. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Inspect Python Classes for instance data information

2005-05-02 Thread George Sakkis
d rather avoid metaclasses and start from scratch, this article is a nice guideline to introspection: http://www-106.ibm.com/developerworks/library/l-pyint.html George -- http://mail.python.org/mailman/listinfo/python-list

Re: Documenting Python code.

2005-05-03 Thread George Yoshida
odule may be useful for that purpose. Doctest can also be used as a unittest. -- george http://www.dynkin.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write this regular expression?

2005-05-04 Thread George Sakkis
This newsgroup is in general very helpful, but there are some exceptions; one of them is when the problem appears blatantly to be a homework. Perhaps if you showed that you worked on it and made some progress, but it's not quite right, someone may help you. George -- http://mail.pytho

Re: PHPParser pod Zope

2005-05-04 Thread George Sakkis
o admit that > my answer may not be as (kindly) funny as intended, and so I hope the OP > has a better sens of humor than you and me !-) > or perhaps the OP's sense of humor is irrelevant if he/she cannot read this thread in english :-) George -- http://mail.python.org/mailman/listinfo/python-list

Weird UserArray AttributeError (bug ?)

2005-05-06 Thread George Sakkis
quot;can't delete attribute" # in ignored v.magnitude = 10 Any ideas on what's going on and if there's a workaround ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: RFC 2822 format date printing function in python

2005-05-06 Thread George Yoshida
timezone; the latter variable follows the POSIX standard while this module follows RFC 2822. http://docs.python.org/lib/module-time.html -- george http://www.dynkin.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting number of iteration

2005-05-06 Thread George Sakkis
"Florian Lindner" wrote: > Hello, > when I'm iterating through a list with: > > for x in list: > > how can I get the number of the current iteration? > > Thx, > > Florianfor in python 2.3+: for i,x in enumerate(sequence): print "sequence[%d]

Re: Weird UserArray AttributeError (bug ?)

2005-05-06 Thread George Sakkis
de/self.magnitude)) Any alternatives to get the same effect without deleting an attribute of the superclass ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie : checking semantics

2005-05-07 Thread George Sakkis
, just as it would verify that the program below is correct: if (aCondition): AFunctionThatIsDefined() . . . . def AFunctionThatIsDefined(): return 0 / (0-0) Moral: There are *many* more reasons for testing every execution path than catching name or type errors. George -- http://mail.python.org/mailman/listinfo/python-list

cimport from different packages [Pyrex]

2005-05-09 Thread George Sakkis
p.pyx tmp.pyx:1:8: 'foo.bar.pxd' not found I tried every reasonable choice for '-I' dir, without success. Am I missing something or it's just cimport's deficiency ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing modules

2005-05-11 Thread George Sakkis
; > did you perhaps stumble upon a strange man with a keg of liquor back > in the sixties, or what's going on here? ;-) > > > > > In more modern terminology, an analog might be UML sequence diagrams. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Documentation (should be better?)

2005-05-11 Thread George Sakkis
to look up language features, modules and APIs, the python quick reference is an excellent starting point, especially for someone new to the language: http://rgruet.free.fr/PQR24/PQR2.4.html (also linked from http://www.python.org/doc/ along with other doc sources). It's available in pd

Re: Markov chain with extras?

2005-05-16 Thread George Sakkis
therchain[j]. If you're talking about something else, you need to clarify the problem more. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing text into dates?

2005-05-16 Thread George Sakkis
by default ). Below is the doctest and the documentation (with epydoc tags); mail me offlist if you'd like to check it out. George #=== def parseDateTime(string, USA=False, implyCurrentDate=False, yearHeuristic=_20thcent

Re: Reg Date string conversion into timestamp function

2005-05-16 Thread George Sakkis
hread posted today with almost the same topic (http://tinyurl.com/bpcg8). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing text into dates?

2005-05-16 Thread George Sakkis
"John Machin" <[EMAIL PROTECTED]> wrote: > On 16 May 2005 17:51:31 -0700, "George Sakkis" <[EMAIL PROTECTED]> > wrote: > > > >#=== > > > >def parseDateTime(string, USA=Fal

Re: Like Christ PBBUH Prayed

2005-05-16 Thread George Sakkis
"flamesrock" wrote: > I don't understand.. why is everyone talking about christ on > comp.lang.python? Isn't this not the place? > Maybe they know something we don't. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python suitable for a huge, enterprise size app?

2005-05-18 Thread George Sakkis
faces, and write the bulk of the implementation in jython. PSF has awarded a grant to make jython catch up with cpython, and that's good news for making the transition from java to python smoother to a large audience. Others may have more to say on the pros and cons of going with java/jython instead of cpython, but it seems a good compromise to me. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python suitable for a huge, enterprise size app?

2005-05-18 Thread George Sakkis
t;standard > business > > practices", so in a way "it's ok" to screw up, you did what everybody > > else does. Yet another failed java enterprise project, nothing to see > > here. > > Hi George, You probably know the tale about Achilles and the turtl

Re: help with generators

2005-05-19 Thread George Sakkis
fe # mutation and accumulation of yielded lists perm[n] = 0; yield perm perm[n] = 1; yield perm return _bin(n) $ python /usr/local/lib/python2.4/timeit.py -s "from bin import bin3" "for i in bin3(10): pass" 1000 loops, best of 3: 587 usec per loop Cheers, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Shift-JIS to UTF-8 conversion

2005-05-20 Thread George Yoshida
3.exe If you only need Japanese support, Japanese Codecs might be handy. On the other hand, CJKCodecs can handle much broader encodings. Aside from that, starting from 2.4, Python ships with CJKCodecs, so I'd recomment CJKCodecs without reservations. -- george -- http://mail.python.org/mailman/listinfo/python-list

Re: Python analog of Ruby on Rails?

2005-05-25 Thread George Sakkis
x27;.')]) for p in '[EMAIL PROTECTED]'.split('@')])" Cheers, George -- http://mail.python.org/mailman/listinfo/python-list

Re: smart logging and the "inspect" module ...

2005-05-28 Thread George Sakkis
esn't use inspect. import sys class Log: def write(self,message): frame = sys._getframe(1) code = frame.f_code print "%s:%d:%s, %s" % (code.co_filename, frame.f_lineno, code.co_name, message) There's a logging module in the

Re: couple of new python articles on onlamp

2005-06-03 Thread George Yoshida
ttp://www.onlamp.com/pub/a/python/2005/06/01/kongulo.html >> >>and >> >>Python Standard Logging >>http://www.onlamp.com/pub/a/python/2005/06/02/logging.html >> >> >>Comments, criticisms, flames all welcome. > > > I've read the logging ar

Re: Iterate through a list calling functions

2005-06-05 Thread George Sakkis
hether numeric value is a decimal.''' class ZipCodeValidator(Validator): def __call__(self,name,value): '''Test if value is a US Zip Code.''' def validateField(name, value, validators): """ Validates field input """ results = {} for validate in validators: result = validate(name,value) if result is not None: results[name] = result # XXX: if more than one validators succeed, # all but the last result will be overwritten return results # test validators = [DecimalValidator(), ZipCodeValidator()] print validateField("home ZIP", "94303", validators) Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-08 Thread George Sakkis
omating the addition of the missing rich comparisons with the expected semantics: == and != are complementary, and given either of them and one of <, >, <=, >=, the other three are defined. You can check it out at http://rafb.net/paste/results/ymLfVo81.html. Corrections and comments are welcome. Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Abstract and concrete syntax

2005-06-08 Thread George Sakkis
show: a.x = val # statement setattr(a,'x',val) # expression George -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-10 Thread George Sakkis
(http://mail.python.org/pipermail/python-dev/2004-June/045111.html) but it was already too late. Waiting-for-python-3K'ly yours George -- http://mail.python.org/mailman/listinfo/python-list

Re: Abstract and concrete syntax

2005-06-10 Thread George Sakkis
: class SomeArray(object): dimensions = property( fget = lambda self: (self.x,self.y), fset = lambda self,(x,y): setattr(self,'x',x) or setattr(self,'y',y)) Again, it is quite limited, but properties are also often limited so it's a useful idiom to know. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Abstract and concrete syntax

2005-06-10 Thread George Sakkis
in the eye of the beholder; IMO both are much less obvious than the if/then/else, especially for a beginner or someone who has never seen these idioms before. I personally don't find the (ab)use of dictionaries in this case to be more beautiful or pythonic than the and/or idiom (not to mention the runtime cost of building a new dictionary every time), but YMMV. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Abstract and concrete syntax

2005-06-10 Thread George Sakkis
ion the runtime cost of building a new dictionary every time), but YMMV. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Structure function

2005-06-10 Thread George Sakkis
> Hello, > > Does anyone have an efficient Python routine for calculating the > structure function? > > > Thanks very much, > > > Daran > [EMAIL PROTECTED] Read this first and come back: http://www.catb.org/~esr/faqs/smart-questions.html#beprecise George -

Re: How to get/set class attributes in Python

2005-06-12 Thread George Sakkis
ks automagically the fget, fset, fdel and __doc__ from the property's locals(), instead of having the property return locals() explicitly. Also, it doesn't break when the property defines local variables other than [fget, fset, fdel, doc]. George -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: collecting tests from many modules?

2005-06-12 Thread George Sakkis
ces sys.modules['__main__'] for each unit test and then it execfile()s it, which seems like a hack. I didn't look into unittest's internals in case there is a more elegant way around this; if there isn't, a future version of unittest should address the automatic aggregation of tests, as py.test does already. The link to the script is http://rafb.net/paste/results/V0y16g97.html. Hope this helps, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning more about "The Python Way"

2005-06-12 Thread George Sakkis
discussion for every single recipe. > + What's going to happen with v3 > Google is your friend; search for "python 3000" (interestingly, searching for "python 3" returns something completely different :-)). George -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-12 Thread George Sakkis
cerned (http://www2.di.uoa.gr/en/lessons.php). Although these are certainly useful if one is interested in hardware, architecture, realtime and embedded systems, etc., I hardly find them relevant (or even more, necessary) for most CS/IT careers. Separation of concerns works pretty well for most practical purposes. George -- http://mail.python.org/mailman/listinfo/python-list

Re: count string replace occurances

2005-06-12 Thread George Sakkis
tring, old, new): count = [0] def counter(match): count[0] += 1 return new replaced = re.sub(old,counter,aString) return count[0], replaced A good example of trying to be smart and failing :) George -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-12 Thread George Sakkis
e needs to be good at both at any given time, it's useful to distinguish between them. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Java to Python - how to??

2005-06-13 Thread George Sakkis
} > public void sendAgent(Agent anAgent, WorkplaceAddress anAddress) { > > } > } > > bye class ConnectionManager(object): def __init__(self): super(ConnectionManager,self).__init__() def sendAgent(self, anAgent, anAddress): pass George -- http://mail.python.org/mailman/listinfo/python-list

Back to the future - python to C++ advice wanted

2005-06-17 Thread George Sakkis
a low level language once he has seen the Light ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: OO approach to decision sequence?

2005-06-18 Thread George Sakkis
if/elif/elif (or switch in C++/Java). That's ok though because, as you noticed, at some point you have to take a decision. What's important is the "once and only once" principle, that is all the decision logic is encapsulated in a single method (or in python in a single function)

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: 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: 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: 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

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: 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

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

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: 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

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: 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: 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: 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

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: 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

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: 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

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

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

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

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: 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: 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: 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

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: 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

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: 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

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: 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: 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: Compiling python2.5 on IBM AIX

2007-07-17 Thread George Trojan
- Version: 08.00..0010 Intermediate Language 060405.07 Driver 060518a Date: Thu May 18 22:08:53 EDT 2006 - I suspect the trailing comma is the issue. Googling for "xlc enumerator trailing comma" gave me http://sources.redhat.com/ml/gdb/1999-q1/msg00136.html which says "AIX 4.2.0.0 xlc gives an error for trailing commas in enum declarations". George -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementaion of random.shuffle

2007-07-18 Thread George Sakkis
e you're waiting... Wow, can you make a coffee in.. 57ms ? $ time python -c "for n in xrange(2**19937 + 1): random.random()" Traceback (most recent call last): File "", line 1, in OverflowError: long int too large to convert to int real0m0.057s user0m0.050s

Re: merge two ranges

2007-07-18 Thread George Sakkis
rlap(a, b) # output:None > print getOverlap(b, a) # output: None > > any easy way of doing this? It's not really hard to come up with a quick and dirty solution; however if this isn't a homework or a toy program, take a look at the interval module (http://cheeseshop.python.org/pypi/interval/1.0.0) for a more thought-out design. HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Break up list into groups

2007-07-18 Thread George Sakkis
test 3: error > test 4: error > 16.23 usec/pass > > `getgropus2' fails test 0 because it produces a reversed list. That > can easily be fixed by re-reversing the output before returning. But, > since it is by far the slowest method, I didn't bother. > > `getgroups3' is a method I got from another post in this thread, just > for comparison. > > >From my benchmarks it looks like getgroups1 is the winner. I didn't > > scour the thread to test all the methods however. Here's a small improvement of getgroups1, both in time and memory: from itertools import islice def getgroups4(seq): idxs = [i for i,v in enumerate(seq) if v&0x80] idxs.append(None) return [seq[i:j] for i,j in izip(idxs, islice(idxs,1,None))] George -- http://mail.python.org/mailman/listinfo/python-list

Re: Issue with CSV

2007-07-19 Thread Harry George
d csv, b) check the loaded structure's data against the new data-on-disk to find changed files, c) update the structure appropriately, d) write out the resulting new csv. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: Posted messages not appearing in this group

2007-07-19 Thread George Sakkis
ts haven't appeared (yet) at the google group but they show up on the mailing list: http://mail.python.org/pipermail/python-list/2007-July/thread.html George -- http://mail.python.org/mailman/listinfo/python-list

Re: class C: vs class C(object):

2007-07-20 Thread George Sakkis
llowing feature, which by the way disproves the assertion that "new-style classes can do anything Classic classes did": class Classic: pass class NewStyle(object):pass for o in Classic(),NewStyle(): o.__str__ = lambda: 'Special method overriding works on instances!' print '%s object: %s' % (o.__class__.__name__, o) George -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Python documentation team looking for members!

2007-07-21 Thread george williams
Take me off mailing list thank you george - Original Message - From: "Georg Brandl" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python.announce To: <[EMAIL PROTECTED]> Sent: Saturday, July 21, 2007 4:10 AM Subject: [ANN] Python documentation team looking for me

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