Re: Time zones and why they change so damned often

2014-01-09 Thread Bob Martin
in 714232 20140109 120741 Alister wrote: >On Thu, 09 Jan 2014 07:17:25 +, Mark Lawrence wrote: > >> On 09/01/2014 04:14, Chris Angelico wrote: >>> On Thu, Jan 9, 2014 at 2:54 PM, Ben Finney >>> wrote: >>>> I'm approaching it with the goal of kn

Re: Monkeypatching a staticmethod?

2014-01-09 Thread Ian Kelly
On Thu, Jan 9, 2014 at 10:23 PM, Roy Smith wrote: > This is kind of surprising. I'm running Python 2.7.1. I've got a class > with a staticmethod that I want to monkeypatch with a lambda: > > -- > class Foo: > @staticmethod > def x(): > return 1 > >

Re: Re : Python GTK GUI struck when process is going on.

2014-01-09 Thread Michael Torrie
On 01/09/2014 08:15 AM, MRAB wrote: > On 2014-01-09 11:53, Prapulla Kumar wrote: >> Hi all, >> I'm using python gtk to upload file to S3 service by boto API , >> GUI struck when uploading file and releases the GUI after completed download >> I'm using thread to show progress of upload in GUI but it

Monkeypatching a staticmethod?

2014-01-09 Thread Roy Smith
This is kind of surprising. I'm running Python 2.7.1. I've got a class with a staticmethod that I want to monkeypatch with a lambda: -- class Foo: @staticmethod def x(): return 1 Foo.x = lambda: 2 print Foo.x() --

Re: Editor for Python

2014-01-09 Thread David Robinow
On Thu, Jan 9, 2014 at 10:50 AM, Jean-Michel Pichavant wrote: > - Original Message - >> >> On Jan 8, 2014, at 10:53 AM, Jean-Michel Pichavant >> wrote: >> > I tried to negotiate this with my IT guys, but it looks like it's >> > now mandatory, something related to being in the USA stock ma

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 7:54 AM, Roy Smith wrote: > On Thursday, January 9, 2014 3:35:05 PM UTC-5, Chris Angelico wrote: >> In fact, I've given end users the ability to enter strftime strings (eg >> to construct a filename), and it's worked just fine. > > I assume you realize that > "../../../../

Re: Constructive Criticism

2014-01-09 Thread jeremiah valerio
On Thursday, January 9, 2014 2:54:44 PM UTC-6, Christopher Welborn wrote: > On 01/08/2014 11:56 PM, jeremiahvalerio...@gmail.com wrote: > > > Hi, hows it going I've been self teaching myself python, and i typed up > > this small script now i know its not the best the coding is not the best > > b

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
On Thursday, January 9, 2014 3:35:05 PM UTC-5, Chris Angelico wrote: > In fact, I've given end users the ability to enter strftime strings (eg > to construct a filename), and it's worked just fine. I assume you realize that "../../../../../../../../../../../../../../../../etc/passwd" is a valid

Re: unicode troubles and postgres [SOLVED]

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 6:51 AM, Ethan Furman wrote: > The problem was I had created the database from template0 instead of > template1, and 0 is SQL-ASCII while 1 is UTF8. Ah, this is one of the traps with Postgres. This is one of the reasons I prefer not to touch template[01] and to script the

Re: Constructive Criticism

2014-01-09 Thread Christopher Welborn
On 01/08/2014 11:56 PM, jeremiahvalerio...@gmail.com wrote: Hi, hows it going I've been self teaching myself python, and i typed up this small script now i know its not the best the coding is not the best but i would like to know of ways to make a small script like this better so all construct

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 3:51 AM, Piet van Oostrum wrote: > I don't know how other countries do it, but here, when the clock goes back, > it goes from 03:00 to 02:00. So I wonder how they communicate when your plane > leaves at 02:30 in that night. Which 02:30? In that case using UTC may come >

Re: unicode troubles and postgres [SOLVED]

2014-01-09 Thread Ethan Furman
On 01/09/2014 10:49 AM, Ethan Furman wrote: So I'm working with postgres, and I get a datadump which I try to restore to my test system, and I get this: ERROR: value too long for type character varying(4) CONTEXT: COPY res_currency, line 32, column symbol: "руб" "py6" sure looks like it shou

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 3:21 AM, Roy Smith wrote: > On Thursday, January 9, 2014 9:57:57 AM UTC-5, Chris Angelico wrote: >> And months are more >> complicated still, so it's probably easiest to use strftime: >> >> >>> time.strftime("%Y%m",time.gmtime(ts)) >> >> '201401' > > strftime is a non-start

Re: Constructive Criticism

2014-01-09 Thread jeremiah valerio
On Thursday, January 9, 2014 3:56:37 AM UTC-6, Peter Otten wrote: > jeremiahvalerio...@gmail.com wrote: > > > > > Hi, hows it going I've been self teaching myself python, and i typed up > > > this small script now i know its not the best the coding is not the best > > > but i would like to kno

Re: unicode troubles and postgres

2014-01-09 Thread Peter Otten
Ethan Furman wrote: > So I'm working with postgres, and I get a datadump which I try to restore > to my test system, and I get this: > > ERROR: value too long for type character varying(4) > CONTEXT: COPY res_currency, line 32, column symbol: "руб" > > "py6" sure looks like it should fit, but

unicode troubles and postgres

2014-01-09 Thread Ethan Furman
So I'm working with postgres, and I get a datadump which I try to restore to my test system, and I get this: ERROR: value too long for type character varying(4) CONTEXT: COPY res_currency, line 32, column symbol: "руб" "py6" sure looks like it should fit, but it don't. Further investigation

Re: Bytes indexing returns an int

2014-01-09 Thread Serhiy Storchaka
09.01.14 19:28, Ethan Furman написав(ла): On 01/09/2014 09:05 AM, Piet van Oostrum wrote: Please ignore jmf's repeated nonsense. Or ban him. His one, minor, contribution has been completely swamped by the rest of his belligerent, unfounded, refuted posts. Please not. I have a fun from every

Re: the Gravity of Python 2

2014-01-09 Thread Ethan Furman
On 01/09/2014 10:20 AM, Mark Lawrence wrote: On Thursday, January 9, 2014 11:30:31 AM UTC-5, Mark Lawrence wrote: So all of the itertools recipes should be part of the Python module and not in more-itertools on pypi? Certainly, the recipes that are documented on the official itertools page, ye

Re: the Gravity of Python 2

2014-01-09 Thread Ethan Furman
On 01/09/2014 10:18 AM, Mark Lawrence wrote: On 09/01/2014 16:01, Ethan Furman wrote: On 01/09/2014 12:42 AM, Mark Lawrence wrote: On 09/01/2014 01:27, Roy Smith wrote: Naive datetimes are what everybody uses. It's what utcnow() gives you. So why make life difficult for everybody? Python 3

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 17:07, Roy Smith wrote: I wrote: Recipes are a cop-out On Thursday, January 9, 2014 11:30:31 AM UTC-5, Mark Lawrence wrote: So all of the itertools recipes should be part of the Python module and not in more-itertools on pypi? Certainly, the recipes that are documented on the

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 16:01, Ethan Furman wrote: On 01/09/2014 12:42 AM, Mark Lawrence wrote: On 09/01/2014 01:27, Roy Smith wrote: Naive datetimes are what everybody uses. It's what utcnow() gives you. So why make life difficult for everybody? Python 3 didn't win a convert today. Yep, dates and t

Re: Bytes indexing returns an int

2014-01-09 Thread Ethan Furman
On 01/09/2014 09:05 AM, Piet van Oostrum wrote: Ned Batchelder writes: On 1/8/14 11:08 AM, wxjmfa...@gmail.com wrote: Byte strings (encoded code points) or native unicode is one thing. But on the other side, the problem is elsewhere. These very talented ascii narrow minded, unicode illiterat

Re: Bytes indexing returns an int

2014-01-09 Thread Piet van Oostrum
Ned Batchelder writes: > On 1/8/14 11:08 AM, wxjmfa...@gmail.com wrote: >> Byte strings (encoded code points) or native unicode is one >> thing. >> >> But on the other side, the problem is elsewhere. These very >> talented ascii narrow minded, unicode illiterate devs only >> succeded to produce t

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
I wrote: > Recipes are a cop-out On Thursday, January 9, 2014 11:30:31 AM UTC-5, Mark Lawrence wrote: > So all of the itertools recipes should be part of the Python module and > not in more-itertools on pypi? Certainly, the recipes that are documented on the official itertools page, yes. -- htt

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
Chris Angelico writes: > On Fri, Jan 10, 2014 at 1:06 AM, Piet van Oostrum wrote: >> Chris Angelico writes: >> >>> On Thu, Jan 9, 2014 at 2:34 PM, Ben Finney >>> wrote: With time zones, as with text encodings, there is a single technically elegant solution (for text: Unicode; for ti

Re: the Gravity of Python 2

2014-01-09 Thread Ethan Furman
On 01/09/2014 12:42 AM, Mark Lawrence wrote: On 09/01/2014 01:27, Roy Smith wrote: Naive datetimes are what everybody uses. It's what utcnow() gives you. So why make life difficult for everybody? Python 3 didn't win a convert today. Yep, dates and times are easy. That's why there are 17 is

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 16:42, Nick Cash wrote: and "%s" (which is incredibly useful) is not even documented (I suspect it's also not available on all platforms). The format specifiers available to Python are just whatever is available to the underlying c time.h. The manpage for strftime indicates that

Re: the Gravity of Python 2

2014-01-09 Thread Ethan Furman
On 01/09/2014 06:57 AM, Chris Angelico wrote: On Fri, Jan 10, 2014 at 1:14 AM, Roy Smith wrote: Thanks for this collection! Now we can discuss. [snip] Datetimes are self-describing. If I have a datetime or a timedelta, I know what I've got. I've written more than one bug where I assume

RE: the Gravity of Python 2

2014-01-09 Thread Nick Cash
> and "%s" (which is incredibly useful) is not even documented (I suspect it's > also not available on all platforms). The format specifiers available to Python are just whatever is available to the underlying c time.h. The manpage for strftime indicates that %s isn't part of the C standard, bu

Re: the Gravity of Python 2

2014-01-09 Thread Tim Golden
On 09/01/2014 16:30, Mark Lawrence wrote: > On 09/01/2014 16:21, Roy Smith wrote: >> >> No, it would be solved by a built-in method. Recipes are a cop-out. >> If something is complicated enough to require a recipe, and used >> frequently enough to be worth writing that recipe up and documenting >

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 16:21, Roy Smith wrote: No, it would be solved by a built-in method. Recipes are a cop-out. If something is complicated enough to require a recipe, and used frequently enough to be worth writing that recipe up and documenting it, you might as well have gone the one additional

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
On Thursday, January 9, 2014 9:57:57 AM UTC-5, Chris Angelico wrote: > And months are more > complicated still, so it's probably easiest to use strftime: > > >>> time.strftime("%Y%m",time.gmtime(ts)) > > '201401' strftime is a non-starter at far as "easy" goes. I don't know about you, but I

Is email.parser a good replacement for formail?

2014-01-09 Thread Matěj Cepl
Hi, I have a script (https://github.com/mcepl/gg_scraper) where I need to read possibly malformed mbox messages. I use subprocess.Popen() and /usr/bin/formail to clean up them to be correct mbox messages (with correct leading From line etc.). Now I try to run tests for my script on Travis-CI, wh

Re: Editor for Python

2014-01-09 Thread Jean-Michel Pichavant
- Original Message - > > On Jan 8, 2014, at 10:53 AM, Jean-Michel Pichavant > wrote: > > >>> -- IMPORTANT NOTICE: > >>> > >> > >> too late you have sent this to a public forum > > > > No pb with that, the python list is the intended recipient :) > > > > I tried to negotiate this with

Re: Time zones and why they change so damned often (was: the Gravity of Python 2)

2014-01-09 Thread Dave Angel
On Thu, 9 Jan 2014 15:14:55 +1100, Chris Angelico wrote: [1] For those who aren't right up on timezone trivia, AZ has no DST. Similarly the Australian state of Queensland does not shift its clocks. And Indiana. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Editor for Python

2014-01-09 Thread TP
On Friday, 23 November 2001 04:13:40 UTC+5:30, MANUEL FERNANDEZ PEREZ wrote: > > Hello, > > I'm looking for an editor for Python.I' m interested it works on > Windows.Can > > anybody help me? > It's an IDE rather than "just" an editor but how about PyCharm 3 Community Edition? [1] [1] https://ww

Re: argparse action on default values

2014-01-09 Thread Chris Angelico
On Thu, Jan 9, 2014 at 5:20 AM, Florian Lindner wrote: > def norm_path(*parts): > """ Returns the normalized, absolute, expanded and joined path, assembled > of all parts. """ > parts = [ str(p) for p in parts ] > return os.path.abspath(os.path.expanduser(os.path.join(*parts))) Apolo

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 2:01 AM, Dan Sommers wrote: > On Thu, 09 Jan 2014 09:14:22 -0500, Roy Smith wrote: > >> Oh, and another thing I can do with a datetime that I can't do with a >> unix timestamp. I can represent the day I was born. > > At the risk of dating myself, the day I was born is -231

Re: Re : Python GTK GUI struck when process is going on.

2014-01-09 Thread MRAB
On 2014-01-09 11:53, Prapulla Kumar wrote: Hi all, I'm using python gtk to upload file to S3 service by boto API , GUI struck when uploading file and releases the GUI after completed download I'm using thread to show progress of upload in GUI but it struck. Can you some suggestion how to show pro

Re: the Gravity of Python 2

2014-01-09 Thread Dan Sommers
On Thu, 09 Jan 2014 09:14:22 -0500, Roy Smith wrote: > Oh, and another thing I can do with a datetime that I can't do with a > unix timestamp. I can represent the day I was born. At the risk of dating myself, the day I was born is -231094800. Dan -- https://mail.python.org/mailman/listinfo/pyt

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 1:14 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> What can you (Roy), with your use-case, achieve with datetime that >> you can't achieve (at least reasonably easily) with a timestamp? Thanks for this collection! Now we can discuss. > As I'm mentione

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
In article , Ben Finney wrote: > Kushal Kumaran writes: > > > Ben Finney writes: > > > > > Kushal Kumaran writes: > > > > > >> Roy Smith writes: > > >> > How, in Python, do you get an aware UTC datetime object? > > >> > > >> classmethod datetime.utcnow() > > >> > > >> Return the current

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
In article , Chris Angelico wrote: > Actually, the nearest parallel to Unicode is probably "use UTC > everywhere", which makes for a superb internal representation and > transmission format, but bugs most human beings :) It is, by the way, the solution that the aviation industry has adopted.

Re: the Gravity of Python 2

2014-01-09 Thread Chris Angelico
On Fri, Jan 10, 2014 at 1:06 AM, Piet van Oostrum wrote: > Chris Angelico writes: > >> On Thu, Jan 9, 2014 at 2:34 PM, Ben Finney >> wrote: >>> With time zones, as with text encodings, there is a single technically >>> elegant solution (for text: Unicode; for time zones: twelve simple, >>> stat

Re: the Gravity of Python 2

2014-01-09 Thread Roy Smith
In article , Chris Angelico wrote: > What can you (Roy), with your use-case, achieve with datetime that > you can't achieve (at least reasonably easily) with a timestamp? As I'm mentioned several times, when you print a datetime, you get something that's human friendly. When you print a time

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
Chris Angelico writes: > On Thu, Jan 9, 2014 at 2:34 PM, Ben Finney wrote: >> [ a bunch of stuff that I totally agree with ] > > No response needed here :) > > So I was wrong on the specific example of .today(), but asking the > question the other way is at least helpful. Maybe the best solution

Re: the Gravity of Python 2

2014-01-09 Thread Ben Finney
Kushal Kumaran writes: > Ben Finney writes: > > > Kushal Kumaran writes: > > > >> Roy Smith writes: > >> > How, in Python, do you get an aware UTC datetime object? > >> > >> classmethod datetime.utcnow() > >> > >> Return the current UTC date and time, with tzinfo None. […] > > > > No, that

Re: Time zones and why they change so damned often

2014-01-09 Thread Alister
On Thu, 09 Jan 2014 07:17:25 +, Mark Lawrence wrote: > On 09/01/2014 04:14, Chris Angelico wrote: >> On Thu, Jan 9, 2014 at 2:54 PM, Ben Finney >> wrote: >>> I'm approaching it with the goal of knowing better what I'm talking >>> about when I advocate scrapping the whole DST system :-) >> >>

Re : Python GTK GUI struck when process is going on.

2014-01-09 Thread Prapulla Kumar
Hi all, I'm using python gtk to upload file to S3 service by boto API , GUI struck when uploading file and releases the GUI after completed download I'm using thread to show progress of upload in GUI but it struck. Can you some suggestion how to show progress of upload in GUI or any spinner until u

Re: Learning python networking

2014-01-09 Thread Alister
On Wed, 08 Jan 2014 19:49:40 -0800, Dan Stromberg wrote: > > The third quote, from Brian Kernighan, seems to underestimate the > complexity of asynchronous programming in the large - it's probably not > just twice as hard. Perhaps it should be rephrased as "at least twice as hard" It really doe

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
Kushal Kumaran writes: > Yes, but the documentation for utcnow explicitly tells you how to get > an aware object. > > "An aware current UTC datetime can be obtained by calling >datetime.now(timezone.utc)." And in Python 2.7 you can just copy the definition of utc from the doc and use that

AW: WebSocket for Python 2 and 3 on Twisted and asyncio

2014-01-09 Thread Tobias Oberstein
Autobahn now also supports asyncio on Python 2! https://github.com/tavendo/AutobahnPython#python-support This is made possible by Trollius, an awesome backport of asyncio: https://pypi.python.org/pypi/trollius/0.1.2 > -Ursprüngliche Nachricht- > Von: Python-list [mailto:python-list- >

Re: nested dictionaries and functions in data structures.

2014-01-09 Thread Sean Murphy
Thanks for that. I will have a play and see how I can apply your example. On 07/01/2014, at 11:19 PM, Jean-Michel Pichavant wrote: > - Original Message - >> Thanks for that. It resolved the issue and it was so simple compared >> to everything else I saw on the net. >> >> Only outstandi

Re: Constructive Criticism

2014-01-09 Thread Peter Otten
jeremiahvalerio...@gmail.com wrote: > Hi, hows it going I've been self teaching myself python, and i typed up > this small script now i know its not the best the coding is not the best > but i would like to know of ways to make a small script like this better > so all constructive critisim is Welc

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 09:03, Ben Finney wrote: Kushal Kumaran writes: Roy Smith writes: How, in Python, do you get an aware UTC datetime object? My local copy of the python 3.2.3 docs says: classmethod datetime.utcnow() Return the current UTC date and time, with tzinfo None. This is li

Re: the Gravity of Python 2

2014-01-09 Thread Kushal Kumaran
Ben Finney writes: > Kushal Kumaran writes: > >> Roy Smith writes: >> > How, in Python, do you get an aware UTC datetime object? >> >> My local copy of the python 3.2.3 docs says: >> >> classmethod datetime.utcnow() >> >> Return the current UTC date and time, with tzinfo None. This is >>

Re: the Gravity of Python 2

2014-01-09 Thread Ben Finney
Kushal Kumaran writes: > Roy Smith writes: > > How, in Python, do you get an aware UTC datetime object? > > My local copy of the python 3.2.3 docs says: > > classmethod datetime.utcnow() > > Return the current UTC date and time, with tzinfo None. This is > like now(), but returns the cur

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 06:06, Kushal Kumaran wrote: My local copy of the python 3.2.3 docs says: classmethod datetime.utcnow() Return the current UTC date and time, with tzinfo None. This is like now(), but returns the current UTC date and time, as a naive datetime object. An aware curre

Re: the Gravity of Python 2

2014-01-09 Thread Mark Lawrence
On 09/01/2014 01:27, Roy Smith wrote: In article , Kevin Walzer wrote: I haven't updated my Python apps to 3.x because there's nothing in 3.x that offers benefits to my users. I almost found a reason to move to Python 3 today. Then I got smacked. I had a datetime. I needed a unix timest

Re: the Gravity of Python 2

2014-01-09 Thread Kushal Kumaran
Roy Smith writes: > In article , > Chris Angelico wrote: > >> On Thu, Jan 9, 2014 at 2:35 PM, Roy Smith wrote: >> >> Yes, it *is* simple. It *is* easy. I've been working with pure-UTC >> >> times (either called time_t, or TIMESTAMP WITH TIME ZONE, or even just >> >> float) for decades. Like wi

Re: Dictionary

2014-01-09 Thread wxjmfauth
Le mercredi 8 janvier 2014 20:00:02 UTC+1, Bischoop a écrit : > Walter Hurry wrote: > > > > > On Mon, 30 Dec 2013 18:38:20 +, Bischoop wrote: > > > > > >> I have a txt file with some words, and need simply program that will > > >> print me words containing provided letters. > > >> > >