Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread Marc 'BlackJack' Rintsch
When you have a list of such objects and want to sort them by name or by date of birth you can't use the `compareTo()` method for both. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Starting up the server

2006-08-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, john Perry wrote: > how to solve these error > > Traceback (most recent call last): > File "mrsm-start.py", line 2, in > import pkg_resources > ImportError: No module named pkg_resources Install the module `pkg_resources`. SCNR

Re: How to store ASCII encoded python string?

2006-08-28 Thread Marc 'BlackJack' Rintsch
\\xa7 some more text\\n" as long as I have a way to later > unescape it when I want to actual do something with the data. In [6]: '\tsome text\xa7some more text\n'.encode('string_escape') Out[6]: '\\tsome text\\xa7some more text\\n' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: csv module strangeness.

2006-08-30 Thread Marc 'BlackJack' Rintsch
nitialspace = True > dialect.quoting = csv.QUOTE_MINIMAL That's possible but why didn't you follow the way `csv.Dialect` set the class attributes? class MyDialect(csv.Dialect): delimiter = '\t' lineterminator = '\n' # and so on… Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: GMPY binaries for Windows 2.5

2006-09-01 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, casevh wrote: Interesting subject line. I think I still have a set of "Win 3.11 for workgroups" disks lying around somewhere, but where do I get Windows 2.5? ;-) SCNR, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about import and namespace

2006-09-01 Thread Marc 'BlackJack' Rintsch
object visible in the module_1 > namespace ? > I guess that if I do an ' import module_1 ', I can make the object > visible with ' module_1.myObject = myObject ', but that won't work with > the from ... import * statement. Give the object as argument to functio

Re: Question about import and namespace

2006-09-01 Thread Marc 'BlackJack' Rintsch
s ? The code at module level is only executed at first import. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: inheritance needed in program configuration - config module or python oo?

2006-09-02 Thread Marc 'BlackJack' Rintsch
dispatch to either the current object or it's > parent, but I am not sure that ConfigObj or any config module allows > such power. What about simply merging the two `ConfigObj` instances with the `merge()` method? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it just me, or is Sqlite3 goofy?

2006-09-04 Thread Marc 'BlackJack' Rintsch
a real RDBMS. If you are so fond of static typing, why are you using Python in the first place? Just see it as consistency -- dynamically typed language → dynamically typed DB columns. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Better way to replace/remove characters in a list of strings.

2006-09-05 Thread Marc 'BlackJack' Rintsch
f you have 200 MiB worth of strings in the list and change all 'u's to 'x's with large_list = [item.replace('u', 'x') for item in large_list] another list with 200 MiB strings will be created. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: IronPython 1.0 - Bugs or Features?

2006-09-06 Thread Marc 'BlackJack' Rintsch
omeValue() >except: > pass >if( type(strData) == str ) : ### <<< HERE THE ERROR > doSomething() > > CPython 2.4.2 doesn't raise an error with same code. Well I get a `NameError` for `someCondition`. Please post a minimal *working

Re: IronPython on Mono howto

2006-09-07 Thread Marc 'BlackJack' Rintsch
this a known problem? Is it a Mono thing or an IronPython thing? Any > workaround? The `boo` shell and the `Nemerle` shell can be quit with Ctrl-D under Mono, so I guess it's an `IronPython` thing. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: help with unicode email parse

2006-09-08 Thread Marc 'BlackJack' Rintsch
nt text files an print the content in Java and see yourself that it's necessary to give the encoding explicitly if you want to deal with arbitrary encodings and not just the default Java uses. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: SQLwaterheadretard3 (Was: Is it just me, or is Sqlite3 goofy?)

2006-09-08 Thread Marc 'BlackJack' Rintsch
foo' 1000 0.5 None Join on `id`: idname age - -- 42bob23 'foo' methusalem 1000 > The implications of violating the SQL Language Specification > are much more serious than you think. Or not so serious than you think. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to make python work properly

2006-09-09 Thread Marc 'BlackJack' Rintsch
s. Why do you install it from sources? > It appears as though for some reaosn the readline module is not being > installed on my system. It's a dependency of the Python packages. That's odd. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: What algorithm does Python use to evaluate: if substring in string

2006-09-09 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Tor Erik wrote: > I would be surprised if it is the naive: Why? I guess it simply calls an appropriate C library function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: PyPy with a smaller PVM for the full Python?

2006-09-11 Thread Marc 'BlackJack' Rintsch
VM is already quite small. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the package, file, and line of a method/function invocant?

2006-09-11 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, metaperl wrote: > # Of course I could cheat and pass it, but I don't want to: > > directories = data.storage.logic(__file__) Why do you consider a plain and simple solution cheating? Ciao, Marc 'BlackJack' Rintsch -- http://ma

Re: How to compare to directories?

2006-09-13 Thread Marc 'BlackJack' Rintsch
information? I think `os.listdir()` and the functions in `os.path` will be the tools you need. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-14 Thread Marc 'BlackJack' Rintsch
en when you are reading other people's data :-) I would spell it: if strg.endswith('\0'): strg = strg[:-1] Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] XPN 0.6.5 released

2006-09-14 Thread Marc 'BlackJack' Rintsch
a loop involved. Can't you update the GUI after each message? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Check if variable is an instance of a File object

2006-09-15 Thread Marc 'BlackJack' Rintsch
t do you do if you check for `file` and it isn't such an instance? Raise an exception? A no, that's something you don't like. So what else? ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: add without carry

2006-09-15 Thread Marc 'BlackJack' Rintsch
ithout carrying`? Do you want to limit the result to a given bit length with a "wrap around" behavior if the number gets too large to fit into those bits? Then this should do the trick: a = (b + c) & (2**bits - 1) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you convert and array of doubles into floats?

2006-09-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, SpreadTooThin wrote: > I have some code... > > import array > > a = array.array('d') > f = open('file.raw') > a.fromfile(f, 10) > > now I need to convert them into floats (32 bit...) what do i do? What about: b

Re: how do you convert and array of doubles into floats?

2006-09-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Diez B. Roggisch wrote: > Marc 'BlackJack' Rintsch schrieb: >> In <[EMAIL PROTECTED]>, SpreadTooThin >> wrote: >> >>> I have some code... >>> >>> import array >>> >>> a = array.arra

Re: How to find number of characters in a unicode string?

2006-09-18 Thread Marc 'BlackJack' Rintsch
on the screen). Is there a way to calculate in characters > and not in bytes to represent the characters. Yes and you already seem to know the answer: Decode the byte string and use `len()` on the unicode string. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie division question

2006-09-18 Thread Marc 'BlackJack' Rintsch
compatibility. >> >> http://www.python.org/dev/peps/pep-3000/ >> >> casevh >> > > Yes, Break Backwards Compatibility is a Level 60 spell, reserved for Night > Elf mages. But new keywords certainly can make it into 2.x releases. Only Level 10 spells? :-)

Re: why a main() function?

2006-09-19 Thread Marc 'BlackJack' Rintsch
functions. The dictionary isn't the dictionary that's used for locals but a proxy just for read access. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: byte count unicode string

2006-09-19 Thread Marc 'BlackJack' Rintsch
TF-8') > > num_chars = len(ustr)# 8 > > buf = ustr.encode('UTF-8') > > num_bytes = len(buf) # 9 That is the correct way. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: how to control file output encoding?

2006-09-19 Thread Marc 'BlackJack' Rintsch
> None > > how can I change the file output encoding? Use the `open()` function in the `codecs` module: import codecs f = codecs.open('abc.txt', 'w', 'utf-8') Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: "list index out of range" error

2006-09-20 Thread Marc 'BlackJack' Rintsch
a beginner > out with this? It has nothing to do with `cmp()` vs. explicit testing but with indexing the `k+1` element. Let's assume `no_lines` is 10 then the elements have the indexes 0 to 9. Within the while loop `k` is incremented and the loop body is executed as long as `k < 10`. Whe

Re: Re[2]: unicode mystery/problem

2006-09-22 Thread Marc 'BlackJack' Rintsch
efault. Don't mix byte strings and unicode strings. Put an encoding declaration at the top of your file and convert everything to unicode on the "way in" and to the proper encoding on the "way out" of your program. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Global module variables as default parameters

2006-09-22 Thread Marc 'BlackJack' Rintsch
default parameters? Default parameters are evaluated *once* when the ``def`` is executed. So in `def2` the value of `foo` won't be looked up when calling the function as it is already bound to the value 0. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Verify an e-mail-adress - syntax and dns

2006-09-24 Thread Marc 'BlackJack' Rintsch
lly correct beforehand. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to change menu text with Tkinter?

2006-09-27 Thread Marc 'BlackJack' Rintsch
the user to restart the application? Then using the `gettext` module is a good way. Maybe in combination with the `locale` module so you can use the language of the operating system as default if the user doesn't choose one explicitly. Ciao, Marc 'BlackJack' Rintsch --

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-27 Thread Marc 'BlackJack' Rintsch
ot;. It's not the O() behavior but the interface that defines abstract data types. If it's a (double) linked list or a dynamical array under the hood is an implementation detail. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-28 Thread Marc 'BlackJack' Rintsch
would you favor such complicated solutions > for this (as posted), when you can have this > in one line, e.g.: > > def int2bin(num, width=32): > return ''.join(['%c'%(ord('0')+bool((1< range((width-1),-1,-1)]) Yeah, I wonder why not everybody sees the beauty in this cool and straightforward one liner. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' > Rintsch wrote: > >> In <[EMAIL PROTECTED]>, >> Preben Randhol wrote: >> >>> Is there a way to calculate in characters >

Re: builtin regular expressions?

2006-09-30 Thread Marc 'BlackJack' Rintsch
t to a function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, gabor wrote: > Marc 'BlackJack' Rintsch wrote: >> In <[EMAIL PROTECTED]>, Jean-Paul >> Calderone wrote: >> >>>> How would you propose listdir should behave? >>> Umm, just a wild guess, but how about raising

Re: function for allocating memory for string array

2006-11-17 Thread Marc 'BlackJack' Rintsch
allowed in ANSI C. Some compilers understand them but if you want to write portable code you should steer clear of them. > fprintf(stderr, "Failed to allocate memory\n"); The declaration of `fprintf()` lives in `stdio.h`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python v PHP for web, and restarting Apache?

2006-11-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, walterbyrd wrote: > I am not trying to suggest anything here. I'm just asking. Asking what? Asking something usually involves a question. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: basic python questions

2006-11-18 Thread Marc 'BlackJack' Rintsch
ne_num+1 not in dict[word]: > dict[word].append(line_num+1) Instead of dealing with words that appear more than once in a line you may use a `set()` to remove duplicates before entering the loop. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: print with variable justification (with *)

2006-11-18 Thread Marc 'BlackJack' Rintsch
27;reilly's books. But there is no example and I > couldn't get it to work by trials and errors. Does anyone have a > working example? In [50]: '%*s' % (5, 'spam') Out[50]: ' spam' In [51]: '%*s' % (10, 'spam') Out[51]: '

Re: Invoking Python from Cygwin problem.

2006-11-25 Thread Marc 'BlackJack' Rintsch
``print`` ended in a comma (see the `sys.stdout.softspace` attribute) and when the interpreter executes its shutdown code and that `softspace` attribute is set, an extra '\n' is printed. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Persistent Threads & Synchronisation

2006-11-26 Thread Marc 'BlackJack' Rintsch
kill for solving the problem of replacing > that loop with something more efficient, though could be a possibility, > I suppose). But that problem *is* about thread synchronization. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python script and C++

2006-11-28 Thread Marc 'BlackJack' Rintsch
r such a task. The only way to find out if it may be to slow is writing a prototype and measure. Maybe it's a good idea to design the API for the "NPCs" independent from the language so you can also write them in C++ or another scripting language. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: "fork and exit" needed?

2006-11-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Vincent Delporte wrote: > Anyone knows if those lines are necessary, why, and what their > alternative is in Python? > > --- > open STDOUT, '>/dev/null'; sys.stdout = open(os.devnull, 'w') Ciao, Marc 'Blac

Re: os.walk return hex excapes

2006-11-28 Thread Marc 'BlackJack' Rintsch
d by the shell, IDE or wherever the string is displayed. How does the real file name look like? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: PythonTidy

2006-11-30 Thread Marc 'BlackJack' Rintsch
g/dev/peps/pep-0263/ Where does it say it has to be emacs-style? It just uses that style as example as far as I can see. The real definition is a regexp: coding[:=]\s*([-\w.]+) So the vim-style is fine. No need to replace it. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleting from a list while iterating

2006-12-03 Thread Marc 'BlackJack' Rintsch
The two other approaches you gave are just needed if it's important that the elements are deleted "in place", i.e. that you don't rebind `items` to a new object. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: algorithm for sorting functional expressions

2006-12-04 Thread Marc 'BlackJack' Rintsch
It would be good if any such algorithm would be able to > check for circular definitions in the input. You are looking for "topological sort". Feed a search engine with that term. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: About the 79 character line recommendation

2006-12-05 Thread Marc 'BlackJack' Rintsch
follow diffs from version control systems. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Marc 'BlackJack' Rintsch
not a function. And non-empty tuples are "true": assert (False, 'boink') This is equivalent to ``assert True``. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to split up lines - RE: About the 79 character linerecommendation

2006-12-08 Thread Marc 'BlackJack' Rintsch
or heterogeneous sequences and lists are for homogeneous ones. > > Any rationale for this theory? The BDFL says so. Don't question him. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this different?

2006-12-08 Thread Marc 'BlackJack' Rintsch
ost obvious what the programmer intends But unnecessary use of `eval()` is evil. You can spell it this way: z = [lambda x=i: x for i in range(10)] The `x` is a local name and default values are evaluated and bound when the function is created. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Common Python Idioms

2006-12-08 Thread Marc 'BlackJack' Rintsch
#x27;t work with dictionaries, either `__contains__()` must be implemented to throw an exception or dictionaries shouldn't be iterable. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic debugging of copy by reference errors?

2006-12-09 Thread Marc 'BlackJack' Rintsch
k for it. So what you want is a warning for *every* assignment. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding "invalid literal for int()" exception

2006-12-11 Thread Marc 'BlackJack' Rintsch
ance(int(uniList[0])) > break > else: > verb.AddNewVerb((uniList[0]) You may want to give `uniList[0]` a name before entering the ``if``/``elif`` construct to avoid accessing the first element over and over. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pb ReportLab (ttfonts.py)

2006-12-11 Thread Marc 'BlackJack' Rintsch
uot;>LLL", checksum, offset, len(data))) > C:\Python25\reportlab\pdfbase\ttfonts.py:419: DeprecationWarning: struct > integer overflow masking is deprecated > stm.write(pack('>L', checksum)) Does the PDF generation work? Those are just warnings. Ciao,

Re: Automatic debugging of copy by reference errors?

2006-12-11 Thread Marc 'BlackJack' Rintsch
binds an object to a name or puts a reference into a "container" object. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-11 Thread Marc 'BlackJack' Rintsch
: http://nemerle.org/Macros I guess you can't really transform Nemerle into a completely different language, but it is at least interesting to see such a feature in language with a more complex syntax than Lisp. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-11 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Paul Rubin wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: >> FYI: Here's how Nemerle does macros: http://nemerle.org/Macros >> >> I guess you can't really transform Nemerle into a completely different &g

Re: namespace question

2006-12-11 Thread Marc 'BlackJack' Rintsch
ce. Simplest way: class Test: c = 3 :-) You know that `a`, `b` and `c` are class variables and not instance variables!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding "invalid literal for int()" exception

2006-12-11 Thread Marc 'BlackJack' Rintsch
t; elif uniList[0] in string.digits: > > elif uniList[0].isdigit(): The last does not work. Not only that it accepts numbers greater than 9 because it checks if the whole string consists of digits, it also accepts u'²₂' and other unicode digits. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: py-ldap question

2006-12-12 Thread jean-marc pouchoulon
and this set option ? ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,ldap.OPT_X_TLS_NEVER) HTH Laszlo Nagy a écrit : > By the way, I already tried the set_option function, but I still get the > same error. > > > import ldap > import local > > ldap.set_option(ldap.OPT_X_TLS_ALLOW,1) > ldap.set_op

Re: About alternatives to Matlab

2006-12-13 Thread Marc 'BlackJack' Rintsch
nt line endings when counting bytes. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: [unicode] inconvenient unicode conversion of non-string arguments

2006-12-13 Thread Marc 'BlackJack' Rintsch
eed to be secure. If verification is required, please > request a hard copy version. Maybe you should rethink if it really makes sense to add this huge block of "nonsense" to a post to a newsgroup or public mailing list. If it's confidential, just keep it secret. ;-) Ciao,

Re: Conditional iteration

2006-12-15 Thread Marc 'BlackJack' Rintsch
guess/hope they will stay in Python 3000. And Guido already said that ``lambda`` will stay, so maybe he changes his mind about `map` and `filter` too. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Roundtrip SQL data especially datetime

2006-12-16 Thread Marc 'BlackJack' Rintsch
Ldb glue code. And he's busy. AFAIK there's no MySQLdb module for Python 2.5 on *Windows* yet, because the author of the module doesn't use Windows anymore and he don't want to maintain a binary he can't test. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: OT : Bug/Issue tracking systems

2006-12-17 Thread Marc 'BlackJack' Rintsch
y efficiently and reliable by a database backend. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: length of multidimensional table

2006-12-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, vertigo wrote: > i have: > x = zeros([3,4],Float) > > how can i check how many rows and columns x have ? > (what is the X and Y size of that table) ? Try `x.getshape()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How would I create an class with a "Person.Address.City" property?

2006-12-18 Thread Marc 'BlackJack' Rintsch
eloper', Address('Detroit', 'Michigan')) } def employee(name): return employees[name] def main(): person = employee('Joe') print person.title print person.address.city print person.address.state Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: When Closure get external variable's value?

2006-12-19 Thread Marc 'BlackJack' Rintsch
it happens at runtime! It's executed every time the outer function is called and executed and creates a function object. As far as I can see you don't create a closure BTW. You are *calling* that inner function and return the *result* of that call. Ciao, Marc 'BlackJack' Rin

Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Marc 'BlackJack' Rintsch
the `binfmt_misc` module you can make anything with a "magic" header executable, including Python scripts/bytecode and even JPEG images. http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Displaying contents of a file using PyWin

2006-12-21 Thread Marc 'BlackJack' Rintsch
: NameError: name 'object_template' is not defined ? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Py++ - 0.8.5

2006-12-21 Thread Marc 'BlackJack' Rintsch
ents or would that be too obvious? Yes that's for making announcements. And usually they are posted here too. Set a filter on the subject if you don't want to read them. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: def index(self):

2006-12-21 Thread Marc 'BlackJack' Rintsch
le used as decorator: @spam + eggs + viking def fn(...): ... This would not be equivalent to: def fn(...): ... fn = spam + eggs + viking(fn) but: def fn(...): ... fn = (spam + eggs + viking)(fn) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Regexp Neg. set of chars HowTo?

2006-12-22 Thread Marc 'BlackJack' Rintsch
t that not lion and tion. And ^ion. The first ^ in that character group "negates" that group, the second is a literal ^, so I guess you meant "[^tl]ion". Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: some OT: how to solve this kind of problem in our program?

2006-12-24 Thread Marc 'BlackJack' Rintsch
ilab has a pure-python package: http://www.logilab.org/view?rql=Any%20X%20WHERE%20X%20eid%20852 Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: File write() problem

2006-12-27 Thread Marc 'BlackJack' Rintsch
t', 'w') In [2]: configfile.readline() --- exceptions.IOError Traceback (most recent call last) /home/marc/ IOError: [Errno 9] Bad file descriptor Please post the exact code you have trouble with. Don&#

Re: newbie question: any better way to write this code?

2006-12-27 Thread Marc 'BlackJack' Rintsch
> x = ord(buf[i]) > x ^= 123 > bout.append(chr(x)) > return "".join(buf) > buf = "".encode("utf8") > buf = xor(buf) def xor(buf): return ''.join(chr(ord(x) ^ 123) for x in buf) Ciao

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-27 Thread Marc 'BlackJack' Rintsch
two separate classes or just one with a flag or maybe a function as argument to the `__init__()` method? Are you writing the `Section` class(es) just for this calculation or do they contain other behavior too? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

re: loose methods: Smalltalk asPython

2006-12-27 Thread Marc 'BlackJack' Rintsch
don't think the response was meant to say that it must be bad but that it won't show up as feature in Python as long as the BDFL thinks it's bad. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-28 Thread Marc 'BlackJack' Rintsch
quot; behavior and that baseclass can be instantiated and used directly. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: answers.py v0.0.1 - source

2006-12-28 Thread Marc 'BlackJack' Rintsch
Assuming the code is in ordinary functions named `level0` to `level4`: def dispatch(): levels = [level0, level1, level2, level3, level4] next_level = 1 while True: next_level = levels[next_level]() Giving the numbers meaningful names helps readability. Or even better give the functions better names and get rid of the numbers by returning the next to call function object directly. Then the `dispatch()` is just: def start_func(): ... if some_condition: return spam_func else: return eggs_func def spam_func(): ... ... def dispatch(): func = start_func while True: func = func() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: DOS, UNIX and tabs

2006-12-28 Thread Marc 'BlackJack' Rintsch
There are plenty of "reasons" from both sides. This is a religious issue, so please search the net for answers and don't start another flam^H^H^H^Hdebate here. Please! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Marc 'BlackJack' Rintsch
f the object that's bound to the local name `y`. Modifying an object is different from binding a name to a new object. ``y = ['uno', 'dos', 'tres']`` would not be visible outside the function. > x = 5 > y = [1,2,3,4] > print x,y > some_function(x,y)

Re: Convert Perl to Python

2006-12-29 Thread Marc 'BlackJack' Rintsch
an beings. Every language has its idioms and a "literal" translation looks very odd to "native speakers" of the target language. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I beat perl at grep-like processing speed?

2006-12-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Tim Smith wrote: > also, if you replace the regex with a test like lambda x: > x.lower().find("destroy") != -1, you will get really close to the speed > of perl's Testing for ``'destroy' in x.lower()`` should even be a little bi

Re: Question concerning this list

2006-12-31 Thread Marc 'BlackJack' Rintsch
h is faster > than list.pop(index) (Is there a lib for this?) If you need a queue then use one: take a look at `collections.deque` or the `Queue` module in the standard library. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: DOS, UNIX and tabs

2006-12-31 Thread Marc 'BlackJack' Rintsch
terminals where code will be displayed from time to time for example as diffs from a version control system. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Question concerning this list [WebCrawler]

2006-12-31 Thread Marc 'BlackJack' Rintsch
and is thread safe. Speedwise I don't think this makes a difference as the most time is spend with IO and parsing. So if you make your spider multi-threaded to gain some speed go with `Queue.Queue`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: how to move files based on file-ending from dirs and subdirs to specific dir?

2007-01-02 Thread Marc 'BlackJack' Rintsch
examples, are needed here. And maybe then you'll see why it doesn't work as wanted!? If these are the destination paths and they should be at the same level as `top`, where is `top` here? Shouldn't that be a prefix of all destination paths? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between __init__ (again) and nothing ...

2007-01-02 Thread Marc 'BlackJack' Rintsch
PC, b.PC Out[12]: (4, 4) In [13]: CPU_1.PC = 3.5 In [14]: a.PC, b.PC Out[14]: (3.5, 3.5) In [15]: c = CPU_2() In [16]: d = CPU_2() In [17]: c.PC, d.PC Out[17]: (4, 4) In [18]: c.PC = 3.5 In [19]: c.PC, d.PC Out[19]: (3.5, 4) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Synchronization methodology

2007-01-03 Thread Marc 'BlackJack' Rintsch
*/ } } in Java. And that's basically: def foo(self): self.lock.aquire() # code self.lock.release() You may want to make sure the lock will be released in case of an exception: def foo(self): self.lock.aquire() try: pass # code finally: self.lock.re

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread Marc 'BlackJack' Rintsch
1, -1), xrange((c * 2) - 1, 0, -2)): d += f[b] * 1 h, f[b] = divmod(d, g) d = h * b h, i = divmod(d, 1) result.append('%.4d' % (e + h)) e = i return ''.join(result) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Encoding / decoding strings

2007-01-05 Thread Marc 'BlackJack' Rintsch
ey are to get info about other users, therefore anonymity is > important. > > Any suggestions? Don't deliver encoded e-mail addresses to other users. They might decode them and the anonymity is gone. What exactly are you trying to do? Why should users see encrypted e-mail addresse

Re: Encoding / decoding strings

2007-01-05 Thread Marc 'BlackJack' Rintsch
x27;s possible for attackers to verify if someone they know the address of, has made specific comments. So part of the anonymity is gone then. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: AES256 in PyCrypto

2007-01-07 Thread Marc 'BlackJack' Rintsch
ion vector > ? `a` must be of length 32 for AES256. And the length of `plainText` must be a multiple of 16 because it's a block cypher algorithm. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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