Re: Is Python really a scripting language?

2007-12-15 Thread Marc 'BlackJack' Rintsch
/pub/a/2006/01/11/from-microsoft-to-openoffice.html Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: RegExp Help

2007-12-14 Thread Marc 'BlackJack' Rintsch
are making the very same mistake. XML may look somewhat simple but producing correct XML and parsing it isn't. Sooner or later you stumble across something that breaks producing or parsing the naive way. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Compressing a text file using count of continous characters

2007-12-14 Thread Marc 'BlackJack' Rintsch
()` might be handy. And you have to think about digits in the source if that's allowed. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: determining bytes read from a file.

2007-12-13 Thread Marc 'BlackJack' Rintsch
mode. Windows alters line endings and stops at a specific byte (forgot the value) otherwise. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic or not?

2007-12-13 Thread Marc 'BlackJack' Rintsch
(do_something, old) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Text widget updates only after calling method exits (threading issue?)

2007-12-12 Thread Marc 'BlackJack' Rintsch
On Tue, 11 Dec 2007 17:58:37 -0800, mariox19 wrote: If I am supposed to send messages to Tkinter objects only from the main thread, how can I get the letters to appear 1 per second? Take a look at the `after()` method on widgets. Ciao, Marc 'BlackJack' Rintsch -- http

Re: Is anyone happy with csv module?

2007-12-12 Thread Marc 'BlackJack' Rintsch
On Tue, 11 Dec 2007 20:08:21 -0300, Gabriel Genellina wrote: data = [row for row in csv.reader(..)] A bit shorter:: data = list(csv.reader(..)) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary of dictionaries

2007-12-11 Thread Marc 'BlackJack' Rintsch
. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to protect my new commercial software.

2007-12-10 Thread Marc 'BlackJack' Rintsch
and unusable as you can. Spend the time you planned for writing documentation for this task. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Dumb newbie back in shell

2007-12-10 Thread Marc 'BlackJack' Rintsch
76 char_ptr = 0 ... 109 def get_toks( text ): 110 while line_ptr last_line: ... So when is a global var global? When you declare it ``global`` *in the function*. ``global`` on module level has no effect. IMHO that should emit at least a warning… Ciao, Marc 'BlackJack' Rintsch

Re: dictionary of dictionaries

2007-12-09 Thread Marc 'BlackJack' Rintsch
in xrange(11)) And just for completeness: The given data in the example can be stored in a list of lists of course: data = [[randint(0, 10) for dummy in xrange(11)] for dummy in xrange(11)] Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Distinguishing attributes and methods

2007-12-09 Thread Marc 'BlackJack' Rintsch
: In [469]: a = collections.defaultdict(int) In [470]: callable(a.default_factory) Out[470]: True In [471]: a.default_factory(42) Out[471]: 42 `a.default_factory` is callable but hardly a method of `a` or `defaultdict` but a data attribute that happens to be callable. Ciao, Marc 'BlackJack

Re: Calculate an age

2007-12-08 Thread Marc 'BlackJack' Rintsch
, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Distinguishing attributes and methods

2007-12-08 Thread Marc 'BlackJack' Rintsch
-- everything on an object is an attribute. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Distinguishing attributes and methods

2007-12-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Dec 2007 00:34:06 -0800, MonkeeSage wrote: I think he means callable attributes (methods) and non-callable attributes (variables). But not every callable attribute is a method. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Distinguishing attributes and methods

2007-12-08 Thread Marc 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Marc 'BlackJack' Rintsch
. It is just some unary pluses chained. Maybe unexpected but no syntax error. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: File to dict

2007-12-07 Thread Marc 'BlackJack' Rintsch
but the throw it away part. If you don't keep it, the loop above is even more efficient than building a dictionary with *all* lines of the file, just to pick one value afterwards. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Newbie Question

2007-12-06 Thread Marc 'BlackJack' Rintsch
: salutation(t)) In Python 2.5 there's an alternative way with the `functools.partial()` function: from functools import partial # ... msg = Button(win, text='Write Something', command=partial(salutation, tree)) Ciao, Marc 'BlackJack' Rintsch

Re: Python is not a good name, should rename to Athon

2007-12-04 Thread Marc 'BlackJack' Rintsch
the language. That name is already taken in the programming language domain. There's a Tiny C compiler for 6510 based targets: http://www.kdef.com/geek/vic/quetz.html Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Split a String

2007-11-30 Thread Marc 'BlackJack' Rintsch
postgresql returns to me. I hope you don't use Python to access the database, get a tuple back, convert it to a string and then try to break up that string into a list!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Oh no, my code is being published ... help!

2007-11-30 Thread Marc 'BlackJack' Rintsch
to explain confused newbies why they can write:: print('hello!') but this acts strange: print('hello, my name is ', name) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are class methods not classmethods?

2007-11-27 Thread Marc 'BlackJack' Rintsch
of class '__main__.Parrot' In [84]: type(Parrot.cmethod) Out[84]: type 'instancemethod' In [85]: Parrot.__dict__['cmethod'] Out[85]: classmethod object at 0x9b26434 In [86]: type(Parrot.__dict__['cmethod']) Out[86]: type 'classmethod' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
that decision. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
cat, dog # not always required, but frequently needed return ', '.join((cat, dog)) Ouch that's bad design IMHO. The need to use ``global`` is a design smell, if needed *frequently* it starts to stink. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Marc 'BlackJack' Rintsch
that knows? AFAIK strings of length 1 and strings that would be valid Python identifiers are treated this way. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote: On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote: I've had the same thought, along with another. You see, on of my pet peeves about all OO languages that that when

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 14:09:04 +0100, Ton van Vliet wrote: On 24 Nov 2007 08:48:30 GMT, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 24 Nov 2007 09:12:34 +0100, Ton van Vliet wrote: Just bringing up something I sometimes miss from good-old Turbo-Pascal here, which has

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 08:27:56 -0800, samwyse wrote: On Nov 24, 7:50 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote: On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote

Re: How to display unicode with the CGI module?

2007-11-24 Thread Marc 'BlackJack' Rintsch
and fails if there's anything non-ASCII in the string. The `encode()` method is your friend. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: foldr function in Python

2007-11-23 Thread Marc 'BlackJack' Rintsch
()` is:: comma_separate = ','.join Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I convert escaped HTML into a string?

