Re: how to make this code faster

2005-10-13 Thread George Sakkis
; 3. It use kind of Array/Matrix analysis style > 4. We have to change our algorithms so that Numeric or Numpy can help > us, Matrix style That's correct more or less. George -- http://mail.python.org/mailman/listinfo/python-list

Re: NYLUG meeting: The Python Object Model with Alex Martelli & Google(open bar and food!)

2005-10-14 Thread George Sakkis
tion, and Google is picking up the tab for an hour and a half > of open bar and food. Additionally, if you're looking for a job as a > Python developer, bring your resume. > > Please RSVP at http://rsvp.nylug.org to attend, as seating is limited. > > - Ron What date is it ? I

Re: Searching files in directories

2005-10-14 Thread George Sakkis
] src_dir = path('/tmp/source/') dest_dir = path('/tmp/destination/') for filename in files: srcfile = src_dir / filename if srcfile.exists(): srcfile.copy(dest_dir) George -- http://mail.python.org/mailman/listinfo/python-list

Re: object inheritance and default values

2005-10-14 Thread George Sakkis
w = self.__class__(**self.__dict__) new.__dict__.update(kwds) return new Personally I would prefer an explicit method name, e.g. 'copy'; hiding the fact that 'shape' is a class while the rest are instances is likely to cause more trouble than it's worth. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Function to execute only once

2005-10-14 Thread George Sakkis
was this: Apparently you're not the first to think of it: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425445. George -- http://mail.python.org/mailman/listinfo/python-list

Re: XML dom question

2005-10-14 Thread George Sakkis
"George" <[EMAIL PROTECTED]> wrote: > How can I do the following in python: > > [snipped] In exactly the same way you could do it if you actually read the replies to the thread with the same topic you posted yesterday. Duh! George -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with creating a dict from list and range

2005-10-14 Thread George Sakkis
erate(description)) > > James > > On Friday 14 October 2005 08:37, Steve Holden wrote: > > >>> dct = dict((x[1], x[0]) for x in enumerate(description)) > > >>> dct > > > > {'second': 1, 'third': 2, 'first': 0} Or even simplest :-) dct = dict(enumerate(description)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-15 Thread George Sakkis
Keith Thompson wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Hm... What does this have to do with Perl? > > > > Why did you post this in comp.lang.perl.misc? > > He posted this in comp.lang.python, comp.lang.perl.misc, > comp.unix.programmer, comp.lang.java.programmer, *and* > comp.

Re: Dynamic generation of doc-strings of dynamically generated classes

2005-10-17 Thread George Sakkis
ny ideas? Am I stuck with the clumsy exec-solution, or are there other > ways to dynamically generate doc-strings of classes? There's nothing specifically about doc-strings, but you can create and customise a whole class dynamically: def makeBaseSubclass(impClassAttr): return type('new_%s' % impClassAttr, (base,object), {'ImportantClassAttribute': impClassAttr, '__doc__': 'The case %s' % impClassAttr}) >>> new = makeBaseSubclass(7) >>> new.ImportantClassAttribute 7 >>> new.__doc__ 'The case 7' HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutual module imports

2005-10-17 Thread George Sakkis
_main__"). I just feel dirty about it. Well, I feel dirty every time I have to share globals . George -- http://mail.python.org/mailman/listinfo/python-list

Re: Intersection of lists/sets -- with a catch

2005-10-18 Thread George Sakkis
for x in some_set.intersection(another_set)] print "unique_some:", [x.obj for x in some_set.difference(another_set)] print "unique_another:", [x.obj for x in another_set.difference(some_set)] George -- http://mail.python.org/mailman/listinfo/python-list

Re: how best to split into singleton and sequence

2005-10-18 Thread George Sakkis
;>> t, l = s.split('|') > Traceback (most recent call last): > File "", line 1, in ? > ValueError: too many values to unpack > >>> > > so, i imagine what is happening is the lhs, t,l, is really > (t, (l)), i.e. only two items. >

Re: Upper/lowercase regex matching in unicode

