<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.python.general">
    <title>gmane.comp.python.general</title>
    <link>http://blog.gmane.org/gmane.comp.python.general</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711114"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711113"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711112"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711111"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711110"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711109"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711108"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711107"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711106"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711105"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711104"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711103"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711102"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711101"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711100"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711099"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711098"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711097"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711096"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.general/711095"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711114">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711114</link>
    <description>&lt;pre&gt;
I configure my editor(s) to always use spaces for indentation.  So a
file that currently uses tabs is unusable to me.  You of course are
right that tabs are syntactically correct, but until I find another
editor that makes tabs visible (like the one I used 20 years ago)
they're unacceptable to me.

&lt;/pre&gt;</description>
    <dc:creator>Dave Angel</dc:creator>
    <dc:date>2012-05-25T03:36:21</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711113">
    <title>Re: Help doing it the "python way"</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711113</link>
    <description>&lt;pre&gt;
Hi, welcome to Python. I came here from C also.


The Python way, especially the Python 3 way, is to not make the new 
sequence into a concrete list unless you actually need a list to append 
or sort or otherwise mutate. In many use cases, that is not necessary.



&lt;/pre&gt;</description>
    <dc:creator>Terry Reedy</dc:creator>
    <dc:date>2012-05-25T03:27:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711112">
    <title>Is there a custom fields plugin or component of django</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711112</link>
    <description>&lt;pre&gt;I want to find a plugin of django what it can custom fields in the form. The functions include custom fields in web page and create the fields in database.

plugin's flow like these:
1.we can define fields in web page  

 --&amp;gt; 2.create the table in database(table includes all custom fields)

--&amp;gt; 3.generate CURD operations in web server 

--&amp;gt; 4.we can CURD records in web pages.

I want to know whether there is a plugin or component of django, If there is please tell me. Maybe there is the other plugin like this as well.
 
&lt;/pre&gt;</description>
    <dc:creator>kevon wang</dc:creator>
    <dc:date>2012-05-25T02:53:48</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711111">
    <title>Re: Namespace hack</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711111</link>
    <description>&lt;pre&gt;Pardon me for breaking threading, but Daniel's response is not available 
on my ISP's news server, and I only discovered it by accident.

On Thu May 24 15:04:34 CEST 2012, Daniel Fetchinson &amp;lt;fetchinson at 
googlemail.com&amp;gt; wrote:

[...]


Do you object to the ability to write standard Python modules?

# module.py
def spam(obj, n):
    return len(obj) + n

def ham(obj):
    return spam(obj, 23)


By your apparent misunderstanding of the Zen, you think that this should 
be written with oodles of more explicitness, 'cos explicit is always 
better, right?

keyword.def globals.spam(locals.obj, locals.n):
    keyword.return builtin.len(locals.obj) + locals.n

keyword.def globals.ham(locals.obj):
    keyword.return globals.spam(locals.obj, 23)


Python, like most (all?) non-trivial languages, has scoping rules so that 
you can refer to names without explicitly specifying which namespace they 
are in. So long as this is unambiguous, Explicit vs Implicit is 
irrelevant if not outright wrong.

My namespace decorator simply applies a slightly different set of scoping 
rules to the ones you are already used to in modules. It's no worse than 
nested functions (hardly a surprise, because it is built on nested 
functions!) or module-level scoping rules.


&lt;/pre&gt;</description>
    <dc:creator>Steven D'Aprano</dc:creator>
    <dc:date>2012-05-25T02:47:11</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711110">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711110</link>
    <description>&lt;pre&gt;Not to start another tabs-vs.-spaces discussion, but tabs are perfectly
legal indentation in Python. That exception is raised when the
interpreter can't determine how much a line is indented because tabs and
spaces are both used.

&lt;/pre&gt;</description>
    <dc:creator>Andrew Berg</dc:creator>
    <dc:date>2012-05-25T02:27:31</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711109">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711109</link>
    <description>&lt;pre&gt;
