Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
the second dimension. If you say 2D I think of something like a table with two columns and not a sequential condition spread over several lines. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to insert in a string @ a index

2007-09-10 Thread Marc 'BlackJack' Rintsch
. It seems to depend on the position if it's a keyword or not. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 19:54:49 +1200, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Marc 'BlackJack' Rintsch wrote: On Mon, 10 Sep 2007 15:02:58 +1200, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Bjoern Schliessmann wrote: Lawrence D'Oliveiro wrote: But then you

Re: concise code (beginner)

2007-09-10 Thread Marc 'BlackJack' Rintsch
, a conversation with a top poster starts to get mixed and even harder to follow. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 20:19:08 +1200, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Marc 'BlackJack' Rintsch wrote: I see a tree structure here ... Good, you're improving. Thanks. ... but still no table. Who said anything about a table? Me. If that statement is 2D I

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 15:48:44 +0200, A.T.Hofkamp wrote: (I have seen references to a module called datetime, but I have never used such a module so no idea what it is or where to get it). It's just an import away -- in the standard library. :-) Ciao, Marc 'BlackJack' Rintsch

Re: How do I read and write to the same CSV file

2007-09-10 Thread Marc 'BlackJack' Rintsch
file's name afterward. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: memcpy

2007-09-10 Thread Marc 'BlackJack' Rintsch
with `ctypes`. `memcpy` expects a pointer not an object. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python syntax wart

2007-09-09 Thread Marc 'BlackJack' Rintsch
to episode %d/A\n % ( LinkToMe({ep : Link[from_episode]}), Link[from_episode] ) ) #end for What do you mean by not possible!? This compiles fine for me. Ciao, Marc 'BlackJack' Rintsch

Re: Speed of Python

2007-09-08 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 23:53:48 +, wang frank wrote: From: Marc 'BlackJack' Rintsch [EMAIL PROTECTED] To: python-list@python.org Subject: Re: Speed of Python Date: 7 Sep 2007 23:17:55 GMT On Fri, 07 Sep 2007 22:59:26 +, wang frank wrote: I also have tried to use numpy to speed it up

Re: python sqlite THREADSAFE?

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

Re: /dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Sep 2007 18:52:57 +0200, Torsten Bronger wrote: Is there a portable and simply way to direct file-like IO to simply nothing? I try to implement some sort of NullLogging by saying `os.devnull`? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: Organizing Code - Packages

2007-09-08 Thread Marc 'BlackJack' Rintsch
. And `MyModule` is a bad name for a package. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using wild character

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Thu, 06 Sep 2007 16:48:31 -0700, Zentrader wrote: On Sep 6, 12:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 05 Sep 2007 22:54:55 -0700, TheFlyingDutchman wrote: To do a *string wildcard filter use the endswith() function instead of startswith() and to do a *string

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 10:40:47 +, Steven D'Aprano wrote: Nor does it include peek and poke commands for reading and writing into random memory locations. I guess `ctypes` offers tools to write `peek()` and `poke()`. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-07 Thread Marc 'BlackJack' Rintsch
is the start time you might override `__cmp__()` of `Step`\s instead:: def __cmp__(self, other): return cmp(self.startTime, other.startTime) Now you can just sort the list with ``steps.sort()``. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: Class design (information hiding)

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

Re: exponential float formmating

2007-09-07 Thread Marc 'BlackJack' Rintsch
number for the exponent. for example 13 shoud be 0.13000E+02 I always get 1.3E001 I don't know if this is platform dependent but this works for me: In [41]: '%e' % 1.3 Out[41]: '1.30e+00' In [42]: ('%e' % 1.3).upper() Out[42]: '1.30E+00' Ciao, Marc 'BlackJack' Rintsch

Re: Generating a unique identifier

2007-09-07 Thread Marc 'BlackJack' Rintsch
. For that easy solution you can use `itertools.count()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to determine the bool between the strings and ints?

2007-09-07 Thread Marc 'BlackJack' Rintsch
, True, False]) Out[52]: [1, 0, 1, 0] Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to determine the bool between the strings and ints?

2007-09-07 Thread Marc 'BlackJack' Rintsch
an instance of `int`. There's nothing special about it. In [57]: issubclass(bool, int) Out[57]: True In [58]: bool.__base__ Out[58]: type 'int' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed of Python

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 22:59:26 +, wang frank wrote: I also have tried to use numpy to speed it up. However, surprisingly, it is slower than the pure python code. Here is the code: import numpy arange=numpy.arange nlog=numpy.log def bench6(n): for i in xrange(n):

Re: Using wild character

2007-09-06 Thread Marc 'BlackJack' Rintsch
()` will go away in the future. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: concise code (beginner)