2005-10-19 Thread George Sakkis
form ::upper:: or similar syntax, but can't find them in the docs. > Maybe I'm getting it mixed up with Perl regexen. > > The upper() and lower() methods do work on accented characters in a > unicode string, so there has to be some recognition of unicode case > in there som

DBM scalability

2005-10-20 Thread George Sakkis
this to be expected and if so, should I expect better performance (i.e. linear or almost linear) from a real database, e.g. sqlite ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: DBM scalability

2005-10-21 Thread George Sakkis
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote: > "George Sakkis" <[EMAIL PROTECTED]> writes: > > I'm trying to create a dbm database with around 4.5 million entries > > but the existing dbm modules (dbhash, gdbm) don't seem to cut > >

Re: How to separate directory list and file list?

2005-10-23 Thread George Sakkis
of thanks in advance! > > Gonnasi Using the path module (http://www.jorendorff.com/articles/python/path/): from path import path path('.').files() George -- http://mail.python.org/mailman/listinfo/python-list

Re: XML Tree Discovery (script, tool, __?)

2005-10-28 Thread George Sakkis
al tests. It would be neat to have it ported in python, at least the inference part. George -- http://mail.python.org/mailman/listinfo/python-list

Re: XML Tree Discovery (script, tool, __?)

2005-10-29 Thread George Sakkis
gbuji.net/tech/akara/nodes/2003-01-01/python-xslt Neat, though non-trivial XSLT makes my head spin. Just for kicks, I rewrote in python Michael Kay's DTDGenerator (http://saxon.sourceforge.net/dtdgen.html), though as the original it has several limitations on the accuracy of the inferred DTD. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive generators and backtracking search

2005-10-29 Thread George Sakkis
frozenset(['a', 'c']) frozenset(['c', 'b']) frozenset(['a', 'c', 'b']) ''' yield frozenset() for s in _powerset(iter(iterable)): yield s def _powerset(iterator): first = frozenset([iterator.next()]) yield first for s in _powerset(iterator): yield s yield s | first George -- http://mail.python.org/mailman/listinfo/python-list

Attributes of builtin/extension objects

2005-11-02 Thread George Sakkis
'isoweekday', 'max', 'min', 'month', 'replace', 'resolution', 'strftime', 'timetuple', 'today', 'toordinal', 'weekday', 'year'] - Where do the attributes of a datetime.date instance live if it has neither a __dict__ nor __slots__ ? - How does dir() determine them ? - dir() returns the attributes of the instance itself, its class and its ancestor classes. Is there a way to determine the attributes of the instance alone ? TIA, George -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you do this in python?

2005-11-04 Thread George Yoshida
[EMAIL PROTECTED] wrote: > Pass your script to Perl via standard input: > echo "print 'Hello, world'" | perl - $ echo "print 'hello, world'" | python - hello, world Cheers, -- george -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl XML::Simple and Data::Dumper - exists in Python?

2005-11-06 Thread George Sakkis
utor/24986 > http://www.crummy.com/software/BeautifulSoup/ > http://www.aaronsw.com/2002/xmltramp/ > http://www.xml.com/pub/a/2005/01/19/amara.html One more: http://www.xml.com/pub/a/2003/07/02/py-xml.html George -- http://mail.python.org/mailman/listinfo/python-list

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-07 Thread George Sakkis
want to. OTOH, you'll probably need other people's code that is OO, so at the very least you'll have to be able to read and use it. Fortunately, using an existing OO module/library is much easier than designing and writing it, so you can get away with it with little effort. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Map of email origins to Python list

2005-11-07 Thread George Sakkis
"Jorge Godoy" <[EMAIL PROTECTED]>: > H... I don't see mine listed there: I'm in South America, Brasil. More > specifically in Curitiba, ParanĂ¡, Brasil. :-) That's funny; I was looking for mine and I stumbled across yours at Piscataway, NJ, US. :-

Re: which feature of python do you like most?

2005-11-08 Thread George Sakkis
and be actually able to read, debug, refactor or extend it after 6 months. George -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread George Sakkis
quite > appropriate here. What about the future of itertools in python 3K ? IIRC, several functions and methods that currently return lists are going to return iterators. Could this imply that itertools.(imap/ifilter/izip) will take the place of map/filter/zip as builtins ? George -- http:/

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread George Sakkis
need to go through the whole range even if p = lambda x: x < 2 Itertools is your friend in this case: >>> from itertools import takewhile >>> list(takewhile(p, xrange(1000))) [0, 1] George -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread George Sakkis
"Steve Holden" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > Itertools is your friend in this case: > > > >>>>from itertools import takewhile > >>>>list(takewhile(p, xrange(1000))) > > > > [0, 1] > > Maybe,

Re: What do you use as symbols for Python ?

2005-11-10 Thread George Sakkis
.state = OPENED Or if you want something closer to real enumerations, there are several recipes in the cookbook. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 seems to be pretty good according to the ratings. George -- http://mail.python.org/mailman/listinfo/python-list

Re: XML Tree Discovery (script, tool, __?)

2005-11-14 Thread George Sakkis
link? Not a permanent one, but I posted it at http://rafb.net/paste/results/rbxGWw37.html if you want to grab it. Season to taste. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance in nested classes

2005-11-15 Thread George Sakkis
n, you may check the recipe here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409366. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Immutable instances, constant values

2005-11-21 Thread George Sakkis
% (name, attr)) cls.__setattr__ = __setattr__ return type.__new__(cls, name, bases, dict) class PhysicsConstants(object): __metaclass__ = CONST c = 2.9979246e+08 >>> PhysicsConstants.c = 0 AttributeError: Cannot reassign constant PhysicsConstants.c George -- http://mail.python.org/mailman/listinfo/python-list

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can use the sorted() builtin instead: c[2].append(sorted(b)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can use the sorted() builtin instead: c[2].append(sorted(b)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a flat list to a list of tuples

2005-11-22 Thread George Sakkis
: from itertools import islice newList = zip(islice(aList,0,None,2), islice(aList,1,None,2)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: How about "pure virtual methods"?

2005-01-06 Thread George Sakkis
ine a base class that provides a default implementation of a full protocol, yet disallow its direct instantiation, as in the example below. George #=== # test_abstract.py import unittest from abstract import abstractclass

Re: Pre/Postconditions with decorators

2005-01-07 Thread George Sakkis
str expected (int given) # >>> f('1',[2,'3']) # (...) # TypeError: container expected ([2, '3'] given) # >>> f('1',[2,3,4]) # (...) # TypeError: Container of size 3 expected ([1, 2, 3, 4] given) I can make it available somewhere (e.g. Vaults of Parnassus) if there's enough interest. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre/Postconditions with decorators

2005-01-07 Thread George Sakkis
> Hi George, > it would be nice to see how you have tackled > the task. > Maybe we will have a checker > module in Python one day... ;-) I posted my module on http://rafb.net/paste/results/voZYTG78.html and its unit test on http://rafb.net/paste/results/MYxMQW95.html. Any f

Re: Pre/Postconditions with decorators

2005-01-09 Thread George Sakkis
I'll post an entry on Vaults of Parnassus as soon as I publish it. George -- http://mail.python.org/mailman/listinfo/python-list

Tuple slices

2005-01-24 Thread George Sakkis
Why does slicing a tuple returns a new tuple instead of a view of the existing one, given that tuples are immutable ? I ended up writing a custom ImmutableSequence class that does this, but I wonder why it is not implemented for tuples. George -- http://mail.python.org/mailman/listinfo

Re: Tuple slices

2005-01-24 Thread George Sakkis
ng > type, but that idea was rejected, for the very same "and how do you get rid of > the original object" reason) > > Fair enough. So perhaps the question is whether such cases are more regular than something like: a = give_me_a_huge_tuple() slices = [a[i:j] for i in xrange(len(a)) for j in xrange(i+1, len(a)+1)] George -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple slices

2005-01-24 Thread George Sakkis
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > George Sakkis wrote: > > Fair enough. So perhaps the question is whether such cases are more regular > > than something like: > > a = give_me_a_huge_tuple() > > slices = [a[i:j

Re: Tuple slices

2005-01-24 Thread George Sakkis
it doesn't have to. One can represent a view as essentially an object with a pointer to a memory buffer and a (start,stop,step) triple. Then a "real tuple" is just a "view" with the triple being (0, len(sequence), 1). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple slices

2005-01-24 Thread George Sakkis
"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [My newsreader crapped out on sending this; apologies if it appears > twice.] > > George Sakkis wrote: > > > "Terry Reedy" <[EMAIL PROTECTED]> wrote in message > &g

Re: Tuple slices

2005-01-25 Thread George Sakkis
An iterator is perfectly ok if all you want is to iterate over the elements of a view, but as you noted, iterators are less flexible than the underlying sequence. The view should be (or at least appear) identical in functionality (i.e. public methods) with its underlying sequence. George

Re: Tuple slices

2005-01-25 Thread George Sakkis
I got one (and only so far) good reason for the current implementation from Fredrik Lundh, namely the reference to the original object. > As George Sakkis the OP noted, the essential data constituting a contiguous > section view are the underlying sequence and two position markers. Whether &g

Re: Tuple slices

2005-01-25 Thread George Sakkis
"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > George Sakkis wrote: > > > An iterator is perfectly ok if all you want is to iterate over the > > elements of a view, but as you noted, iterators are less flexible than > > the und

Re: Tuple slices

2005-01-26 Thread George Sakkis
ns (I know it's a stupid example, don't flame me for this): $ python /usr/lib/python2.3/timeit.py \ -s "x=tuple(xrange(1))" \ "[x[1:-1] for n in xrange(100)]" 10 loops, best of 3: 3.84e+04 usec per loop $ python /usr/lib/python2.3/timeit.py \ -s "from immutableseq import ImmutableSequence" \ -s "x=ImmutableSequence(xrange(1))" \ "[x[1:-1] for n in xrange(100)]" 100 loops, best of 3: 5.85e+03 usec per loop Feel free to comment or suggest improvements. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Proccess termination

2005-01-28 Thread George Yoshida
otherwise? popen2.Popen3, popen2.Popen4 and subprosess.Popen have poll/wait methods. These will do what you're looking for. -- George -- http://mail.python.org/mailman/listinfo/python-list

Swig-friendly distutils.command.build_ext

2005-02-05 Thread George Sakkis
useful, I think they (c|sh)ould make it into the next release of distutils. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no instancemethod builtin?

2005-06-18 Thread George Sakkis
>>> '(1 (2 3) (4 5) foo)' Here duck typing doesn't help because the function should take the if branch only for lists and not other iterables (e.g. strings). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread George Sakkis
might/should be refactored so that the decision between each obj_i_a and obj_i_b is done in a separate obj_i_factory callable. If you provide an example or two of specific triples (type_of_obj_i, obj_i_a, obj_i_b), we'll have a better idea of whether factories are an overkill in this case or not. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
s except for lists are considered atomic ? An implementation of s-expressions would use a single data structure for the nesting (e.g. a builtin list or a custom linked list) and objects of all other types should be considered atoms, even if they happen to be iterable. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
n __iter__ method. It would be more uniform if the default 'type' metaclass added an __iter__ method to classes that define __getitem__ but not __iter__ with something like: from itertools import count def __iter__(self): for i in count(): try: yield self[i] excep

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
ur of iterators for classes that define __getitem__ without __iter__: class AnIterable(object): def __init__(self, it): self._it = it def __getitem__(self,i): return self._it[i] >>> x = AnIterable(dict(a=1,b=2)) >>> list(x) KeyError: 0 George -- http://mail.python.org/mailman/listinfo/python-list

Re: Couple functions I need, assuming they exist?

2005-06-20 Thread George Sakkis
>>> num2str(-1934) '-1,934' ''' parts = [] div = abs(num) while True: div,mod = divmod(div,1000) parts.append(mod) if not div: if num < 0: parts[-1] *= -1 return ','.join(str(part) for part in reversed(parts)) Regards, George -- http://mail.python.org/mailman/listinfo/python-list

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

2005-06-20 Thread George Sakkis
last but not least, Boost.Python. I don't think it's just a coincidence that among all languages they chose Python to make interoperable with C++ :-) Thanks again, George -- http://mail.python.org/mailman/listinfo/python-list

Compiling C++ extensions with distutils on Cygwin

2005-06-21 Thread George Sakkis
arget_lang argument but CCompiler.link() does). Is there a good reason for this ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling C++ extensions with distutils on Cygwin

2005-06-22 Thread George Sakkis
"George Sakkis" wrote: > I'm trying to build a C++ extension on Cygwin, but it fails because > distutils invokes gcc instead of g++. Looking into distutils internals, > it turns out that compilation is assumed to be independent of the > target language, while linkin

Re: Does a function like isset() exist in Python?

2005-06-22 Thread George Sakkis
e a defined name, use del: >>> foo=None >>> print foo None >>> del foo >>> print foo NameError: name 'foo' is not defined George -- http://mail.python.org/mailman/listinfo/python-list

Profiling extension modules

2005-06-22 Thread George Sakkis
eful. Any ideas ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-24 Thread George Sakkis
to have for time-critical situations, assuming that other optimization solutions (psyco, pyrex, weave) are not applicable. George -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-24 Thread George Sakkis
ort snippet that works for 2.3 or later: try: set except NameError: from sets import Set as set George -- http://mail.python.org/mailman/listinfo/python-list

Re: How does one write a function that increments a number?

2005-06-24 Thread George Sakkis
ger answer is you can create a, say, MutableInt class whose instances behave as modifiable integers. Most probably you don't really need this, but if you think you do, others in the list will sketch out how. George -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
wordCount[word] += 1 wordPos[word].append(pos) Other candidate optional arguments would allow type checking (e.g. dict(keys=int, values=list)) or performance fine-tuning (e.g. dict(minsize = 10, maxsize = 1, average = 200)). I hope the decision for this form of the constructor is reconsidered for python 3K. George -- http://mail.python.org/mailman/listinfo/python-list

