Re: [Python-Dev] Set the namespace free!

2010-07-26 Thread Stephen J. Turnbull
Georg Brandl writes: > Am 26.07.2010 10:59, schrieb Anders Sandvig: > > On Sat, Jul 24, 2010 at 3:31 AM, Gregory P. Smith wrote: > >> Yuck. Anyone who feels they need a variable named the same a reserved > >> word > >> simply feels wrong and needs reeducation. [...] > > > > While I agre

Re: [Python-Dev] Set the namespace free!

2010-07-26 Thread Georg Brandl
Am 26.07.2010 10:59, schrieb Anders Sandvig: > On Sat, Jul 24, 2010 at 3:31 AM, Gregory P. Smith wrote: >> Yuck. Anyone who feels they need a variable named the same a reserved word >> simply feels wrong and needs reeducation. [...] > > While I agree with you in principle, I have been finding i

Re: [Python-Dev] Set the namespace free!

2010-07-26 Thread Anders Sandvig
On Sat, Jul 24, 2010 at 3:31 AM, Gregory P. Smith wrote: > Yuck.  Anyone who feels they need a variable named the same a reserved word > simply feels wrong and needs reeducation.  [...] While I agree with you in principle, I have been finding it frustrating trying to calculate yield in my financi

Re: [Python-Dev] Set the namespace free!

2010-07-25 Thread Bartosz Tarnowski
So OK, thank you for response. No, I wasn't joking. I'm sorry, I didn't know that you Python guys get offended from being compared to PHP or Perl. Perhaps that shouldn't surprise me, though. I have posted all of this here, because I was hoping this feature would be implemented secretly, with

Re: [Python-Dev] Set the namespace free!

2010-07-23 Thread Gregory P. Smith
hose > which happen to be keywords. > > I've suggested :name, which doesn't break old code, and doesn't require > using any new punctuation. Syntax would not change, > just the lexical definition of 'identifier'. If the intent is to allow > arbitrary names

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Greg Ewing
On 23/07/10 04:24, gregory.smi...@sympatico.ca wrote: I've suggested :name, which doesn't break old code, I'm not so sure about that. Consider foo[a::b] Do you parse that as a 3-element slice, or as a 2-element slice with :b as the second element? -- Greg

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Georg Brandl
Am 22.07.2010 21:49, schrieb Reid Kleckner: > On Thu, Jul 22, 2010 at 11:49 AM, Alexander Belopolsky > wrote: >> On Thu, Jul 22, 2010 at 12:53 PM, wrote: >>> I'm very amused by all the jokes about turning python into perl, but there's >>> a good idea here that doesn't actually require that... >>

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread gregory.smith3
> Date: Thu, 22 Jul 2010 14:49:17 -0400 > Subject: Re: [Python-Dev] Set the namespace free! > From: alexander.belopol...@gmail.com > To: gregory.smi...@sympatico.ca > CC: python-dev@python.org > > On Thu, Jul 22, 2010 at 12:53 PM, wrote: > .. > > So, ::name

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Terry Reedy
On 7/22/2010 2:04 PM, John Nagle wrote: From: Bartosz Tarnowski Python has more and more reserved words over time ... What should I do then, when the attribute is a reserver word? I am going to be a grinch and note that this is strictly a usage question with no development implications.

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Reid Kleckner
On Thu, Jul 22, 2010 at 11:49 AM, Alexander Belopolsky wrote: > On Thu, Jul 22, 2010 at 12:53 PM,   wrote: >> I'm very amused by all the jokes about turning python into perl, but there's >> a good idea here that doesn't actually require that... > > No, there isn't.  And both '&' and '|' are valid

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Éric Araujo
> Using "setattr" to set attributes, where the attribute string > comes from an external source, can create a security hole. Remember > that you can override functions on an object, for that object only, > by setting an attribute. This offers the opportunity for an attack > similar to SQL in

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Éric Araujo
> Using "setattr" to set attributes, where the attribute string > comes from an external source, can create a security hole. Remember > that you can override functions on an object, for that object only, > by setting an attribute. This offers the opportunity for an attack > similar to SQL in

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Alexander Belopolsky
On Thu, Jul 22, 2010 at 12:53 PM, wrote: .. > So, ::name or &name or |name or whatever. > > I'm very amused by all the jokes about turning python into perl, but there's > a good idea here that doesn't actually require that... No, there isn't. And both '&' and '|' are valid python operators that

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread gregory.smith3
I have no idea why my last post was a copy of the previous one. Webmail choking on a hairball. It was supposed to say: === Oops, :name does break things, e.g. if x :return So, ::name or &name or |name or whatever. I'm very amused by all the jokes about turning python into perl

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread John Nagle
On 7/22/2010 5:45 AM, python-dev-requ...@python.org wrote: Message: 10 Date: Thu, 22 Jul 2010 16:04:00 +0200 From: Bartosz Tarnowski To:python-dev@python.org Subject: [Python-Dev] Set the namespace free! Message-ID:<4c484fd0.2080...@zlotniki.pl> Content-Type: text/plain; charset=UTF-8;

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread gregory.smith3
oops, :name does break things, e.g if x :return So, it could be ::name or |name or &name or !name or whatever. From: gregory.smi...@sympatico.ca To: python-dev@python.org Subject: RE: [Python-Dev] Set the namespace free! Date: Thu, 22 Jul 2010 16:24:27 + I agree with

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread gregory.smith3
work better (and is consistent with existing stuff). > Date: Thu, 22 Jul 2010 10:41:39 -0400 > From: jnol...@gmail.com > To: bartosz-tarnow...@zlotniki.pl > CC: python-dev@python.org > Subject: Re: [Python-Dev] Set the namespace free! > > On Thu, Jul 22, 2010 at 10:04 AM, B

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread 岳帅杰
> > !for boo in foo: !if boo is !None: !print(hoo) !else: !return !sorted(woo) I feel most people could not bear such a difficult syntax. Why have I to type so much '!'s ? On Thu, Jul 22, 2010 at 10:04 PM, Bartosz Tarnowski < bartosz-tarnow...@zlotniki.pl> wrote: > > Hel

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Chris Bergstresser
On Thu, Jul 22, 2010 at 10:37 AM, Antoine Pitrou wrote: > On Thu, 22 Jul 2010 16:54:58 +0100 > Georg Brandl wrote: >> >> That also has the advantage of introducing a measure of much needed >> compatibility with industry-leading web programming languages. > > Also, Python would gain much needed fl

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Antoine Pitrou
On Thu, 22 Jul 2010 16:54:58 +0100 Georg Brandl wrote: > > You raise a good point. However, I'd rather explicitly signify names instead > of keywords: > > for $boo in $foo: > if $boo is $None: > print($hoo) > else: > return sorted($woo) > > That also has the advantage o

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Alexander Belopolsky
On Thu, Jul 22, 2010 at 11:54 AM, Georg Brandl wrote: .. > That also has the advantage of introducing a measure of much needed > compatibility with industry-leading web programming languages. Looks like our messages crossed in flight. pathologically-eclecticly-yours _

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Alexander Belopolsky
On Thu, Jul 22, 2010 at 10:41 AM, Jesse Noller wrote: .. > I'm not a fan of this - I'd much prefer[1] that we use the exclamation > point to determine scope: > > foobar - local > !foobar - one up > !!foobar - higher than the last one > !!!foobar - even higher in scope > > We could do the inverse a

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Alex Light
On Thu, Jul 22, 2010 at 10:04 AM, Bartosz Tarnowski < bartosz-tarnow...@zlotniki.pl> wrote: > > Let all reserved words be preceded with some symbol, i.e. "!" (exclamation > mark). This goes also for standard library global identifiers. > > !for boo in foo: >!if boo is !None: >!print(hoo

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Georg Brandl
Am 22.07.2010 15:04, schrieb Bartosz Tarnowski: > > Hello, guys. > > Python has more and more reserved words over time. It becomes quite annoying, > since you can not use variables and attributes of such names. Suppose I want > to > make an XML parser that reads a document and returns an objec

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Jesse Noller
On Thu, Jul 22, 2010 at 10:04 AM, Bartosz Tarnowski wrote: > > Hello, guys. > > Python has more and more reserved words over time. It becomes quite > annoying, since you can not use variables and attributes of such names. > Suppose I want to make an XML parser that reads a document and returns an

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Simon Brunning
On 22 July 2010 14:14, Xavier Morel wrote: > getattr(elem, 'param') I believe, rather than elem.getattr('param') Doh! You're absolutely right, of course. -- Cheers, Simon B. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mail

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Xavier Morel
On 2010-07-22, at 14:45 , Simon Brunning wrote: > On 22 July 2010 15:04, Bartosz Tarnowski > wrote: >> What should I do then, when the attribute is a reserver word? > > You would use elem.getattr('param'). That's what it's for. getattr(elem, 'param') I believe, rather than elem.getattr('param'

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Isaac Morland
On Thu, 22 Jul 2010, Bartosz Tarnowski wrote: [] My proposal: let's make a syntax change. I'm pretty sure this belongs on python-ideas. Let all reserved words be preceded with some symbol, i.e. "!" (exclamation mark). This goes also for standard library global identifiers. !for boo in

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Simon Brunning
On 22 July 2010 15:04, Bartosz Tarnowski wrote: > What should I do then, when the attribute is a reserver word? You would use elem.getattr('param'). That's what it's for. > Let all reserved words be preceded with some symbol, i.e. "!" (exclamation > mark). Oh, God, no. This would be better off

[Python-Dev] Set the namespace free!

2010-07-22 Thread Bartosz Tarnowski
Hello, guys. Python has more and more reserved words over time. It becomes quite annoying, since you can not use variables and attributes of such names. Suppose I want to make an XML parser that reads a document and returns an object with attributes corresponding to XML element attributes: