Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Abdur-Rahmaan Janhangeer
me too i come from "other languages" but what i liked in python was python
now the world got mixed up again

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ

In the long run, why do we always fear people coming from other
> languages? Why don't they fear Python programmers coming to their
> language and saying "Why do I have to bother with these type
> declarations, why can't the compiler work it out?


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


Re: I lost nearly all my modules installing 3.7

2018-07-01 Thread tljarolimek
On Thursday, June 28, 2018 at 1:09:04 PM UTC-4, Elliott Roper wrote:
> I have done something stupid. Don't know what.
> 
> My $PATH looks like this
> XXXMac:~ elliott$ echo $PATH
> /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyth
> on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.
> 5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/bin
> :/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
> 
> pip3 list or pip3.7 list gives me
> Package Version
> -- ---
> pip 10.0.1
> setuptools 39.0.1
> > > > import numpy as np
> Traceback (most recent call last):
> File "", line 1, in 
> ModuleNotFoundError: No module named 'numpy'
> So it is not lying to me!!!
> 
> pip list or pip3.6 list
> gives the whole caboodle I was expecting with a far smaller version number 
> for setuptools.
> 
> My understanding is that the whole $PATH is searched in order to resolve an 
> import, but it isn't.
> 
> It might be relevant that I have had a bit of hassle installing module 
> updates in the past. I would get an error saying the module version being 
> replaced could not be deleted with permissions errors which I resolved with a 
> bit of sudo -H.
> 
> Python 3.6 is still working properly when invoked explicitly
> 
> -- 
> To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
> 637F 896B C810 E199 7E5C A9E4 8E59 E248

https://www.youtube.com/watch?v=rAlTOfl9F2w
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33972] AttributeError in email.message.iter_attachments()

2018-07-01 Thread Bradley Laney


Bradley Laney  added the comment:

Hey Sven,

New here, decided to try a bit at an issue. 

According to the email.message docs, "the payload is either a string or bytes 
object, in the case of simple message objects, or a list of EmailMessage 
objects, for MIME container documents such as multipart/* and message/rfc822 
message objects."

Like you said, this error happens if the email.message.EmailMessage object is 
bad, i.e. the payload is a string or bytes but the content-type is marked as 
multipart/*. After reading online, it seems like an error is necessary.

I've proposed a small change in a pull request to make this situation raise a 
more useful error. It doesn't blow up any earlier but it at least says 
something more useful. 

The function could return instead of throwing an error, just providing an empty 
iterator, but that seems even less useful.

I fixed it on master (3.8 dev or whatever).

Best,
Brad

--
nosy: +Bradley Laney
versions: +Python 3.8 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33972] AttributeError in email.message.iter_attachments()

2018-07-01 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +7650
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: logging module

2018-07-01 Thread dieter
Sharan Basappa  writes:
> I am trying to use logging module and somehow I cannot make it work.
>
> A simple code that I am trying is below. The commented code line 5,6 are 
> other options I have tried but don't work
>
> #importing module
> import logging
>  
> #Create and configure logger
> #logging.basicConfig(filename="D:/Projects/Initiatives/machine 
> learning/programs/newfile.log",
> #logging.basicConfig(filename="newfile.log",
> logging.basicConfig(format='%(asctime)s %(message)s')

You can provide more than a single argument to "basicConfig",
e.g. "...basicConfig(filename='...', format='...')".

> ...
> #Creating an object
> logger=logging.getLogger()
>  
> #Setting the threshold of logger to DEBUG
> logger.setLevel(logging.DEBUG)
>  
> #Test messages
> logger.debug("Harmless debug Message")
> logger.info("Just an information")
> logger.warning("Its a Warning")
> logger.error("Did you try to divide by zero")
> logger.critical("Internet is down")
>
> PS: I am running this under Enthought Canopy
>
> The following is the output
> %run "D:/Projects/Initiatives/machine learning/programs/debug_4.py"

Not sure, that "basicConfig" (without "filename" parameter)
logs to "stdout" or "stderr" (what you seem to expect).

Apart from that, your use of the "logging" module looks okay.
It should work (and usually does).

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


Re: I lost nearly all my modules installing 3.7

2018-07-01 Thread dieter
Elliott Roper  writes:
> ...
> I should have mentioned that none of this went wrong in 3.6. All I'm after 
> are packages I can install with pip3. I really don't need to go down all the 
> twisty passages installing Fortran

"pip[*]" is a tool to install Python packages.
But some Python packages are not pure Python and require
additional (beyond Python) infrastructure in your target system:
e.g. additional (operating) system packages, compilers, utilities, ...

Ideally, the installation instructions for a package would
describe which infrastructure is necessary. Of course,
you would need to consult them to find out whether a package
is pure Python or what additional components are necessary
in the target.

In my view, the packages you have reported problems with
do quite a good job: they provide precise and helpfull
error/warning messages during the installation process.
With their help, you can resolve the problems (or decide that
you do not need the package).

Side note: a missing "pkg-config" or Fortran compiler
is very likely not a "3.6" versus "3.7" issue.
It has to do with the target system (and its available infrastructure),
maybe the versions of the installed packages but not
the Python versions.


> I DID have pkg-config installed in ~/Library . site-packages.

Jim told us that "pkg-config" is not a Python package (but an
(operating) system package). Therefore, its expected place
is not below ".../site-packages". You must install it where
system packages are looked for -- or use system specific configuration
(likely, the envvar "PATH" in your case)
to look where you have installed it.

>I 
> uninstalled it and re-installed with an Admin account, where it appeared in 
> /Library ... site-packages
> but that made no difference, pip3 install -- user matplotlib still 
> complaining about pkg-config

"pkg-config" (once successfully installed) will provide
an operating system command "pkg-config". You can check whether
it is available and working by invoking "pkg-config" from the command
line.

On my system (Ubuntu) is is located at "/usr/bin/pkg-config".

On *nix like systems the envvar "PATH" controls where
operating system level commands are looked for.
Badly configuring "PATH" can lead to unexpectedly not finding
some commands.

> ...
> I do have write access. It looks like a Mac specific per user directory tree 
> for temporary stuff and installation records.

Apparently, you are on a "Mac". Its OS 10 started as
a *nix like system - but with many peculiarities. Not sure,
what of the above is applying.

What remains true: your "pkg-config" problem is not
a Python problem but an operating system level problem --
either with the installation of the "pkg-config" package
or with the configuration where commands are looked for.

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


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Jim Lee



On 07/01/18 18:21, Steven D'Aprano wrote:


Guido has been talking about this for a LONG time:


You keep bringing that up.  It's not an argument.

People have been talking about taxes for a long, long time.  Does it 
surprise you that they still do?  None of us has a time machine that 
will transport us back to the beginning to change the course of events.  
We can only read them as history (if we're lucky).  You enter the 
discussion whenever you get there.




And for a perspective on why this is not only something desirable, but
something which historically dynamic languages *used to have* but lost,
see

https://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html



I did get one epiphany out of that.  He's right - there are orders of 
magnitude more programmers today than there were a couple of decades ago 
- and they ARE almost all entry level, in that they are fluent in only 
one (maybe two) languages.


Back before the dot com boom, programmers (generally) knew at least 6, 
7, 8 languages.  They were intimately familiar with machine 
architecture, and knew how to pick the right language for any given task 
to exploit the features they wanted - speed, code size, I/O throughput, 
concurrency, interrupt latency, whatever.  In my case, the languages I 
became fluent in were C, Fortran, Assembly (several dialects and 
architectures), Forth, PL/M, Pascal, Modula-2, Oberon, Basic, Lisp, and 
Smalltalk.  Later on, Tcl, Hypertalk, Object Pascal, Prolog, and C++ 
were added.  Today, Python, Perl, Java and Lua round out the list.  And 
I have at least a working familiarity with several more.


The want ads used to be for positions like "systems programmer", 
"application programmer", "embedded engineer", "database designer", 
etc.  Today, the ads read "Java programmer", "Swift programmer", 
"Javascript programmer", ".NET architect".  The focus has shifted from 
the *domain* to the *language*.


And so, *most* of the new generation of programmers want to stick with 
one language for the long haul, and they'd like to cram every possible 
feature into it.  They look at the *language* the way we used to look at 
the *operating system*.


Languages that used to be small, lean, and exceptional at doing things 
really well in a given domain have morphed into large, monolithic, 
bloated language *systems* that do many things in many domains, and have 
many ways to do the *same* thing, but none of it particularly well.  
Throwing more processor horsepower and more GB of memory at the problem 
can only mask it for so long.


-Jim


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


[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@corona10 You might want to discuss this at 
https://mail.python.org/pipermail/python-ideas/ so that you get some initial 
feedback on the work and it's acceptance to the core.

Thanks

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 4:30 PM, eryk sun  wrote:
> On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano
>
>> spam/eggs
[...]
>> And how would that file be displayed in the Windows GUI file explorer?
>
> I suppose if a file system allowed forward slash in names that
> Explorer would just display it. When I get the time, I'll attach a
> debugger to explorer.exe and hack a forward slash into one of the
> names in a directory listing, i.e. a result from WinAPI FindFirstFile
> (or native NtQueryDirectoryFile).

I checked this by attaching a debugger to an instance of explorer.exe
and opening a folder that has a single file named "spam eggs.txt".
With a breakpoint on NtQueryDirectoryFile, I changed the filename to
"spam/eggs.txt" in the directory listing (an array of
FILE_ID_BOTH_DIR_INFORMATION records). As expected, Explorer just
displays the filename "spam/eggs.txt" if that's what the file system
returns from the NtQueryDirectoryFile system call. However, even if a
file system allowed such a name, it wouldn't be accessible normally.
It requires a \\?\ path, which bypasses canonicalization.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33944] Deprecate and remove pth files

2018-07-01 Thread Mark Hammond


Mark Hammond  added the comment:

pywin32, up until recently, just listed 3 directories in its .pth file - these 
were for directories which pre-dated packages and were never converted. Eg, 
"import win32api" actually loads win32api.pyd from the "site-packages/win32" 
directory.

Earlier this year, via https://github.com/mhammond/pywin32/issues/1151, I also 
added the line:

import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32"))

which is to support pywin32 being installed from wheels - this is due to 
pywin32 shipping with various shared DLLs which implement many pywin32 types - 
eg, pywintypesXX.dll is used by (almost) every single .pyd shipped with 
pywin32, and disutils doesn't offer any way of copying files as part of a 
post-install script or any other way of ensuring these .dll files are on the 
PATH or otherwise next to pythonXX.dll/.exe

I'm happy to replace both of these with alternatives when they exist.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 22:48:00 +0400, Abdur-Rahmaan Janhangeer wrote:

> not python, the spirit of python,
> 
> i guess i must have been around when it was first discussed, now it's
> too late to discuss why it was introduced in the first place ...

Guido has been talking about this for a LONG time:

https://www.artima.com/weblogs/viewpost.jsp?thread=85551

https://www.artima.com/weblogs/viewpost.jsp?thread=86641

https://www.artima.com/weblogs/viewpost.jsp?thread=87182


And for a perspective on why this is not only something desirable, but 
something which historically dynamic languages *used to have* but lost, 
see 

https://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html





-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Gregory Ewing

eryk sun wrote:

Python 2 raw strings are half-baked.


Obviously the "r" actually stand for "rare".

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


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 21:55:21 +0400, Abdur-Rahmaan Janhangeer wrote:

> i meant that x: int = 3 is dangerously close to int x = 3,
> 
> in the long run, you'll come across people who come from other languages
> wanting to java/c style their code and end up sprinkling a lot of these,
> it'll be a sad day for me

It is a sad day for me when I see Python programmers writing x=3 or using 
eight space tabs or putting a space before function call parentheses len 
(seq) too, but I cope.

Its a sad day for me when I see people on mailing lists top posting and 
not using capital letters or correct punctuation, but I cope with that 
too.

In the long run, why do we always fear people coming from other 
languages? Why don't they fear Python programmers coming to their 
language and saying "Why do I have to bother with these type 
declarations, why can't the compiler work it out?"


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue28657] cmd.Cmd.get_help() implementation can't see do_*() methods added dynamically by setattr()

2018-07-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Okay, I'll mark this as on-hold until you find the relevant code.

I'm not sure why you think modifying the class definition would look weird.  
That is the normal and intended place to put methods.  Likely, the only reason 
that you had any success at all when attaching a function to an instance was 
that it didn't need access to either "self" or "class".

--
resolution:  -> later
versions: +Python 3.8 -Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 
3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: logging module

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 06:05:48 -0700, Sharan Basappa wrote:

> Folks,
> 
> I am trying to use logging module and somehow I cannot make it work.
> 
> A simple code that I am trying is below. The commented code line 5,6 are
> other options I have tried but don't work
> 
> #importing module
> import logging
>  
> #Create and configure logger
> #logging.basicConfig(filename="D:/Projects/Initiatives/machine
> learning/programs/newfile.log",
> #logging.basicConfig(filename="newfile.log",
> logging.basicConfig(format='%(asctime)s %(message)s')

This is not the actual code you are using, because this gives a 
SyntaxError. You are missing a closing parentheses.

Please don't retype your code from memory. Copy and paste the actual 
code. It is hard enough to work out what code does when we can see it, it 
is next to impossible to work out what it does when we're given 
*different* code and have to guess how many changes have been made.


> #Creating an object
> logger=logging.getLogger()
>  
> #Setting the threshold of logger to DEBUG 
> logger.setLevel(logging.DEBUG)
>  
> #Test messages
> logger.debug("Harmless debug Message")
> logger.info("Just an information")
> logger.warning("Its a Warning")
> logger.error("Did you try to divide by zero")
> logger.critical("Internet is down")
> 
> PS: I am running this under Enthought Canopy
> 
> The following is the output
> %run "D:/Projects/Initiatives/machine learning/programs/debug_4.py"

Are you sure that is the OUTPUT?


It looks more like the input -- the command you are running. Have you 
looked inside the file 

D:/Projects/Initiatives/machine learning/programs/newfile.log

where output is going?


By the way, as a total beginner to this, I don't think you need the extra 
complexity and discipline of using log files. Don't try catching errors 
and logging them. Let the errors fail. While you are learning, the BEST 
thing to do is to learn to read the tracebacks and fix the bug in your 
code, not to try to cover them up and bury the failures inside a log file.

If you need informational messages, just use print.

You can come back to logging when you have more experience.

(I've been programming with Python for 20+ years, and I still use print 
for simple scripts and when learning a new library.)




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: logging module

2018-07-01 Thread Bev in TX



> On Jul 1, 2018, at 8:05 AM, Sharan Basappa  wrote:
> 
> Folks,
> 
> I am trying to use logging module and somehow I cannot make it work.

Saying that something does not work does not provide enough information for 
anyone to assist you.  You need to provide both the exact code that did not 
work, what you expected and what happened, and the error message that you 
received, if any.  Details, details and more details.

> 
> A simple code that I am trying is below. The commented code line 5,6 are 
> other options I have tried but don't work
> 
> #importing module
> import logging
> 
> #Create and configure logger
> #logging.basicConfig(filename="D:/Projects/Initiatives/machine 
> learning/programs/newfile.log",
> #logging.basicConfig(filename="newfile.log",
> logging.basicConfig(format='%(asctime)s %(message)s')
> 
> #Creating an object
> logger=logging.getLogger()
> 
> #Setting the threshold of logger to DEBUG
> logger.setLevel(logging.DEBUG)
> 
> #Test messages
> logger.debug("Harmless debug Message")
> logger.info("Just an information")
> logger.warning("Its a Warning")
> logger.error("Did you try to divide by zero")
> logger.critical("Internet is down")
> 
> PS: I am running this under Enthought Canopy
> 
> The following is the output
> %run "D:/Projects/Initiatives/machine learning/programs/debug_4.py"
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Bev in TX




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


[issue34010] tarfile stream read performance

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

Nice catch.

I confirmed this is a hard regression of performance.
Decompressing a file must be O(n) when n=filesize, but O(n^2) now.

While we live with this regression for a long time, I feel it's worth enough to 
backport.
This can be DoS vulnerability.

Can you write NEWS entry for it?

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33995] test_min_max_version in test_ssl.py fails when Python is built against LibreSSL; {min,max}imum_version behavior differs from OpenSSL

2018-07-01 Thread Alan Huang


Change by Alan Huang :


--
components:  -Documentation
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


Lucas Sampaio  added the comment:

ok, I got it

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

print(type(lista4[2]))

 6 8 10['6', '8', '10']
['10', '6', '8']


ok, I got it

2018-07-01 18:05 GMT-03:00 Tim Peters :

>
> Tim Peters  added the comment:
>
> Lucas, as Mark said you're sorting _strings_ here, not sorting integers.
> Please study his reply.  As strings, "10" is less than "9", because "1" is
> less than "9".
>
> >>> "10" < "9"
> True
> >>> 10 < 9
> False
>
> --
> nosy: +tim.peters
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34016] Bug in sort()

2018-07-01 Thread Tim Peters


Tim Peters  added the comment:

Lucas, as Mark said you're sorting _strings_ here, not sorting integers.  
Please study his reply.  As strings, "10" is less than "9", because "1" is less 
than "9".

>>> "10" < "9"
True
>>> 10 < 9
False

--
nosy: +tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


Lucas Sampaio  added the comment:

same code with another input
type is list

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

 6 8 9
['6', '8', '9']
['6', '8', '9']


lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

 10 11 12
 
['10', '11', '12']
['10', '11', '12']

but if you put a 9 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34016] Bug in sort()

2018-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

This isn't a bug: I'm guessing that you expected an output of `['6', '8', 
'10']`, but in the example you give you're sorting strings rather than numbers, 
and those strings are sorted lexicographically (i.e., using "dictionary order") 
as normal.

If you want to do a numeric sort, convert your inputs to numbers first.

>>> lista4 = ['6', '8', '10']
>>> lista4_numbers = [int(s) for s in lista4]
>>> lista4_numbers.sort()
>>> lista4_numbers
[6, 8, 10]

--
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


New submission from Lucas Sampaio :

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

Input = 6 8 10

Output:
 6 8 10
['6', '8', '10']
['10', '6', '8']

a bug occurs when setting the 10

--
messages: 320843
nosy: lucassdssampaio
priority: normal
severity: normal
status: open
title: Bug in sort()
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33955] Implement PyOS_CheckStack on macOS using pthread_get_stack*_np

2018-07-01 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Sure. I'm not working on this at the moment.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Abdur-Rahmaan Janhangeer
not python, the spirit of python,

i guess i must have been around when it was first discussed, now it's too
late to discuss why it was introduced in the first place ...

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ

I'm sure people will misuse type hints too. What of it? Does it
> destroy Python when people use it inefficiently?
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Chris Angelico
On Mon, Jul 2, 2018 at 3:55 AM, Abdur-Rahmaan Janhangeer
 wrote:
> i meant that x: int = 3 is dangerously close to int x = 3,
>
> in the long run, you'll come across people who come from other languages
> wanting to java/c style their code and end up sprinkling a lot of these,
> it'll be a sad day for me

People already write code like this:

for i in range(len(stuff)): #{
frobnicate(stuff[i])
#}

I'm sure people will misuse type hints too. What of it? Does it
destroy Python when people use it inefficiently?

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


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Abdur-Rahmaan Janhangeer
i meant that x: int = 3 is dangerously close to int x = 3,

in the long run, you'll come across people who come from other languages
wanting to java/c style their code and end up sprinkling a lot of these,
it'll be a sad day for me

return type in function definition also managed to return via ->

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
Mauritius

PEP 526 says that the annotation would be:
>
> x: int = 3
>
> It also says """It should also be emphasized that Python will remain a
> dynamically typed language, and the authors have no desire to ever make
> type hints mandatory, even by convention.""
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Ian Kelly
On Sun, Jul 1, 2018 at 11:09 AM Abdur-Rahmaan Janhangeer
 wrote:
>
> was viewing pep526, so, finally, python cannot do without hinting the type
> as other languages?

Python certainly can do without it. That's why it's an optional
feature with no runtime effect beyond making the annotations
inspectable and causing unassigned function variables to be considered
locals.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread MRAB

On 2018-07-01 18:06, Abdur-Rahmaan Janhangeer wrote:

was viewing pep526, so, finally, python cannot do without hinting the type
as other languages?
will python finally move to
int x = 3 where int is a pre annotation?

i am not arguing it's usefulness but rather, does it fit with python?


PEP 526 says that the annotation would be:

x: int = 3

It also says """It should also be emphasized that Python will remain a 
dynamically typed language, and the authors have no desire to ever make 
type hints mandatory, even by convention.""

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


PEP 526 - var annotations and the spirit of python

2018-07-01 Thread Abdur-Rahmaan Janhangeer
was viewing pep526, so, finally, python cannot do without hinting the type
as other languages?
will python finally move to
int x = 3 where int is a pre annotation?

i am not arguing it's usefulness but rather, does it fit with python?

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 4:00 PM, Abdur-Rahmaan Janhangeer
 wrote:
> one common scenario is
>
> C:\Users\
>
> where \U is taken as a unicode litteral

This one is especially annoying in Python 2, since it makes raw
unicode strings useless for common path literals. For example:

>>> ur'C:\Users'
  File "", line 1
SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode
bytes in position 2-3: truncated \u

>>> ur'C:\users'
  File "", line 1
SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode
bytes in position 2-3: truncated \u

Python 2 raw strings are half-baked.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano
 wrote:
> On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:
>
>> Bear in mind that forward slash is just a  name character in NT.
>
> So, using Python, how could you open, write to, and then read from, a
> file with a slash in its name? Say, something like:

By that I meant that NT's base object namespace treats forward slash
as a name character, i.e. object names in the base NT namespace can
include slash. This includes Device objects in the "\Device" directory
and "DOS" device symbolic links to them in "\Global??" or a
subdirectory of "\Sessions\0\DosDevices", as well as other named
objects (Section, Job, Event, Semaphore, etc). The Windows API stores
most of the latter in a single per-session directory that's named
"\BaseNamedOjects" for session 0 (system services) and
"\Sessions\\BaseNamedObjects" for interactive
sessions.

The base registry Key object is named "\Registry". Its parse procedure
(for creating and opening key paths) only reserves backslash, which is
the same as the object namespace itself.

> spam/eggs

You can create a named pipe with that name in the named-pipe file
system. But regular file systems that I've used in Windows reserve
forward slash, even though they don't use it for anything. They'll
just fail the create/open with STATUS_OBJECT_NAME_INVALID. The way to
observe this is to use forward slash in a \\?\ prefixed path. Note
that the prefix must be \\?\, with backslash only. //?/ is basically
the same as //./.

As far as file paths go, "spam/eggs" could be set as a device name,
which from Windows would only be accessible with a \\?\ prefixed path.
For example:

DefineDosDevice(DDD_RAW_TARGET_PATH, 'spam/eggs',
'\\Device\\HarddiskVolume2\\Temp')

f = open(r'\\?\spam/eggs\test.txt', 'w')
h = msvcrt.get_osfhandle(f.fileno())

>>> GetFinalPathNameByHandle(h, VOLUME_NAME_DOS)
'?\\C:\\Temp\\test.txt'

>>> GetFinalPathNameByHandle(h, VOLUME_NAME_NT)
'\\Device\\HarddiskVolume2\\Temp\\test.txt'

> in your home directory. (Is that still C:\\My Documents by default?)

No, the user profile directory is "C:\Users\", i.e. the
%UserProfile% environment variable. In some cases a user may have a
separate home directory configured, which is set in
%HOMEDRIVE%%HOMEPATH%. Commonly no home directory is set, in which
case %HOMEDRIVE%%HOMEPATH% is just the fixed %UserProfile% path.

> And how would that file be displayed in the Windows GUI file explorer?

I suppose if a file system allowed forward slash in names that
Explorer would just display it. When I get the time, I'll attach a
debugger to explorer.exe and hack a forward slash into one of the
names in a directory listing, i.e. a result from WinAPI FindFirstFile
(or native NtQueryDirectoryFile).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Abdur-Rahmaan Janhangeer
one common scenario is

C:\Users\

where \U is taken as a unicode litteral

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ

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


Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Richard Damon
On 7/1/18 6:49 AM, Mikhail V wrote:
> [Steven D'Aprano]
>
>> (The same applies to Unix/Linux systems too, of course.) But while you're
>> using Python to manipulate files, you should use Python rules, and that
>> is "always use forward slashes".
>>
>> Is that reasonable?
>>
>> Under what circumstances would a user calling open(pathname) in Python
>> need to care about backslashes?
> Cough cough
>
> On Windows a path is e.g.:
> C:\programs\util\
>
> So why should I use forward slashes in a Python literal?
> I don't remember any problem caused by using backslashes in paths in Python -
> are there problems?
> (Apart from the fact that Python dos not have true raw string literals)
>
> So what is reasonable about using forward slashes?
> It happens to me that I need to copy-paste real paths like 100 times
> a day into scripts - do you propose to convert to forward slashes each time?

The one major issue with backslashes is that they are a special
character in string literals, so you either need to use raw literals a
remember the few cases they still act as special characters, or remember
to convert them to double back slashes, at a minimum for all the
characters that they are special for (easier to double them all).

I think it was originally an error to make the backslash followed by a
character not defined as special with a backslash as keeping the
backslash as a literal as it causes a number of these issues. Yes, it
allows you to not need to double it in many cases but that just sets you
up for the mistakes that started the thread. It is probably too late to
change that behavior now though.

-- 
Richard Damon

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


Re: error in os.chdir

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 8:50 AM, Steven D'Aprano
 wrote:
> On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:
>
>> The Windows API handles this, but not for a path that begins with \\?\.
>
> But what about the *Python* API? The Python open() function, and all the
> high-level os.* and os.path.* functions which take paths as strings are
> supposed to automatically convert forward slashes to backslashes. Aren't
> they?

Python's I/O functions don't modify file paths, except to decode bytes
paths in 3.6+.

os.path.normpath uses backslash in Windows, without involving the OS,
as does pathlib in Python 3. os.path.abspath calls WinAPI
GetFullPathName to get a canonical, fully-qualified path, including
transforming reserved paths, e.g.

>>> os.path.abspath('C:/Temp/conout$.txt')
'.\\conout$'

>>> os.path.abspath('C:/Temp/spam. . .')
'C:\\Temp\\spam'

(Note that the above "conout$" example is for Windows 8 and 10. In
prior versions, "conin$" and "conout$"  aren't reserved in
qualified-relative or absolute paths, only when passed to CreateFile
as unqualified names.)

The \\?\ prefix allows using otherwise reserved names such as "con"
and "spam...".

For versions of Windows prior to 10 or Python prior to 3.6, the \\?\
prefix is also the only way to get past the 260 character limit of
legacy DOS paths to work with paths with up to 32K characters. Python
3.6+ is manifested to support long paths in Windows 10 without
requiring the \\?\ prefix. This can be enabled by setting the
LongPathsEnabled value in
"HKLM\System\CurrentControlSet\Control\FileSystem". Maybe in a future
version this registry setting will be enabled by default.

>> Bear in mind that forward slash is just a  name character in NT.
>
> Interesting...
>
> That's rather like on HFS Plus, where / is an ordinary character allowed
> in file names (although Mac OS goes to extraordinary effort to ensure
> that tools that expect / as a path separator see it, and those which
> expect : as the path separator see it instead).

Many characters are reserved in Windows file systems that aren't
generally reserved in NT, including forward slash. What happens here
is that the Object Manager hands off parsing the rest of a path as
soon as it reaches an object that has a parse procedure. This allows
object types such as Key and Device objects to implement custom
namespaces.

The Configuration Manager's (registry) Key parse procedure limits
names to 256 characters and the tree depth to 512 keys. (Note that
HKCU is a pseudo-handle for "\Registry\User\", so subtract 3 from
the depth.) However it doesn't reserve characters, except for the
native backslash path separator. IIRC it allows NUL in key names, but
that would render them impossible to access in the Windows API, which
uses null-terminated strings.

The I/O Manager's Device parse procedure sends an IRP_MJ_CREATE I/O
request packet either to the first device in the stack (including
lower/upper filter drivers), or to the file-system device stack that's
managing it. The I/O manager doesn't reserve additional characters or
limit name length, but most file systems limit names to 255 characters
(127 for UDF) and reserve backslash (path separator), slash, colon,
pipe, wildcards (*?<>"), and ASCII controls. In contrast, the named
pipe file system (i.e. WinAPI \\.\PIPE or native \Device\NamedPipe) is
extremely lenient. Pipe names can be up to 259 characters and can
include any character except NUL. This file system doesn't support
directories, so pipe names can even include backslash, which is a
common practice.

Except for disk volumes, most devices aren't file systems or managed
by one. However, sometimes they do implement a simple namespace of
hard-coded names. For example, the console device "\Device\ConDrv"
implements a few names such as "Connect", "Input", "Output", "Console"
(con), "CurrentIn" (conin$), and "CurrentOut" (conout$).
-- 
https://mail.python.org/mailman/listinfo/python-list


File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Mikhail V
[Steven D'Aprano]

> (The same applies to Unix/Linux systems too, of course.) But while you're
> using Python to manipulate files, you should use Python rules, and that
> is "always use forward slashes".
>
> Is that reasonable?
>
> Under what circumstances would a user calling open(pathname) in Python
> need to care about backslashes?

Cough cough

On Windows a path is e.g.:
C:\programs\util\

So why should I use forward slashes in a Python literal?
I don't remember any problem caused by using backslashes in paths in Python -
are there problems?
(Apart from the fact that Python dos not have true raw string literals)

So what is reasonable about using forward slashes?
It happens to me that I need to copy-paste real paths like 100 times
a day into scripts - do you propose to convert to forward slashes each time?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31415] Add -X option to show import time

2018-07-01 Thread Nico Schlömer

Nico Schlömer  added the comment:

I just updated tuna [1] to support import time profiles as well.
Install with
```
pip install tuna
```
and use with
```
python -X importprofile yourfile.py 2> import.log
tuna import.log
```
See screenshot for example output.

Cheers,
Nico

[1] https://github.com/nschloe/tuna

--
nosy: +nschloe
Added file: https://bugs.python.org/file47663/sc.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

And here's my work in progress patch.

https://github.com/corona10/cpython/commit/133825346fd60e518e9ab5830a0755250c8c3e79

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks,

my easy patch is worked by pre-checking left paren index. but some edge case 
which I don't expect should be considered.

 if (left_paren_index != -1) {
-/* Use default error message for any line with an opening paren */
-return 0;
+   int found_white_space = 0;
+   int found_other_char = 0;
+   Py_ssize_t pos = 0;
+   while(pos != left_paren_index) {
+   int kind = PyUnicode_KIND(self->text);
+   void *data = PyUnicode_DATA(self->text);
+Py_UCS4 ch = PyUnicode_READ(kind, data, pos);
+   if (Py_UNICODE_ISSPACE(ch)) {
+found_white_space = 1;
+   }
+   if (!Py_UNICODE_ISSPACE(ch) && found_white_space == 1) {
+found_other_char = 1;
+   }
+   pos++;
+   }
+
+   if (found_other_char == 0) {
+   return 0;
+   }
 }


Type "help", "copyright", "credits" or "license" for more information.
>>> print (foo.)
  File "", line 1
print (foo.)
   ^
SyntaxError: invalid syntax

>>> print "a".toupper().tolower()
  File "", line 1
print "a".toupper().tolower()
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print("a".toupper().tolower())?

SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

>>> class Foo:
... pass
...
>>> print Foo().header(a=foo(1))
  File "", line 1
print Foo().header(a=foo(1))
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Assignments to ps1

2018-07-01 Thread Gregory Ewing

Stefan Ram wrote:

from sys import ps1
ps1 = 'alpha'


>>> import sys
>>> sys.ps1 = "alpha"
alpha

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


[issue33660] pathlib.Path.resolve() returns path with double slash when resolving a relative path in root directory

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

Please review my pull request.
This PR is pending for 19 days.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I took an initial stab at this and there is a comment where if there is an open 
paren then to use the normal error message. Additional context on the issue 
which lists false positive cases where the change was introduced 
https://bugs.python.org/issue21669. I removed the check where the left paren 
count is not -1 in case of a function call and it seems to work. Of course, 
there are cases to handle as mentioned in the linked issue and I tried some of 
the cases like "foo".toupper().tolower() and the results as below : 

Patch : 

diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index bb50c1c..7e616cf 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2966,10 +2966,7 @@ _report_missing_parentheses(PySyntaxErrorObject *self)
 if (left_paren_index < -1) {
 return -1;
 }
-if (left_paren_index != -1) {
-/* Use default error message for any line with an opening paren */
-return 0;
-}
+
 /* Handle the simple statement case */
 legacy_check_result = _check_for_legacy_statements(self, 0);
 if (legacy_check_result < 0) {

Cases :

➜  cpython git:(master) ✗ cat foo_print.py
class Foo:
pass

print Foo().header(a=foo(1))
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 4
print Foo().header(a=foo(1))
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

➜  cpython git:(master) ✗ cat foo_print.py
print "a".toupper().tolower()
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 1
print "a".toupper().tolower()
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print("a".toupper().tolower())?


Linked cases in the patch : 

➜  cpython git:(master) ✗ cat foo_print.py
print (foo.)
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 1
print (foo.)
   ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print((foo.))?


Would like to link to https://hackmd.io/s/ByMHBMjFe#08-Debugging-Python-Objects 
. As a beginner the tutorial was helpful and I had to set a break point on 
Objects/exceptions.c:1323 where SyntaxError_init is called and then execute 
line by line where the current code returns the left_paren_index which you can 
set as `set left_paren_index = -1` to skip the branch and then continue the 
program to print the above error messages. IMO I think it was an explicit 
decision with this change being done 4 years ago with the false positive cases 
and tests listed but I am curious if there are any improvements in this area to 
be done.


Thanks

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



logging module

2018-07-01 Thread Sharan Basappa
Folks,

I am trying to use logging module and somehow I cannot make it work.

A simple code that I am trying is below. The commented code line 5,6 are other 
options I have tried but don't work

#importing module
import logging
 
#Create and configure logger
#logging.basicConfig(filename="D:/Projects/Initiatives/machine 
learning/programs/newfile.log",
#logging.basicConfig(filename="newfile.log",
logging.basicConfig(format='%(asctime)s %(message)s')
 
#Creating an object
logger=logging.getLogger()
 
#Setting the threshold of logger to DEBUG
logger.setLevel(logging.DEBUG)
 
#Test messages
logger.debug("Harmless debug Message")
logger.info("Just an information")
logger.warning("Its a Warning")
logger.error("Did you try to divide by zero")
logger.critical("Internet is down")

PS: I am running this under Enthought Canopy

The following is the output
%run "D:/Projects/Initiatives/machine learning/programs/debug_4.py"
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] PyYAML-4.1: ***RETRACTED***

2018-07-01 Thread Ingy dot Net
I am sorry to report that the PyYAML-4.1 release from 48 hours ago has been
removed from PyPI

There were too many problems to make this a viable release.

The biggest known issue with this retraction is that PyYAML will not work
with the new Python 3.7  until PyYAML-4.2 is released.
https://github.com/yaml/pyyaml/issues/126#issuecomment-401175258

We are starting work immediately on 4.2b1 prerelease series. I hope to see
4.2 released in the next few days.

Work is being coordinated on #pyyaml on irc.freenode.net and issues can be
reported and followed at https://github.com/yaml/pyyaml

Thank you for your patience.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


EuroPython 2018: Community Discounts

2018-07-01 Thread M.-A. Lemburg
The EuroPython Society (EPS) extended its mission last year to not
only run the EuroPython conference, but also provide help for the
Python community in Europe in general.

Let’s all meet at EuroPython


In addition to the Python Organizers Lunch (see previous post), which
focuses on conference organizers, we are also establishing a program
to support attendees of Python user groups and conferences in Europe.

We’d like to invite all of you to EuroPython 2018 this year. Of
course, we cannot give out free tickets to everyone, but we can at
least recognize your participation in the Python community by giving
out discounts for the conference.

Discounts for EuroPython Tickets


If you are running a Python event (conference or user group) in
Europe, please reach out to bo...@europython.eu to request a coupon
code for your group, which you can then pass on to your group members
or attendees.

If you are not running a user group or conference, but a regular
attendee of one, please contact your organizers to have them submit a
request. We can only distribute codes at the user group and conference
organizer level.

The coupon codes are valid for conference tickets bought starting
today and will give you a 10% discount on the ticket price (both
regular and late bird prices). The codes are setup for user group
sizes of between 30-50 members, but we are also extending this to
organizers and attendees of larger conferences. If you need a code
valid for larger groups, please mention this in your email.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/175435749712/europython-2018-community-discounts

Tweet:

https://twitter.com/europython/status/1013405285770252288


Enjoy,
--
EuroPython Society
https://ep2018.europython.eu/
https://www.europython-society.org/

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


EuroPython 2018: Inviting European Python Conference Organizers

2018-07-01 Thread M.-A. Lemburg
The EuroPython Society (EPS), who is organizing the EuroPython
conference, last year extended it’s mission to also provide help for
the Python community in Europe in general.

As part of this, we would like to get to know, and help create closer
ties between organizers of other European Python events.


Organizers’ Lunch
-

We would like to invite representatives of all European Python
conference to EuroPython 2018 to join us for an organizers’
lunch. We’re planing the lunch for Friday, July 27, in the organizer’s
room (Soutra Suite).

Our aim is to get to know each other, exchange experience in
organizing events and to find out how we, as EPS, can most effectively
help other conferences going forward.


Free Tickets


To support and facilitate this, we are giving out one free conference
ticket per conference team, so that each team can send a
representative to the organizers’ lunch.

If your team wants to send someone to join, please write to
bo...@europython.eu, mentioning the conference you’re organizing and
some background on your team.



Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/175435613817/europython-2018-inviting-european-python

Tweet:

https://twitter.com/europython/status/1013403476112691201

Enjoy,
--
EuroPython Society
https://ep2018.europython.eu/
https://www.europython-society.org/

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


[issue34015] doc Add link to Descriptor HowTo Guide in Data Model

2018-07-01 Thread Andrés Delfino

Andrés Delfino  added the comment:

ok :) I have just updated the PR following your comment.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Piyush Hajare


Piyush Hajare <4piyushhaj...@gmail.com> added the comment:

I'm interested to solve this issue

--
nosy: +piyushhajare

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: error in os.chdir

2018-07-01 Thread Peter J. Holzer
On 2018-07-01 08:50:22 +, Steven D'Aprano wrote:
> On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:
> > On Sun, Jul 1, 2018 at 1:44 AM, Steven D'Aprano
> >  wrote:
> >> I guess that if the user is using a path beginning with \\?\ they may
> >> or may not need to use backslashes, but I have no way of testing it,
> >> and I would expect that Python will correctly replace //?/ with
> >> backslashes the same as it does for any other file system path.
> > 
> > The Windows API handles this, but not for a path that begins with \\?\.
> 
> But what about the *Python* API? The Python open() function, and all the 
> high-level os.* and os.path.* functions which take paths as strings are 
> supposed to automatically convert forward slashes to backslashes. Aren't 
> they?

Are they? I don't see anything in the docs that support this (but maybe
my Google Fu is weak).

Rather from the existence and design of os.path I conclude that the
programmer is supposed to construct path names in the local convention
(i.e., you should use os.path.join(dirname, filename) instead of dirname +
"/" + filename, which will ensure that the correct separator is used).

I think the lazy approach using just forward slashes works because
*Windows* treats slashes in filenames like backslashes (most of the
time), not because Python converts them.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-07-01 Thread Peter J. Holzer
On 2018-07-01 01:52:12 +, Steven D'Aprano wrote:
> On Sat, 30 Jun 2018 23:49:41 +0200, Peter J. Holzer wrote:
> > The old adage that "security is binary" is utter balderdash.
> 
> I think that "old adage" is one of those ones that only people denying it 
> actually use.
> 
> I've never seen anyone say "security is binary"

That was almost a dogma in some (mostly German) usenet groups 15 to 20
years ago.

Some people apparently still believe it - it hasn't been that long
(maybe a year or so) since I've last had a discussion about this. 

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon


Mark Shannon  added the comment:

This looks like a Greenlet bug to me.
Possibly 
https://github.com/python-greenlet/greenlet/commit/780a12b51fcef9adcc4f2c9a4cc5b05c2d652ba4
 is incomplete.

It is not clear to me why greenlets hold their own exception state, but I 
suspect that if they didn't then this issue might go away.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:

> Bear in mind that forward slash is just a  name character in NT.


So, using Python, how could you open, write to, and then read from, a 
file with a slash in its name? Say, something like:

spam/eggs

in your home directory. (Is that still C:\\My Documents by default?)

And how would that file be displayed in the Windows GUI file explorer?



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: error in os.chdir

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:

> On Sun, Jul 1, 2018 at 1:44 AM, Steven D'Aprano
>  wrote:
>> On Sat, 30 Jun 2018 23:36:40 +, eryk sun wrote:
>>
>>> Only use forward slashes for legacy DOS paths passed to Windows API
>>> functions. Do not use forward slashes for paths in command line
>>> arguments, \\?\ prefixed paths, or registry paths.
>>
>> I don't see why this is relevant, or at least not the "command line
>> arguments" and "registry paths" parts.
> 
> Command-line arguments are relevant to executing a child process, e.g.
> via subprocess.Popen.

Ah, yes they are. But using subprocess is a little more of an advanced 
use than regular file handling. But your point is taken.


>> I guess that if the user is using a path beginning with \\?\ they may
>> or may not need to use backslashes, but I have no way of testing it,
>> and I would expect that Python will correctly replace //?/ with
>> backslashes the same as it does for any other file system path.
> 
> The Windows API handles this, but not for a path that begins with \\?\.

But what about the *Python* API? The Python open() function, and all the 
high-level os.* and os.path.* functions which take paths as strings are 
supposed to automatically convert forward slashes to backslashes. Aren't 
they?


> The intent of this prefix is to bypass DOS-path normalization --
> allowing paths with length up to 32K characters that can use otherwise
> reserved DOS-device names or names ending in spaces or dots.
> 
>> (Besides, Python doesn't have an API for interacting directly with the
>> registry.)
> 
> The standard library has winreg -- or _winreg in 2.x.

Oh, I live and learn.


> Bear in mind that forward slash is just a  name character in NT.

Interesting... 

That's rather like on HFS Plus, where / is an ordinary character allowed 
in file names (although Mac OS goes to extraordinary effort to ensure 
that tools that expect / as a path separator see it, and those which 
expect : as the path separator see it instead).


> We only need to clearly state that the
> Windows API allows using forward slash as the path separator in file
> paths that do not begin with the \\?\ prefix. I prefer to also add a
> warning about command-line arguments, since it isn't an improbable or
> inconsequential problem

Fair enough.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon


Mark Shannon  added the comment:

Strange. 
I could only reproduce this intermittently with 3.7 build.
But with a debug build, I cannot reproduce this at all.
Rebuilding Python (optimised, but without PGO) I cannot reproduce at all now.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20304] Argument Clinic: char convertor should use default values of type bytes

2018-07-01 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +7649
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20304] Argument Clinic: char convertor should use default values of type bytes

2018-07-01 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-8039, which fixes this in order to AC convert 
Objects/stringlib/transmogrify.h.

--
versions: +Python 3.8 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-07-01 Thread Tal Einat


Tal Einat  added the comment:

See updated PR for Objects/stringlib/transmogrify.h in GH-8039.

--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-07-01 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +7648

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34015] doc Add link to Descriptor HowTo Guide in Data Model

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

I think "See also" is better than sidebar.
Many other sections in data-model chapter have it.

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

@xtreak

Thanks, I have interest with this issue :)
I will take a look at the implementation

Thanks!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34006] Windows HTML Help (chm) has fixed line length

2018-07-01 Thread INADA Naoki

INADA Naoki  added the comment:

http://www.sphinx-doc.org/en/master/theming.html#builtin-themes

> body_max_width (int or str): Maximal width of the document body. This can be 
> an int, which is interpreted as pixels or a valid CSS dimension string such 
> as ‘70em’ or ‘50%’. Use ‘none’ if you don’t want a width limit. Defaults may 
> depend on the theme (often 800px).

Maybe, all you we need to do is adding "-D 
html_theme_options.body_max_width=none" option to sphinx-build when building 
html for htmlhelp, in Doc/make.bat.

I confirmed this option works with "make html", but I don't have environment 
for building htmlhelp for now.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30660] Lossless Optimization of PNG files

2018-07-01 Thread INADA Naoki


Change by INADA Naoki :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30660] Lossless Optimization of PNG files

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:


New changeset c6cd164cffedb306a4c6644d9d03072f24da246d by INADA Naoki in branch 
'master':
bpo-30660: Doc: Optimize PNG files by optipng (GH-8032)
https://github.com/python/cpython/commit/c6cd164cffedb306a4c6644d9d03072f24da246d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34006] Windows HTML Help (chm) has fixed line length

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

I prefer limiting width on browser, but I'm OK to remove limitation from chm 
files.

Rational:

Changing window size to control line width for readable length is bad UX 
because all modern browsers are tabbed.  Or it may be impossible on iPad.

On the other hand, chm is file format only on Windows.  And window is dedicated 
to Python doc.  User can control width easily than browser.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Related issue that introduced the error message if you would like to take a 
look at the implementation : https://bugs.python.org/issue30597

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com