[issue34122] inspect.getmembers does not retrive dataclass's __dataclass_fields__ properly

2018-07-15 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I think there is some note about this on the doc as below : 

https://docs.python.org/3/library/dataclasses.html#dataclasses.field . Relevant 
commit : 98d50cb8f57eb227c373cb94b8680b12ec8aade5

If the default value of a field is specified by a call to field(), then the 
class attribute for this field will be replaced by the specified default value. 
If no default is provided, then the class attribute will be deleted. The intent 
is that after the dataclass() decorator runs, the class attributes will all 
contain the default values for the fields, just as if the default value itself 
were specified.

Using a default value returns the parameter in the inspect module as below : 


➜  cpython git:(master) ✗ cat foo.py
import inspect
from dataclasses import *
import enum

@dataclass
class SimpleDataObject(object):
field_a: int = field(default=10)
field_b: str = "asdad"

print([a[0] for a in inspect.getmembers(SimpleDataObject)])
➜  cpython git:(master) ✗ ./python foo.py
['__annotations__', '__class__', '__dataclass_fields__', 
'__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', 
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', 
'__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', 
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', 
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'field_a', 
'field_b']


I think this is an intended behavior as above and a test case could be added or 
docs could be improved about this with the inspect example?

Thanks

--

___
Python tracker 

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



[issue34122] inspect.getmembers does not retrive dataclass's __dataclass_fields__ properly

2018-07-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34122] inspect.getmembers does not retrive dataclass's __dataclass_fields__ properly

2018-07-15 Thread Dong-hee Na


New submission from Dong-hee Na :

When I execute this script.

import inspect
from dataclasses import *
import enum

@dataclass
class SimpleDataObject(object):
field_a: int = field()
field_b: str = "asdad"

print([a[0] for a in inspect.getmembers(SimpleDataObject)])


I expected

['__annotations__', '__class__', '__dataclass_fields__', 
'__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', 
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', 
'__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', 
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', 
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'field_a', 
'field_b']

but got

['__annotations__', '__class__', '__dataclass_fields__', 
'__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', 
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', 
'__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', 
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', 
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'field_b']

If this behavior is not intended, I propose a new patch with providing 
Inspect.isdataclass for Python 3.8 and Inspect._is_dataclss for Python 3.7

https://github.com/corona10/cpython/commit/c2665176ce836a7b328ddc09c6c7d3de0a2b29a0

--
components: Library (Lib)
files: inspect_dataclass.py
messages: 321706
nosy: corona10, eric.smith, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: inspect.getmembers does not retrive dataclass's __dataclass_fields__ 
properly
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47693/inspect_dataclass.py

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 8487ef61dea9fb0579f0be8f01d74fa20d3b8ed1 by Benjamin Peterson in 
branch '3.6':
[3.6] bpo-34121: Fix detection of C11 atomic support on clang. (GH-8290)
https://github.com/python/cpython/commit/8487ef61dea9fb0579f0be8f01d74fa20d3b8ed1


--

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread miss-islington


miss-islington  added the comment:


New changeset 3fc12f0e2ad9ba49243f5a43a8803018b2ff5904 by Miss Islington (bot) 
in branch '3.7':
bpo-34121: Fix detection of C11 atomic support on clang. (GH-8288)
https://github.com/python/cpython/commit/3fc12f0e2ad9ba49243f5a43a8803018b2ff5904


--
nosy: +miss-islington

___
Python tracker 

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



[issue21617] importlib reload can fail with AttributeError if module removed from sys.path

2018-07-15 Thread Brett Cannon


Brett Cannon  added the comment:

If there's no spec, Michael, then your work-around is the next best option (and 
reloading never actually replaces the actual module object or it's dict/global 
namespace because we don't know who is holding on to a reference).

--
nosy: +ncoghlan

___
Python tracker 

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



[issue21617] importlib reload can fail with AttributeError if module removed from sys.path

2018-07-15 Thread Michael Forbes


Michael Forbes  added the comment:

It seems that a reasonable workaround (if you generate your own `spec`) is to 
call `spec.loader.exec_module(mod)`.  This seems to reload the module into the 
same namespace. (I was afraid that it might replace the namespace hence the 
desire to use `importlib.reload()` explicitly.)

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Ammar Askar


Ammar Askar  added the comment:

Roger, personally I don't think its worth it to complicate the code in order to 
use the thread pool API. Especially considering this is just a private API and 
the only consumer will be the test suite runner. Let's see what the core devs 
think when this gets reviewed.

--

___
Python tracker 

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



[issue21617] importlib reload can fail with AttributeError if module removed from sys.path

2018-07-15 Thread Michael Forbes


Michael Forbes  added the comment:

What is the status of this issue?  Is there a work-around?  The 3.7 codebase 
raises an exception, but what is the correct solution for reloading a module 
that was loaded dynamically without modifying `sys.path`?

--
nosy: +mforbes

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

The RegisterWaitForSingleObject() function does use the thread pool API:

https://docs.microsoft.com/en-us/windows/desktop/ProcThread/thread-pool-api

However, PdhCollectQueryDataEx() also creates a user-space thread to handle its 
work of setting the event whenever the timeout elapses.

I would think that it should be preferable to use a single thread pool worker 
to retrieve the queue length and calculate the average.

--

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> fixed
stage: patch review -> 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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +7824

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7823

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 15c7b2abdfb93f8902dd72474818aee2bf97fa66 by Benjamin Peterson in 
branch 'master':
bpo-34121: Fix detection of C11 atomic support on clang. (GH-8288)
https://github.com/python/cpython/commit/15c7b2abdfb93f8902dd72474818aee2bf97fa66


--

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
components: +Build -Interpreter Core

___
Python tracker 

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



[issue34121] configure fails to detect C11 atomic support on clang

2018-07-15 Thread Benjamin Peterson


New submission from Benjamin Peterson :

clang supports C11 atomic APIs just fine but Python's configure fails to detect 
it:

configure:16529: checking for stdatomic.h
configure:16545: clang -pthread -o conftestconftest.c -lpthread -ldl  
-lutil >&5
conftest.c:389:5: error: _Atomic cannot be applied to incomplete type 'void' 
_Atomic void *py_atomic_address = (void*) 
^
1 error generated.

Indeed, the atomic uninhabited type is not very useful. If we wanted an atomic 
pointer, we should write _Atomic(void *).

--
components: Interpreter Core
messages: 321697
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: configure fails to detect C11 atomic support on clang
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue30400] Race condition in shutil.copyfile(): source file replaced file during copy

2018-07-15 Thread STINNER Victor


STINNER Victor  added the comment:

Python doesn't use FD of directories by default because it introduces
issues of FD limit with deep directory tree, issue of managing FD lifetime,
etc. That's why some API have one flavor for path and another for FD.

--

___
Python tracker 

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



[issue33120] infinite loop in inspect.unwrap(unittest.mock.call)

2018-07-15 Thread ppperry


Change by ppperry :


--
type: crash -> behavior

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-07-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I was uncertain from Ethan's post what does work best. "endless errors with 
both 'spawn", "Only 'fork' works...but without graphics", "method='spawn'and 
... does work".  Do the 1st and 3rd sentences mean that spawn + graphics fails 
without the proper additional code but does work with it?  Should the 2nd 
sentence be "fork only works without graphics" rather than starting with 'only 
fork'?

If so, this would suggest that the default should depend on whether there is a 
graphic import ;-).  In any case, how to use successfully use multiprocessing 
with graphics on Mac should be documented.

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Ammar Askar


Ammar Askar  added the comment:

Is the function I used for the callback, RegisterWaitForSingleObject  
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-registerwaitforsingleobject
using the thread pooling system you're talking about underneath? The 
documentation seems to suggest so, but I'll wait for your opinion on it.

--

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-07-15 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

As I mentioned in msg314304 this is almost certainly expected behavior on macOS 
because Apple’s GUI frameworks are not fork()-safe.  There is nothing we can do 
about this other than changing the default spawn mechanism for multiprocessing 
on macOS. 

--
On the road, hence brief. 

Op 14 jul. 2018 om 19:30 heeft Terry J. Reedy  het 
volgende geschreven:

> 
> Terry J. Reedy  added the comment:
> 
> On MacOS, 3.7.0 is compiled for and the installer loads tcl/tk 8.6.8.  The 
> same is true for the 3.6.6 64-bit installer.  Do tkinter and multiprocessing 
> work together better with these installations?
> 
> I want to consider using multiprocessing and pipes instead subprocess and 
> socket for IDLE's user-code execution process, started from and communicating 
> with the initial tkinter gui process.  idlelib.run, which runs in the 
> execution process to communicae with the gui process and supervise running 
> user code, imports tkinter.  Besides which, users have to be able to import 
> tkinter in their programs.
> 
> --
> nosy: +pitrou
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

Correct.  Windows provides the building blocks for implementing getloadavg(), 
but does not provide an interface that does the averaging.  That is deferred to 
a per application basis.  The best that an application can do for that is to 
use thread pools.  You can think of thread pools as kernel-managed threads 
(different from user-managed threads via CreateThread()).

As of Win10 1703, any process linked with DLLs automatically have thread pools 
created for them (to parallel-ize the loading of said DLLs).  Leveraging that 
feature would minimize the costs incurred to do the running average.

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

I suppose there is no way to emulate os.getloadavg() on Windows because that 
would necessarily imply using a thread to call the necessary routine (WMI, PDH, 
whatever...) every X secs or something, correct?

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

Not that it matters all that much, but from a terminology standpoint, WMI != 
PDH != Performance Counters.

Performance counters (the objects, not the topic) are provided by DLLs 
registered in the HKLM\SYSTEM\CurrentControlSet\Services key.  Their data is 
accessed via registry API functions using the HKEY_PERFORMANCE_DATA root key.

PDH (Performance Data Helper) provides an abstraction layer that can access 
those values among other things like a GUI or writing to log files.

WMI (Windows Management Instrumentation) is yet another layer on top of PDH and 
raw Performance Counters.

In this case of the "System" performance counter object, it is provided by a 
performance DLL (perfos.dll in the case of Win10 1803).  If overhead (memory 
and/or CPU) is a concern, then accessing the counter data via the registry is 
the way to go.

--

___
Python tracker 

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



[issue27741] datetime.datetime.strptime functionality description incorrect

2018-07-15 Thread Farhaan Bukhsh


Farhaan Bukhsh  added the comment:

Hey I would like to remove this bug I was going through the discussion so does 
that mean remove the about mentioned lines from 

https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime

will fix this issue? Or should we add some more information there?

--
nosy: +fhackdroid

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Ammar Askar


Ammar Askar  added the comment:

Aah, yeah I don't think there's a good way of doing it purely from the windows 
API. There might be a way to enumerate through all the processes and see if 
they're queued up but I didn't look into it.

In this case it should be fine, we just pay a bit of WMI cost to initialize the 
query, all the updating and retrieval is done asynchronously to the python code.

--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2018-07-15 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

> Giampaolo, on your psutil issue you specifically said, "(possibly without 
> using WMI)" Is there any particular problem with using WMI?

Performance. In general WMI is (a lot) slower than the Windows API counterpart 
(psutil never uses WMI except in unit tests). Don't know if this matters for 
this specific issue though, or whether a correspondent Windows API for doing 
the same thing exists.

--

___
Python tracker 

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



[issue34120] IDLE Caret/Focus Lost

2018-07-15 Thread Vlad Tudorache


New submission from Vlad Tudorache :

When closing the IDLE's Preferences dialog the IDLE's Console window and/or 
Editor window (whichever was active before) doesn't show cursor/caret any more. 
One must click on Desktop or another window then click again in the IDLE's 
window in order to regain cursor/caret. This problem shows on macOS High 
Sierra, Python 3.6.N and 3.7.N (and even 3.5.N), with the provided installers 
(64 bit, 64/32 bit, Tk 8.6.8) and with self-compiled Python(s). After a number 
of openings IDLE will crash with an @autoreleasepool issue. I've compiled 
Tcl/Tk and Python with CC=clang CXX=clang++ MACOSX_DEPLOYMENT_TARGET=10.9 
(10.10, 10.12 also), Tcl/Tk with and without --enable-threads, always with 
--enable-64bit --enable-framework and --enable-dtrace, clang 902.0.39.2 (Apple 
LLVM version 9.1.0), Python was compiled with and without --enable-dtrace and 
--enable-optimizations, with --enable-framework.

--
assignee: terry.reedy
components: IDLE
messages: 321686
nosy: terry.reedy, vtudorache
priority: normal
severity: normal
status: open
title: IDLE Caret/Focus Lost
type: behavior
versions: 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



[issue34047] IDLE: on macOS, scroll slider 'sticks' at bottom of file

2018-07-15 Thread Vlad Tudorache