2007-11-23 Thread Marc 'BlackJack' Rintsch
if whitespace is preserved. What matters is the actual text in the source, not the formatting. That's left to the browser. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-23 Thread Marc 'BlackJack' Rintsch
): x, y, z = self.__unpack__(x,y,z) return math.sqrt(x**2 + y**2 + z**2) What about ``from`` instead of ``by``? That's already a keyword so we don't have to add a new one. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: why it is invalid syntax?

2007-11-21 Thread Marc 'BlackJack' Rintsch
Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding lowest value in dictionary of objects, how?

2007-11-19 Thread Marc 'BlackJack' Rintsch
. In the example `min()` finds the object with the lowest `id()`. To change that you can implement the `__cmp__()` method on your `Block` objects. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: pydoc - how to generate documentation for an entire package?

2007-11-19 Thread Marc 'BlackJack' Rintsch
On Mon, 19 Nov 2007 10:50:28 -0800, Jens wrote: Generating documentation form code is a nice thing, but this pydoc.py is driving me insane - isn't there are better way? Epydoc!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Problem?

2007-11-19 Thread Marc 'BlackJack' Rintsch
`tagOrId` coming from? That's a `NameError` here. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to add a Decorator to a Class Method

2007-11-19 Thread Marc 'BlackJack' Rintsch
): print a + b a = A() a.func(3, 5) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: list of class initiations ?

2007-11-16 Thread Marc 'BlackJack' Rintsch
with those functions. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python To Change The World :)

2007-11-14 Thread Marc 'BlackJack' Rintsch
realistic imaging for whatever purpose, 3D is the way to go. If you are after traffic-simulations, it's unneeded complexity. Not if their solution includes flying buses and taxis. Or this pneumatic delivery system for people from `Futurama`. ;-) Ciao, Marc 'BlackJack' Rintsch -- http

Re: referencing a subhash for generalized ngram counting

2007-11-13 Thread Marc 'BlackJack' Rintsch
no effect on the object bound to that name before. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python as primary language

2007-11-12 Thread Marc 'BlackJack' Rintsch
. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: regex that is equivalent to perl's syntax

2007-11-12 Thread Marc 'BlackJack' Rintsch
to the following perl's search string? m/^\S{1,8}\.\S{0,3}/ It is ``re.match(r'\S{1,8}\.\S{0,3}', string)``. There's something called documentation… Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: reading file objects in chunks