But why do you want to validate the email address? That's the
question. Usually it's because you're going to be sending emails to
that address, in which case you not only want to ensure that it's a
real address, you want to ensure that the person who keyed it in is
legitimately allowed to do so - the usual implementation of that being
"please check your emails for the confirmation code".

There are, however, ways of not-quite-sending an email. For instance,
you can connect to the domain's MX, give your HELO, MAIL FROM, and
RCPT TO commands, and then quit before sending any DATA. That won't
give a 100% guarantee, but it'll certainly tell you about a lot of
failures (most of them in that first megastep of looking up the domain
in DNS to find its MX record, and then attempting a connection).

Now, if your goal is to recognize email addresses in plain text (eg to
make them clickable), then you probably don't want true validation -
you want more of a DWIM setup where common "tails" aren't included
[for instance, an email address followed by a close bracket, like
foo&amp;lt; at &amp;gt;bar.com]. That's completely different.

ChrisA
&lt;/pre&gt;</description>
    <dc:creator>Chris Angelico</dc:creator>
    <dc:date>2012-05-25T01:56:40</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711108">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711108</link>
    <description>&lt;pre&gt;
Guess that depends on what you mean by work.  First, it gets a syntax
error on the print function call, because you omitted the parens.  When
I fixed that, I got
   UnboundLocalError: local variable 's' referenced before assignment

so I fixed that, and got
     inconsistent use of tabs and spaces in indentation

because you mistakenly used tabs for indentation. Then I got the output
    &amp;lt;built-in function sum&amp;gt; &amp;lt;built-in function sum&amp;gt;

because sum is a built-in function.  Presumably you meant to return s,
not sum.

Here's what I end up with, and it seems to work fine in Python 3.2 on Linux:

def adder():
    s = 0
    def a(x):
        nonlocal s
        s += x
        return s
    return a

pos, neg = adder(), adder()
for i in range(10):
    print (pos(i), neg(-2*i))

.....
Output is:

0 0
1 -2
3 -6
6 -12
10 -20
15 -30
21 -42
28 -56
36 -72
45 -90


&lt;/pre&gt;</description>
    <dc:creator>Dave Angel</dc:creator>
    <dc:date>2012-05-25T01:59:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711107">
    <title>Re: Embedding Python27 in C++ on Windows: CRT compatibility issueswith VS2010?</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711107</link>
    <description>&lt;pre&gt;
It depends on the APIs you use.  eg, some APIs take a "FILE *" and some 
may take ownership of memory - such APIs needs to use the same CRT. 
APIs that don't attempt to share CRT "objects" should be fine.

Mark


&lt;/pre&gt;</description>
    <dc:creator>Mark Hammond</dc:creator>
    <dc:date>2012-05-25T01:53:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711106">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711106</link>
    <description>&lt;pre&gt;
Add a "nonlocal s" declaration right here.
See http://www.python.org/dev/peps/pep-3104/


Python doesn't have a C-like variable declaration scheme. So without a
`global` or `nonlocal` declaration, you can only assign to names which
reside in the innermost scope.


You mean slide #38 ("And functions are full closures.").


