Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread rusi
On Thursday, December 5, 2013 8:13:49 AM UTC+5:30, Ian wrote: > On Wed, Dec 4, 2013 at 3:09 AM, rusi wrote: > > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote: > >> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: > >> > Its a more fundamental problem than that: > >> > It emerges from

Re: status of regex modules

2013-12-04 Thread Terry Reedy
On 12/4/2013 11:21 AM, Mark Lawrence wrote: On 24/10/2013 22:47, Mark Lawrence wrote: The new module is now five years old. PEP 429 Python 3.4 release schedule has it listed under "Other proposed large-scale changes" but I don't believe this is actually happening. Lots of issues on the bug tra

Re: The Python license

2013-12-04 Thread Terry Reedy
On 12/4/2013 10:17 PM, musicdenotat...@gmail.com wrote: The third clause of the PSF license requires you to include a brief summary of changes in Python-derived software. "In the event Licensee prepares a derivative work that is based on or incorporates Python 3.3.3 or any part thereof, and wa

Re: The Python license

2013-12-04 Thread Roy Smith
In article , musicdenotat...@gmail.com wrote: Now that's the kind of software license I like. Short, and easy to understand. -- https://mail.python.org/mailman/listinfo/python-list

The Python license

2013-12-04 Thread musicdenotation
The third clause of the PSF license requires you to include a brief summary of changes in Python-derived software. Why? How exactly to comply with it? I think that this condition is not suitable for using Python in closed-source software. I suggest to remove it. -- https://mail.python.org/mailm

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Terry Reedy
On 12/4/2013 6:42 PM, Piotr Dobrogost wrote: On Wednesday, December 4, 2013 11:11:56 PM UTC+1, Terry Reedy wrote: The discussion of keystrokes is also a side-track. To great degree, yes. Having said that I find extra 11 keystrokes needed to access some attributes to be a freaking big and unj

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 06:58 PM, Terry Reedy wrote: On 12/4/2013 3:46 PM, Mark Lawrence wrote: On 04/12/2013 20:35, Piotr Dobrogost wrote: there should be a variant of dot access allowing to access these "non-standard" named attributes, too. More opinion. I am sure that I am not the only developer wh

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Terry Reedy
On 12/4/2013 3:46 PM, Mark Lawrence wrote: On 04/12/2013 20:35, Piotr Dobrogost wrote: On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote: I think random832 is saying that the designed purpose of setattr() was to dynamically set attributes by name, so they could later be accessed

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ian Kelly
On Wed, Dec 4, 2013 at 3:09 AM, rusi wrote: > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote: >> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: >> > Its a more fundamental problem than that: >> > It emerges from the OP's second post) that he wants '-' in the attributes. >> > Is that

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Cameron Simpson
On 04Dec2013 09:44, Helmut Jarausch wrote: > On Wed, 04 Dec 2013 08:13:03 +1100, Cameron Simpson wrote: > > I iterate over Queues so often that I have a personal class called > > a QueueIterator which is a wrapper for a Queue or PriorityQueue > > which is iterable, and an IterablePriorityQueue fac

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Rotwang
On 04/12/2013 20:07, Piotr Dobrogost wrote: [...] Unless we compare with what we have now, which gives 9 (without space) or 10 (with space): x = obj.'value-1' x = getattr(obj, 'value-1') That is not a significant enough savings to create new syntax. Well, 9 characters is probably significa

Re: Python and PEP8 - Recommendations on breaking up long lines?

2013-12-04 Thread Nick Mellor
Hi Victor, I use PyCharm which is set up by default to warn when line length exceeds 120 chars, not 80. Perhaps times have changed? I often break comprehensions at the for, in and else clauses. It's often not for line length reasons but because it's easier to follow the code that way. I have h

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ned Batchelder
On 12/4/13 6:57 PM, Piotr Dobrogost wrote: On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote: Perhaps you should look at different ways of spelling your identifiers? Why can't you use an underscore instead of a hyphen? So that underscore could be left for use inside fields'

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > Spaces? I present to you two FORTRAN statements > > DO 10 I = 3 . 14159 > and > DO10I = 3 , 1 4 1 5 9 > > Which is the loop and which is the assignment? I know it's rude to quote oneself, but

Re: Managing Google Groups headaches

2013-12-04 Thread Roy Smith
In article , Rich Kulawiec wrote: > Yes, I'm > aware of web forums: I've used hundreds of them. They suck. They ALL > suck, they just all suck differently. I could spend the next several > thousand lines explaining why, but instead I'll just abbreviate: they > don't handle threading, they don

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 03:57 PM, Piotr Dobrogost wrote: On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote: Perhaps you should look at different ways of spelling your identifiers? Why can't you use an underscore instead of a hyphen? So that underscore could be left for use inside fie

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote: > Perhaps you should look > at different ways of spelling your identifiers? Why can't you use an > underscore instead of a hyphen? So that underscore could be left for use inside fields' names? However I think we could use some

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 11:11:56 PM UTC+1, Terry Reedy wrote: > > The discussion of enlarging the scope of 'identifier' is not relevant as > you are not proposing that. In particular, you are not asking that > obj.value-1 get the 'value-1' attribute of obj. Right. > The discussion of k

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 02:13 PM, Piotr Dobrogost wrote: On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote: On 2013-12-04, Piotr Dobrogost <> wrote: Right. If there's already a way to have attributes with these "non-standard" names (which is a good thing) At best its a neutral thing

Re: Managing Google Groups headaches

2013-12-04 Thread Cameron Simpson
On 03Dec2013 17:39, rusi wrote: > On Wednesday, December 4, 2013 6:10:05 AM UTC+5:30, Cameron Simpson wrote: > > My first act on joining any mailing list is to download the entire > > archive into my local mail store. I have a script for this, for > > mailman at least. > > and you happen to own >

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Dave Angel
On Wed, 4 Dec 2013 14:05:11 -0800 (PST), Piotr Dobrogost wrote: Object's attributes and dictionary's keys are quite different things. Right. So if you need arbitrary keys, use a dict. Attributes are keyed by identifiers, which are constrained. No problem. -- DaveA -- https://mail.python.or

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote: > On 2013-12-04, Piotr Dobrogost <> wrote: > > > Right. If there's already a way to have attributes with these > > "non-standard" names (which is a good thing) > > At best its a neutral thing. You can use dict for the same > pu

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Terry Reedy
On 12/4/2013 3:07 PM, Piotr Dobrogost wrote: You have proposed to make non-identifier attribute names 'official', rather than discouraged, by abbreviating > x = getattr(obj, 'value-1') or x = obj.__dict__['value-1'] # implementation detail as x = obj.'value-1' The discussion of enlarging th

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Tuesday, December 3, 2013 6:48:38 PM UTC+1, Dave Angel wrote: > On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost > > wrote: > > > What is the reason there's no "natural" syntax allowing to access > > attributes with names not being valid Python identifiers in a similar > > way to ot

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote: > > not something to do commonly. Your proposed syntax leaves the > distinction between valid and invalid identifiers a problem the > programmer has to deal with. It doesn't unify access to > attributes the way the getattr and se

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 12:55 PM, Mark Lawrence wrote: On 04/12/2013 20:22, Ethan Furman wrote: On 12/04/2013 12:07 PM, Piotr Dobrogost wrote: If there ought to be only one way to access attributes then it should be dot notation. Not "only one way", it's "one obvious way". Not "one obvious way" it

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Neil Cerutti
On 2013-12-04, Piotr Dobrogost wrote: > On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote: >> >> I think random832 is saying that the designed purpose of setattr() >> was to dynamically set attributes by name, so they could later be >> accessed the traditional way; not designed from

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 12:58 PM, Jerry Hill wrote: On Wed, Dec 4, 2013 at 3:35 PM, Piotr Dobrogost wrote: Right. If there's already a way to have attributes with these "non-standard" names (which is a good thing) then for uniformity with dot access to attributes with "standard" names there should be a

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 2:23:24 PM UTC+1, Roy Smith wrote: > In article <17gt99hg615jfm7bdid26185884d2pf...@4ax.com>, > > Tim Roberts <> wrote: > > > Piotr Dobrogost <> wrote: > > > >Attribute access syntax being very concise is very often preferred > > >to dict's interface. > > > It

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Jerry Hill
On Wed, Dec 4, 2013 at 3:35 PM, Piotr Dobrogost wrote: > Right. If there's already a way to have attributes with these "non-standard" > names (which is a good thing) then for uniformity with dot access to > attributes with "standard" names there should be a variant of dot access > allowing to a

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Mark Lawrence
On 04/12/2013 20:22, Ethan Furman wrote: On 12/04/2013 12:07 PM, Piotr Dobrogost wrote: If there ought to be only one way to access attributes then it should be dot notation. Not "only one way", it's "one obvious way". -- ~Ethan~ Not "one obvious way" it's "There should be one-- and prefe

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 12:07 PM, Piotr Dobrogost wrote: If there ought to be only one way to access attributes then it should be dot notation. Not "only one way", it's "one obvious way". The obvious way to deal with objects that do not have legal identifier names is with a dict. -- ~Ethan~ -- https

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Mark Lawrence
On 04/12/2013 20:35, Piotr Dobrogost wrote: On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote: I think random832 is saying that the designed purpose of setattr() was to dynamically set attributes by name, so they could later be accessed the traditional way; not designed from the

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote: > > I think random832 is saying that the designed purpose of setattr() > was to dynamically set attributes by name, so they could later be > accessed the traditional way; not designed from the ground-up to > support non-identifier na

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Piotr Dobrogost
On Wednesday, December 4, 2013 6:45:05 AM UTC+1, Tim Roberts wrote: > > It is not "very concise". It is slightly more concise. > > x = obj.value1 > x = dct['value1'] > > You have saved 3 keystrokes. Actually only 1 as you should have compared these: x = obj.'value-1' x = dct['value-1

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Antoon Pardon
Op 04-12-13 14:02, rusi schreef: > On Wednesday, December 4, 2013 6:02:18 PM UTC+5:30, Antoon Pardon wrote: >> Op 04-12-13 13:01, rusi schreef: >>> On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote: Op 04-12-13 11:09, rusi schreef: > I used the spaces case to indicate

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/04/2013 03:30 AM, Jussi Piitulainen wrote: rusi writes: How do we decide which '-' are valid identifier components -- hyphens and which minus-signs? I think the OP might be after the JavaScript mechanism where an attribute name can be any string, the indexing brackets are always availab

Re: Input without line break, is it possible?

2013-12-04 Thread Mark Lawrence
On 04/12/2013 16:23, Michael Torrie wrote: On 12/04/2013 08:38 AM, geezl...@gmail.com wrote: my question, can i make it in just a single line like, 1 2 3 4 5 6 (and so forth) Can I? Yes of course. raw_input() is going to give you a string that you can then parse any way you want. That's

Re: Managing Google Groups headaches

2013-12-04 Thread Mark Lawrence
On 04/12/2013 16:21, Ned Batchelder wrote: On 12/4/13 11:07 AM, Mark Lawrence wrote: On 04/12/2013 15:50, Grant Edwards wrote: On 2013-12-04, Cameron Simpson wrote: On 30Nov2013 14:25, pec...@pascolo.net wrote: Dennis Lee Bieber writes: [NNTP] clients provide full-fledged editors and

Re: Input without line break, is it possible?

2013-12-04 Thread Chris Angelico
On Thu, Dec 5, 2013 at 3:27 AM, Mark Lawrence wrote: > I'm contemplating what it would be like migrating code from Python 1.x to > Python 4.0, the fun and games that could be :) I never used Python 1.x seriously, but when I went digging in one of my OS/2 machines a while ago, I found several Pyth

Re: Managing Google Groups headaches

2013-12-04 Thread Travis Griggs
On Dec 4, 2013, at 6:52 AM, Rich Kulawiec wrote: > Yes, I'm > aware of web forums: I've used hundreds of them. They suck. They ALL > suck, they just all suck differently. I could spend the next several > thousand lines explaining why, but instead I'll just abbreviate: they > don't handle thre

Re: Input without line break, is it possible?

2013-12-04 Thread Mark Lawrence
On 04/12/2013 16:14, Chris Angelico wrote: On Thu, Dec 5, 2013 at 3:04 AM, Mark Lawrence wrote: On 04/12/2013 15:38, geezl...@gmail.com wrote: The source code: for i in range(8): n = input() Yes you can get them on a single line, see the response from Tim Chase. But just to be crysta

Re: status of regex modules

2013-12-04 Thread Mark Lawrence
On 24/10/2013 22:47, Mark Lawrence wrote: The new module is now five years old. PEP 429 Python 3.4 release schedule has it listed under "Other proposed large-scale changes" but I don't believe this is actually happening. Lots of issues on the bug tracker have been closed as fixed in the new mod

Re: Managing Google Groups headaches

2013-12-04 Thread Ned Batchelder
On 12/4/13 11:07 AM, Mark Lawrence wrote: On 04/12/2013 15:50, Grant Edwards wrote: On 2013-12-04, Cameron Simpson wrote: On 30Nov2013 14:25, pec...@pascolo.net wrote: Dennis Lee Bieber writes: [NNTP] clients provide full-fledged editors and conversely full-fledged editors provide

Re: Input without line break, is it possible?

2013-12-04 Thread Michael Torrie
On 12/04/2013 08:38 AM, geezl...@gmail.com wrote: > my question, can i make it in just a single line like, > > 1 2 3 4 5 6 (and so forth) > > Can I? Yes of course. raw_input() is going to give you a string that you can then parse any way you want. -- https://mail.python.org/mailman/listinfo/py

Re: Input without line break, is it possible?

2013-12-04 Thread Chris Angelico
On Thu, Dec 5, 2013 at 3:04 AM, Mark Lawrence wrote: > On 04/12/2013 15:38, geezl...@gmail.com wrote: >> >> The source code: >> >> for i in range(8): >> n = input() > > Yes you can get them on a single line, see the response from Tim Chase. But > just to be crystal clear, are you aware that y

Re: Managing Google Groups headaches

2013-12-04 Thread Mark Lawrence
On 04/12/2013 15:50, Grant Edwards wrote: On 2013-12-04, Cameron Simpson wrote: On 30Nov2013 14:25, pec...@pascolo.net wrote: Dennis Lee Bieber writes: [NNTP] clients provide full-fledged editors and conversely full-fledged editors provide NNTP clients GNU Emacs is a LISP oper

Re: Input without line break, is it possible? [correction]

2013-12-04 Thread Tim Chase
On 2013-12-04 09:55, Tim Chase wrote: > You could make it a bit more robust with something like: > > answers = [] > while len(answers) < 8: > s = input() > answers.append(s.split()) this should be answers.extend(s.split()) instead of .append() That's what I get for coding in my i

Re: Input without line break, is it possible?

2013-12-04 Thread Mark Lawrence
On 04/12/2013 15:38, geezl...@gmail.com wrote: The source code: for i in range(8): n = input() When we run it, consider the numbers below is the user input, 1 2 3 4 5 6 (and so forth) my question, can i make it in just a single line like, 1 2 3 4 5 6 (and so forth) Can I? Yes you can

Re: Managing Google Groups headaches

2013-12-04 Thread Grant Edwards
On 2013-12-04, Cameron Simpson wrote: > On 30Nov2013 14:25, pec...@pascolo.net wrote: >> Dennis Lee Bieber writes: >> > [NNTP] clients provide full-fledged editors >>and conversely full-fledged editors provide >>NNTP clients > > GNU Emacs is a LISP operating system disguised as a word

Re: Input without line break, is it possible?

2013-12-04 Thread Tim Chase
On 2013-12-04 07:38, geezl...@gmail.com wrote: > for i in range(8): >n = input() > > When we run it, consider the numbers below is the user input, > > 1 > 2 > 3 > 4 > 5 > 6 > (and so forth) > > my question, can i make it in just a single line like, > > 1 2 3 4 5 6 (and so forth) Not easily

Re: Managing Google Groups headaches

2013-12-04 Thread Chris Angelico
On Thu, Dec 5, 2013 at 1:52 AM, Rich Kulawiec wrote: > Mailing lists/Usenet newsgroups remain, as they've been for a very > long time, the solutions of choice for online discussions. Yes, I'm > aware of web forums: I've used hundreds of them. They suck. They ALL > suck, they just all suck diffe

Input without line break, is it possible?

2013-12-04 Thread geezle86
The source code: for i in range(8): n = input() When we run it, consider the numbers below is the user input, 1 2 3 4 5 6 (and so forth) my question, can i make it in just a single line like, 1 2 3 4 5 6 (and so forth) Can I? -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Managing Google Groups headaches

2013-12-04 Thread Mark Lawrence
On 04/12/2013 14:34, Neil Cerutti wrote: On 2013-12-04, alex23 wrote: On 3/12/2013 5:13 PM, Steven D'Aprano wrote: You poor fools you, this is what happens when you give control of the tools you use to a (near) monopolist whose incentives are not your incentives. To paraphrase Franklin: thos

Re: Managing Google Groups headaches

2013-12-04 Thread Rich Kulawiec
(comments from a lurker on python-list) - Google "groups" is a disaster. It's extremely poorly-run, and is in fact a disservice to Usenet -- which is alive and well, tyvm, and still used by many of the most senior and experienced people on the Internet. (While some newsgroups are languishing an

Re: Python Unicode handling wins again -- mostly

2013-12-04 Thread Neil Cerutti
On 2013-12-04, wxjmfa...@gmail.com wrote: > Yon intuitively pointed a very important feature of "unicode". > However, it is not necessary, this is exactly what unicode does > (when used properly). Unicode only provides character sets. It's not a natural language parsing facility. -- Neil Cerutt

Re: [OT] Managing Google Groups headaches

2013-12-04 Thread Neil Cerutti
On 2013-12-04, alex23 wrote: > On 3/12/2013 5:13 PM, Steven D'Aprano wrote: >> You poor fools you, this is what happens when you give control >> of the tools you use to a (near) monopolist whose incentives >> are not your incentives. > > To paraphrase Franklin: those who would give up control to >

Re: Python Unicode handling wins again -- mostly

2013-12-04 Thread Mark Lawrence
On 04/12/2013 13:52, wxjmfa...@gmail.com wrote: [snip all the double spaced stuff] Yon intuitively pointed a very important feature of "unicode". However, it is not necessary, this is exactly what unicode does (when used properly). jmf Presumably using unicode correctly prevents messages b

Re: Python Unicode handling wins again -- mostly

2013-12-04 Thread wxjmfauth
Le mardi 3 décembre 2013 15:26:45 UTC+1, Ethan Furman a écrit : > On 12/02/2013 12:38 PM, Ethan Furman wrote: > > > On 11/29/2013 04:44 PM, Steven D'Aprano wrote: > > >> > > >> Out of the nine tests, Python 3.3 passes six, with three tests being > > >> failures or dubious. If you believe that t

simple ElementTree based parser that allows entity definition map

2013-12-04 Thread Robin Becker
I'm tasked with writing a 'simple' ElementTree based parser with support for unknown entities eg &foo;. This code derived from FL's old documentation fails in both python 2 and 3. import xml.etree.ElementTree as ET try: ascii except: from future_builtins import

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Roy Smith
In article <17gt99hg615jfm7bdid26185884d2pf...@4ax.com>, Tim Roberts wrote: > Piotr Dobrogost wrote: > > > >Attribute access syntax being very concise is very often preferred > >to dict's interface. > > It is not "very concise". It is slightly more concise. > > x = obj.value1 > x =

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread rusi
On Wednesday, December 4, 2013 6:02:18 PM UTC+5:30, Antoon Pardon wrote: > Op 04-12-13 13:01, rusi schreef: > > On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote: > >> Op 04-12-13 11:09, rusi schreef: > >>> I used the spaces case to indicate the limit of chaos. > >>> Other ch

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Antoon Pardon
Op 04-12-13 13:01, rusi schreef: > On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote: >> Op 04-12-13 11:09, rusi schreef: >>> I used the spaces case to indicate the limit of chaos. >>> Other characters (that >>> already have uses) are just as problematic. >> >> I don't agree

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread rusi
On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote: > Op 04-12-13 11:09, rusi schreef: > > I used the spaces case to indicate the limit of chaos. > > Other characters (that > > already have uses) are just as problematic. > > I don't agree with the latter. As it is now python c

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Chris Angelico
On Wed, Dec 4, 2013 at 10:30 PM, Jussi Piitulainen wrote: > Hm. Can't specific classes be made to behave this way even now by > implementing suitable underscored methods? Yup. Definitely possible. I don't think it'd be a good idea, though, not without somehow changing every dict method into a sta

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Jussi Piitulainen
rusi writes: > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote: > > On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: > > > Its a more fundamental problem than that: > > > It emerges from the OP's second post) that he wants '-' in the > > > attributes. Is that all? > > > > > > Where does

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread rusi
On Wednesday, December 4, 2013 4:03:14 PM UTC+5:30, Chris Angelico wrote: > On Wed, Dec 4, 2013 at 9:09 PM, rusi wrote: > > OP wants attribute identifiers like > > outer_fieldset-inner_fieldset-third_field. > > Say I have a python expression: > > obj.outer_fieldset-inner_fieldset-third_field > >

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Tim Chase
On 2013-12-04 21:33, Chris Angelico wrote: > I don't think so. What the OP asked for was: > > my_object.'valid-attribute-name-but-not-valid-identifier' > > Or describing it another way: A literal string instead of a token. > This is conceivable, at least, but I don't think it gives any > advantag

Re: Print a text at a specific location on the page

2013-12-04 Thread Peter Otten
loic.esp...@gmail.com wrote: > Hi all > > This is my first post on this list :-) > > I have a web-application (developped using a python framework). In this > web-app, I would like to print certificates for some courses. > > The principle : > The course teacher has a "default" certificates, wit

Re: any use case of logging.config.listen()?

2013-12-04 Thread Chris Angelico
On Wed, Dec 4, 2013 at 8:09 PM, Zhang Weiwu wrote: > Either case I don't find use of logging.config.listen(), even though I am > looking hard for every way to reuse existing code. > That's not a problem. It's a feature that doesn't quite fit your task, so you don't use it. It's like trying to ins

Re: using ffmpeg command line with python's subprocess module

2013-12-04 Thread Chris Angelico
On Wed, Dec 4, 2013 at 8:38 PM, Andreas Perstinger wrote: > "fp" is a file object, but subprocess expects a list of strings as > its first argument. More fundamentally: The subprocess's arguments must include the *name* of the file. This means you can't use TemporaryFile at all, as it's not guara

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Chris Angelico
On Wed, Dec 4, 2013 at 9:09 PM, rusi wrote: > OP wants attribute identifiers like outer_fieldset-inner_fieldset-third_field. > Say I have a python expression: > obj.outer_fieldset-inner_fieldset-third_field I don't think so. What the OP asked for was: my_object.'valid-attribute-name-but-not-vali

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Antoon Pardon
Op 04-12-13 11:09, rusi schreef: > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote: >> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: >>> Its a more fundamental problem than that: >>> It emerges from the OP's second post) that he wants '-' in the attributes. >>> Is that all? >>> >>> Wh

Print a text at a specific location on the page

2013-12-04 Thread loic . espern
Hi all This is my first post on this list :-) I have a web-application (developped using a python framework). In this web-app, I would like to print certificates for some courses. The principle : The course teacher has a "default" certificates, with placeholders for the name, and the certifica

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread rusi
On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote: > On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: > > Its a more fundamental problem than that: > > It emerges from the OP's second post) that he wants '-' in the attributes. > > Is that all? > > > > Where does this syntax-enlargement sto

Re: A cautionary tale

2013-12-04 Thread Peter Otten
Frank Millman wrote: > Hi all > > There is no question at the end of this, it is just an account of a couple > of days in the life of a programmer (me). I just felt like sharing it. > Feel free to ignore. > > The business/accounting system I am writing involves a lot of reading data > from a dat

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Peter Otten
Helmut Jarausch wrote: > On Tue, 03 Dec 2013 13:38:58 +0100, Peter Otten wrote: > >> Helmut Jarausch wrote: >> >>> Hi, >>> >>> I'd like to extracted elements from a heapq in a for loop. >>> I feel my solution below is much too complicated. >>> How to do it more elegantly? >>> I know I could use

Re: using ffmpeg command line with python's subprocess module

2013-12-04 Thread Andreas Perstinger
iMath wrote: >I use the following code to do the test ,but error occurred ,it >prompts system cannot find specified files ,but the files are indeed >exists there ,any help ? > >with tempfile.TemporaryFile() as fp: >fp.write(("file '"+'a1.mp3'+"'\n").encode('utf-8')) >fp.write(("file '"+'a2

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Wed, 04 Dec 2013 08:13:03 +1100, Cameron Simpson wrote: > On 03Dec2013 12:18, Helmut Jarausch wrote: >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? > > I can't believe nobody has mentioned Pri

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 15:56:11 +0200, Jussi Piitulainen wrote: > Helmut Jarausch writes: > ... >> I know I could use a while loop but I don't like it. > ... >> from heapq import heappush, heappop >> # heappop raises IndexError if heap is empty > ... >> # how to avoid / simplify the following functio

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 13:06:05 +, Duncan Booth wrote: > Helmut Jarausch wrote: > >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? >> I know I could use a while loop but I don't like it

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 04:40:26 -0800, rusi wrote: > On Tuesday, December 3, 2013 5:48:59 PM UTC+5:30, Helmut Jarausch wrote: >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? >> I know I could

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 13:38:58 +0100, Peter Otten wrote: > Helmut Jarausch wrote: > >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? >> I know I could use a while loop but I don't like it. >

A cautionary tale

2013-12-04 Thread Frank Millman
Hi all There is no question at the end of this, it is just an account of a couple of days in the life of a programmer (me). I just felt like sharing it. Feel free to ignore. The business/accounting system I am writing involves a lot of reading data from a database, and if changed, writing it b

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ethan Furman
On 12/03/2013 09:45 PM, Tim Roberts wrote: Piotr Dobrogost wrote: Attribute access syntax being very concise is very often preferred to dict's interface. It is not "very concise". It is slightly more concise. x = obj.value1 x = dct['value1'] You have saved 3 keystrokes. That is

Re: any use case of logging.config.listen()?

2013-12-04 Thread Zhang Weiwu
Thank you a lot for your case description. On Wed, 4 Dec 2013, Dan Sommers wrote: It begets the question, that if it is easier to write a socket-listening loging handler and forget all about logging.config.listen() stuff. I never did it before, hence the question. But why develop all of that

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Ian Kelly
On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote: > Its a more fundamental problem than that: > It emerges from the OP's second post) that he wants '-' in the attributes. > Is that all? > > Where does this syntax-enlargement stop? Spaces? Newlines? At non-strings. >>> setattr(foo, 21+21, 42) Tracebac