Re: regex question

2005-06-25 Thread George Sakkis
e searching for single characters (such as digits), perhaps the fastest way is to use string.translate: >>> import string >>> allchars = string.maketrans('','') # 2 empty strings >>> nondigits = allchars.translate(allchars, string.digits) >>> '1 ab 34 6'.translate(allchars, nondigits) '1346' Note that the result is a string of the matched characters, not a list; you can simply turn it to list by list('1346'). Hope this helps, George -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
"Steven D'Aprano" wrote: > On Sat, 25 Jun 2005 06:44:22 -0700, George Sakkis wrote: > > > "Roy Smith" <[EMAIL PROTECTED]> wrote: > > > >> I just re-read the documentation on the dict() constructor. Why does it > >> support ke

Re: Favorite non-python language trick?

2005-06-25 Thread George Sakkis
behaviour of current built-ins. > Filter, for instance, doesn't always return lists and map accepts more > than one seq... Just my $.02. > > - kv If they go to itertools, they can simply be: def map(f, *iterables): return list(imap(f,*iterables)) def filter(f, seq): return list(ifilter(f,seq)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-26 Thread George Sakkis
"Konstantin Veretennicov" <[EMAIL PROTECTED]> wrote: > > On 25 Jun 2005 12:17:20 -0700, George Sakkis <[EMAIL PROTECTED]> wrote: > > If they go to itertools, they can simply be: > > > > def map(f, *iterables): > > return list(imap(f,*iterabl

Re: Thoughts on Guido's ITC audio interview

2005-06-26 Thread George Sakkis
gex module has since 2.2 a function (and method for regex objects) called finditer that does exactly that. Perhaps str (and unicode) should have it too for consistency ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question

2005-06-26 Thread George Sakkis
vention (e.g. CamelCase for classes, mixedCase for methods, etc.). See also http://www.python.org/peps/pep-0008.html for some (semi-)standard conventions. George -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: collecting tests from many modules?

2005-06-26 Thread George Sakkis
"Bengt Richter" <[EMAIL PROTECTED]> wrote: > On 12 Jun 2005 08:06:18 -0700, "George Sakkis" <[EMAIL PROTECTED]> wrote: > > >I had written a script to do something close to this; currently it > >doesn't do any kind of aggregation, but it s

Re: OO approach to decision sequence?

2005-06-26 Thread George Sakkis
1.0 1.0 > 1+2j (1+2j) > 1+0j (1+0j) > True True > False False > A A Nice technique. Something that needs to be pointed out is that the order of the converters *is* important; int takes precedence over float, which take precedence over complex and bool takes precedence over string. More succinctly: { int -> float -> complex } { bool -> str } In general the converters will form a strict partially ordered set, so the list of converters should be a topological sort of the respective DAG. George -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: collecting tests from many modules?

2005-06-26 Thread George Sakkis
ying a defaultTest if unittest.main() was looking also for TestSuites in addition to TestCases within each module. Is this a design choice ? Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules for inclusion in standard library?

2005-06-27 Thread George Sakkis
I'd love to see IPython replace the standard interpreter. Pychecker seems to be a strong candidate too. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules for inclusion in standard library?

2005-06-28 Thread George Sakkis
> "bruno modulix" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'd love to see IPython replace the standard interpreter. > I dont. Care to say why ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules for inclusion in standard library?

2005-06-28 Thread George Sakkis
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > >> "bruno modulix" <[EMAIL PROTECTED]> wrote: > > > >> George Sakkis wrote: > >> > I'd love to see IPython replace the standard interprete

Re: map vs. list-comprehension

2005-06-29 Thread George Sakkis
ors instead of lists in several contexts (e.g. dict.keys(), dict.items()), so perhaps zip will stand for what itertools.izip is today. George -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread George Sakkis
"Tom Anderson" <[EMAIL PROTECTED]> wrote: > if it hadn't been for the quirks of the Cockney accent, we'd all be using > curly > brackets and semicolons. +1 QOTW George -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie backreference question

2005-06-30 Thread George Sakkis
rt re a = 'test string' b = re.match(r'test (\w+)', a).group(1) print b George -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie backreference question

2005-06-30 Thread George Sakkis
#x27; b = re.match(r'test \w{2}(.+)', a, re.DOTALL).group(1) print b By the way, if you want to catch any single character (including new lines), '.' with re.DOTALL flag is more clear than [\W\w]. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Speaking of list-comprehension?

2005-06-30 Thread George Sakkis
e lack of a ternary if?then:else operator manifests itself in such examples, but alas, there isn't much hope that even python 3K will have one... Would-go-with-ugly-syntax-than-no-syntax-any-day'ly yrs, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
more efficiently written as: from itertools import izip, islice d = dict(izip(islice(translations,0,None,2), islice(translations,1,None,2))) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
gt; doing in the second line? > > Regards > David Why don't you fire up the python interpreter and type >>> help(zip) >>> zip([1,2,3],"abc") Teaching-a-man-to-fish-instead-of-giving-him-a-fish'ly yrs, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Speaking of list-comprehension?

2005-06-30 Thread George Sakkis
ctly the same in that it doesn't change values in > place, but this is similar if you are only interested in the > values: > > ta = [t>=10 and t-10 or t+10 for t in ta] Not quite; it differs for t==10. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
"David Pratt" > Thanks George! You guys are great! I am always learning. Python is > awesome!! Yeap, that was the reaction of many/most of us when we stumbled upon python. Welcome aboard ! George -- http://mail.python.org/mailman/listinfo/python-list

Re: I am a Java Programmer

2005-06-30 Thread George Sakkis
"[EMAIL PROTECTED]" wrote: > I am a java programmer and I want to learn Python Please help me. Google Is Your Friend: http://www.razorvine.net/python/PythonForJavaProgrammers http://www.ferg.org/projects/python_java_side-by-side.html George -- http://mail.python.org/mailman/li

Re: map vs. list-comprehension

2005-07-01 Thread George Sakkis
recipe (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410698) comes pretty close to it, but I wouldn't mind a small addition to the language syntax for something so useful as properties. Keeping the language small is a worthwhile goal, but it should be traded off with conciseness and re

Re: map vs. list-comprehension

2005-07-01 Thread George Sakkis
"Tom Anderson" wrote: > On Fri, 1 Jul 2005, George Sakkis wrote: > > > Keeping the language small is a worthwhile goal, but it should be traded > > off with conciseness and readability; otherwise we could well be content > > with s-expressions. > >

Re: Question about Python

2005-07-01 Thread George Sakkis
c.l.py, e.g. http://tinyurl.com/d3lfx. HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re:

2005-07-01 Thread George Sakkis
an attribute should be hidden or unnecessary to its subclasses by being declared "private" instead of "protected". The distinction between public and non-public (private + protected) is more understandable, but again python's philosophy is "we're all consenting adults here". _single_underscored names just flash a "use at your own risk" signal, instead of tying your hands in case the original class designer made a wrong assumption. George -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread George Sakkis
e work done you need to look elsewhere. It's a > shame... What do we have here, a perl troll ? Perhaps you need to post elsewhere "to have fun". George -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a better way to walk a file system?

2005-07-01 Thread George Sakkis
example I discovered that properties cannot be unbound, i.e. using path.ext instead of getExtension raises TypeError. Couldn't/shouldn't Class.prop(instance) be allowed as equivalent of instance.prop, just as methods ? > The answer to the question "is there a better w

Re: Regular Expression for pattern substitution

2005-07-01 Thread George Sakkis
where the middle part of the strings remains > > unmodified. > > > > Any suggestions? > > > > Peace. > > Vibha Fire up the interpreter and write: >>> import re >>> line = 'see this man with that woman holding this dog and that cat' &

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-03 Thread George Sakkis
may be released in parallel with 2.5-2.9 (http://www.python.org/doc/essays/ppt/euro2004/euro2004.ppt), I guess this *someday* will be no later than 2015-16, probably sooner than that. George -- http://mail.python.org/mailman/listinfo/python-list

Re: math.nroot [was Re: A brief question.]

2005-07-03 Thread George Sakkis
e http://docs.sun.com/source/806-3568/ncg_goldberg.html, http://http.cs.berkeley.edu/~demmel/cs267/lecture21/lecture21.html for more. George -- http://mail.python.org/mailman/listinfo/python-list

Re: math.nroot [was Re: A brief question.]

2005-07-03 Thread George Sakkis
reason for it, though. How about 'conformance with standard mathematic notation', does this count for a terribly good reason ? What would one expect to be the result of 5^2 - 2^2, 29 or 21 ? Would you expect 5^2 + - 2^2 to be different, even if you write it as 5^2 + -2 ^ 2 ? White space is not significant in math AFAIK ;-) George -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get 4 numbers from the user in one line for easycomparision?

2005-07-03 Thread George Sakkis
nt, raw_input('Type 4 numbers separated ' 'by spaces:').split()) If you want to do error handling later, you may need to split this line into two steps so that you can distinguish between invalid values and wrong count of values (less or more than 4). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python concurrent tasking frameworks?

2005-07-03 Thread George Sakkis
e it in the end, but it's better than starting from scratch. Let me know if you're interested and I'll send it over. Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: math.nroot [was Re: A brief question.]

2005-07-03 Thread George Sakkis
ther than 'unknown'. It makes sense to have x==y, because x and y are the outcome of the *same* invalid operation. Similarly, if z=0/0, z would also be invalid, but different from x and y, since it is the result of a different invalid operation. This brings us to the many-NaN situation. George -- http://mail.python.org/mailman/listinfo/python-list

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