2007-11-12 Thread Marc 'BlackJack' Rintsch
with it for some reason I can't explain... chunksize = 26 f = open('datafile.dat', 'rb') for chunk in iter(lambda: f.read(chunksize), ''): compute_data(chunk) f.close() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Populating a dictionary, fast

2007-11-11 Thread Marc 'BlackJack' Rintsch
seconds here. [EMAIL PROTECTED]:~$ time python test.py real0m38.758s user0m25.290s sys 0m1.580s Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: how to know if folder contents have changed

2007-11-11 Thread Marc 'BlackJack' Rintsch
of names and the `pickle` module to store Python objects in files. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables within classes.

2007-11-10 Thread Marc 'BlackJack' Rintsch
attributes into computed attributes without changing the API of the objects. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: String/Decimal issues

2007-11-10 Thread Marc 'BlackJack' Rintsch
, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables within classes.

2007-11-10 Thread Marc 'BlackJack' Rintsch
in code or they even use this gotcha for immutable default values. As long a the value isn't changed the default value is just referenced from the class then and not every instance. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding Help

2007-11-10 Thread Marc 'BlackJack' Rintsch
] ││ │ │││└───┬┘│ │ └───┬┴┴┘ │ │ [S5] │ │ └┘ Program Sounds pretty much like homework to me. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: Global variables within classes.

2007-11-10 Thread Marc 'BlackJack' Rintsch
On Sat, 10 Nov 2007 17:39:04 +, Marc 'BlackJack' Rintsch wrote: On Sat, 10 Nov 2007 18:53:08 +0200, Donn Ingle wrote: print b.ref.attribute # print haschanged print j.ref.attribute #prints original value ## If it changed and an attribute of the Class, then ## why is it back to original

Re: parallel csv-file processing

2007-11-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Nov 2007 02:51:10 -0800, Michel Albert wrote: Obviously this won't work as you cannot access a slice of a csv-file. Would it be possible to subclass the csv.reader class in a way that you can somewhat efficiently access a slice? An arbitrary slice? I guess not as all records

Re: [OT] Stupid email disclaimers

2007-11-09 Thread Marc 'BlackJack' Rintsch
? Use a crystal ball for the very long distance call? Call Dr. Frankenstein for help? =:o) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Some pythonic suggestions for Python

2007-11-09 Thread Marc 'BlackJack' Rintsch
it into a Python environment. This doesn't mean it will fit into the language or scales beyond the small toy examples. What about function names in tracebacks? What about nesting these anonymous multiline functions? What about the impact on the grammar? Ciao, Marc 'BlackJack' Rintsch -- http

Re: operator overloading on built-ins

2007-11-08 Thread Marc 'BlackJack' Rintsch
On Thu, 08 Nov 2007 22:53:16 -0800, r.grimm wrote: (1).__cmp__(10) -1 As the dot is an operator like ``+`` or ``/`` you can also add spaces to avoid the ambiguity: In [493]: 1 . __cmp__(10) Out[493]: -1 In [494]: 1 .__cmp__(10) Out[494]: -1 Ciao, Marc 'BlackJack' Rintsch -- http

Re: Deep comparison of sets?

2007-11-07 Thread Marc 'BlackJack' Rintsch
, other.value) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: os.popen does not seem to catch stdout

2007-11-07 Thread Marc 'BlackJack' Rintsch
On Wed, 07 Nov 2007 18:35:51 +, kyosohma wrote: I've never had to put the command into a list or tuple...but you're welcome to try it that way. You don't *have* to but if you do the module takes care of quoting the arguments if necessary. Ciao, Marc 'BlackJack' Rintsch -- http

Re: how to filter files by creation date

2007-11-06 Thread Marc 'BlackJack' Rintsch
the 'datetime.date.today()'. Build a `datetime.date` object from the timestamp you get from the stat call: In [438]: !touch test.py In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime) Out[439]: datetime.date(2007, 11, 6) Ciao, Marc 'BlackJack' Rintsch -- http

Re: how to filter files by creation date

2007-11-06 Thread Marc 'BlackJack' Rintsch
On Tue, 06 Nov 2007 01:45:02 -0800, awel wrote: On 6 nov, 09:00, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote: I am trying to to make a script to move all the files that has been created at today's to another folder but my problem

Re: how to filter files by creation date

