Re: meta language to define forms

2014-03-27 Thread alex23
On 28/03/2014 6:56 AM, Sells, Fred wrote: The idea is to use a nice clean syntax like Python to define form content, then render it as HTML but only as a review tool for users, The actual rendering would go into a database to let a vendor's tool generate the form in a totally non-standard syn

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Steven D'Aprano
On Thu, 27 Mar 2014 17:14:09 -0500, Mark H Harris wrote: > People want to use their computer. They want to solve problems with > it... and frankly, they would like to know how to program it, if there > where some royal road, or fast track, or short and easy tutorial. Most people want to program

Re: meta language to define forms

2014-03-27 Thread Rustom Mody
On Friday, March 28, 2014 9:27:11 AM UTC+5:30, Chris Angelico wrote: > On Fri, Mar 28, 2014 at 2:44 PM, Rustom Mody wrote: > > [BTW I consider the windows registry cleaner than the linux /etc for > > the same reason] > And if I felt like trolling, I'd point out that there are a lot more > search

Re: meta language to define forms

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 2:44 PM, Rustom Mody wrote: > [BTW I consider the windows registry cleaner than the linux /etc for > the same reason] And if I felt like trolling, I'd point out that there are a lot more search engine hits for "windows registry cleaner" than "linux etc cleaner". :) ChrisA

Re: meta language to define forms

2014-03-27 Thread Rustom Mody
On Friday, March 28, 2014 8:43:21 AM UTC+5:30, Roy Smith wrote: > Chris Angelico wrote: > > Your syntax there looks reasonable already. I'd recommend you make it > > a flat data file, though, don't try to make it a programming language > > - unless you actively need it to be one. Here are a couple

Re: meta language to define forms

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 2:13 PM, Roy Smith wrote: > In article , > Chris Angelico wrote: >> Rule of Python: XML is not the answer. XML is the question, and "NO!" >> is the answer :) > > The nice thing about that rule is that it ports easily to so many other > programming languages. Except possi

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Rustom Mody
On Friday, March 28, 2014 8:36:26 AM UTC+5:30, Chris Angelico wrote: > On Fri, Mar 28, 2014 at 1:46 PM, Rustom Mody wrote: > >> Moore’s Law isn’t a mythical beast that magically materialized in 1965 > >> and threatens to unpredictably vanish at any moment. In fact, it’s > >> part of a broader ancie

Re: meta language to define forms

2014-03-27 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Mar 28, 2014 at 7:56 AM, Sells, Fred > wrote: > > I don't have a lot of time or management support to do something elegant > > like XML and then parse it, I'm thinking more like > > > > Class FyFormNumber001(GeneralForm): > > Section1 = Sec

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 1:46 PM, Rustom Mody wrote: >> Moore’s Law isn’t a mythical beast that magically materialized in 1965 >> and threatens to unpredictably vanish at any moment. In fact, it’s >> part of a broader ancient mechanism that has no intention of >> stopping. This mechanism, which I c

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 1:24 PM, Terry Reedy wrote: > I do know that the people responsible are not normally braindead ;-). Yeah, anyone who develops Python is clearly abnormally braindead... *dives for cover* ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: meta language to define forms

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 7:56 AM, Sells, Fred wrote: > I don't have a lot of time or management support to do something elegant like > XML and then parse it, I'm thinking more like > > Class FyFormNumber001(GeneralForm): > Section1 = Section(title="Enter Patient Vital Signs") >

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Rustom Mody
On Friday, March 28, 2014 3:44:09 AM UTC+5:30, Mark H. Harris wrote: > On 3/27/14 4:42 PM, Chris Angelico wrote: > > And this is the bit where, I think, we disagree. I think that > > programming is for programmers, in the same way that music is for > > musicians and the giving of legal advice is fo

Re: implementing download using a url call

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 12:34 PM, wrote: > Hey Guys, > > here is what I am trying to solve. > > I have a URL - somesite.com/server/pattern.x?some_more_stuff > > This URl is out there as an href tag on users website. Is there a way in > which I can serve a file(not from my server) while ensuring

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Terry Reedy
On 3/27/2014 9:59 PM, Roy Smith wrote: In article , Terry Reedy wrote: On 3/27/2014 5:10 PM, Terry Reedy wrote: On 3/27/2014 7:42 AM, Chris Angelico wrote: In any case... what I'd suggest would be opening a tracker issue, or discussing this on python-ideas, and seeing what core devs think

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 9:14 AM, Mark H Harris wrote: > Your question has a somewhat false premise. They *really do* want to learn > them, and they are frustrated with the time and attention it takes. The > argument is also from analogy, which in this case is almost similar but not > quite. > > No

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Roy Smith
In article , Terry Reedy wrote: > On 3/27/2014 5:10 PM, Terry Reedy wrote: > > On 3/27/2014 7:42 AM, Chris Angelico wrote: > > > >> In any case... what I'd suggest would be opening a tracker issue, or > >> discussing this on python-ideas, and seeing what core devs think of > >> the matter. I thi

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 12:44 PM, Dave Angel wrote: >> if (array m = Regexp.split2(some_pattern, some_string)) >> do_something(m); >> > > I don't know for certain about if, but you can declare (in C++) a > new variable in for, which is a superset of if. Scope ends when > the for does. Yeah,

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Terry Reedy
On 3/27/2014 5:10 PM, Terry Reedy wrote: On 3/27/2014 7:42 AM, Chris Angelico wrote: In any case... what I'd suggest would be opening a tracker issue, or discussing this on python-ideas, and seeing what core devs think of the matter. I think that, on balance, it's probably better to show the wh

Re:SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC

2014-03-27 Thread Dave Angel
tade.an...@gmail.com Wrote in message: > > hei , > > I am a newcome to Python. > > I am trying to create a python script which will connect to an SSL URL and > using the HEAD request will get the status of URL. > > For one the link I am getting following error > > [SSL: DECRYPTION_FAILED_

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Dave Angel
Chris Angelico Wrote in message: > On Fri, Mar 28, 2014 at 3:08 AM, Tim Chase > wrote: >> Multiple times, I've seen someone want something like what C-style >> languages offer where assignment is done in a test, something like >> >> if (m = re.match(some_string)): >> do_something(m) > > I

implementing download using a url call

2014-03-27 Thread tanmay . kansara
Hey Guys, here is what I am trying to solve. I have a URL - somesite.com/server/pattern.x?some_more_stuff This URl is out there as an href tag on users website. Is there a way in which I can serve a file(not from my server) while ensuring that the users remain on the third party website. I am

Re: meta language to define forms

2014-03-27 Thread Terry Reedy
On 3/27/2014 4:56 PM, Sells, Fred wrote: I'm trying to use python classes and members to define complex data entry forms as a meta language The idea is to use a nice clean syntax like Python to define form content, then render it as HTML but only as a review tool for users, The actual rendering

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Ben Finney
Roy Smith writes: > In article <5334b747$0$29994$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > > > On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote: > > > Give ma a real-life situation where you would want such behavior > > > [the ‘datetime.timedelta.__str__’ method returni

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Steven D'Aprano
On Thu, 27 Mar 2014 10:44:49 -0500, Mark H Harris wrote: > On 3/26/14 1:35 AM, alex23 wrote: >> On 25/03/2014 12:39 PM, Mark H Harris wrote: >>> my version semantically is "how it is perceived" by the user >> >> Could you please stop claiming to have insight into the comprehension >> of anyone oth

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Roy Smith
In article <5334b747$0$29994$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote: > > > In article , > > Chris Angelico wrote: > >> It's not "equally braindead", it follows a simple and logical rule: > >> Only the day portion is ne

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Ethan Furman
On 03/27/2014 02:10 PM, Terry Reedy wrote: On 3/27/2014 7:42 AM, Chris Angelico wrote: In any case... what I'd suggest would be opening a tracker issue, or discussing this on python-ideas, and seeing what core devs think of the matter. I think that, on balance, it's probably better to show the

Re: unicode as valid naming symbols

2014-03-27 Thread Gregory Ewing
Mark H Harris wrote: Good ol infix -- x+y.. prefix (with paren) -- foo(x) prefix without -- ¬ x In case you thought alphanumerics had parens -- sin x Then theres postfix -- n! Inside fix -- nCr (Or if you prefer ⁿCᵣ ??) And outside fix -- mod -- |x| And mismatched delimiters: [5, 7)

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Dan Stromberg
On Fri, Mar 21, 2014 at 1:42 PM, vasudevram wrote: > Can anyone - maybe one of the Python language core team, or someone with > knowledge of the internals of Python - can explain why this code works, and > whether the different occurrences of the name x in the expression, are in > different sco

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Steven D'Aprano
On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote: > In article , > Chris Angelico wrote: >> It's not "equally braindead", it follows a simple and logical rule: >> Only the day portion is negative. > > Simple and logical, yes. But also entirely braindead. Do you think it is "braindead" for

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Mark H Harris
On 3/27/14 4:42 PM, Chris Angelico wrote: And this is the bit where, I think, we disagree. I think that programming is for programmers, in the same way that music is for musicians and the giving of legal advice is for lawyers. Yes, there are armchair lawyers, and plenty of people can pick up a hy

Re: CentOS 6.5 / SPEC file

2014-03-27 Thread Michael Torrie
On 03/27/2014 03:26 PM, Michael Torrie wrote: > On 03/27/2014 02:02 PM, Devin wrote: >> RPM build errors: >> error: Bad exit status from /var/tmp/rpm-tmp.yqWO6C (%install) >> line 71: buildprereq is deprecated: BuildPrereq: expat-devel >> line 72: buildprereq is deprecated: BuildPrereq: db4

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 7:54 AM, Mark H Harris wrote: > Some people equate developer with programmer with software engineer. This > ought not be done, in my view. There are *many* programmers out there who > suck at software engineering (and they are not computer scientists). They > also do not q

Re: CentOS 6.5 / SPEC file

2014-03-27 Thread Michael Torrie
On 03/27/2014 02:02 PM, Devin wrote: > RPM build errors: > error: Bad exit status from /var/tmp/rpm-tmp.yqWO6C (%install) > line 71: buildprereq is deprecated: BuildPrereq: expat-devel > line 72: buildprereq is deprecated: BuildPrereq: db4-devel > line 73: buildprereq is deprecated: Bui

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Terry Reedy
On 3/27/2014 7:42 AM, Chris Angelico wrote: In any case... what I'd suggest would be opening a tracker issue, or discussing this on python-ideas, and seeing what core devs think of the matter. I think that, on balance, it's probably better to show the whole thing with the same sign; but should i

meta language to define forms

2014-03-27 Thread Sells, Fred
I'm trying to use python classes and members to define complex data entry forms as a meta language The idea is to use a nice clean syntax like Python to define form content, then render it as HTML but only as a review tool for users, The actual rendering would go into a database to let a vendo

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Mark H Harris
On 3/27/14 11:48 AM, Chris Angelico wrote: On Fri, Mar 28, 2014 at 3:37 AM, Mark H Harris wrote: For the purposes of this list, a "normal" user is a reasonably intelligent college educated non "computer professional" non "computer scientist" non "expert" who for the moment has an interest in le

CentOS 6.5 / SPEC file

2014-03-27 Thread Devin
I have been trying to compile an RPM manually using the SPEC file that is contained in the source tarball from Python.org's website. I have tried multiple versions and they all seem to fail. I have tried the latest 3.4.0 release, 3.3.5 release, and 3.2.5 release. It appears the SPEC file contained

Re: unicode as valid naming symbols

2014-03-27 Thread Rustom Mody
On Thursday, March 27, 2014 10:47:04 PM UTC+5:30, MRAB wrote: > On 2014-03-27 15:51, Rustom Mody wrote: > > On Thursday, March 27, 2014 8:58:51 PM UTC+5:30, Mark H. Harris wrote: > >> On 3/25/14 6:58 PM, Steven D'Aprano wrote: > >> > To quote a great Spaniard: > >> > “You keep using that word,

Re: unicode as valid naming symbols

2014-03-27 Thread Rustom Mody
On Thursday, March 27, 2014 9:52:40 PM UTC+5:30, Ian wrote: > On Thu, Mar 27, 2014 at 9:28 AM, Mark H Harris wrote: > >> Do you think that the ability to write this would be an improvement? > >> import ⌺ > >> ⌚ = ⌺.╩░ > >> ⑥ = 5*⌺.⋨⋩ > >> ❹ = ⑥ - 1 > >> ♅⚕⚛ = [⌺.✱✳**⌺.❇*❹{⠪|⌚.∣} for ⠪ in ⌺.⣚] > >>

Re: unicode as valid naming symbols

2014-03-27 Thread MRAB
On 2014-03-27 15:51, Rustom Mody wrote: On Thursday, March 27, 2014 8:58:51 PM UTC+5:30, Mark H. Harris wrote: On 3/25/14 6:58 PM, Steven D'Aprano wrote: > To quote a great Spaniard: > “You keep using that word, I do not think it means what you > think it means.” In~con~thev

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 3:37 AM, Mark H Harris wrote: > For the purposes of this list, a "normal" user is a reasonably intelligent > college educated non "computer professional" non "computer scientist" non > "expert" who for the moment has an interest in leveraging computer science > and|or progr

SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC

2014-03-27 Thread tade . ankur
hei , I am a newcome to Python. I am trying to create a python script which will connect to an SSL URL and using the HEAD request will get the status of URL. For one the link I am getting following error [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Mark H Harris
On 3/27/14 11:10 AM, Chris Angelico wrote: On Fri, Mar 28, 2014 at 2:44 AM, Mark H Harris wrote: My comments here are not in the least hasty, nor are they generalizations. They are based on long years of experience with "normal" users, {snip} Who is a "normal user"? For the purposes of th

Re: Reading in cooked mode (was Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary)

2014-03-27 Thread Mark H Harris
On 3/25/14 6:38 PM, Dennis Lee Bieber wrote: A couple of us managed to "steal" the school login/password (don't think we ever used it, but...)... The teaching assistant didn't notice the paper tape punch was active when persuaded to login to let us run a short program (high school BASIC

Re: unicode as valid naming symbols

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 2:28 AM, Mark H Harris wrote: > No, any unicode character (except numerals) should be able to begin a name > identifier. alt-l λ and alt-v √ should be valid first character > name identifier symbols. > What, even whitespace?? ChrisA -- https://mail.python.org/

Re: unicode as valid naming symbols

2014-03-27 Thread Ian Kelly
On Thu, Mar 27, 2014 at 9:28 AM, Mark H Harris wrote: >> Do you think that the ability to write this would be an improvement? >> >> import ⌺ >> ⌚ = ⌺.╩░ >> ⑥ = 5*⌺.⋨⋩ >> ❹ = ⑥ - 1 >> ♅⚕⚛ = [⌺.✱✳**⌺.❇*❹{⠪|⌚.∣} for ⠪ in ⌺.⣚] >> ⌺.˘˜¨´՛՜(♅⚕⚛) > > >Steven, you're killing me here; argument by analo

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 3:08 AM, Tim Chase wrote: > Multiple times, I've seen someone want something like what C-style > languages offer where assignment is done in a test, something like > > if (m = re.match(some_string)): > do_something(m) If you want a language where you can do this sort

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 3:08 AM, Tim Chase wrote: > So when I stumbled upon this horrific atrocity of language abuse and > scope leakage, I thought I'd share it. > > if [m for m in [regex.match(some_string)] if m]: > do_something(m) > > And presto, assignment in an if-statement. And presto,

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 2:44 AM, Mark H Harris wrote: > My comments here are not in the least hasty, nor are they generalizations. > They are based on long years of experience with "normal" users, personal > programming experience for almost 40 years, and insight into student > perception from rea

Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Tim Chase
Multiple times, I've seen someone want something like what C-style languages offer where assignment is done in a test, something like if (m = re.match(some_string)): do_something(m) So when I stumbled upon this horrific atrocity of language abuse and scope leakage, I thought I'd share it.

Re: unicode as valid naming symbols

2014-03-27 Thread Mark H Harris
On 3/27/14 10:51 AM, Rustom Mody wrote: Observe: Good ol infix -- x+y.. prefix (with paren) -- foo(x) prefix without -- ¬ x In case you thought alphanumerics had parens -- sin x Then theres postfix -- n! Inside fix -- nCr (Or if you prefer ⁿCᵣ ??) And outside fix -- mod -- |x| And Ive pro

Re: unicode as valid naming symbols

2014-03-27 Thread Rustom Mody
On Thursday, March 27, 2014 8:58:51 PM UTC+5:30, Mark H. Harris wrote: > On 3/25/14 6:58 PM, Steven D'Aprano wrote: > > To quote a great Spaniard: > > “You keep using that word, I do not think it means what you > > think it means.” > In~con~theveable ! My name is Inigo Montoya

Re: regex line by line over file

2014-03-27 Thread Peter Pearson
On Thu, 27 Mar 2014 06:41:55 -0700 (PDT), James Smith wrote: > On Thursday, March 27, 2014 1:32:03 AM UTC-4, Steven D'Aprano wrote: > >> - are you mistaken about the content of the file? >> >> I can't help you with the first. But the second: try running this: >> >> # line2 and pat as defined abov

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-27 Thread Mark H Harris
On 3/26/14 1:35 AM, alex23 wrote: On 25/03/2014 12:39 PM, Mark H Harris wrote: my version semantically is "how it is perceived" by the user Could you please stop claiming to have insight into the comprehension of anyone other than yourself? Hasty generalisations don't help your argument. hi

Re: regex line by line over file

2014-03-27 Thread James Smith
On Thursday, March 27, 2014 9:41:55 AM UTC-4, James Smith wrote: > (134, False, '\' > "SHELF-17:LOG_COLN_IP,SC,03-25,01-18-58,NEND,NA,,,:"Log Collection In > Progress",NONE:170035-6364-1048,:YEAR=2014,MODE=NONE"\\r\\n\'') > > > > Is the \r\n on the end of the line screwing it up

Re: unicode as valid naming symbols

2014-03-27 Thread Mark H Harris
On 3/25/14 6:58 PM, Steven D'Aprano wrote: To quote a great Spaniard: “You keep using that word, I do not think it means what you think it means.” In~con~theveable ! My name is Inigo Montoya, you killed my father, prepare to die... Do you think that the ability to write

Re: unicode as valid naming symbols

2014-03-27 Thread Tim Chase
On 2014-03-27 08:10, Rustom Mody wrote: > > I know, for such a reason I would love it if keywords would have > > been written like this: 𝗱𝗲𝗳 (using mathematical bold) instead of > > just like this: def (using plain latin letters). It would mean > > among other things we could just write operator.no

Re: unicode as valid naming symbols

2014-03-27 Thread Rustom Mody
On Thursday, March 27, 2014 3:06:02 PM UTC+5:30, Antoon Pardon wrote: > On 26-03-14 17:37, Ian Kelly wrote: > > On Wed, Mar 26, 2014 at 2:52 AM, Antoon Pardon > >> Of course we don't have to follow mathematical convention with python. > >> However allowing any > >> unicode symbol as an identifier

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Antoon Pardon
On 27-03-14 13:52, Roy Smith wrote: >> On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer wrote: >>> Besides, there's an infinite amount of (braindead) timedelta string >>> representations. For your -30 hours, it is perfectly legal to say >>> >>> 123 days, -2982 hours >>> >>> Yet Python doesn't (but

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Marko Rauhamaa
Skip Montanaro : > Feel free to submit a patch to improve str(t), where t is negative, The cat's out of the bag already, isn't it? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Fri, Mar 28, 2014 at 1:12 AM, Antoon Pardon wrote: > I don't recall specifics, but I do remember multiple times > where I was working with a structure that consisted of > a whole part and a fracture part where I found it useful > to have the fracture part always positive and displayed > as such

Re: regex line by line over file

2014-03-27 Thread James Smith
On Thursday, March 27, 2014 1:32:03 AM UTC-4, Steven D'Aprano wrote: > - are you mistaken about the content of the file? > > I can't help you with the first. But the second: try running this: > > # line2 and pat as defined above > filename = sys.argv[1] > with open(filename) as f: > for line

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Skip Montanaro
>> There are, >> as I see it, two common cases where t is negative: >> >> -1 day < t < 0 >> >> and >> >> t <= -1 day > > There are two types of negative numbers: Those closer to zero than -1, > and those not closer to zero than -1. Yeah, I think those are the most > common cases. :) Sorry I wa

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Roy Smith
> On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer wrote: > > Besides, there's an infinite amount of (braindead) timedelta string > > representations. For your -30 hours, it is perfectly legal to say > > > > 123 days, -2982 hours > > > > Yet Python doesn't (but chooses an equally braindead represen

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Thu, Mar 27, 2014 at 10:56 PM, Skip Montanaro wrote: > There are, > as I see it, two common cases where t is negative: > > -1 day < t < 0 > > and > > t <= -1 day There are two types of negative numbers: Those closer to zero than -1, and those not closer to zero than -1. Yeah, I think those

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Skip Montanaro
I took a moment to scan the datetime documentation. The behavior of str() on timedelta objects is very consistent, and matches the internal representation. From the docs: str(t) Returns a string in the form [D day[s], ][H]H:MM:SS[.UU], where D is negative for negative t. (5) Note (5) reads: S

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Thu, Mar 27, 2014 at 10:25 PM, Johannes Bauer wrote: > And it makes it extremely error-prone to the reader: > str(datetime.timedelta(0, -1)) > '-1 day, 23:59:59' > > This looks MUCH more like "almost two days ago" than > > '-00:00:01' > > does. It's easy when the timedelta is >-1 day. Is

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Thu, Mar 27, 2014 at 10:05 PM, Johannes Bauer wrote: > On 27.03.2014 11:44, Chris Angelico wrote: >> On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer wrote: >>> Besides, there's an infinite amount of (braindead) timedelta string >>> representations. For your -30 hours, it is perfectly legal to

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Johannes Bauer
On 27.03.2014 11:44, Chris Angelico wrote: > It's not "equally braindead", it follows a simple and logical rule: > Only the day portion is negative. The more I think about it, the sillier this rule seems to me. A timedelta is a *whole* object. Either the whole delta is negative or it is not. It

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Johannes Bauer
On 27.03.2014 11:44, Chris Angelico wrote: > On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer wrote: >> Besides, there's an infinite amount of (braindead) timedelta string >> representations. For your -30 hours, it is perfectly legal to say >> >> 123 days, -2982 hours >> >> Yet Python doesn't (but

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Chris Angelico
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer wrote: > Besides, there's an infinite amount of (braindead) timedelta string > representations. For your -30 hours, it is perfectly legal to say > > 123 days, -2982 hours > > Yet Python doesn't (but chooses an equally braindead representation). It's

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Johannes Bauer
On 27.03.2014 01:16, Steven D'Aprano wrote: > py> divmod(30, 24) > (1, 6) > > That makes perfect intuitive sense: 30 hours is 1 day with 6 hours > remaining. In human-speak, we'll say that regardless of whether the > timedelta is positive or negative: we'll say "1 day and 6 hours from now" > o

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Johannes Bauer
On 26.03.2014 10:53, Jean-Michel Pichavant wrote: > Note : I don't see what's wrong in your example, however I have the feeling > the term "stupiditie" is a little bit strong ;) The problem is that for a given timedelta t with t > 0 it is intuitive to think that its string representation str(t)

ANN: python-ldap 2.4.15

2014-03-27 Thread Michael Ströder
Find a new release of python-ldap: http://pypi.python.org/pypi/python-ldap/2.4.15 python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related st

Re: unicode as valid naming symbols

2014-03-27 Thread Antoon Pardon
On 26-03-14 17:37, Ian Kelly wrote: > On Wed, Mar 26, 2014 at 2:52 AM, Antoon Pardon > wrote: >> Of course we don't have to follow mathematical convention with python. >> However allowing any >> unicode symbol as an identifier doesn't prohibit from using √ as an >> operator. We do have >> "in" a

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Mark Lawrence
On 27/03/2014 01:38, Roy Smith wrote: In article , Chris Angelico wrote: On Thu, Mar 27, 2014 at 11:16 AM, Steven D'Aprano wrote: If an event happened 30 hours ago, it is correct to say that it occurred "18 hours after 2 days ago", but who talks that way? That response demonstrates real

Re: Time we switched to unicode? (was Explanation of this Python language feature?)

2014-03-27 Thread Ian Kelly
On Thu, Mar 27, 2014 at 1:32 AM, Ian Kelly wrote: > On Tue, Mar 25, 2014 at 7:36 AM, Steven D'Aprano > wrote: >> Yes, Python could have changed the meaning of {} to mean the empty set. >> But you know what? The empty set is not that important. Sets are not >> fundamental to Python. Python didn't

Re: Time we switched to unicode? (was Explanation of this Python language feature?)

2014-03-27 Thread Ian Kelly
On Tue, Mar 25, 2014 at 7:36 AM, Steven D'Aprano wrote: > Yes, Python could have changed the meaning of {} to mean the empty set. > But you know what? The empty set is not that important. Sets are not > fundamental to Python. Python didn't even have sets until 2.3, and at > first they were just a