[issue25343] Document atomic operations on builtin types

2020-09-11 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Yes, I was asking where to put the disclaimer.  The thread docs would be 
approriate if there is nothing already.

Guido has been very reluctant to put any performance guarantees in the language 
reference.  I believe he said that O(f(n)) info even for CPython should be in 
the wiki -- and taken as a guideline, not a iron guarantee.

Further discussion might be better directed to python-ideas, after a search of 
the pydev and python-ideas archives (most easily done with the gmane mirrors, I 
believe).

--

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread R. David Murray

R. David Murray added the comment:

I think you are correct, and I wouldn't be surprised if there is some in the 
stdlib as well.

--

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread Dima Tisnek

Dima Tisnek added the comment:

To clarify, Python language disclaimer can be in the general atomic operations 
or multithreading section.

What I'd really like to see is documented, practical CPython and stdlib 
behaviour.

I'm under the impression that there's quite a bit of code out there that relies 
on what's actually atomic in CPython.

d.

--

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread R. David Murray

R. David Murray added the comment:

I think what Terry was asking was, where would you expect to see the disclaimer 
that *no* operations are guaranteed to be atomic?  That's what we're inclining 
toward (though we'll probably need a signoff from Guido).

--

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread Dima Tisnek

Dima Tisnek added the comment:

Ideally I'd like 2 sources:

1. a whole section on atomic operations in language and CPython implementation

2. annotation of standard library methods, e.g.:
set().add(element)  [atomic] or [CPython: atomic(*)]
(*) assuming basic types, note about what custom methods would break this 
guarantee; the reference could be to 1.

--

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This question has been asked multiple times before.  I think it should be 
documented that as far as the language goes, there is no answer.  Raymond's 
answer is a start.  Dima, where would you expect to find such a disclaimer 
(other than in the FAQ)?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-08 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> what set() operations are atomic?

The language doesn't make any guarantees about set operation atomicity.  
Different implementations such as PyPy, Jython, and IronPython are free to make 
different choices than CPython.  In general, users should make no assumptions 
about atomicity unless explicitly documented and tested.  The wise course of 
action is to use mutexes when there is any doubt.

FWIW, it is difficult to make blanket statements about the methods on sets 
because the atomicity depends on the objects looked up or stored in the sets 
rather than the set itself.   Aside from trivial calls to __sizeof__ and 
__len__, most set methods potentially call __hash__ or __eq__ on the set 
elements either of which could make a callback into pure python code.  
Likewise, any reference count decrement can potentially make a callback as well.

--
nosy: +rhettinger

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-08 Thread R. David Murray

R. David Murray added the comment:

I wonder...personally I prefer to program in asyncio style rather than 
threading style, where one doesn't have to worry about atomicity.  Maybe Python 
shouldn't make any atomicity guarantees.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-08 Thread Brett Cannon

Brett Cannon added the comment:

We actually don't have any guarantees written down because we have never 
formalized them. It was discussed at the PyCon language summit this past year 
-- https://lwn.net/Articles/640177/ -- but it didn't lead to anyone writing a 
proposal to formalize the memory model.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue25343] Document atomic operations on builtin types

2015-10-08 Thread Dima Tisnek

New submission from Dima Tisnek:

Please document what builtin type operations are actually atomic.
For example, what set() operations are atomic?

(There are some blogs / tutorials online, but information is outdated and not 
authoritative)

--
messages: 252545
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: Document atomic operations on builtin types
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



[issue25343] Document atomic operations on builtin types

2015-10-08 Thread Dima Tisnek

Changes by Dima Tisnek :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
type:  -> enhancement

___
Python tracker 

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