Re: Printing list of dates starting today

2008-09-01 Thread Ari Makela
On 2008-09-01, Luka Djigas [EMAIL PROTECTED] wrote:

 please, I need your help. I'm new to python, so I don't know if this
 will seem like a stupid question to some of you ...

There are several ways to do it. Have a look at the documentation
of modules time and datetime. For this exact problem time is the 
most straighforward one.

 I have a need to write to a file (or just print on screen, that part
 doesn't matter at this point) a list of dates, starting today. For
 example:
 02.09.2008. tue
 03.09.2008. wed

0 [EMAIL PROTECTED]:~
$ /usr/bin/python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type help, copyright, credits or license for more information.
 import time
 DAY = 60 * 60 * 24
 today = time.time()
 for i in (0, 1, 2, 3):
... t = time.gmtime(time.time() + i * DAY)
... print time.strftime('%d.%m.%Y, %a', t)
...
01.09.2008, Mon
02.09.2008, Tue
03.09.2008, Wed
04.09.2008, Thu

-- 
Ari Makela   late autumn -
[EMAIL PROTECTED]   a single chair waiting
http://arska.org/hauva/ for someone yet to come 
 -- Arima Akito
--
http://mail.python.org/mailman/listinfo/python-list


Re: How Compute # of Days between Two Dates?

2008-09-01 Thread Ari Makela
On 2008-09-01, W. eWatson [EMAIL PROTECTED] wrote:

 Oddly, Leaning Python has no mention of datetime (not date or time), at 
 least, that I could find. I'm considering the Nutshell book, 2nd ed., as a 
 better reference (and cross reference) to various topics.

datetime is pretty new standard library module. I'm quite sure that 
it wasn't around when the latest edition of Learning Python was written.

-- 
Ari Makela   late autumn -
[EMAIL PROTECTED]   a single chair waiting
http://arska.org/hauva/ for someone yet to come 
 -- Arima Akito
--
http://mail.python.org/mailman/listinfo/python-list


[issue3181] ConfigParsers are classic classes

2008-06-24 Thread Ari Makela

Ari Makela [EMAIL PROTECTED] added the comment:

New-style classes make object orientated programming considerably more
convenient. For example one can use property() instead of __setitem__ et
al. There's super(). This is, of course, not a serious problem and one
can always implement a composite class which inherits from object and
has a configparser as an attribute.

This would be a nice improvement and as far as I know completely safe.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3181
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3181] ConfigParsers are classic classes

2008-06-23 Thread Ari Makela

New submission from Ari Makela [EMAIL PROTECTED]:

The base class, ConfigParser.RawConfigParser does not inherit object and
therefore it is a classic class.

Test script run with my normal python installation:

$ /usr/bin/python -V
Python 2.5.2

$ /usr/bin/python arska/configparser.py
bar

And run with uptodate svn checkout with modified ConfigParser.py

$ LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/python -V
Python 2.6b1+

$ LD_LIBRARY_PATH=/usr/local/lib arska/configparser.py
Setting value=bar
Getting value=bar
bar

Platform: Kubuntu 8.04.
$ uname -a
Linux laphroaig 2.6.24-19-generic #1 SMP Wed Jun 4 15:10:52 UTC 2008
x86_64 GNU/Linux

The test script and diff -u as attachments.

--
components: Library (Lib)
files: configparser.diff
keywords: patch
messages: 68639
nosy: hauva
severity: normal
status: open
title: ConfigParsers are classic classes
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file10710/configparser.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3181
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3181] ConfigParsers are classic classes

2008-06-23 Thread Ari Makela

Changes by Ari Makela [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file10712/configparser.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3181
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com