Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 5:59 PM, Marko Rauhamaa  wrote:
> Chris Angelico :
>
>> On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
>>> Then I graduated and joined the workforce. Since then, I have learned
>>> a thing or two, but I learned more during my first year in college
>>> than I have during the 25 since I left.
>>
>> Interesting. I'm not surprised that you can learn more in college than
>> in the years *prior* to it (if you were just dabbling), but I would
>> have expected that you learn more actually on the job. Are you
>> seriously saying that you've been 25 years in the workforce and not
>> learned anything new?
>
> Let's see. What I have learned on the job is projects and processes
> (even though college tried to give a taste of those, as well). Then, I
> have gathered some encyclopedic knowledge about programming languages,
> libraries, frameworks and operating systems. Finally, I have developed
> routine.
>
> But true eye-openers took place in college: data structures, algorithms,
> complexity theory, parsing and compiling, recursion, object-oriented
> programming, logic programming, functional programming, distributed
> systems, cryptography, logic and formalisms, mathematical rigor etc.
>

So if you were to choose between two potential hires, one who had 25
years' experience and the other had nothing but college, which would
you choose? Are you worth virtually the same salary now as you were
worth straight out of college?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 5:43 PM, Random832  wrote:
> On Sun, Dec 17, 2017, at 10:46, Chris Angelico wrote:
>> But if you're trying to *validate* an email address - for instance, if
>> you receive a form submission and want to know if there was an email
>> address included - then my recommendation is simply DON'T. You can't
>> get all the edge cases right; it is actually impossible for a regex to
>> perfectly match every valid email address and no invalid addresses.
>
> That's not actually true (the thing that notoriously can't be matched in
> a regex, RFC822 "address", is basically most of the syntax of the To:
> header - the part that is *the address* as we speak of it normally is
> "addr-spec" and is in fact a regular language, though a regex to match
> it goes on for a few hundred characters.

Hmm, is that true? I was under the impression that the quoting rules
were impossible to match with a regex. Or maybe it's just that they're
impossible to match with a *standard* regex, but the extended
implementations (including Python's, possibly) are able to match them?

Anyhow, it is FAR from simple; and also, for the purpose of "detect
email addresses in text documents", not desirable. Same as with URL
detection - it's better to have a handful of weird cases that don't
autolink correctly than to mis-detect any address that's at the end of
a sentence, for instance. For that purpose, it's better to ignore the
RFC and just craft a regex that matches *common* email address
formats.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Marko Rauhamaa
Chris Angelico :

> On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
>> Then I graduated and joined the workforce. Since then, I have learned
>> a thing or two, but I learned more during my first year in college
>> than I have during the 25 since I left.
>
> Interesting. I'm not surprised that you can learn more in college than
> in the years *prior* to it (if you were just dabbling), but I would
> have expected that you learn more actually on the job. Are you
> seriously saying that you've been 25 years in the workforce and not
> learned anything new?

Let's see. What I have learned on the job is projects and processes
(even though college tried to give a taste of those, as well). Then, I
have gathered some encyclopedic knowledge about programming languages,
libraries, frameworks and operating systems. Finally, I have developed
routine.

But true eye-openers took place in college: data structures, algorithms,
complexity theory, parsing and compiling, recursion, object-oriented
programming, logic programming, functional programming, distributed
systems, cryptography, logic and formalisms, mathematical rigor etc.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Random832
On Sun, Dec 17, 2017, at 10:46, Chris Angelico wrote:
> But if you're trying to *validate* an email address - for instance, if
> you receive a form submission and want to know if there was an email
> address included - then my recommendation is simply DON'T. You can't
> get all the edge cases right; it is actually impossible for a regex to
> perfectly match every valid email address and no invalid addresses.

That's not actually true (the thing that notoriously can't be matched in
a regex, RFC822 "address", is basically most of the syntax of the To:
header - the part that is *the address* as we speak of it normally is
"addr-spec" and is in fact a regular language, though a regex to match
it goes on for a few hundred characters. The formal syntax also has some
surprising corners that might not reflect real-world implementations:
for example, a local-part may not begin or end with a dot or contain two
dots in a row (unless quoted - the suggestion someone else made that a
local-part may contain an @ sign also requires quoting). It's also
unfortunate that a domain-part may not end with the dot, since this
would provide a way to specify TLD- only addresses without allowing the
error of mistakenly leaving the TLD off of an address.

> And that's only counting *syntactically* valid - it doesn't take into
> account the fact that "b...@junk.example.com" is not going to get
> anywhere. So if you're trying to do validation, basically just don't.

The recommendation still stands, of course - this script is probably not
the place to explore these obscure corners. If the email address is
important, you can send a link to it and wait for them to click it to
confirm the email. If it's not, don't bother at all.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 4:04 PM, Chris Angelico  wrote:

On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:

Chris Angelico wrote:

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


Then how are you going to explain dynamic_cast?


I wouldn't. I'd teach Python to beginning programmers. C++ is not a
good first language.

And even for C++ programners, you can go a pretty long way without dynamic_cast.
You either know it exists, and what it can do for you, or you don't.  If 
you want to teach a 2nd course in C++, and leave out vtables and 
dynamic_cast, I don't have a problem with that. If you always choose the 
lowest common denominator, your class may not be that interesting.  I 
told my students that my goal was for them was to learn how to learn so 
that they "didn't need me".




ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Christian Gollwitzer

Am 17.12.17 um 15:30 schrieb Skip Montanaro:

I've emailed the administrator of bbs.geek.nz, maybe he
will be able to stop it.


Thanks, Greg. We're actually blocking via that and related headers at
the gateway, which is why the mailing list is no longer seeing the
duplicates. I'm not sure any of us thought to email the news server
admin, though!


I did; the address is fake.


Worked for me. From the URL http://news.bbs.geek.nz/

*Welcome to Agency News - a Usenet News system located in Dunedin, New
Zealand.*
*...*
*Agency News is run as a not-for-profit hobby and offers free access to
text-only Usenet News*
*...*
*Contact - newsmaster {at} news.bbs.geek.nz  to
obtain a username / password.*

I just sent a note to that email address. No bounce yet.


He already replied; maybe it's not going through to the list because of 
the blocking. Here is the post:



Apologies guys for the dupes being injected in to this newsgroup.

I run a message network using Fido Technical Networking standards and a
single node within fsxNet (bbs.geek.nz/fsxnet.zip) that was connected to the
gateway software had seemingly sent a bunch of looped messages though the
gateway. I have closed the node access off and removed some borked packets on
my side of the gateway.

Hopefully someone will see this reply and know I've acted as soon as I heard
from Greg. :)

If anyone spots anything further amiss you can reach me at avon [at] bbs
[dot] geek [dot] nz

Best, Paul


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:


I agree with some of that, but you then take it to absurdity. You most
certainly CAN drive a car without knowing how one works; in fact, with
this century's cars, I think that's very much the case. How many
people REALLY know what happens when you push the accelerator pedal,
and how that makes the car go faster? Originally, it would actually
open a valve and allow more fuel into the engine; now, it's all
managed by a computer. So how much can you really understand of how it
works?


You can understand the "systems" which comprise your car. Engine, 
Cooling, braking, transmission, exhaust, etc.  And you can similarly 
understand the systems which comprise the workings of your computer 
program. As it happens, I've been studying electronics lately.
In answer to your question, there is an "invisible line" between 
hardware and software which most people don't generally cross. As 
another response to your question, try to master all of the features of 
the emacs editor. Personally, I've never felt motivated enough to do so.





You can certainly use functions without knowing details of the
run-time stack, though you'll need at least SOME comprehension of it.

Avoiding functions and documentation, though, now you're just being ridiculous.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 4:04 PM, Chris Angelico  wrote:
> On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:
>> Chris Angelico wrote:
>>>
>>> I don't know about vtables as needing to be in ANY programming course.
>>> They're part of a "let's dive into the internals of C++" course. You
>>> certainly don't need them to understand how things work in Python,
>>> because they don't exist; and I'm doubtful that you need to explain
>>> them even to C++ programmers.
>>>
>> Then how are you going to explain dynamic_cast?
>>
>
> I wouldn't. I'd teach Python to beginning programmers. C++ is not a
> good first language.

And even for C++ programners, you can go a pretty long way without dynamic_cast.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:
> Chris Angelico wrote:
>>
>> I don't know about vtables as needing to be in ANY programming course.
>> They're part of a "let's dive into the internals of C++" course. You
>> certainly don't need them to understand how things work in Python,
>> because they don't exist; and I'm doubtful that you need to explain
>> them even to C++ programmers.
>>
> Then how are you going to explain dynamic_cast?
>

I wouldn't. I'd teach Python to beginning programmers. C++ is not a
good first language.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


Then how are you going to explain dynamic_cast?



Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:31 PM, Bill  wrote:
> Chris Angelico wrote:
>>
>>
>> I don't know about vtables as needing to be in ANY programming course.
>> They're part of a "let's dive into the internals of C++" course. You
>> certainly don't need them to understand how things work in Python,
>> because they don't exist; and I'm doubtful that you need to explain
>> them even to C++ programmers.
>
>
> I guess "need to" is a relative thing. You can drive a car without know how
> one works. You can use functions with little knowledge of a run-time stack.
> You can avoid recursion if you are scared of it. And you can totally avoid
> functions if you are scared of them. And who needs documentation...seems
> like a big waste of time! Programmers don't need to know how to write, do
> they?  Ask some programmers that just taught themselves, and they will tell
> you!
>
> After reading, writing, and arithmetic, then perhaps programming.
>

I agree with some of that, but you then take it to absurdity. You most
certainly CAN drive a car without knowing how one works; in fact, with
this century's cars, I think that's very much the case. How many
people REALLY know what happens when you push the accelerator pedal,
and how that makes the car go faster? Originally, it would actually
open a valve and allow more fuel into the engine; now, it's all
managed by a computer. So how much can you really understand of how it
works?

You can certainly use functions without knowing details of the
run-time stack, though you'll need at least SOME comprehension of it.

Avoiding functions and documentation, though, now you're just being ridiculous.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:


I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


I guess "need to" is a relative thing. You can drive a car without know 
how one works. You can use functions with little knowledge of a run-time 
stack. You can avoid recursion if you are scared of it. And you can 
totally avoid functions if you are scared of them. And who needs 
documentation...seems like a big waste of time! Programmers don't need 
to know how to write, do they?  Ask some programmers that just taught 
themselves, and they will tell you!


After reading, writing, and arithmetic, then perhaps programming.




Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:09 PM, Bill  wrote:
> I tried pretty hard not to say that. I said they needed some "mathematical
> sophistication"--not actual mathematics.  My error was using that expression
> among an audience not so familiar with that terminology. That said, I think
> I would have a hard time explaining polymorphism and vtables to a student
> who had not grasped the distributive property of multiplication over
> addition.
> You can try, and let me know how it goes for you... I've been there.

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.

Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 11:31 AM, Bill  wrote:

Larry Martell wrote:

So, your experience is that the style of learning you offer is

unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


You might benefit by a course in logic.  I never said that was the only way
to learn. I learned (BASIC) in 8th grade too.


You said earlier:


In my years of teaching experience, students who came to college without
the equivalent of "college algebra" were under-prepared for what was
expected of them. This is not just an opinion, it's a fact.

If you want to qualify that by saying that coming to college is not
the only way to learn programming, you'd better say so, because
otherwise, the tone of what you're saying says that students NEED
algebra prior to learning a programming language.


I tried pretty hard not to say that. I said they needed some 
"mathematical sophistication"--not actual mathematics.  My error was 
using that expression among an audience not so familiar with that 
terminology. That said, I think I would have a hard time explaining 
polymorphism and vtables to a student who had not grasped the 
distributive property of multiplication over addition.

You can try, and let me know how it goes for you... I've been there.

Bill




Logic isn't the problem here. Clarity of language is. Watch your
implications if you don't want to be misunderstood.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Automated distribution building tools to support SpamBayes

2017-12-17 Thread Skip Montanaro
Thanks. I've had a couple references to Appveyor, so will see if I can make
heads or tails of it during my Christmas-to-New Year's break.

Skip

On Dec 15, 2017 5:43 PM, "Ned Batchelder"  wrote:

> On 12/15/17 2:03 PM, Skip Montanaro wrote:
>
>> SpamBayes (http://www.spambayes.org/) has languished for quite awhile,
>> in part because nobody is around who can put together a Windows
>> installer. Unfortunately, most users are on Windows and have to work
>> around problems caused by the march of time and consequent beefing up
>> of Windows security.
>>
>> I don't do Windows, but I wonder... Can one of the various continuous
>> integration tools out there be enlisted to build Windows installers?
>> The SB code is written in Python, uses the Win32 extension, and is
>> hosted on GitHub (https://github.com/smontanaro/spambayes), so
>> something which plays nice with that environment would be a plus. I'm
>> slowly gaining familiarity at work with Bamboo (very, very slowly), so
>> the general idea of what CI tools can do is starting to sink in. Since
>> I'm a captive Atlassian customer at work, though, I don't know what
>> limitations I might encounter trying to use it in an open source
>> environment.
>>
>> Any feedback appreciated. As this is only Python-related in the sense
>> that SpamBayes is written in Python, feel free to reply off-list.
>>
>> Skip
>>
>
> I use AppVeyor CI to build Windows installers for coverage.py.  It's not
> straightforward though, there are Powershell scripts, etc. The config file
> is here: https://github.com/nedbat/coveragepy/blob/master/appveyor.yml
> with other necessities in the ci folder.
>
> Hope that helps,
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 11:31 AM, Bill  wrote:
> Larry Martell wrote:
>>
>> So, your experience is that the style of learning you offer is
>>>
>>> unsuitable to anyone who doesn't have some background in algebra.
>>> That's fine. For your course, you set the prereqs. But that's not the
>>> only way for someone to get into coding. You do NOT have to go to
>>> college before you start creating software. That is also not an
>>> opinion; it's a fact backed by a number of proven instances (myself
>>> included).
>
>
> You might benefit by a course in logic.  I never said that was the only way
> to learn. I learned (BASIC) in 8th grade too.
>

You said earlier:

> In my years of teaching experience, students who came to college without
> the equivalent of "college algebra" were under-prepared for what was
> expected of them. This is not just an opinion, it's a fact.

If you want to qualify that by saying that coming to college is not
the only way to learn programming, you'd better say so, because
otherwise, the tone of what you're saying says that students NEED
algebra prior to learning a programming language.

Logic isn't the problem here. Clarity of language is. Watch your
implications if you don't want to be misunderstood.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:

The point is that it takes a certain amount of what is referred to as
"mathematical maturity" (not mathematical knowledge) to digest a book
concerning computer programming.

Emphasis on *a book*.


In my years of teaching experience,
students who came to college without the equivalent of "college algebra"
were under-prepared for what was expected of them. This is not just an
opinion, it's a fact.

So, your experience is that the style of learning you offer is
unsuitable to anyone who doesn't have some background in algebra. That's fine. 
For your course, you set the prereqs.


I never said that they needed any knowledge of algebra.  But if they 
don't understand the logic behind an inequality, for instance, then may 
run into some trouble.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Gregory Ewing wrote:

Bill wrote:
In my years of teaching experience, students who came to college 
without the equivalent of "college algebra" were under-prepared for 
what was expected of them.


This could be simply because it weeds out people who aren't
good at the required style of thinking. 


I think that's absolutely true.  If someone gets out of high school and 
doesn't understand college algebra (~8th grade math), they come into a 
programming class with an inherent disadvantage. They "can't understand" 
the book, just like they "couldn't" understand their math book.





If that's true,
anything that exercises mathematical thinking should have
the same effect. There just doesn't happen to be anything
else in the mainstream education curriculum that does that.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Larry Martell wrote:

So, your experience is that the style of learning you offer is

unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


You might benefit by a course in logic.  I never said that was the only 
way to learn. I learned (BASIC) in 8th grade too.



I started coding when I was 16, in 1975. I wrote a downhill skiing
game in basic, which I had taught to myself. I went to collage when I
was 17, and I had taught myself FORTRAN and I tested out of the class.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
> Gregory Ewing :
>> Chris Angelico wrote:
>>> You do NOT have to go to college before you start creating software.
>>> That is also not an opinion; it's a fact backed by a number of proven
>>> instances (myself included).
>>
>> Me, too. I started programming (a tiny homebrew machine) when I was
>> about 12 or 13. I was just starting to get exposed to algebra at
>> school then.
>
> I thought I had programming covered when I entered college. I wondered
> if I'd be wasting my time and just collecting my diploma. However, after
> every year I realized I hadn't understood anything the year before.
> There was just such a wealth of understanding I never would have been
> able to come up with on my own.
>
> Then I graduated and joined the workforce. Since then, I have learned a
> thing or two, but I learned more during my first year in college than I
> have during the 25 since I left.
>
> What's more, everything I learned in college has been priceless in
> practical day-to-day work.
>

Interesting. I'm not surprised that you can learn more in college than
in the years *prior* to it (if you were just dabbling), but I would
have expected that you learn more actually on the job. Are you
seriously saying that you've been 25 years in the workforce and not
learned anything new?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Marko Rauhamaa
Gregory Ewing :
> Chris Angelico wrote:
>> You do NOT have to go to college before you start creating software.
>> That is also not an opinion; it's a fact backed by a number of proven
>> instances (myself included).
>
> Me, too. I started programming (a tiny homebrew machine) when I was
> about 12 or 13. I was just starting to get exposed to algebra at
> school then.

I thought I had programming covered when I entered college. I wondered
if I'd be wasting my time and just collecting my diploma. However, after
every year I realized I hadn't understood anything the year before.
There was just such a wealth of understanding I never would have been
able to come up with on my own.

Then I graduated and joined the workforce. Since then, I have learned a
thing or two, but I learned more during my first year in college than I
have during the 25 since I left.

What's more, everything I learned in college has been priceless in
practical day-to-day work.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Gregory Ewing

Chris Angelico wrote:

You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


Me, too. I started programming (a tiny homebrew machine) when
I was about 12 or 13. I was just starting to get exposed to
algebra at school then.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Gregory Ewing

Bill wrote:
In my years of teaching experience, 
students who came to college without the equivalent of "college algebra" 
were under-prepared for what was expected of them.


This could be simply because it weeds out people who aren't
good at the required style of thinking. If that's true,
anything that exercises mathematical thinking should have
the same effect. There just doesn't happen to be anything
else in the mainstream education curriculum that does that.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Larry Martell
On Sun, Dec 17, 2017 at 4:18 PM, Chris Angelico  wrote:
> On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:
>> The point is that it takes a certain amount of what is referred to as
>> "mathematical maturity" (not mathematical knowledge) to digest a book
>> concerning computer programming.
>
> Emphasis on *a book*.
>
>> In my years of teaching experience,
>> students who came to college without the equivalent of "college algebra"
>> were under-prepared for what was expected of them. This is not just an
>> opinion, it's a fact.
>
> So, your experience is that the style of learning you offer is
> unsuitable to anyone who doesn't have some background in algebra.
> That's fine. For your course, you set the prereqs. But that's not the
> only way for someone to get into coding. You do NOT have to go to
> college before you start creating software. That is also not an
> opinion; it's a fact backed by a number of proven instances (myself
> included).

I started coding when I was 16, in 1975. I wrote a downhill skiing
game in basic, which I had taught to myself. I went to collage when I
was 17, and I had taught myself FORTRAN and I tested out of the class.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 6:28 AM, Piyush Verma <114piy...@gmail.com> wrote:
> Yes Dieter, I see that it is connecting with 443 port number and service is
> running. Is this related to python version or mac?

Can you confirm that it really is an HTTPS server, not just an HTTP
server that's running on port 443? Try accessing it using a web
browser or some other program.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:
> The point is that it takes a certain amount of what is referred to as
> "mathematical maturity" (not mathematical knowledge) to digest a book
> concerning computer programming.

Emphasis on *a book*.

> In my years of teaching experience,
> students who came to college without the equivalent of "college algebra"
> were under-prepared for what was expected of them. This is not just an
> opinion, it's a fact.

So, your experience is that the style of learning you offer is
unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread dieter
Piyush Verma <114piy...@gmail.com> writes:

> Yes Dieter, I see that it is connecting with 443 port number and service is
> running. Is this related to python version or mac?

It might be.

Python does not perform the SSL handling itself but delegates it to
an external SSL library ("OpenSSL" on a *nix like platform).
SSL can use different protocols, e.g. for the encryption.
The error message might mean that the server side uses a protocol
which is not supported by the client side. In this case, you would need
to use a more up-to-date SSL library.


I have had no problems to acces "https://www.facebook.com/piyushkv1";
with "urllib2.urlopen" of Python 2.7.12 (on Ubuntu 16.4).

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ben Finney
Peng Yu  writes:

> Hi,
>
> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".

Others have address this question. I'll answer a separate one:

> Does anybody see what is wrong with it? Thanks.

One thing that's wrong with it is that it is far too restrictive.

> email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')

This excludes a great many email addresses that are valid. Please don't
try to restrict a match for email addresses that will exclude actual
email addresses.

For an authoritative guide to matching email addresses, see RFC 3696 §3
https://tools.ietf.org/html/rfc3696#section-3>.

A more correct match would boil down to:

* Match any printable Unicode characters (not just ASCII).

* Locate the *last* ‘@’ character. (An email address may contain more
  than one ‘@’ character; you should allow any printable ASCII character
  in the local part.)

* Match the domain part as the text after the last ‘@’ character. Match
  the local part as anything before that character. Reject an address
  that has either of these empty.

* Validate the domain by DNS request. Your program is not an authority
  for what domains are valid; the only authority for that is the DNS.

* Don't validate the local part at all. Your program is not an authority
  for what local parts are accepted to the destination host; the only
  authority for that is the destination mail host.

-- 
 \ “Jealousy: The theory that some other fellow has just as little |
  `\ taste.” —Henry L. Mencken |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Bill

Rustom Mody wrote:

In response to


Rustom Mody wrote:

On Saturday, December 16, 2017 at 9:45:17 AM UTC+5:30, Bill wrote:

so it really doesn't make that much difference where one starts, just
"Do It!".  :  )

Really ¿?
https://en.wikipedia.org/wiki/Principles_of_learning#Primacy


On Sunday, December 17, 2017 Bill wrote:

You would give precedence to something written on a wikipedia page over
your experience?

Bill also wrote:

…in college, the prerequisite of "at least co-enrolled in pre-calc",
turned out to be the right one (based upon quite a lot of teaching
experience).

So… I dont understand where you are coming from:
Is there such a thing as a “learning curve” or not?


The point is that it takes a certain amount of what is referred to as 
"mathematical maturity" (not mathematical knowledge) to digest a book 
concerning computer programming. In my years of teaching experience, 
students who came to college without the equivalent of "college algebra" 
were under-prepared for what was expected of them. This is not just an 
opinion, it's a fact. Of course, you could argue that a student who 
arrives at college needing to take college algebra is of a certain 
category. In your words, they are not yet ready to face any sort of 
(steep) learning curve.


Bill
--
https://mail.python.org/mailman/listinfo/python-list


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread Piyush Verma
Yes Dieter, I see that it is connecting with 443 port number and service is
running. Is this related to python version or mac?

Regards,
~Piyush
Facebook  Twitter


On Sat, Dec 16, 2017 at 1:59 PM, dieter  wrote:

> Piyush Verma <114piy...@gmail.com> writes:
>
> > Getting SSL error while connecting from httplib.HTTPSConnection.
> >
> > Any help would be appreciated.
> > ...
> > line 579, in __init__
> > self.do_handshake()
> >   File
> > "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/ssl.py",
> > line 808, in do_handshake
> > self._sslobj.do_handshake()
> > ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
>
> Are you sure, you try to connect to an HTTPS port?
>
> The error message tells you that the "ssl" handshake failed because
> the protocol was unknown (likely because the message was not understood).
> The most natural reason is to try to connect to something which is not
> prepared for an "ssl" handshake.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse.ArgumentParser formatter_class argument

2017-12-17 Thread Seb
On Sun, 17 Dec 2017 10:12:07 +0100,
Peter Otten <__pete...@web.de> wrote:

> Seb wrote:
>> As far as I can see it is currently impossible to apply more than one
>> class to an ArgumentParser.  For example, I'd like to use both
>> RawDescriptionHelpFormatter *and* ArgumentDefaultsHelpFormatter in an
>> ArgumentParser, but it seems that's impossible, as one can only
>> choose a single one.  Any suggestions?

> Try

> class MyHelpFormatter( argparse.RawDescriptionHelpFormatter,
> argparse.ArgumentDefaultsHelpFormatter ): pass

> parser = argparse.ArgumentParser(formatter_class=MyHelpFormatter)

Yes, that worked.

Thanks,
-- 
Seb

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ned Batchelder

On 12/17/17 10:29 AM, Peng Yu wrote:

Hi,

I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
Does anybody see what is wrong with it? Thanks.

$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:

import re
email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
s = 'a...@efg.hij.xyz.'
for email in re.findall(email_regex, s):
 print email

$ ./main.py
.hij



There are two problems: you have a group at the end to match .something, 
but you need to make that 1-or-more of those, with a +. Second, 
re.findall will only return the matched groups, so you need to change 
your final group to be a non-capturing group, with (?:...)


    email_regex = 
re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+')


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 2:29 AM, Peng Yu  wrote:
> Hi,
>
> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
> Does anybody see what is wrong with it? Thanks.
>
> $ cat main.py
> #!/usr/bin/env python
> # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 
> fileencoding=utf-8:
>
> import re
> email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
> s = 'a...@efg.hij.xyz.'
> for email in re.findall(email_regex, s):
> print email
>
> $ ./main.py
> .hij

What is the goal of your email address extraction? There are two
goals, one of which cannot be done perfectly but doesn't need to, and
the other cannot be done perfectly and is thus virtually useless. If
you want to detect email addresses in text and turn them into mailto:
links, it's okay to miss out some edge cases, and for that, I would
recommend keeping your regex REALLY simple - something like you have
above, but maybe even simpler. (And I wouldn't have the parentheses in
there, which I think might be what you're getting tripped up on.) But
if you're trying to *validate* an email address - for instance, if you
receive a form submission and want to know if there was an email
address included - then my recommendation is simply DON'T. You can't
get all the edge cases right; it is actually impossible for a regex to
perfectly match every valid email address and no invalid addresses.
And that's only counting *syntactically* valid - it doesn't take into
account the fact that "b...@junk.example.com" is not going to get
anywhere. So if you're trying to do validation, basically just don't.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


What is wrong with this regex for matching emails?

2017-12-17 Thread Peng Yu
Hi,

I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
Does anybody see what is wrong with it? Thanks.

$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:

import re
email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
s = 'a...@efg.hij.xyz.'
for email in re.findall(email_regex, s):
print email

$ ./main.py
.hij

-- 
Regards,
Peng
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Skip Montanaro
>> I've emailed the administrator of bbs.geek.nz, maybe he
>> will be able to stop it.
>
> Thanks, Greg. We're actually blocking via that and related headers at
> the gateway, which is why the mailing list is no longer seeing the
> duplicates. I'm not sure any of us thought to email the news server
> admin, though!

I did; the address is fake.


Worked for me. From the URL http://news.bbs.geek.nz/

*Welcome to Agency News - a Usenet News system located in Dunedin, New
Zealand.*
*...*
*Agency News is run as a not-for-profit hobby and offers free access to
text-only Usenet News*
*...*
*Contact - newsmaster {at} news.bbs.geek.nz  to
obtain a username / password.*

I just sent a note to that email address. No bounce yet.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Tim Golden



On 17/12/2017 13:22, Jon Ribbens wrote:

On 2017-12-17, Tim Golden  wrote:

On 17/12/17 00:10, Gregory Ewing wrote:

The duplicate posts all seem to have this header:

Injection-Info: news.bbs.geek.nz;
posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E";
  logging-data="4415"; mail-complaints-to="ab...@news.bbs.geek.nz"

I've emailed the administrator of bbs.geek.nz, maybe he
will be able to stop it.

Thanks, Greg. We're actually blocking via that and related headers at
the gateway, which is why the mailing list is no longer seeing the
duplicates. I'm not sure any of us thought to email the news server
admin, though!

I did; the address is fake.
Thanks, Jon. Looks like there's nothing for us to do on the mailing list 
but keep blocking, then!


TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Rustom Mody
On Saturday, December 16, 2017 at 6:11:31 PM UTC+5:30, Marko Rauhamaa wrote:
> Stefan Ram:
> 
> > Varun R writes:
> >>I'm new to programming, can anyone guide me, how to start
> >>learning python programming language
> >
> >   As a start, one should learn:
> >
> > 1.) how to install Python
> > (if not already installed)
> >
> > 2.) how to start the Python console
> > (if not already started)
> >
> > 3.) how to type characters into a line of the
> > console and how to submit the line (using
> > the Enter key) (if this is not already known)
> 
> A good list. Even more important, though, is the installation, use and
> understanding of a text editor. What is the difference of MS Word,
> Notepad and a Python-aware text editor? 

This is a useful 3-way classification
Just now dealing with a class in which students write python resolutely 
- using gedit
- on linux VMs
- on Windows hosts

So I wonder where on the spectrum
MS Word → notepad → Programmer’s editor
would you place gedit??
[If you know what that is ]


> What text editors are there?
Seriously?!?
Does that list ever end?

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread Rustom Mody
In response to

> Rustom Mody wrote:
>> On Saturday, December 16, 2017 at 9:45:17 AM UTC+5:30, Bill wrote:
>>> so it really doesn't make that much difference where one starts, just
>>> "Do It!".  :  )
>> Really ¿?
>> https://en.wikipedia.org/wiki/Principles_of_learning#Primacy


On Sunday, December 17, 2017 Bill wrote:
> You would give precedence to something written on a wikipedia page over
> your experience?

Bill also wrote:
> …in college, the prerequisite of "at least co-enrolled in pre-calc",
> turned out to be the right one (based upon quite a lot of teaching
> experience).

So… I dont understand where you are coming from:
Is there such a thing as a “learning curve” or not?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning (Posting On Python-List Prohibited)

2017-12-17 Thread Rustom Mody
On Sunday, December 17, 2017 at 6:39:41 AM UTC+5:30, Lawrence D’Oliveiro wrote:
> On Sunday, December 17, 2017 at 2:26:43 AM UTC+13, Marko Rauhamaa wrote:
> 
> > Unfortunately, Python's indentation mechanism makes the REPL too
> > frustrating an environment to type in even the simplest of function
> > definitions, let alone a whole class.
> 
> Let me suggest using a Jupyter notebook as an introductory program editor.

Um… Well…
At first I did not take jupyter seriously
“browser is the universal OS” — Sounds like the usual empty fluff

But now seeing things like this:
http://www.leouieda.com/blog/scipy-on-android.html
I guess I am going to be force
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Jon Ribbens
On 2017-12-17, Tim Golden  wrote:
> On 17/12/17 00:10, Gregory Ewing wrote:
>> The duplicate posts all seem to have this header:
>> 
>> Injection-Info: news.bbs.geek.nz; 
>> posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E";
>>  logging-data="4415"; mail-complaints-to="ab...@news.bbs.geek.nz"
>> 
>> I've emailed the administrator of bbs.geek.nz, maybe he
>> will be able to stop it.
>
> Thanks, Greg. We're actually blocking via that and related headers at 
> the gateway, which is why the mailing list is no longer seeing the 
> duplicates. I'm not sure any of us thought to email the news server 
> admin, though!

I did; the address is fake.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-17 Thread alister via Python-list
On Sat, 16 Dec 2017 14:41:00 +1200, Marko Rauhamaa wrote:

> r...@zedat.fu-berlin.de (Stefan Ram):
> 
>> Varun R  writes:
>>>I'm new to programming, can anyone guide me, how to start learning
>>>python programming language
>>
>>   As a start, one should learn:
>>
>> 1.) how to install Python
>> (if not already installed)
>>
>> 2.) how to start the Python console
>> (if not already started)
>>
>> 3.) how to type characters into a line of the
>> console and how to submit the line (using the Enter key) (if
>> this is not already known)
> 
> A good list. Even more important, though, is the installation, use and
> understanding of a text editor. What is the difference of MS Word,
> Notepad and a Python-aware text editor? What text editors are there?
> What is a newline? What is whitespace? (Advanced: what is a TAB.) What
> is the difference between lower case and upper case? What is trailing
> whitespace? What is an underscore?
> What is the difference between a parenthesis, bracket and a brace?
> 
> What is a file? What is a filename? What is a directory/folder? What is
> a pathname? What is a terminal (emulator)? What is standard input? What
> is standard output?
> 
> How do I see the listing of files? How do I erase a file? How do I
> rename a file? What is the current working directory? How do I change it
> and why?
> 
> 
> Marko

you seem to be moving more into knowledge about the operating system 
rather than programming itself.

Still a good pre-requisite you cannot hope to successfully program a 
system you do no know how to use



-- 
Mr Young hadn't had to quiet a screaming baby for years. He'd never been
much good at it to start with. He'd always respected Sir Winston 
Churchill,
and patting small versions of him on the bottom had always seemed
ungracious.
-- (Terry Pratchett & Neil Gaiman, Good Omens)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse.ArgumentParser formatter_class argument

2017-12-17 Thread Peter Otten
Seb wrote:

> As far as I can see it is currently impossible to apply more than one
> class to an ArgumentParser.  For example, I'd like to use both
> RawDescriptionHelpFormatter *and* ArgumentDefaultsHelpFormatter in an
> ArgumentParser, but it seems that's impossible, as one can only choose a
> single one.  Any suggestions?

Try 

class MyHelpFormatter(
argparse.RawDescriptionHelpFormatter,
argparse.ArgumentDefaultsHelpFormatter
):
pass

parser = argparse.ArgumentParser(formatter_class=MyHelpFormatter)

If there are any conflicts you have to write more code...

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Templating Language

2017-12-17 Thread Brian J. Oney via Python-list
I am not exactly sure what you mean, so I will guess. 

Jinja may be what you're looking for. It's an important component of flask & 
ansible, for example.

pyweave may also serve your purposes.

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list