I would suggest reading through the Python Language Reference
(http://docs.python.org/release/3.1.5/reference/index.html ) prior to
asking further questions, as it may well answer them for you.

Cheers,
Chris
&lt;/pre&gt;</description>
    <dc:creator>Chris Rebert</dc:creator>
    <dc:date>2012-05-25T01:56:53</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711105">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711105</link>
    <description>&lt;pre&gt;

I think you mean "return s", not sum.



No, it shouldn't. When you have an assignment, such as "s += x", Python 
treats s as a local variable. Since s is local to the inner function a(), 
it has no initial value, and the += fails.

In Python 3, you can declare s to be a non-local variable with the 
nonlocal keyword:

def adder():
    s = 0
    def a(x):
        nonlocal s
        s += x
        return s
    return a


which now works the way you should expect:

1
3
8


But in Python 2, which you are using, there is no nonlocal keyword and 
you can only write to globals (declaring them with the global keyword) or 
locals (with no declaration), not nonlocals.

There are a number of work-arounds to this. One is to use a callable 
class:

class Adder:
    def __init__(self):
        self.s = 0
    def __call__(self, x):
        self.s += x
        return self.s


Another is to use an extra level of indirection, and a mutable argument. 
Instead of rebinding the non-local, you simply modify it in place:

def adder():
    s = [0]
    def a(x):
        s[0] += x
        return s[0]
    return a



&lt;/pre&gt;</description>
    <dc:creator>Steven D'Aprano</dc:creator>
    <dc:date>2012-05-25T01:50:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711104">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711104</link>
    <description>&lt;pre&gt;

Ha, of course. I assumed that the OP actually has a valid reason for 
requesting an email address from the user.


&lt;/pre&gt;</description>
    <dc:creator>Steven D'Aprano</dc:creator>
    <dc:date>2012-05-25T01:51:49</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711103">
    <title>Re: Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711103</link>
    <description>&lt;pre&gt;
If you bind to a name (assign to a variable) in a function, that name
is by default local to the function unless it's declared as "global" 
(which means "in this module's namespace") or "nonlocal" (which means
"in the enclosing function's namespace") (Python 3 only).
&lt;/pre&gt;</description>
    <dc:creator>MRAB</dc:creator>
    <dc:date>2012-05-25T01:51:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711102">
    <title>Re: Dynamic comparison operators</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711102</link>
    <description>&lt;pre&gt;
import operator

test(val1, val2, operator.ge)
&lt;/pre&gt;</description>
    <dc:creator>Paul Rubin</dc:creator>
    <dc:date>2012-05-25T01:36:57</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711101">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711101</link>
    <description>&lt;pre&gt;
Of course spamming people will make them hate you even more.  Insisting
that people give you a valid email address (unless you have a
demonstrably legitimate use for it) is a variant of that.
&lt;/pre&gt;</description>
    <dc:creator>Paul Rubin</dc:creator>
    <dc:date>2012-05-25T01:35:21</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711100">
    <title>Scoping Issues</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711100</link>
    <description>&lt;pre&gt;def adder():
s = 0
def a(x):
    s += x
    return sum
return a

pos, neg = adder(), adder()
for i in range(10):
print pos(i), neg(-2*i)

This should work, right? Why does it not?

Checkout slide no. 37 of a Tour of Go to know inspiration. Just wanted to see if python was the same as Go in this regard. Sorry, if I'm being rude, or anything. 
&lt;/pre&gt;</description>
    <dc:creator>SherjilOzair</dc:creator>
    <dc:date>2012-05-25T01:23:18</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711099">
    <title>Re: Dynamic comparison operators</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711099</link>
    <description>&lt;pre&gt;

What is "a b.__name__ constant", and how will it be useful?

As for your solution using eval, please, please, PLEASE do not encourage 
newbies to write slow, insecure, dangerous code. There are enough 
security holes in software without you encouraging people to create more.

    * eval is slow.

    * eval is dangerous.

    * eval is using a 200lb sledgehammer to crack a peanut.

Any time you find yourself thinking that you want to use eval to solve a 
problem, take a long, cold shower until the urge goes away.

If you have to ask why eval is dangerous, then you don't know enough 
about programming to use it safely. Scrub it out of your life until you 
have learned about code injection attacks, data sanitation, trusted and 
untrusted input. Then you can come back to eval and use it safely and 
appropriately.

Today, your "test" function using eval is used only by yourself, at the 
interactive interpreter. Tomorrow, it ends up in a web application, and 
random hackers in China and script-kiddies in Bulgaria now have total 
control of your server. Any time you hear about some piece of malware or 
some virus infecting people's systems when they look at a PDF file, 
chances are high that it is a code injection attack.

To learn more, you can start here:

http://cwe.mitre.org/top25/index.html

Two of the top three most common vulnerabilities are code injection 
attacks, similar to the improper use of eval.

Here is the "eval injection" vulnerability:

http://cwe.mitre.org/data/definitions/95.html

Also google on "code injection" for many more examples.



&lt;/pre&gt;</description>
    <dc:creator>Steven D'Aprano</dc:creator>
    <dc:date>2012-05-25T01:08:14</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711098">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711098</link>
    <description>&lt;pre&gt;Some regex implementations _can_ do recursion.


True, it's the wrong tool for the job.
&lt;/pre&gt;</description>
    <dc:creator>MRAB</dc:creator>
    <dc:date>2012-05-25T00:48:45</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711097">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711097</link>
    <description>&lt;pre&gt;

Why do you want to write buggy code that makes your users hate your 
program? Don't do it! Write good code, useful code! Validating email 
addresses is the wrong thing to do.

The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO 
IT. That is all. Just because an address is syntactically valid doesn't 
mean it is deliverable.

You can't validate postal addresses. How would you even try? Even if you 
could, you wouldn't use a regex for it. That's the post office's job to 
decide whether mail can be delivered, not yours. Who are you to say that 
some address in Russia or Bolivia or Kuwait is "invalid"?

Email addresses are no different. It is the job of the mail server to 
decide whether email can be delivered, not yours.

http://northernplanets.blogspot.com.au/2007/03/how-not-to-validate-email-addresses.html

http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx

http://haacked.com/archive/2007/08/26/dont-be-a-validation-nazi.aspx


&lt;/pre&gt;</description>
    <dc:creator>Steven D'Aprano</dc:creator>
    <dc:date>2012-05-25T00:46:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711096">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711096</link>
    <description>&lt;pre&gt;
Committed to an asylum or to source control?

Python is an asylum. Ruled by a Benevolent Inmate For Life. And yes,
it's a life sentence.

ChrisA
&lt;/pre&gt;</description>
    <dc:creator>Chris Angelico</dc:creator>
    <dc:date>2012-05-24T23:48:05</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711095">
    <title>Re: Help doing it the "python way"</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711095</link>
    <description>&lt;pre&gt;On 5/24/2012 2:30 PM Paul Rubin said...


 &amp;gt;&amp;gt;&amp;gt; from itertools import chain
 &amp;gt;&amp;gt;&amp;gt; coord_list = zip(range(20,30),range(30,40))
 &amp;gt;&amp;gt;&amp;gt; a = [((x,y-1),(x,y+1)) for x,y in coord_list]
 &amp;gt;&amp;gt;&amp;gt; b = list(chain(((x,y-1),(x,y+1)) for x,y in coord_list))
 &amp;gt;&amp;gt;&amp;gt; a == b
True
 &amp;gt;&amp;gt;&amp;gt;

So, why use chain?  Is it a premature optimization?  Similar to the 
practice of using "".join(targets) vs targeta+targetb+...+targetn?

Emile


&lt;/pre&gt;</description>
    <dc:creator>Emile van Sebille</dc:creator>
    <dc:date>2012-05-24T23:12:34</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.general/711094">
    <title>Re: Email Id Verification</title>
    <link>http://permalink.gmane.org/gmane.comp.python.general/711094</link>
    <description>&lt;pre&gt;| Hello everyone..
| I am new to asp.net...

Time to run away fast before you're commited then:-)
You're aware this is a _python_ list/group, yes?

| I want to use Regular Expression validator in Email id verification..

You can't. Valid addresses including nesting comments. Regexps don't do
recursion.

| Can anyone tell me how to use this and what is the meaning of
| this
| \w+([-+.']\w+)*&amp;lt; at &amp;gt;\w+([-.]\w+)*\.\w+([-.]\w+)*

If you don't understand it, DON'T use it. And in any case, it is
simplistic (== wrong). As pointed out by others in this thread.
&lt;/pre&gt;</description>
    <dc:creator>Cameron Simpson</dc:creator>
    <dc:date>2012-05-24T23:03:36</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.python.general">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.python.general</link>
  </textinput>
</rdf:RDF>

