Re: format a number for output

2006-08-07 Thread Marc 'BlackJack' Rintsch
[24]: 'en_US.UTF-8' In [25]: locale.format('%d', 1890284, True) Out[25]: '1,890,284' It's not always commas but whatever character is used to group thousands in the active locale. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Datetime question

2006-08-03 Thread Marc 'BlackJack' Rintsch
) Out[19]: datetime.datetime(2006, 8, 12, 10, 13, 56, 609000) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Antoon Pardon wrote: On 2006-07-28, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: This avoids the problem but you get others in return. And it's an abuse of `__slots__` which is meant as a way to save memory if you need really many objects of that type

Re: ElementTree and Unicode

2006-08-02 Thread Marc 'BlackJack' Rintsch
it in UTF-8 and then Base64. AFAIK the only reliable way to put an arbitrary string into XML and get exactly the same string back again. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle vs XML for file I/O

2006-08-02 Thread Marc 'BlackJack' Rintsch
, file) Yes that would work. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle vs XML for file I/O

2006-08-01 Thread Marc 'BlackJack' Rintsch
`shelve` by the way? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle vs XML for file I/O

2006-08-01 Thread Marc 'BlackJack' Rintsch
a party of characters and load them back together than pickle a list with those characters. If you want a database of many characters the player can choose from than you might want to store them in a `shelve`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Html character entity conversion

2006-07-30 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Here is my script: from mechanize import * from BeautifulSoup import * import StringIO b = Browser() f = b.open(http://www.translate.ru/text.asp?lang=ru;) b.select_form(nr=0) b[source] = hello python html = b.submit().get_data() soup =

Re: BCD List to HEX List

2006-07-30 Thread Marc 'BlackJack' Rintsch
describe you problem a little better. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: BCD List to HEX List

2006-07-30 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Philippe Martin wrote: Marc 'BlackJack' Rintsch wrote: And now please describe you problem a little better. ;-) I'll try. first of all python is not going to be used for my purpose (sigh) I have device A which holds a binary coded decimal array [N1,N2,Nn

Re: War chest for writing web apps in Python?

2006-07-29 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Rob Sinclar wrote: Synaptic is using aptitude as back-end (this is serious). Why can I deinstall aptitude without deinstalling synaptic then!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: War chest for writing web apps in Python?

2006-07-29 Thread Marc 'BlackJack' Rintsch
without X server installed. I know what aptitude is… Synaptic is the interface which leads the underlying application. …but I ask why I can deinstall it and still use synaptic if it's using aptitude as back-end as you seriously claim!? Ciao, Marc 'BlackJack' Rintsch -- http

Re: system programign

2006-07-29 Thread Marc 'BlackJack' Rintsch
', 'w') for line in in_file: out_file.write(line) in_file.close() out_file.close() how do you do ? I'm fine, thanks. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Math package

2006-07-29 Thread Marc 'BlackJack' Rintsch
have: (1 billion)^2 bytes You want: terabyte * 100 / 1e-06 Hope you have enough memory. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Pygame Help

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

Re: Zipping Files to user defined Directory

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

Re: Newbie Q: Class Privacy (or lack of)

2006-07-28 Thread Marc 'BlackJack' Rintsch
aren't backed by empirical data either but often seems to be just learned by heart in Java and C++ courses. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-28 Thread Marc 'BlackJack' Rintsch
: x.bar = 'foo' This avoids the problem but you get others in return. And it's an abuse of `__slots__` which is meant as a way to save memory if you need really many objects of that type and not as protection. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: MySql

2006-07-27 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
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: dicts vs classes

2006-07-25 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
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: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread Marc 'BlackJack' Rintsch
tree.first('p') p class=contentBodyFOO a name=f/a /p 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 tree.first('p').string Null Any solution? In [53]: print tree.first('p').contents[0] FOO Ciao, Marc 'BlackJack

Re: Type signature

2006-07-24 Thread Marc 'BlackJack' 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 for the programmer, or more important, for the programmer. Without it, we have

Re: Python Stripped CSS Background Image Calls

2006-07-24 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
length. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: [Newbie] List from a generator function

2006-07-23 Thread Marc 'BlackJack' Rintsch
? 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 'BlackJack' Rintsch
('test2.csv', 'wb') writer = csv.writer(out_file) for row, identical_rows in groupby(data): row.append(len(list(identical_rows))) writer.writerow(row) out_file.close() Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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

2006-07-22 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Type signature

2006-07-22 Thread Marc 'BlackJack' Rintsch
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: Semantics of propagated exceptions

2006-07-21 Thread Marc 'BlackJack' Rintsch
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 distinction is not important. Ciao, Marc 'BlackJack' Rintsch

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Marc 'BlackJack' Rintsch
then. The language is obviously not bondage enough for your needs. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
) 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 'BlackJack' Rintsch
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 'BlackJack' 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, Marc 'BlackJack' Rintsch

Re: Retrieve ext. variables in python program

2006-07-19 Thread Marc 'BlackJack' Rintsch
`cfgparse`. Diez suggestet the `ConfigParser` modul. You notice the difference? 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 'BlackJack' Rintsch
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: Recursive function returning a list

2006-07-17 Thread Marc 'BlackJack' Rintsch
get_all_children(self, accumulator=None): if accumulator is None: accumulator = list() accumulator.extend(self.children) for child in self.children: child.get_all_children(accumulator) return accumulator Ciao, Marc 'BlackJack' Rintsch

Re: compiling 2.3.5 on ubuntu

2006-07-17 Thread Marc 'BlackJack' Rintsch
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: Commercial Programming

2006-07-16 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' 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: # n.py import m

Re: math symbols not displaying

2006-07-15 Thread Marc 'BlackJack' Rintsch
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 'BlackJack' Rintsch
is implemented but you might have a look at it. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte array question

2006-07-14 Thread Marc 'BlackJack' Rintsch
!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

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

Re: uTidylib question..

2006-07-12 Thread Marc 'BlackJack' Rintsch
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: hash of hashes

2006-07-11 Thread Marc 'BlackJack' 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: some questions on how to study the bittorent.

2006-07-08 Thread Marc 'BlackJack' Rintsch
://www.bittorrent.com/bittorrentecon.pdf Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: multithreading and shared dictionary

2006-07-08 Thread Marc 'BlackJack' Rintsch
? If there is a GIL then maybe yes. But the GIL is an implementation detail. It's not in Jython nor IronPython and maybe not forever in CPython. Don't know about PyPy. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter and dialogs

2006-07-06 Thread Marc 'BlackJack' Rintsch
. If you just call `show_ui()` you should get some windows. The ``global`` is unnecessary by the way. It even generates a warning: test.py:0: SyntaxWarning: name 'root' is assigned to before global declaration Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: Perl Dictionary Convert

2006-07-06 Thread Marc 'BlackJack' Rintsch
['Contacts']['Class'] Output is: IPF.Contact Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: use var to form name of object

2006-07-06 Thread Marc 'BlackJack' Rintsch
, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Countdown timer for different timezones

2006-07-06 Thread Marc 'BlackJack' Rintsch
of the website with just HTTP. So you need a JavaScript solution I guess. Send the end time as UTC time to the browser an use JavaScript's `Date` object to display the countdown in local time. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: setting variables from a tuple NEWB

2006-07-06 Thread Marc 'BlackJack' Rintsch
no effect on the real locals. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: looping question 4 NEWB

2006-07-06 Thread Marc 'BlackJack' Rintsch
. You can get rid of the indexes and make the code a bit clearer by the way: for old, new in find: data = data.replace(old, new) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: compressed file ended before the logical end-of-stream was detected

2006-07-05 Thread Marc 'BlackJack' Rintsch
*why* it failed. For example because he has no rights or the file system is full. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Very practical question

2006-07-05 Thread Marc 'BlackJack' Rintsch
to the `interClassCall()`? class B(object): def interClassCall(self, c): print c.a.a() class C(object): def __init__(self): self.a=A() self.b=B() def c(self): self.b.interClassCall(self) Much less magic involved this way. Ciao, Marc 'BlackJack' Rintsch

Re: How can I access the 'Entry' string in another function?

2006-07-04 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], arvind wrote: i've created the myclass instance and calles the function second(). i want to access the text entered in 'w' through Entry widget in function third() i am getting the 'fuction not having 'w' attribute error. how to overcome it? Make `w` an attribute of

RE: ascii character - removing chars from string update

2006-07-04 Thread Marc 'BlackJack' Rintsch
with a ''. in html, the 'nbsp;' char is not a valid ascii char... in perl, i'd do 's /nbsp;//' and be done with it!!! And in Python I'd use the `replace()` method on strings and be done with it!!! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: converting file formats to txt

2006-07-04 Thread Marc 'BlackJack' Rintsch
that automagically converts *anything* to text? What about pictures? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: inline metaclasses

2006-07-04 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], K.S.Sreeram wrote: Marc 'BlackJack' Rintsch wrote: But why use a metaclass? If the meta class is only applied to *one* class, can't you do at class level whatever the metaclass is doing!? The very fact that you can put a loop inside __metaclass__ may be reason enough

Re: inline metaclasses

2006-07-04 Thread Marc 'BlackJack' Rintsch
. Yes, but setting properties works only with new-style classes. So I use them whenever I use properties. In my mind properties and new-style classes are linked together. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: regex module, or don't work as expected

2006-07-04 Thread Marc 'BlackJack' Rintsch
, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: python - regex handling

2006-07-04 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], bruce wrote: does python provide regex handling similar to perl. can't find anything in the docs i've seen to indicate it does... The `re` module handles Perl compatible regexes. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python

Re: inline metaclasses

2006-07-03 Thread Marc 'BlackJack' Rintsch
of defining a separate metaclass function/class, you can do it inline. isn't that cool? But why use a metaclass? If the meta class is only applied to *one* class, can't you do at class level whatever the metaclass is doing!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: how do i make an array global

2006-06-29 Thread Marc 'BlackJack' Rintsch
] - exceptions.IndexErrorTraceback (most recent call last) /home/marc/ipython console IndexError: list index out of range So from the traceback it seems that `i` has a value that's not between 0 and ``len(d_list_code)``. Ciao, Marc 'BlackJack' Rintsch -- http

Re: problems with mimify.mime_encode_header

2006-06-29 Thread Marc 'BlackJack' Rintsch
(before dot) is not quoted, and resulting string is not 8bit clean. Why should a simple ASCII 'a' be quoted? And what do you mean by not 8bit clean? The string is even 7-bit clean! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: handling unicode data

2006-06-28 Thread Marc 'BlackJack' Rintsch
, it does not contain the unicode character u'\xd8'. From the traceback it seems your terminal uses `cp437` as encoding. As you can see here: http://www.wordiq.com/definition/CP437 there's no Ø in that character set. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo

Re: re question

2006-06-23 Thread Marc 'BlackJack' Rintsch
]:pattern.match('package TEST123 is xyz end;') Out[13]:_sre.SRE_Match object at 0x405b15f8 I have copy and pasted you code. For debugging re's in Python you might take a look at http://kodos.sourceforge.net/ Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Opening a file with system default application

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

Re: Program slowing down with greater memory use

2006-06-22 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Dan Stromberg wrote: What's the deal here? Very hard to tell without more details. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: help() on stdout.closed

2006-06-21 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Pekka Karjalainen wrote: Suppose I had no idea what sys.stdout.closed was and wanted to find out. Where would I look it up? `sys.stdout` is a file (like) object: http://docs.python.org/lib/bltin-file-objects.html Ciao, Marc 'BlackJack' Rintsch -- http

Re: crawlers in python with graphing?

2006-06-19 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], bryan rasmussen wrote: It should hopefully be as high level as Wget, not download the pages but just follow the links, and output graphs. How do you get at the links without downloading the page!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: memory-leak in pysqlite 2.3.0 ?

2006-06-19 Thread Marc 'BlackJack' Rintsch
print dbapi2.version db = dbapi2.connect(bla.db) c = db.cursor() c.execute(create table b (c integer)) for i in xrange(1000): c.execute(insert into b values (%d) % i) Just a guess: Commit the changes from time to time. Ciao, Marc 'BlackJack' Rintsch -- http

Re: pyfcp

2006-06-19 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], aum wrote: On Mon, 19 Jun 2006 14:45:19 +0800, Thomas Moore wrote: http://www.python.org/pyfcp It gets me to Error 404. Apologies - that URL should have been: http://www.python.org.nz/pyfcp I get: Unknown host www.python.org.nz Ciao, Marc 'BlackJack

Re: Overriding a function...

2006-06-19 Thread Marc 'BlackJack' Rintsch
an already imported module doesn't reload the module. 2) Once I assign mymodule.test with override, will modules that imported my module *PRIOR* to the assignment get override, or will they keep the original function test()? They see the `override()` function. Ciao, Marc 'BlackJack' Rintsch

Re: Date Subtraction

2006-06-18 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Cameron Laird wrote: In article [EMAIL PROTECTED], Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], rsutradhar_python wrote: date1=2006-01-10 date2=2005-12-15 date = date1 - date2 should give me 25 but problem is that date1 and date2 datatype

Re: Extracting values from text file

2006-06-18 Thread Marc 'BlackJack' Rintsch
. And don't mix up weakly and dynamically typed. Python is dynamically and strictly typed. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Date Subtraction

2006-06-17 Thread Marc 'BlackJack' Rintsch
which i am not able to do so please help me. from datetime import date date_str_1 = '2006-01-10' date_str_2 = '2005-12-15' date_1 = date(*map(int, date_str_1.split('-'))) date_2 = date(*map(int, date_str_2.split('-'))) print (date_1 - date_2).days - 1 Ciao, Marc 'BlackJack' Rintsch

Re: add elements to indexed list locations

2006-06-17 Thread Marc 'BlackJack' Rintsch
++ in Python. Take a step back and describe *what* you want to achieve and not *how* you do it in another language. And then implement it in Python. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: list of polynomial functions

2006-06-16 Thread Marc 'BlackJack' Rintsch
' % i .7.:return functions .7.: In [8]:for function in pitfall(): .8.:print function() .8.: pitfall: i=2 2 2 2 At the time the list with the functions is returned `i` is 2. So if you call any of the functions it looks up this `i`. Ciao, Marc 'BlackJack

Re: Pycrypto

2006-06-16 Thread Marc 'BlackJack' Rintsch
]:binascii.unhexlify('ea523a664dabaa4476d31226a1e3bab0') Out[27]:'\xeaR:fM\xab\xaaDv\xd3\x12\xa1\xe3\xba\xb0' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: python and HDF

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

Re: list of polynomial functions

2006-06-15 Thread Marc 'BlackJack' Rintsch
when the lambda *definition* is executed but when the lambda function is called. And then `i` is always == `n`. You have to explicitly bind it as default value in the lambda definition: polys.append(lambda x, i=i: polys[i](x)*x) Then it works. Ciao, Marc 'BlackJack

Re: About Threading - implementation

2006-06-14 Thread Marc 'BlackJack' Rintsch
threads. If your task is computational intensive then it may be better to use processes and some form of inter process communication. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: determining file type

2006-06-14 Thread Marc 'BlackJack' Rintsch
]:'foo.txt' In [8]:file('x') --- exceptions.TypeError Traceback (most recent call last) /home/bj/ipython console TypeError: 'str' object is not callable Ciao, Marc 'BlackJack' Rintsch -- http

Re: Need C# Coding for MD5 Algorithm...

2006-05-29 Thread Marc 'BlackJack' Rintsch
. You can get an MD5 `HashAlgorithm` object this way:: HashAlgorithm algorithm = HashAlgorithm.Create(MD5); Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: write() vs. writelines()

2006-05-26 Thread Marc 'BlackJack' Rintsch
'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Modify one character in a string

2006-05-26 Thread Marc 'BlackJack' Rintsch
of the operating system you're using. On Unix, you can seek to a specific place in a file, write a single character, seek to EOF, and you've done an in-place single character edit of the file. Why seeking to EOF after writing the byte? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: Question about exausted iterators

2006-05-20 Thread Marc 'BlackJack' Rintsch
. :-) SCNR, Marc 'BlackJack' Rintsch [1] http://www.cybersalt.org/cleanlaugh/images/03/ducktape.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: altering an object as you iterate over it?

2006-05-19 Thread Marc 'BlackJack' Rintsch
was the possibility to inherit from builtins. Inheriting from `open` looks quite strange. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using time.sleep() in 2 threads causes lockup when hyper-threading is enabled

2006-05-05 Thread Marc 'BlackJack' Rintsch
` implementation. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Using time.sleep() in 2 threads causes lockup when hyper-threading is enabled

2006-05-04 Thread Marc 'BlackJack' Rintsch
it was something like an NTP daemon that caused the clock to jump a little and (Window's) sleep was confused. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: request help with Pipe class in iterwrap.py

2006-05-03 Thread Marc 'BlackJack' Rintsch
:: new_list = pipe(grep('larch'), grep('parrot', 'v')), list)(my_list) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question: TypeError wrong number of args

2006-05-03 Thread Marc 'BlackJack' Rintsch
y, z x.e(23) def e(u, v): print u, v class B: def e(v, w): print 'spam', v, w A.e = e x = A() x.a('answer', 42) e('eric', 'viking') A.a(x, 'ham', 'eggs') Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: scope of variables

2006-05-03 Thread Marc 'BlackJack' Rintsch
that code. Running this:: b = 3 def adding(a): print a + b adding(5) Puts out 8 as expected. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does bufsize=1 not work in subprocess.Popen ?

2006-04-29 Thread Marc 'BlackJack' Rintsch
at termination, which is what is happening. From the Python side you can only control Python's input buffer but not the output buffer of the external program you are starting. I guess that programs buffers its output. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-28 Thread Marc 'BlackJack' Rintsch
``. There are no classes, just four objects. Convention in naming and usage makes two of them something like templates or classes for new objects but they are in no way special. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

<    9   10   11   12   13   14   15   >