Re: python interpreter

2005-10-13 Thread Marc 'BlackJack7; Rintsch
an infinitive number of function pointers stored at `*ip`!? The Python equivalent might be :: for w in ip: w() if `ip` is a (finite) sequence of functions or callables in general. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: HTTPResponse.read() returns an empty string?

2005-10-18 Thread Marc 'BlackJack7; Rintsch
e response object contains just the headers. So you can inspect them before you decide to download the actual content. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Python variables are bound to types when used?

2005-10-19 Thread Marc 'BlackJack7; Rintsch
etails. > and if I did, > > if (l2 = "hello"): # would it become string? It would become a syntax error. No assignement allowed there. > and what if I never used it in the definition body? Again: The objects have types, the names not. A string that is never used remains a string. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Rich __repr__

2005-11-01 Thread Marc 'BlackJack7; Rintsch
rn repr_str I'm a bit surprised that `Human_Sex` is subclassing `str`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: user account logon from python

2005-11-09 Thread Marc 'BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, Philippe C. Martin wrote: > I am attempting to write a linux logon manager with python. Have you considered looking at the sources of xdm/gdm/kdm/... to see how they solve the problems you have? Ciao, Marc 'BlackJack' Rintsch -- http://mail

Re: option argument length

2005-12-04 Thread Marc &#x27;BlackJack7; Rintsch
s) = parser.parse_args() > > len(options) != 1 or len(options) > 2: > print "Incorrect number of arguments passed." > > How do I accomplish it ? Just insert an ``if`` in front of the condition and end the program with ``sys.exit()`` after the message. Ciao

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Marc &#x27;BlackJack7; Rintsch
ry > the language. Their loss. :-) > And nobody else sees the need for change? Oh, except those who think > Tabs are evil and should no longer be allowed. > > How about (1) add some more flexibility for optional braces […] Try this:: from __future__ import braces Ciao, Marc &

Re: XML: Better way to accomplish this?

2005-01-03 Thread Marc &#x27;BlackJack7; Rintsch
se an attribute for the city nr.? Something like . At least if you intent to write a DTD or Schema this might be better. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic search of list of dictionaries

2005-01-04 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, Bulba! wrote: > I put those dictionaries into the list: > >oldl=[x for x in orig] # where orig=csv.DictReader(ofile ... If you don't "do" anything with each `x` you can write this as: oldl = list(orig) Ciao, Mar

Re: EOF for binary?

2005-01-08 Thread Marc &#x27;BlackJack7; Rintsch
r/lib/python2.3/posixpath.py", line 142, in getsize return os.stat(filename).st_size TypeError: coercing to Unicode: need string or buffer, file found Something expected a string instead of a file object. >>> os.path.getsize("tmp.txt") 28190L Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: escape string for command line

2005-01-08 Thread Marc &#x27;BlackJack7; Rintsch
nt command % evil.encode('string-escape') echo '\'; rm -rf /;' > Will it > always be safe, even when binary data is submitted through POST? Don't know if it's always safe. Unprintable bytes like 0x00 will be escaped as '\x00'. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Documenting data members

2005-01-08 Thread Marc &#x27;BlackJack7; Rintsch
become: """ (Module description) :var xmlns: A dictionary of the namespaces. """ Ciao, Marc 'BlackJack' Rintsch .. _epydoc: http://epydoc.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & unicode

2005-01-12 Thread Marc &#x27;BlackJack7; Rintsch
lophone chinese? > > And, did you think of klingons? Klingons don't do Python, they hack ('n slash) in var'aq: http://www.geocities.com/connorbd/varaq/ SCNR, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Assigning to self

2005-01-18 Thread Marc &#x27;BlackJack7; Rintsch
I need a "Singleton" I just put it as global into a module. Either initialize it at module level or define a function with the content of your __init__(). Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: getting file size

2005-01-22 Thread Marc &#x27;BlackJack7; Rintsch
;> import os >>> os.path.getsize('/etc/shadow') 612L >>> f = open('/etc/shadow', 'r') Traceback (most recent call last): File "", line 1, in ? IOError: [Errno 13] Permission denied: '/etc/shadow' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread Marc &#x27;BlackJack7; Rintsch
()) with this syntax: ``tbl.attr`` and it's also possible to put functions into those tables. So it's already a prototype based OO language. Remember: you need objects for an OO language -- classes are optional! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: "pickle" vs. f.write()

2005-02-02 Thread Marc &#x27;BlackJack7; Rintsch
ame__, self.name, self.age, self.friends, self.comment) And it's robust against changing the class name. It even works in subclasses if the signature of the __init__() method stays the same. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Package organization

2005-06-23 Thread Marc &#x27;BlackJack7; Rintsch
ase it's nice to have a more descriptive name than `File`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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

2005-07-07 Thread Marc &#x27;BlackJack7; Rintsch
esis. Using tuples it > would be. But empty parenthesis are parsed as empty tuple:: In [8]: type( () ) Out[8]: Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I get an sha1 hash in base32?

2005-07-23 Thread Marc &#x27;BlackJack7; Rintsch
elsewhere). Thanks. Doesn't Bitzi calculate some kind of audio fingerprint? Just a hash of the file would result in very different hash values for different codecs, bitrates etc. for the "same" audio data. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: consistency: extending arrays vs. multiplication ?

2005-07-23 Thread Marc &#x27;BlackJack7; Rintsch
] >>>> a+b > [1, 2, 3, 4, 5, 6] Both operate on the lists themselves and not on their contents. Quite consistent if you ask me. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: "Compile time" checking?

2005-08-10 Thread Marc &#x27;BlackJack7; Rintsch
ple (?) test:: def tester(a, b, c): global tester print "bogus test function", a, b, c def tester(a, b): print "other test function", a, b tester(1, 2, 3) # This runs fine. tester(1, 2)# This too. > Any other comments appreciated (a

Re: "Compile time" checking?

2005-08-10 Thread Marc &#x27;BlackJack7; Rintsch
# some code if __name__ == '__main__': foo() `__name__` is set to the module name if the module will be imported but to '__main__' if the module is directly executed. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: "Compile time" checking?

2005-08-11 Thread Marc &#x27;BlackJack7; Rintsch
clear to a human reader that the wrapping doesn't change the number of arguments. But it's harder to let a program figure this out. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle.load not working?

2005-08-14 Thread Marc &#x27;BlackJack7; Rintsch
" > ip = "" > loggedin = 0 > invalid_logins = 0 > allow_login = 1 > status = "" > realname = "" > phone = "" > email = "" > > derek = chatuser If this is copy and pasted and not jus

Re: creating/modifying sparse files on linux

2005-08-17 Thread Marc &#x27;BlackJack7; Rintsch
with 314,572,800 numbers. That seems to eat up all your RAM and causes the swapping. You can use `xrange(len)` instead which uses a constant amount of memory. But be prepared to wait some time because now you are writing 314,572,800 characters *one by one* into the file. It would be faster to write larger strings in each step. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle.load not working?

2005-08-19 Thread Marc &#x27;BlackJack7; Rintsch
epr(b) Out[232]: '<__main__.A instance at 0x4075e52c>' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: error processing variables

2005-09-09 Thread Marc &#x27;BlackJack7; Rintsch
on't give two different objects the same name!? >>> import shutil >>> >>> #variables >>> s = shutil This can be written as ``import shutil as s`` or maybe you could use ``from shutil import copy2`` to import the `copy2` function into the moduls namespac

Re: encryption with python

2005-09-10 Thread Marc &#x27;BlackJack7; Rintsch
order > usable_IDs = range(last_number_used, last_number_used + 1000) - usable_IDs.sort(random.random()) + random.shuffle(usable_IDs) > last_number_used += 1000 > return usable_IDs.pop() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: overwriting method in baseclass

2005-02-08 Thread Marc &#x27;BlackJack7; Rintsch
l entity without sacrificing the stability of your own project. [...] The section deals specifically with the situation how to manage 3rd party source code with subversion which you want to update from time to time and even apply some modifications. Ciao, Marc 'BlackJack' Rintsch

Re: list of all type names

2005-03-01 Thread Marc &#x27;BlackJack7; Rintsch
hted in your text editor. If I type ``dict`` it's immediatly colored differently than "normal" names and I know it's probably not a good idea to rebind this name to something else. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: binutils "strings" like functionality?

2005-03-03 Thread Marc &#x27;BlackJack7; Rintsch
u find it interesting and challenging go ahead and try it. It is possible and with the help of the 're' and 'mmap' modules it should be quite easy to filter strings out of files without the need to load them into memory at once. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Equality operator

2005-03-05 Thread Marc &#x27;BlackJack7; Rintsch
1 == (not 0) True Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: using python to parse md5sum list

2005-03-06 Thread Marc &#x27;BlackJack7; Rintsch
d(aline[:-1].split(None, 1)) That works too if md5sum opened the files in binary mode which is the default on Windows. The filename is prefixed with a '*' then, leaving just one space between checksum and filename. > myfile.close() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert python to exe

2005-03-13 Thread Marc &#x27;BlackJack7; Rintsch
-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't seem to insert rows into a MySQL table

2005-03-14 Thread Marc &#x27;BlackJack7; Rintsch
ot; % ("a", "b", "c") ) AFAIK grumfish made the Right Thingâ. If you use '%', some interesting things can happen, e.g. if your values contain "'" characters. The "%s"s without quotes and the comma let the DB module format and

Re: The use of :

2004-11-29 Thread Marc &#x27;BlackJack7; Rintsch
;:' serves as a very good hint to "python aware" text editors to automagically indent the next line after hitting return. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic use of CSV module to skip headers?

2004-12-02 Thread Marc &#x27;BlackJack7; Rintsch
er line. for row in reader: # do something with row Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

ANN: mkplaylist.py 0.3

2004-12-08 Thread Marc &#x27;BlackJack7; Rintsch
http://www.andrewchatham.com/pyogg It's "beta quality" software and only tested on Linux, so I'm interested in positive/negative feedback and bug reports. You can find the script here: http://www.marc.rintsch.de/software.html#mkplaylist Ciao, Marc 'BlackJack'

Re: A beginner's problem...

2004-12-15 Thread Marc &#x27;BlackJack7; Rintsch
vePython pack (PythonWin IDE) > > Solution anyone? Yes -> help(reload) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: getopt: Make argument mandatory

2004-12-15 Thread Marc &#x27;BlackJack7; Rintsch
the subject of your post. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: getopt: Make argument mandatory

2004-12-15 Thread Marc &#x27;BlackJack7; Rintsch
simple toggle), > that means a user specified value must always be specified. I had the following in mind: http://www.python.org/doc/2.4/lib/optparse-what-options-for.html Although the optparse documentation discourages `required options` there are two examples in the source distribution how to i

Re: cross platform use of set locale

2005-03-22 Thread Marc &#x27;BlackJack7; Rintsch
between unix's it's horrid. Have you tried this:: import locale locale locale.setlocale(LC_ALL, '') locale.format('%.2f', 100, True) The `True` turns on grouping. Should work cross platform. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: problems with  character

2005-03-22 Thread Marc &#x27;BlackJack7; Rintsch
x27; in latin-1 encoding is a non breakable space character. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: cross platform use of set locale

2005-03-22 Thread Marc &#x27;BlackJack7; Rintsch
/ it'd be nicer if i could just select a proper locale It uses the locale of the system. If *your* systems locale is configured to use ',' as separator for grouping, then it should be used by `locale.format()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: problems with  character

2005-03-23 Thread Marc &#x27;BlackJack7; Rintsch
aracter:: In [42]: import unicodedata In [43]: unicodedata.name('\xc2\xa0'.decode('utf-8')) Out[43]: 'NO-BREAK SPACE' In [44]: unicodedata.name('\xc2\xbb'.decode('utf-8')) Out[44]: 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-23 Thread Marc &#x27;BlackJack7; Rintsch
ell us in complete sentences what you want to achieve, not in incomplete C snippets. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-23 Thread Marc &#x27;BlackJack7; Rintsch
of handling multiple > buffers and how i can map index to a buffer? Still incomplete. You don't map an index to a buffer in that code. What is getBuf() doing? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: escape single and double quotes

2005-03-24 Thread Marc &#x27;BlackJack7; Rintsch
scape(row[4]), row[1])) > elif row[2] == 6: # name part = 'toponym' > query = ("update names set toponym='%s' where name_id=%s" % \ >(escape(row[4]), row[1])) > sql.execute(query) > sql.commit() > connection.close() A lot of redundant code. Try something like the following instead of the ``elif`` sequence:: name_part = ['prefix', 'given', 'surname', 'suffix', 'patronym', 'toponym'] for row in result: query = 'update names set %s=%%s where name_id=%%s' % name_part[row[2]-1] sql.execute(query, (row[4], row[1])) sql.commit() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-24 Thread Marc &#x27;BlackJack7; Rintsch
uffer: %s" % buffer return buffer In your code, no matter if index equals 1 or 2, a list with 512 `None`s is created, printed and then returned. It would be really better if you describe *what* you want to achieve, not *how*. And in words please, not in code snippets. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Cpickle module... not in Lib installs

2005-03-25 Thread Marc &#x27;BlackJack7; Rintsch
;> import cPickle >>> cPickle.__file__ '/usr/lib/python2.4/lib-dynload/cPickle.so' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: ossaudiodev full duplex

2005-03-26 Thread Marc &#x27;BlackJack7; Rintsch
elect all other sources except the line-in or microphone input because some soundcards can mix several input sources when recording. The `ossaudiodev` module has an `openmixer()` function but it may be easier to use one of the graphical mixer programs like `kmix` or `alsamixergui`. Ciao, M

Re: putting the output of a print statement into a string

2005-03-27 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, Jon Perez wrote: > Question: > > Is there a way to somehow put the output of 'print exc_obj' into > a string? There are ways to do even that, but maybe ``str(exc_obj)`` is enough for your needs!? Ciao, Marc 'BlackJack' Rint

Re: Performance issue

2005-04-02 Thread Marc &#x27;BlackJack7; Rintsch
t results in moving all remaining elements one index down. Better iterate over the words in a for loop:: for word in words: # use `word` instead of `word[0]` in the loop body. ... Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance issue

2005-04-02 Thread Marc &#x27;BlackJack7; Rintsch
ne characters at the end of each line while `str.splitlines()` removes them. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance issue

2005-04-02 Thread Marc &#x27;BlackJack7; Rintsch
ak try: print anagram_map[''.join(sorted(list(word.strip().lower(] except KeyError: print 'No anagrams found for %r' % word # # Print all anagrams sorted by number of anagrams. # print '\n'.join(map(str, sorted(anagram

Re: Changing TEXT color from python

2005-04-04 Thread Marc &#x27;BlackJack7; Rintsch
ows, Google for ANSI.SYS and read up on Escape Sequences, or check > out the curses for Windows implementation that's floating around somewhere on > the net, I don't know the URL. At least under Linux the ANSI color escapes should work too. Out of the box. Ciao, Marc

Re: Overwrite just one line? Am I a n00b or is this impossible? Both? :D

2005-04-06 Thread Marc &#x27;BlackJack7; Rintsch
= open('test.dat') In [74]: a = f.read() In [75]: f.close() In [76]: a Out[76]: '\x00\x00\x00\x00\x00\x00\x00\00<...>hello If you want to open an existing file without overwriting it you have to use mode "w+" or "a". Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Are circular dependencies possible in Python?

2005-04-09 Thread Marc &#x27;BlackJack7; Rintsch
ap both definitions without problems. 3. Function A is actually called and *must* exist at this point. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Directory in Windows

2005-04-30 Thread Marc &#x27;BlackJack7; Rintsch
lf.path.get()), listFiles, None) > print filelist > =========== Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-13 Thread Marc &#x27;BlackJack7; Rintsch
which is a bit uglier than parenthesis (IMHO). And you want to trade occasional parenthesis for mandatory curly braces? I guess it leads to much more braces or other explicit end markers for suits than the few "unneccessary" parenthesis one has to use to group long expressions. Ciao, Marc 'BlackJack' Rintsch. -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda (and reduce) are valuable

2005-12-14 Thread Marc &#x27;BlackJack7; Rintsch
tter complicated_list.sort(key=itemgetter(3)) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: reading files

2005-12-20 Thread Marc &#x27;BlackJack7; Rintsch
th the memory. It makes clear you're done with the *name* since that's what ``del`` deletes from the namespace, not the object. I know that you know this but many people seem to think ``del`` get's rid of the object like a call to `free()` in C. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: csv.Sniffer: wrong detection of the end of line delimiter

2005-12-29 Thread Marc &#x27;BlackJack7; Rintsch
x27;b' flag on platforms where that makes a difference. I guess the reason is the same as for "text" pickle format: If you don't use binary mode the file is not platform independend anymore because some OSes "manipulate" the data in text mode. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: compare dictionary values

2005-12-30 Thread Marc &#x27;BlackJack7; Rintsch
list() for (key, value) in new: try: if old[key] != value: result.append(key) except KeyError: result.append(key) return result Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Get path of a class

2006-01-10 Thread Marc &#x27;BlackJack7; Rintsch
[33]: import inspect, zipfile In [34]: inspect.getsourcefile(zipfile.ZipInfo) Out[34]: '/usr/lib/python2.4/zipfile.py' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-13 Thread Marc &#x27;BlackJack7; Rintsch
ose '\x??' escapes? '\x00' is *one* byte! A byte with the value zero. Something your DB doesn't allow in a `TEXT` type. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-16 Thread Marc &#x27;BlackJack7; Rintsch
ded=True). > > How about... > > for i in (0..x]: > blah That would break most editors "highlight matching brace" functionality. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: hash of hashes

2006-07-11 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, sfo wrote: > how do i create a hash of hash similar to perl using dict in python > $x{$y}{z}=$z Just put dictionaries as values into a dictionary. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: uTidylib question..

2006-07-11 Thread Marc &#x27;BlackJack7; Rintsch
ntents of the object. If this means it prints out what you want as a string… > my question, can the "document object" be turned/translated into a string > var? …then yes: ``str(s)`` Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Marc &#x27;BlackJack7; Rintsch
find those trivial getters and setters because we have properties if the access might become a bit more complex in the future. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte array question

2006-07-14 Thread Marc &#x27;BlackJack7; Rintsch
eserializing: : > {'hostname': '', 'faultData': faultData at -1216226708>: {'exception': None, 'message': 'Found > character data inside an array element while deserializing'}}> In the Java snippet from your initial post the `c

Re: math symbols not displaying

2006-07-15 Thread Marc &#x27;BlackJack7; Rintsch
ng Gnome > under Ubuntu 6.06. The glyphs have to be present in the font that is used. Fonts that should contain almost all mathematical characters are in the `latex-xft-fonts` package. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: reading specific lines of a file

2006-07-15 Thread Marc &#x27;BlackJack7; Rintsch
the standard library is implemented but you might have a look at it. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Commercial Programming

2006-07-16 Thread Marc &#x27;BlackJack7; Rintsch
using and spreading the software without permission from you. The only secure way is to put the software on a server under your control and offer your program as web service. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: instantiate all subclasses of a class

2006-07-16 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, Daniel Nogradi wrote: > More precisely I have a module m with some content: > > # m.py > class A: > pass > class x( A ): > pass > class y( A ): > pass > # all kinds of other objects follow > # end of m.py > > and then in another module I have currently: > > #

Re: Recursive function returning a list

2006-07-17 Thread Marc &#x27;BlackJack7; Rintsch
ildren(accumulator) return accumulator Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: compiling 2.3.5 on ubuntu

2006-07-17 Thread Marc &#x27;BlackJack7; Rintsch
7;t imagine there's anything older on Ubuntu 6.06. There's a `python2.3` package with version 2.3.5 and a `python2.2` with version 2.2.3 in it. All of them can be installed side by side. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-18 Thread Marc &#x27;BlackJack7; Rintsch
tyle of and'ing two comparisons together to emphasize the fact it is > god's chosen way of doing this ;-) Pete doesn't like to be called god in public. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
planned in future releases of Python. Can you flesh out your use case a little bit and tell why you can't solve the problem with inheritance or a meta class? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
e presence of ambiguity, refuse the temptation to guess". > > OTOH, my favorite there would be > > list(True) is [None] Wow it even gets better, the list containing one `None` object should be a singleton too. Argh. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression issue

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
und\) You need the flags re.MULTILINE and re.DOTALL when compiling the regular expression. You'll have to check the 'baro' and 'na' groups to decide if it matched a numerical value or 'N/A'. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, Boris Borcic wrote: >> And I don't find `list(False)` to return an empty list be very obvious. > > What would be your choice ? ``list()`` or ``[]`` for empty lists and a `TypeError` for ``list(False)``. Just like it is right now. Ciao, M

Re: Retrieve ext. variables in python program

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
e 1, in ? > [wsadmin] ImportError: no module named cfgparse Well, the message is quite descriptive. There is no module named `cfgparse`. Diez suggestet the `ConfigParser` modul. You notice the difference? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Marc &#x27;BlackJack7; Rintsch
rash my system by changing Robust's > state arbitrarily. Because in the real world when your program is buggy, > you get bug reports, nasty emails among other forms of ridicule. And > your supposed solution to my problem is me saying, "but...but...I told > you not change is_

Re: Semantics of propagated exceptions

2006-07-21 Thread Marc &#x27;BlackJack7; Rintsch
not an ordinary `E` but one that has a special, well defined meaning if raised by `f` itself according to your protocol. Put the original exception as an attribute to the new one and/or subclass the new exception type from `E`. This way calling code can choose to to handle both types as `E` if the

Re: Is it possible to get image size before/without downloading?

2006-07-22 Thread Marc &#x27;BlackJack7; Rintsch
is header. Depends on the image format how much of the file has to be read and how the information is encoded. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if object is sequence, or iterable?

2006-07-22 Thread Marc &#x27;BlackJack7; Rintsch
cover most cases. What about objects that just implement an apropriate `__getitem__()` method? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Type signature

2006-07-22 Thread Marc &#x27;BlackJack7; Rintsch
`this functions takes an iterable as input` then `iterable` isn't a specific type but an object that implements the behavior of an iterable. You can't check that reliable without actually trying to iterate over it. Search for "duck typing". Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: [Newbie] List from a generator function

2006-07-23 Thread Marc &#x27;BlackJack7; Rintsch
I missing something? What is `length`? Do you want unique elements from `possible_notes`? Then you could use `random.sample()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: easy questions from python newbie

2006-07-23 Thread Marc &#x27;BlackJack7; Rintsch
t example: import csv from itertools import groupby in_file = open('test.csv', 'rb') data = list(csv.reader(in_file)) in_file.close() data.sort() out_file = open('test2.csv', 'wb') writer = csv.writer(out_file) for row, identical_rows in groupby(data): row.append(le

Re: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread Marc &#x27;BlackJack7; Rintsch
;> ' >> tree = BeautifulSoup(s) > >> print tree.first('p') > FOO > > So if I run 'print tree.first('p').string' to get the 'FOO' string it > shows Null value because it's the 'a' tag: > >> print t

Re: Type signature

2006-07-24 Thread Marc &#x27;BlackJack7; Rintsch
In <[EMAIL PROTECTED]>, paul kölle wrote: > Marc 'BlackJack' Rintsch wrote: >> In <[EMAIL PROTECTED]>, Yacao Wang >> wrote: >> >>> However, type signatures are not only a kind of information provided for >>> the compiler, but also

Re: Python Stripped CSS Background Image Calls

2006-07-24 Thread Marc &#x27;BlackJack7; Rintsch
are doing? Python doesn't know about CSS and it's illegal syntax to just write CSS into Python programs. I guess there's a web framework involved? Or CGI? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: prob with struct and byte order

2006-07-24 Thread Marc &#x27;BlackJack7; Rintsch
bers in front is 47 bytes so there's a 5 byte difference. You have to look at some more messages to get an idea how the length corresponds to the actual payloads length. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: dicts vs classes

2006-07-25 Thread Marc &#x27;BlackJack7; Rintsch
nt of view? If you really have a memory problem read the documentation about `__slots__`. But I would only consider this if `a lot of` is several 100k or millions of objects and the memory consumption really is a problem. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: csv file or sqlite ?

2006-07-25 Thread Marc &#x27;BlackJack7; Rintsch
that blacklist and just query a few of them per program run, say in a CGI script, then a database will become faster than linear searching through a csv file. Just try both and measure to know for sure. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: MySql

2006-07-27 Thread Marc &#x27;BlackJack7; Rintsch
2|32 > 6|47 > > please tell me what i am doing wrong. thanks. Where's the problem? Do you mind that the third entry has a 6 as unique `auto` value? Doesn't `AUTO_INCREMENT` just guarantee unique values? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-27 Thread Marc &#x27;BlackJack7; Rintsch
; "23h59m59s", that would have to be handled separately. Looking at the subject I would expect to be able to give 76°04'54" as argument. Hm, but degrees don't map directly to hours!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping Files to user defined Directory

2006-07-27 Thread Marc &#x27;BlackJack7; Rintsch
rectory and then deliver that archive to the user. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >