Re: get a list from a string

2007-06-07 Thread Josef Dalcolmo

simon kagwe wrote:
> Hi,
> 
> I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a
> variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How 
> can
> I go about that?

s = "distances = [[1,1,1,1],[2,2,2,2]]"
exec(s)

- Josef

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getmtime differs between Py2.5 and Py2.4

2007-05-08 Thread Josef Dalcolmo
Martin v. Löwis wrote:
>> the difference (rounding to an int number of seconds) is just about one
>> hour; in certain parts of the world (Europe and Africa), that could
>> indeed be a timezone issue.
> 
> With the help of Tony Meyer, we rediscovered the explanation: because
> of a bug in the Microsoft C run-time library, the UTC time reported by
> 2.4 may have been off by one hour (it wasn't local time - just off
> by one hour). This was due to DST issues. They have been fixed in 2.5,
> which now reports the correct UTC value.
> 
> Regards,
> Martin

Well, indeed I got only a 1 hour difference, on my machine (local time 
here is +1 hour). But when I temporarily set the local time of my 
machine to GMT I the difference became 0, therefore I assumed wrongly it 
had something to do with the local time difference.

Thanks to everyone helping to clarify this. My response was slow, 
because I have been experiencing problems with my newsreader setup.

- Josef


-- 
http://mail.python.org/mailman/listinfo/python-list


getmtime differs between Py2.5 and Py2.4

2007-05-07 Thread Josef Dalcolmo

I tried this on Windows only:

In Python 2.4 os.path.getmtime returned the local time,
in Python 2.5 it seems to return GMT:

import os, time
print ctime.time(os.path.getmtime(foo))

differs on Python 2.4 and Python 2.5 by the timezone.

Now, the implementation of the two stat calls differs on Windows
between the two versions.

I actually like the new behaviour better, because I believe the
reported time of a file should not depend on the timezone or other
local settings, however the old behaviour is the time also Windows
shows - and there is an incompatibility.

Is this a bug? 

- Josef
-- 
http://mail.python.org/mailman/listinfo/python-list


getmtime in 2.5 reports GMT instead of local time

2007-05-03 Thread Josef Dalcolmo
Hello,

I have tried this only on Windows XP.

in Python 2.4 os.path.getmtime() used to return an integer representing
the local time.

in Python 2.5 os.path.getmtime() reports a float representing the GMT of the
file's modification time.

Since I could not find any documentation to this behavioural change, I am asking
here: was this change intentional? Is it going to stay? Windows reports
the same time for the file as Python 2.4 used to. So I am tempted to
call this a bug, but wanted some feedback from the developers,
before filing a bug report.


If you want to test this, make sure your local time differs from GMT,
then do:

import os, time
print time.ctime(os.path.getmtime('foo.txt'))

on a file foo.txt, once with Python 2.4 then with Python 2.5, 
and you should see what I mean.

- Josef


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-11 Thread Josef Dalcolmo

You can distribute GPL'ed code in binary form, you just have to make
the sources available as well.  And, yes I would use this as a test:
if your program needs gpl-ed code for some of it's functionality, you
have to licence your program according to the GPL - unless you
distribute the GPL'ed parts separately and your program is still
basically functioning without the GPL'ed code.

Now, if you are unsure about these questions and are serious about
writing a program using GPL'ed code, the FSF is probably willing to
help you with your questions.

Besides this, why not putting your code under the GPL? 

- Josef

-- 
http://mail.python.org/mailman/listinfo/python-list