Vlad Tudorache  added the comment:

I can reproduce this problem only with Tk 8.6.7, both compiled by myself or 
installed from ActiveState (Python 3.7 and 3.6 compiled by myself, too). I 
can't see it with Tk 8.6.8 provided with the installers, nor with Tk 8.5.18.

--
nosy: +vtudorache

___
Python tracker 

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



[issue34112] 3.7.0 build error with --enable-optimizations

2018-07-15 Thread Jayanth Koushik


Jayanth Koushik  added the comment:

Updating gcc to 8.1.0 fixed the problem.

--
resolution:  -> works for me
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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-15 Thread Nick Coghlan


Nick Coghlan  added the comment:

OK, that makes sense to me. Given that, there'd be two changes proposed.

1. Replace the opening paragraph of 
https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types
 (the one I originally quoted when opening this issue) with the text:

=
Bitwise operations only make sense for integers. The result of bitwise 
operations is calculated as though carried out in two's complement with an 
infinite number of sign bits.
=

2. Add a new footnote ``(4)`` to the table for the ``|``, ``^``, and ``&`` 
entries that reads:

=
4. Performing these calculations with at least one extra sign extension bit in 
the internal representation (a working bit-width of ``1 + max(x.bit_length(), 
y.bit_length()`` or more) is sufficient to get the same result as if there were 
an infinite number of sign bits.
=

--

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-15 Thread Tim Peters


Tim Peters  added the comment:

Well, all 6 operations "are calculated as though carried out in two's 
complement with an infinite number of sign bits", so I'd float that part out of 
the footnote and into the main text.  When, e.g., you're thinking of ints _as_ 
bitstrings, it's essentially useless to think of `n >> 13` as being equivalent 
to `n // 2**13`.

Quick:  what's ~0 >> 13?  Well, ~0 is an infinite string of 1 bits, so shifting 
it right by any finite number of bits doesn't change it.  That, mathematically, 
floor(~0 / 8192) = -1 is only interesting if you're thinking of ~0 as being an 
integer instead.

And, if you are, _then_ you need to know that the infinite string of 1 bits ~0 
represents is viewed as being a 2's-complement representation of -1.  But so 
long as you're sticking to the bitstring view, the "2's complement" part is 
irrelevant to anything these 6 operations do.

Indeed, in the very earliest versions of Python, longs (but not ints!) were 
viewed as being 1's-complement infinite bitstrings, but "infinite string of 
sign bits" was just as applicable to what these operations did then.  The 
meaning of what these operations compute _as bitstrings_ is independent of how 
bitstrings are mapped to and from integers.  When longs changed from 1's-comp 
to 2's-comp only the latter changed; code using longs as bitstrings wasn't 
affected.

So, in all, there's quite a bit of background these telegraphic docs are 
glossing over.  You (Nick) don't seem to ever think of them as being 
bitstrings, but what the "bitwise operators" do was driven by the bitstring 
view.  That some of them can also be defined by arithmetic (+ - * /) is 
secondary.  It may well take more text to get that all across than is suitable 
here, though.

--

___
Python tracker 

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



[issue34119] Able to name a variable as 'input'. This creates problem when using input() function.

2018-07-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

While "shadowing a builtin" was irritating in your case, it is an unavoidable 
part of how Python works and is in some cases considered a feature.  

FWIW, there is a workaround.  You can reference the real input() function 
directly in the __builtins__ namespace:

>>> input = 'x'
>>> __builtins__.input('Enter your name: ')
Enter your name: Becky
'Becky'
>>> input
'x'

Also, consider using tools like pylint and flake8 which give warnings in cases 
like this.

--
nosy: +rhettinger
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



[issue34119] Able to name a variable as 'input'. This creates problem when using input() function.

2018-07-15 Thread Kishore Aadada


New submission from Kishore Aadada :

When i used input as a variable name, there is no error provided. After that I 
am calling input() function to read data. In such case, below error is reported.

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> input = "Test input"
>>> data = input("Please enter some input")
Traceback (most recent call last):
  File "", line 1, in 
data = input("Please enter some input")
TypeError: 'str' object is not callable
>>>

--
components: IO
files: inputError.png
messages: 321680
nosy: kishoreaadada
priority: normal
severity: normal
status: open
title: Able to name a variable as 'input'. This creates problem when using 
input() function.
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47692/inputError.png

___
Python tracker 

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