[RELEASE] Python 3.6.4 is now available

2017-12-19 Thread Ned Deily
On behalf of the Python development community and the Python 3.6
release team, I am happy to announce the availability of Python 3.6.4,
the fourth maintenance release of Python 3.6.  Detailed information
about the changes made in 3.6.4 can be found in the change log here:

https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-4-final

Please see "What’s New In Python 3.6" for more information about the
new features in Python 3.6:

https://docs.python.org/3.6/whatsnew/3.6.html

You can download Python 3.6.4 here:

https://www.python.org/downloads/release/python-364/

The next maintenance release of Python 3.6 is expected to follow in
about 3 months, around the end of 2018-03.  More information about the
3.6 release schedule can be found here:

https://www.python.org/dev/peps/pep-0494/

Enjoy!

--
  Ned Deily
  n...@python.org -- []

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


Re: Problem with timeit

2017-12-19 Thread Steve D'Aprano
On Tue, 19 Dec 2017 02:27 am, ast wrote:

> I discovered that log functions from math module
> works with integers, whatever their size, there is
> no conversion to float.
> 
>> import math
>> x = 123456**123456
>> math.log10(x)
> 628577.7303641582   (instantaneous)
> 
> so 628578 digits


Nice!

It also works with other bases:

py> x = 10**100
py> math.log(x, 2)
3321928.0948873623
py> x.bit_length()
3321929


Today I learned. Thank you.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: [OT] Python and Excel

2017-12-19 Thread Rustom Mody
On Tuesday, December 19, 2017 at 4:38:17 AM UTC+5:30, Les Cargill wrote:
> oliver wrote:
> > That would be amazing. I still have nightmares of when I had to create this
> > big options analysis VBA program in Excel 2007.
> > 
> 
> 
> Odd - I haven't found VBA itself to be all that horrible. Yeah, it's got 
> some serious weaknesses but it jut hasn't bit me badly, yet. Then again,
> it's not something I do a lot of.

In the era of Windows 95-98 I did some VBA — I quite liked the experience
Coming to libreoffice I find it boasts many languages which can program it
But Ive never managed to make any headway

Evidently documentation matters more than fancy language features [at least to 
me]
-- 
https://mail.python.org/mailman/listinfo/python-list


Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread Ziggy
I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread Rhodri James

On 19/12/17 18:33, Ziggy wrote:

I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/


Nope.  Not following a link from someone I don't know (with all due 
respect) with a URL I don't immediately recognise.  If you want help, 
post your code here, preferably trimmed down to the minimum you need to 
demonstrate the problem.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread MRAB

On 2017-12-19 18:33, Ziggy wrote:

I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/

The function called by .after should return to the tkinter's event loop. 
If you want to display a sequence of pictures, then the function should 
call .after to make it call the function again.


Here's a slightly reworked version:


import collections
import os

pictures = collections.deque()

for folder, subfolders, files in os.walk('/home/vimart/Python/img/'):
for file in files:
pictures.append(os.path.join(folder, file))

canvas_width = 300
canvas_height =300

master = Tk()

canvas = Canvas(master, width=canvas_width, height=canvas_height)
canvas.pack()

img = PhotoImage(file="sport.gif")
canvas.create_image(20,20, anchor=NW, image=img)

def change_img():
canvas.delete("all")
canvas.img = PhotoImage(file=pictures.popleft())
canvas.create_image(20,20, anchor=NW, image=canvas.img)

# If there's more to come, call again later.
if pictures:
master.after(3000, change_img)

master.after(3000, change_img)
mainloop()
--
https://mail.python.org/mailman/listinfo/python-list


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

2017-12-19 Thread alister via Python-list
On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:

> 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.

At which point you have basicaly boiled your test down to 
@. which is rather pointless

there are only 2 reasons why you would want an email anyway

1) Data mining, just to add to your mailing list- in which case even if 
it validates you still don't know if it is a fake address to prevent spam 
so validating is pointless

2) it is part of a registration process, in which case if it is incorrect 
the registration email will not be received & registration cannot be 
completed so self validating without any effort.




-- 
OMNIVERSAL AWARENESS??  Oh, YEH!!  First you need four GALLONS of JELL-O
and a BIG WRENCH!! ... I think you drop th'WRENCH in the JELL-O as if
it was a FLAVOR, or an INGREDIENT ... ... or ... I ... um ... WHERE'S
the WASHING MACHINES?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread namenobodywants
On Monday, December 18, 2017 at 10:16:07 PM UTC-8, Terry Reedy wrote:

> Where or how have you looked so far?  How formal do you want?

i want full-on formal with lots of rigor and every possible detail spelled out; 
i've looked in a couple of books but my best lead so far is a paper by knuth 
called "an analysis of alpha-beta pruning" - what i need is along those lines 
but with just a few more of the details spelled out

peace
stm

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


Re: [Python-Dev] [RELEASE] Python 3.6.4 is now available

2017-12-19 Thread Hasan Diwan
Grats to all!

On 19 December 2017 at 00:42, Ned Deily  wrote:

> On behalf of the Python development community and the Python 3.6
> release team, I am happy to announce the availability of Python 3.6.4,
> the fourth maintenance release of Python 3.6.  Detailed information
> about the changes made in 3.6.4 can be found in the change log here:
>
> https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-4-final
>
> Please see "What’s New In Python 3.6" for more information about the
> new features in Python 3.6:
>
> https://docs.python.org/3.6/whatsnew/3.6.html
>
> You can download Python 3.6.4 here:
>
> https://www.python.org/downloads/release/python-364/
>
> The next maintenance release of Python 3.6 is expected to follow in
> about 3 months, around the end of 2018-03.  More information about the
> 3.6 release schedule can be found here:
>
> https://www.python.org/dev/peps/pep-0494/
>
> Enjoy!
>
> --
>   Ned Deily
>   n...@python.org -- []
>
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> hasan.diwan%40gmail.com
>



-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
http://bit.ly/hd1ScheduleRequest.
Si vous voudrais faire connnaisance, allez a
http://bit.ly/hd1ScheduleRequest.

Sent
from my mobile device
Envoye de mon portable
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2017-12-19 Thread Chris Angelico
On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list
 wrote:
> On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:
>> 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.
>
> At which point you have basicaly boiled your test down to
> @. which is rather pointless

Not quite. Firstly, I would exclude all whitespace from your matchable
characters; even though technically you CAN have spaces in email
addresses, that'll almost never happen, and it's a lot more common to
delimit with whites. Secondly, there's actually no requirement to have
a dot in the domain part (and Ben never said so). However, you can
straight-forwardly validate the domain by attempting a lookup.

rosuav@sikorsky:~$ dig +short mx ntlworld.com
1 mx.tb.ukmail.iss.as9143.net.
1 mx.mnd.ukmail.iss.as9143.net.
rosuav@sikorsky:~$ dig +short mx benfinney.id.au
10 in1-smtp.messagingengine.com.
20 in2-smtp.messagingengine.com.
rosuav@sikorsky:~$ dig +short mx dud.example.off.rosuav.com
rosuav@sikorsky:~$

If there are no MX records for a domain, either the domain doesn't
exist, or it doesn't receive mail. (Remove the "+short" for a more
verbose report, in which case the failure state is a return code of
NXDOMAIN.)

> there are only 2 reasons why you would want an email anyway
>
> 1) Data mining, just to add to your mailing list- in which case even if
> it validates you still don't know if it is a fake address to prevent spam
> so validating is pointless
>
> 2) it is part of a registration process, in which case if it is incorrect
> the registration email will not be received & registration cannot be
> completed so self validating without any effort.

3) You're building a text display system (forum posts, text chat, etc,
etc) and want to have web links and email addresses automatically
become clickable

4) You ask a user to provide "contact information". If s/he provides
an email address, you automatically send emails; if a phone number,
you automatically send SMS/text messages; otherwise, you leave it up
to a human to contact the user.

Plenty of possibilities beyond those two. Don't assume there's nothing
else that can be done just because your imagination can't come up with
anything :)

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


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

2017-12-19 Thread alister via Python-list
On Wed, 20 Dec 2017 08:21:02 +1100, Chris Angelico wrote:

> On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list
>  wrote:
>> On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:
>>> 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.
>>
>> At which point you have basicaly boiled your test down to
>> @. which is rather pointless
> 
> Not quite. Firstly, I would exclude all whitespace from your matchable
> characters; even though technically you CAN have spaces in email
> addresses, that'll almost never happen, and it's a lot more common to
> delimit with whites. Secondly, there's actually no requirement to have a
> dot in the domain part (and Ben never said so). However, you can
> straight-forwardly validate the domain by attempting a lookup.
> 
> rosuav@sikorsky:~$ dig +short mx ntlworld.com 1
> mx.tb.ukmail.iss.as9143.net.
> 1 mx.mnd.ukmail.iss.as9143.net.
> rosuav@sikorsky:~$ dig +short mx benfinney.id.au 10
> in1-smtp.messagingengine.com.
> 20 in2-smtp.messagingengine.com.
> rosuav@sikorsky:~$ dig +short mx dud.example.off.rosuav.com
> rosuav@sikorsky:~$
> 
> If there are no MX records for a domain, either the domain doesn't
> exist, or it doesn't receive mail. (Remove the "+short" for a more
> verbose report, in which case the failure state is a return code of
> NXDOMAIN.)
> 
>> there are only 2 reasons why you would want an email anyway
>>
>> 1) Data mining, just to add to your mailing list- in which case even if
>> it validates you still don't know if it is a fake address to prevent
>> spam so validating is pointless
>>
>> 2) it is part of a registration process, in which case if it is
>> incorrect the registration email will not be received & registration
>> cannot be completed so self validating without any effort.
> 
> 3) You're building a text display system (forum posts, text chat, etc,
> etc) and want to have web links and email addresses automatically become
> clickable
possible but again if people making the posts want to be contacted & will 
list a working email address, more likely it will be munged to stop the 
spammers from harvesting it. otherwise if an emaikl has to be given they 
will provide a valid looking fake.
> 
> 4) You ask a user to provide "contact information". If s/he provides an
> email address, you automatically send emails; if a phone number, you
> automatically send SMS/text messages; otherwise, you leave it up to a
> human to contact the user.
> 
I can see auto detecting between a Tel no & an email may be a plausible 
desire, you now have 2 problems because not only are email address so 
difficult to validate that it is not worth the effort telephone numbers 
are also to variable to validate reliably (assuming an international 
audience)

> Plenty of possibilities beyond those two. Don't assume there's nothing
> else that can be done just because your imagination can't come up with
> anything :)

Indeed the most obvious other reason is scraping web pages Newsgroups & 
forums for email addresses to spam & I am sure no-one wants to help with 
that

> 
> ChrisA





-- 
I know you believe you understand what you think this fortune says, but
I'm not sure you realize that what you are reading is not what it means.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2017-12-19 Thread Random832
On Mon, Dec 18, 2017, at 02:01, Chris Angelico wrote:
> 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?

What's impossible to match with a regex are the comments permitted by RFC822 
(which are delimited by balanced parentheses - AIUI perl can do it, python 
can't.) Which are, according to my argument, not part of the address.

> 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.

Email addresses don't, according to the formal spec, allow a dot at the end of 
the domain part. I was half-seriously proposing that as an extension (since DNS 
names *do*).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread Steve D'Aprano
On Wed, 20 Dec 2017 07:23 am, namenobodywa...@gmail.com wrote:

> On Monday, December 18, 2017 at 10:16:07 PM UTC-8, Terry Reedy wrote:
> 
>> Where or how have you looked so far?  How formal do you want?
> 
> i want full-on formal with lots of rigor and every possible detail spelled
> out; i've looked in a couple of books but my best lead so far is a paper by
> knuth called "an analysis of alpha-beta pruning" - what i need is along
> those lines but with just a few more of the details spelled out

Does this have anything specifically to do with Python programming?

If not, why are you asking here? Do you think that Python programmers are
especially well-known for their hard-core formal academic methodology?

Have you tried searching on Google Scholar?

We're pretty accepting of off-topic posts here, especially when they evolve
naturally from an on-topic post. But in future, if you're going to *start* an
off-topic thread from the first post, it would be polite to label it such
with an "[OT]" or "Off-topic" prefix to the subject line.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


adding elif to for

2017-12-19 Thread bob gailer

Has any thought been given to adding elif to the for statement?

for x in foo:
    if y: break
elif a==b:
    something
else:
    something else

as a shortcut to:
for x in foo:
    if y: break
else:
    if a==b:
    something
else:
    something else
bob gailer
--
https://mail.python.org/mailman/listinfo/python-list


Re: adding elif to for

2017-12-19 Thread Bill

bob gailer wrote:

Has any thought been given to adding elif to the for statement?


I don't think it is a good idea because it needlessly, from my point of 
view, embeds too much complexity into a single construct (making it more 
difficult to maintain, for instance). That's what language designer's do 
though--they kick ideas like that around.  If you have a great idea, 
maybe propose a new language.




for x in foo:
if y: break
elif a==b:
something
else:
something else

as a shortcut to:
for x in foo:
if y: break
else:
if a==b:
something
else:
something else
bob gailer


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


Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Apologies. Misread your question.

Skip

On Dec 19, 2017 6:16 PM, "Skip Montanaro"  wrote:

>
> Has any thought been given to adding elif to the for statement?
>
>
> Time machine at work I think:
>
> https://docs.python.org/3/reference/compound_stmts.html#the-if-statement
>
> Skip
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Has any thought been given to adding elif to the for statement?


Time machine at work I think:

https://docs.python.org/3/reference/compound_stmts.html#the-if-statement

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


Re: [OT] Python and Excel

2017-12-19 Thread Thomas Jollans
On 2017-12-18 20:16, MRAB wrote:
> Those who use Excel might find this interesting:
> 
> Microsoft Considers Adding Python as an Official Scripting Language to
> Excel
> https://www.bleepingcomputer.com/news/microsoft/microsoft-considers-adding-python-as-an-official-scripting-language-to-excel/
> 

I don't use Excel, but if this happens it could be really good news for
IronPython.


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


[META] Are the list admins honouring Posting Prohibited demands?

2017-12-19 Thread Steve D'Aprano
This is possibly a question for the list admins...

I notice that Lawrence D’Oliveiro has taken up labelling his posts with a
demand that his posts are not to be posted to the Python-List mailing list.

I also see that his posts are not showing up on the mailing list archive. Is
this a coincidence or a direct consequence of his demand?


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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