2007-09-06 Thread Marc 'BlackJack' Rintsch
; self.disablePLmessages([self.dev]); def a0050(): global self; self.dev.testH.writePLram((PL.BCAL128)); What is this ``global self`` meant to do? And the first line is missing a colon at the end. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: We need PIGs :)

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

Re: Noob: What is a slot? Me trying to understand another's code

2007-09-05 Thread Marc 'BlackJack' Rintsch
Python syntax. I guess there's an older issue of that book that used the SmallTalk programming language and they switched to Python syntactically but not mentally and not the vocabulary. A slot in SmallTalk is called attribute in Python. Ciao, Marc 'BlackJack' Rintsch -- http

Re: TypeError: 'module object is not callable'

2007-09-03 Thread Marc 'BlackJack' Rintsch
to access `Main.stepStore`. Unless you are modifying `stepStore.stepList` while iterating over it, you don't need to make a copy by the way. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pivy problem and some other stuff

2007-09-02 Thread Marc 'BlackJack' Rintsch
that the calling line didn't work. What meaningless error message are you talking about!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-09-01 Thread Marc 'BlackJack' Rintsch
just hold water back. And some produce electricity. And most if not all can regulate how many water is let through. If something goes wrong the valley behind the dam gets flooded. If this is controlled by a computer you have the need for reliable software. Ciao, Marc 'BlackJack' Rintsch

Re: list index()

2007-09-01 Thread Marc 'BlackJack' Rintsch
on a how a set is stored, I'd estimate any membership check in a set to be O(log N). Sets are stored as hash tables so membership check is O(1) just like Alex said. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: list index()

2007-09-01 Thread Marc 'BlackJack' Rintsch
to return the `Maybe` type. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: reload(sys)

2007-08-31 Thread Marc 'BlackJack' Rintsch
encoding\n') sys.exit() So there is an attribute `self.encoding` on that object. Is it set? What encoding is it? And do you put byte strings with values outside ASCII into your XML or unicode strings? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: list index()

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

Re: We need PIGs :)

2007-08-30 Thread Marc 'BlackJack' Rintsch
v2.0`_ or `API for Block Encryption Algorithms v1.0`_ what you are looking for? .. _API for Block Encryption Algorithms v1.0: http://www.python.org/dev/peps/pep-0272/ .. _Python Database API Specification v2.0: http://www.python.org/dev/peps/pep-0249/ Ciao, Marc 'BlackJack

Re: list index()

2007-08-30 Thread Marc 'BlackJack' Rintsch
. What about -1? C programmers do this all the time. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python doesn't see the directories I create

2007-08-30 Thread Marc 'BlackJack' Rintsch
string literal. In [23]: len('\r') Out[23]: 1 In [24]: len('\\') Out[24]: 1 In [25]: len(r'\r') Out[25]: 2 In [26]: len(r'\\') Out[26]: 2 Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: SAXParseException: not well-formed (invalid token)

2007-08-30 Thread Marc 'BlackJack' Rintsch
in a browser. (Could not connect…) Maybe you can download that XML file and use `xmllint` to check if it is well formed XML!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python doesn't see the directories I create

2007-08-30 Thread Marc 'BlackJack' Rintsch
: [EMAIL PROTECTED]:~$ touch C:/test.txt [EMAIL PROTECTED]:~$ ls -l C: total 0 -rw-r--r-- 1 bj bj 0 2007-08-30 14:38 test.txt :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: SAXParseException: not well-formed (invalid token)

2007-08-30 Thread Marc 'BlackJack' Rintsch
On Thu, 30 Aug 2007 15:31:58 +0200, Pablo Rey wrote: On 30/08/2007 14:35, Marc 'BlackJack' Rintsch wrote: Maybe you can download that XML file and use `xmllint` to check if it is well formed XML!? This is the output of the xmllint command: [EMAIL PROTECTED] voms2users]$ xmllint

Re: list index()

2007-08-30 Thread Marc 'BlackJack' Rintsch
to provide both as well, but it provides only `index()`. Anyone know the reason for this lack of parallelism? Historical reasons and IIRC the `find()` method on strings will go away in Python 3.0. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pivy problem and some other stuff

2007-08-30 Thread Marc 'BlackJack' Rintsch
: In [56]: def b(): : return 2 : In [57]: funcs = [a, b] In [58]: funcs Out[58]: [function a at 0xb7792e2c, function b at 0xb779e1ec] In [59]: funcs[0]() Out[59]: 1 In [60]: funcs[1]() Out[60]: 2 Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: list index()

2007-08-30 Thread Marc 'BlackJack' Rintsch
notation. Return -1 if sub is not found. But that is a valid index into a string! So this may go unnoticed if one doesn't check after every call to `str.find()`. And that method is going away in Python 3.0. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: Error handling in file generation (Pythonic way: with / decorators?)

2007-08-29 Thread Marc 'BlackJack' Rintsch
error, e: os.remove(dictpath) sys.exit(str(e)) except: os.remove(dictpath) raise Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference ?

2007-08-29 Thread Marc 'BlackJack' Rintsch
example has to look up the `has_key()` method on the object first. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: general function for sorting a matrix

2007-08-29 Thread Marc 'BlackJack' Rintsch
in place too. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: re compiled object result caching?

2007-08-29 Thread Marc 'BlackJack' Rintsch
, it started out life as a unidimensional thing, but later needs to be a flattening of 3 dimensions or something), you won't necessarily need to change depenent code. Maybe you should read about the `property()` function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: How to free memory ( ie garbage collect) at run time with Python 2.5.1(windows)

2007-08-27 Thread Marc 'BlackJack' Rintsch
is given back to the OS and reported as free memory again. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: XML File -- dictionary edit/search

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

Re: How can I use python for file processing

2007-08-26 Thread Marc 'BlackJack' Rintsch
()` the lines and put them into a `dict()`. This is a neat little project to start learning the language. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Joining Big Files

2007-08-25 Thread Marc 'BlackJack' Rintsch
, would I be better reading every line in every file and writing each line to the output file or is there someway I could execute some shell command. There are some copy functions that work with file like objects in the `shutil` module. Ciao, Marc 'BlackJack' Rintsch -- http

Re: any problem with py's RC?

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

Re: Raw strings to normal strings conversion?

2007-08-23 Thread Marc 'BlackJack' Rintsch
-escape') a b Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Redo: Problem with dynamic creation of classes.

2007-08-23 Thread Marc 'BlackJack' Rintsch
something wrong? Hard to tell without seeing where `IFRAMED2` is bound and without knowing what you actually want to do. Can you provide a self contained example that people here can actually try!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a dictionary from a dictionary with regex

2007-08-22 Thread Marc 'BlackJack' Rintsch
', 'line3.item':'N73', 'line5.item':'Screen Cover'} result = defaultdict(dict) for key, value in d.iteritems(): new_key = key.split('.', 1)[0] # Get the 'line#' part. result[new_key][key] = value print result Ciao, Marc 'BlackJack' Rintsch -- http

Re: File Read Cache - How to purge?

2007-08-22 Thread Marc 'BlackJack' Rintsch
`` before. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: way to define static method

2007-08-22 Thread Marc 'BlackJack' Rintsch
(object): @staticmethod def my_real_static_method(): # Look ma, no `self`. :-) Static methods are just functions, on classes `classmethod`\s are often more useful. They get the class as first argument. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: File Read Cache - How to purge?

2007-08-21 Thread Marc 'BlackJack' Rintsch
? That is without having to read another large file first? AFAIK no. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: File Read Cache - How to purge?

2007-08-21 Thread Marc 'BlackJack' Rintsch
in the previous run. So you only gain something on subsequent reads on the file. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: to property or function in class object

2007-08-17 Thread Marc 'BlackJack' Rintsch
returning something is okay, but a calculation that lasts an hour or so would surprise many. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming dictionaries recursively

2007-08-17 Thread Marc 'BlackJack' Rintsch
problem seems to be parsing those lines. That is not a valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and `predatory` are not already defined. So you can't just ``eval`` it. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: replacement for string.printable

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

Re: What order does info get returned in by os.listdir()

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

Re: replacement for string.printable

2007-08-15 Thread Marc 'BlackJack' Rintsch
` are deprecated. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Variable variable name or variable lvalue

2007-08-15 Thread Marc 'BlackJack' Rintsch
= dict() for x in xrange(1, 4): M[x] = Material(x) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.5 bug

2007-08-11 Thread Marc 'BlackJack' Rintsch
On Sat, 11 Aug 2007 02:41:26 -0700, vedrandekovic wrote: I was install Python 2.5 and uninstall Python 2.4 now I cannot run my scripts, only from idle What should I do? Install 2.4 again. Both can be installed in parallel. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: Destruction of generator objects

2007-08-11 Thread Marc 'BlackJack' Rintsch
But then, even when terminating the interpreter, __del__ is not called. Because that is not guaranteed by the language reference. The reason why it is a bad idea to depend on `__del__` for important resource management. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: How to change a PyObject passed to the C extension

2007-08-11 Thread Marc 'BlackJack' Rintsch
`` this would have severe consequences for cached/shared objects. Just imagine: from your_module import bzzzt def f(): print 2 + 2 bzzzt(2) # This changes the value of 2 to 3. f()# This prints '6'! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: Who told str() to round my int()'s!!!

2007-08-11 Thread Marc 'BlackJack' Rintsch
0.1555111512312578270211815834045410156250 instead? Use string formatting to tell the number of digits you want to see: In [16]: '%.56f' % 0.1 Out[16]: '0.1555111512312578270211815834045410156250' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: decorators - more than just syntactic sugar

2007-08-11 Thread Marc 'BlackJack' Rintsch
decorators? *The* predefined decorators? Decorators are just functions after all. There are some meant to be used as decorators but there are also ordinary functions that may make sense as decorators. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Who told str() to round my int()'s!!!

2007-08-11 Thread Marc 'BlackJack' Rintsch
On Sat, 11 Aug 2007 17:10:05 +, Adam W. wrote: On Aug 11, 12:53 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: If `str()` would not round you would get very long numbers because of the inaccuracies of floating point values. I know Python is lying when 0.1 prints as 0.1, but do you

Re: Puzzled by is

2007-08-10 Thread Marc 'BlackJack' Rintsch
run but not in the next. For me CPython, Iron Python and Jython are different implementations as they are all written from scratch. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Does PyModule_GetDict return information about class method variables?

2007-08-10 Thread Marc 'BlackJack' Rintsch
On Fri, 10 Aug 2007 05:54:03 -0700, MD wrote: On Aug 10, 12:43 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: class A(object): def foo(self): bar = 42 The local name `bar` only exists if `foo()` is called on an instance of `A`. Thanks for your reply. I am calling my

Re: Question about properties.

2007-08-10 Thread Marc 'BlackJack' Rintsch
get_x(self): return ~self.__x x = property(get_x) Can anyone please help me understand what the symbol ~ does here ?? This has nothing to do with properties. For integer objects ``~`` is the bitwise negation or invertion operator. Ciao, Marc 'BlackJack' Rintsch

Re: check if regeular expression has results

2007-08-09 Thread Marc 'BlackJack' Rintsch
an ``if`` on the result of the search or match. If the regular expression doesn't match `None` is returned, which is `False` in a boolean context, otherwise a match object is returned, which is `True` in a boolean context. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: Jython - variables are stored somehow

2007-08-09 Thread Marc 'BlackJack' Rintsch
Abschnitt in DatenTypen: + str(self.abschnitte) So, I read about deleting Instances with del ... but it does not work at all. You can't delete objects with ``del``, just names or references to objects in containers. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: tempfile behavior

2007-08-09 Thread Marc 'BlackJack' Rintsch
` or open the file with the `filename`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: High performance binary data

2007-08-09 Thread Marc 'BlackJack' Rintsch
of the question you might consider actually measuring your program, as the task may be I/O bound i.e. Python may be faster than the data comes in regardless of which module, `struct` or `ctypes`, you use to tear apart and access the data. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: Does PyModule_GetDict return information about class method variables?

2007-08-09 Thread Marc 'BlackJack' Rintsch
as soon as the function returns. It's the very same situation in Python: class A(object): def foo(self): bar = 42 The local name `bar` only exists if `foo()` is called on an instance of `A`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: Seek the one billionth line in a file containing 3 billion lines.

2007-08-08 Thread Marc 'BlackJack' Rintsch
for the second line and so on. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid reverse code engineering of a python executable

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

Re: This bit of code hangs Python Indefinitely

2007-08-08 Thread Marc 'BlackJack' Rintsch
on. That's the typical use case for queues. Why did you put an upper bound to the queue? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: some import / namespace questions

2007-08-08 Thread Marc 'BlackJack' Rintsch
On Wed, 08 Aug 2007 17:11:19 +0200, stef mientki wrote: Now it's not possible to import in the existing modules the main plugin, like from Main_User import * because this will start the infinite loop. Which means there's code at the module level. Tell the users to put that into a

Re: How to use C enum in Python CTypes?

2007-08-07 Thread Marc 'BlackJack' Rintsch
: (OLSS_AD, OLSS_DA, OLSS_DIN, OLSS_DOUT, OLSS_SRL, OLSS_CT) = map(ctypes.c_int, xrange(6)) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Relative-importing *

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

Re: Regular Expression Groups - loop

2007-08-07 Thread Marc 'BlackJack' Rintsch
regular expression. I guess you are confusing groups within one match with multiples matches in the text. `re.search()` finds exactly one sentence. If you want all sentences use `re.find_all()` or `re.find_iter()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: How to use C enum in Python CTypes?

2007-08-07 Thread Marc 'BlackJack' Rintsch
On Tue, 07 Aug 2007 02:13:38 -0700, rozniy wrote: On Aug 7, 2:11 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 07 Aug 2007 04:57:19 +, rozniy wrote: This site http://python.net/crew/theller/ctypes/tutorial.html#bugs-todo-and-non... says that enumeration types

Re: Adding a list of descriptors to a class

2007-08-07 Thread Marc 'BlackJack' Rintsch
: TypeError: 'dictproxy' object does not support item assignment Does ``setattr(self.__class__, attr, MyDesc(attr))`` work? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: re.sub does not replace all occurences

2007-08-07 Thread Marc 'BlackJack' Rintsch
but removed when doing multiple runs. Can you give some example HTML where it fails? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Something in the function tutorial confused me.

2007-08-06 Thread Marc 'BlackJack' Rintsch
between function calls in the first function, but doesn't in the second one? Not `y` is accumulating but the list object does. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Something in the function tutorial confused me.

2007-08-06 Thread Marc 'BlackJack' Rintsch
is called. It is always the very same list object. And if you mutate it, this will be visible to other calls to the function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Is shelve/dbm supposed to be this inefficient?

2007-08-02 Thread Marc 'BlackJack' Rintsch
it may be expected to see that bloat. It's a space vs. speed trade off then. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python by Adding Keywords Data types

2007-08-01 Thread Marc 'BlackJack' Rintsch
and can be compiled as Python extension module. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How does xmlrpc work ?

2007-08-01 Thread Marc 'BlackJack' Rintsch
and keep it alive forever OR create a new connection when a method is called and end it after the call is finished? Every XMLRPC call uses its own HTTP connection that is closed after the call is finished. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: A way to re-organize a list

2007-08-01 Thread Marc 'BlackJack' Rintsch
`` is executed. So all calls to this function share the same list object bound to `target`. Call this function twice without an explicit `target` and you'll see the problem. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: access the name of my method inside it

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

Re: access the name of my method inside it

2007-08-01 Thread Marc 'BlackJack' Rintsch
On Wed, 01 Aug 2007 07:01:42 -0400, Steve Holden wrote: Marc 'BlackJack' Rintsch wrote: On Wed, 01 Aug 2007 09:06:42 +, james_027 wrote: for example I have this method def my_method(): # do something # how do I get the name of this method which is my_method here? Why do

Re: Assertion in list comprehension

2007-08-01 Thread Marc 'BlackJack' Rintsch
, showing) whether a function works as expected. If it is input validation I wouldn't expect it protected by a ``if __debug__:``. That looks more like debugging/testing. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a two-column file into an array?

2007-07-31 Thread Marc 'BlackJack' Rintsch
def main(): data_file = open('filename', 'rb') a = list(csv.reader(data_file, delimiter='\t')) data_file.close() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: get directory and file names

2007-07-31 Thread Marc 'BlackJack' Rintsch
. In particular `os.listdir()`, `os.path.isfile()` and `os.path.splitext()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: encode() question

2007-07-31 Thread Marc 'BlackJack' Rintsch
that are really needed. One could argue about `str.encode` and `unicode.decode`. But there are at least uses for `str.encode` like 'sting-escape', 'hex', 'bz2', 'base64' etc. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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