2007-11-06 Thread Marc 'BlackJack' Rintsch
the call I made and the result I got. How can I be more clear and precise!? Ok but I run in Windows and I cannot understand your '!touch test.py' Ah, sorry this was just to create and/or make sure that the file exists and has today's date. Ciao, Marc 'BlackJack' Rintsch -- http

Re: Insane crazy question - printing commands

2007-11-06 Thread Marc 'BlackJack' Rintsch
. If that module has an ``import inspect`` it imports *itself*! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: modify a file

2007-11-04 Thread Marc 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input() and utf-8 formatted chars

2007-11-02 Thread Marc 'BlackJack' Rintsch
and not a string. The object itself decides what `repr(obj)` returns. Soup objects represent themselves as UTF-8 encoded strings. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Is pyparsing really a recursive descent parser?

2007-11-02 Thread Marc 'BlackJack' Rintsch
')`` part which fails because the 'end' is already gone. Is there a way to get pyparsing to parse a grammar like this? Negative lookahead maybe: grammar = (OneOrMore(NotAny(Literal('end')) + Word(alphas)) + Literal('end')) Ciao, Marc 'BlackJack' Rintsch -- http

Re: jpeg image read class

2007-10-31 Thread Marc 'BlackJack' Rintsch
with `numpy`. It should be faster to shift and or a whole array instead of every pixel one by one in pure Python. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Marc 'BlackJack' Rintsch
. And what should ``'string'.find('str')`` return? How do you distinguish the not found at all case from the found at the very beginning case!? The simple test you want can be written this way: if 'something' in check: do(something_else) Ciao, Marc 'BlackJack' Rintsch -- http

Re: Method needed for skipping lines

2007-10-31 Thread Marc 'BlackJack' Rintsch
and look up the docs for the `startswith()` method on strings. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: XML DOM, but in chunks

2007-10-31 Thread Marc 'BlackJack' Rintsch
record of the data at a time? Have you tried `iterparse()`? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Built-in functions and keyword arguments

2007-10-30 Thread Marc 'BlackJack' Rintsch
intention. He wanted to give the optional third argument of `getattr()` as keyword argument. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-30 Thread Marc 'BlackJack' Rintsch
, seq): return zip(seq, map(func,seq)) table(len, ('', (), [])) table(lambda x:x.__len__(), ('',[],())) What was the point again ? Beautiful is better than ugly!? ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing xml file in python

2007-10-30 Thread Marc 'BlackJack' Rintsch
. Don't do that. Catch the specific exception you want to handle with an ``except`` and not simply *all*. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: sharing vars with different functions

2007-10-29 Thread Marc 'BlackJack' Rintsch
something(lines): for line in lines: print lines And the call it with the object. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Built-in functions and keyword arguments

2007-10-29 Thread Marc 'BlackJack' Rintsch
exactly the same as normal functions. As Steven D'Aprano showed they behave like normal functions. Even pure Python functions can have arguments without names: def spam(*args): pass Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-29 Thread Marc 'BlackJack' Rintsch
().spammify(eggs)`` instead of a plain function call. And functions are first class objects in Python. That sounds quite OO to me. You can think of a module with functions as a singleton. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: statvfs

2007-10-29 Thread Marc 'BlackJack' Rintsch
* stat.f_blocks Out[188]: 10741866496L Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: insert string problems..

2007-10-28 Thread Marc 'BlackJack' Rintsch
schema design BTW. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Which index can i use ?

2007-10-28 Thread Marc 'BlackJack' Rintsch
ind4 ON test USING btree (w) CREATE INDEX ind5 ON test USING btree (d) This isn't a Python question. You'll get more and probably better feedback in a group, mailing list or forum dealing with PostgreSQL. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question on dictionary usage

2007-10-27 Thread Marc 'BlackJack' Rintsch
, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: xmpfilter-a-like for python (code annotation)

2007-10-27 Thread Marc 'BlackJack' Rintsch
. if the code is wrong it nonetheless adds assertions that don't fail. I always thought one writes assertions to test what the code should do and not what it actually does!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk and recursive deletion

2007-10-27 Thread Marc 'BlackJack' Rintsch
function. #os.rmdir(path) print Removing: %s % (path, ) #--snap Or `shutil.rmtree()`. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: xmpfilter-a-like for python (code annotation)

2007-10-27 Thread Marc 'BlackJack' Rintsch
On Sat, 27 Oct 2007 17:57:06 +, [EMAIL PROTECTED] wrote: On Oct 27, 6:27 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 27 Oct 2007 17:10:13 +, [EMAIL PROTECTED] wrote: http://eigenclass.org/hiki/xmpfilter looks cool , anything like this for python? any reason that we

Re: Proposal: Decimal literals in Python.

2007-10-27 Thread Marc 'BlackJack' Rintsch
implicitly) spells it out? And the equivalent of ``os.chmod(filename, 0777)`` looks like what!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples within tuples

2007-10-26 Thread Marc 'BlackJack' Rintsch
deep... and I'm not sure how to resolve it Resolve *what*? The problem isn't clear yet; at least to me. Above you say what you get. What exactly do you want? Examples please. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: Decimal literals in Python.

2007-10-26 Thread Marc 'BlackJack' Rintsch
:27) [MSC v.1310 32 bit (Intel)] on win32 snip type(0b1) type 'int' type(0o1) type 'int' type(0x1) type 'int' assert 0b1 is 0x1 That this doesn't raise `AssertionError` is an implementation detail. It's not guaranteed the two objects are really the same. Ciao, Marc 'BlackJack

Re: Regular Expression question

2007-10-25 Thread Marc 'BlackJack' Rintsch
+', re.IGNORECASE) for i, line in enumerate(lines): if needle.match(line): print 'match in line %d' % (i + 1) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: about functions question

2007-10-25 Thread Marc 'BlackJack' Rintsch
you think it is. The code above, the dots replaced with nothing, will of course run forever until the stack limit is reached. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: elementtree w/utf8

2007-10-25 Thread Marc 'BlackJack' Rintsch
not unicode. Decoding twice doesn't work. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Better writing in python

2007-10-24 Thread Marc 'BlackJack' Rintsch
, lOptional) I think there is a better way, but I can't see how... Drop the prefixes. `l` is for list? `d` is for what!? Can't be dictionary because the code doesn't make much sense. Where is `cls` coming from? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: How to find out which functions exist?

2007-10-24 Thread Marc 'BlackJack' Rintsch
, globals().itervalues())) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Better writing in python

2007-10-24 Thread Marc 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Marc 'BlackJack' Rintsch
the value of the wrapped objects attribute. Or lazy computation of an attribute. Breaks expectations for the first access -- long calculation for simple attribute access -- but meets it for every subsequent access. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: How to implement function like this?

2007-10-23 Thread Marc 'BlackJack' Rintsch
if t_array_length len(result): result = (result[:t_array_length] + func_b(remaining_length)[:remaining_length]) return tuple(result) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to implement function like this?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 11:48:08 +0200, Loic Mahe wrote: even shorter: def funcA(tarray): s = min(len(tarray), 3) return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]] Why the list comprehension!? Ciao, Marc 'Blackjack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: greatest and least of these...

2007-10-23 Thread Marc 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't refer to base class attribute?

2007-10-23 Thread Marc 'BlackJack' Rintsch
but *instances* of `Base` have. class Derived(Base): def __init__(self): Base.__init__(self) Base.foo.x = 5 Instances of `Derived` have a `foo` attribute inherited from `Base`. So the last line should be ``self.foo.x = 5``. Ciao, Marc 'BlackJack' Rintsch -- http

Re: How to find out which functions exist?

2007-10-23 Thread Marc 'BlackJack' Rintsch
from Base? Take a look at the `issubclass()` function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out which functions exist?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 21:51:20 +, mrstephengross wrote: Ok, I see how to use issubclass(). How can I get a list of classes present in the file? import module from inspect import getmembers, isclass classes = getmembers(module, isclass) Ciao, Marc 'BlackJack' Rintsch -- http

Re: Wrapping stdout in a codec

2007-10-22 Thread Marc 'BlackJack' Rintsch
anonymous. How can we accomplish this wrapping? The `codecs` module has more than just the `codecs.open()` function. Try something like this:: sys.stdout = codecs.getwriter('utf-8')(sys.stdout) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: a question about decorator

2007-10-22 Thread Marc 'BlackJack' Rintsch
* `A`. Then `A` returns `why` and that is then used as decorator function, i.e. called with `T.test` as argument. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: python with braces pre-processor

2007-10-22 Thread Marc 'BlackJack' Rintsch
. Maybe (almost) nobody feels the need to generate Python source code. The language is so dynamic that there are almost always ways to avoid source code generation. Maybe you can generate a token stream and use `tokenize.untokenize()` to generate the source code!? Ciao, Marc 'BlackJack

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