[issue20099] a new idea

2013-12-31 Thread Liam Marsh

New submission from Liam Marsh:

idea:
var():
input var name (str),
outputs var value
useful for(example in a chess program):

>>>count=1
>>>while count<=8:
...var('a', count)='black queen'
...count=count+1

--
messages: 207118
nosy: Liam.Marsh
priority: normal
severity: normal
status: open
title: a new idea
versions: Python 3.3

___
Python tracker 

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



[issue20099] a new idea

2013-12-31 Thread Ezio Melotti

Ezio Melotti added the comment:

You should propose this to the python-ideas mailing list, but from your 
description is not clear to me what you want.
Can you try to explain it more in detail?
Are you asking for a new function that accepts the name of a variable as a 
string and prints its value?  Or for a function that creates dynamically a new 
"variable name"?

If you want to dynamically create variable names, it's better to just use a 
dictionary instead, e.g.:
d = {}
for count in range(1, 9):
name = 'a' + str(count)
d[name] = 'black queen'

--
nosy: +ezio.melotti
status: open -> pending
versions: +Python 3.5 -Python 3.3

___
Python tracker 

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



[issue20095] what is that result!?

2013-12-31 Thread Mark Dickinson

Mark Dickinson added the comment:

> can you add an approximation of the result in the command?

I don't really understand what you're asking here.

If you're asking for the behaviour of multiplication to change so that it 
becomes more do-what-I-mean-ish, that's not going to happen.  You could try 
writing your own DWIM-style multiplication if that's what you want, but the 
basic multiplication operator should stay as it is now: a simple wrapper around 
the C multiplication, which on most machines has a simple, easily-stated and 
well-defined behaviour: return me the floating-point number that's closest to 
the exact mathematical result of the multiplication.

--

___
Python tracker 

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



[issue20100] epoll docs are not clear with regards to CLOEXEC.

2013-12-31 Thread R. David Murray

New submission from R. David Murray:

http://docs.python.org/dev/library/select.html#select.epoll documents the 
EPOLL_CLOEXEC flag as something you can specify that makes the file descriptor 
be closed on exec.  But then it goes on to say that the file descriptor is 
non-inheritable.  So is the flag useless and should be removed from the docs, 
or is the documentation just unclear as to its purpose?  Or, conversely, do we 
need a way to say that the file descriptor should *not* be closed on exec?

--
assignee: docs@python
components: Documentation
messages: 207121
nosy: docs@python, haypo, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: epoll docs are not clear with regards to CLOEXEC.
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue20095] what is that result!?

2013-12-31 Thread Tim Peters

Tim Peters added the comment:

@Liam, try using the "decimal" module instead.  That follows rules much like 
the ones people learn as kids.

>>> from decimal import Decimal as D
>>> D("0.1") * 3  # decimal results are computed exactly
Decimal('0.3')
>>> D("1.01") - D(".01")  # number of significant digits is preserved
Decimal('1.00')

Etc.

--
nosy: +tim.peters

___
Python tracker 

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



[issue20099] a new idea

2013-12-31 Thread Liam Marsh

Liam Marsh added the comment:

first, it was for the second idea, which can be replaced,
but maybe sameone needs it,
when you reed theese lines, this idea is sent.
meen while,
have a happy new year.

--
status: pending -> open

___
Python tracker 

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



[issue20100] epoll docs are not clear with regards to CLOEXEC.

2013-12-31 Thread STINNER Victor

STINNER Victor added the comment:

Use os.set_inheritable(epoll.fileno(), True) to make the file descriptor
inheritable. You should find this info easily if you follow the link on
"non inheritable" in epoll documentation.

EPOLL_CLOEXEC becomes useless in Python 3.4. It is used internally by
default if available. Removing it would break existing code, it would be
harder to write code for python 3.4 and 3.3.

Just update the doc.

--

___
Python tracker 

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



[issue20101] Determine correct behavior for time functions on Windows

2013-12-31 Thread Zachary Ware

New submission from Zachary Ware:

For previous discussion, see issue1.

To summarize, time on Windows is far from straight-forward, and currently for

"""
t1 = time.monotonic()
time.sleep(0.5)
t2 = time.monotonic()
dt = t2-t1
"""

dt may end up as very slightly smaller than 0.5 (0.499003017485 or so), 
0.5, or somewhat larger than 0.5 (0.515001303852 or so); or 0.5 almost all 
of the time, depending on the machine in question.  So far, two very different 
Win7 machines of mine both produced the first result, and Tim Peters' Vista 
machine produced the second.  Both of mine report the resolution as 
0.0156000999, Tim's reports 0.015625.

See also 
http://stackoverflow.com/questions/7685762/windows-7-timing-functions-how-to-use-getsystemtimeadjustment-correctly
 and http://www.windowstimestamp.com/description for more related reading.

Due to the issue, test_monotonic regularly fails for me.  A simple workaround 
is to relax the lower bound of 0.5 <= dt <= 1.0 to 0.45; I intend to commit 
that workaround soon, but it won't close this issue.

In preparation for creating this issue I also checked the other time functions 
(time, clock, and perf_counter) for the same issue, and on my test machine all 
of them have it (although it is apparently intermittent for time (earlier I got 
straight failures, now it won't fail), and clock and perf_counter are 
implemented by the same underlying function).

Here is some output from my machine, formatted slightly for nicer presentation:

3.4.0b1 (default:fd846837492d+, Dec 30 2013, 11:01:01) [MSC v.1600 32 bit 
(Intel)]
Windows-7-6.1.7601-SP1
Running:
"""
import time
import sys
import platform
print(sys.version)
print(platform.platform())

with open(__file__) as file:
print('Running:\n"""')
print(file.read())
print('"""')

clock_info = {}

for time_func in (time.monotonic, time.time, time.clock, time.perf_counter):
name = time_func.__name__
info = str(time.get_clock_info(name))
print(name, info)
if info in clock_info:
print('Same clock as time.{}'.format(clock_info[info]))
continue
else:
clock_info[info] = name
good = 0
values = {}
count = 0
try:
while count < 25:
# basic test copied from test_monotonic, extras bolted on
t1 = time_func()
time.sleep(0.5)
t2 = time_func()
dt = t2 - t1
if values.get(dt):
values[dt] += 1
else:
values[dt] = 1
assert t2 > t1
passed = 0.5 <= dt <= 1.0
print('.' if passed else 'F', end='', flush=True)
if passed:
good += 1
count += 1
except KeyboardInterrupt:
pass

print()
print('total:', count,
  'good:', good,
  'bad:', count - good)
print(sorted(values.items()))
print()

"""
monotonic namespace(adjustable=False, implementation='GetTickCount64()', 
monotonic=True, resolution=0.0156000999)
FF..FFF.FF.FFF..F
total: 25 good: 6 bad: 19
[(0.498998360872, 13), (0.499003017485, 6), (0.5, 5), 
(0.515001303852, 1)]

time namespace(adjustable=True, implementation='GetSystemTimeAsFileTime()', 
monotonic=False, resolution=0.0156000999)
.
total: 25 good: 25 bad: 0
[(0.5, 25)]

clock namespace(adjustable=False, implementation='QueryPerformanceCounter()', 
monotonic=True, resolution=2.851518034140655e-07)
.FF.F
total: 25 good: 2 bad: 23
[(0.49929681565278194, 1), (0.49941258728496685, 1), (0.4995377689266647,  1),
(0.4995543077312634,   1), (0.49955459288306736, 1), (0.4995597256155282,  1),
(0.4995602959191352,   1), (0.4995659989552035,  1), (0.4995679950178271,  1),
(0.49956970592864813,  1), (0.4995748386611094,  1), (0.499581967456195,   1),
(0.4995956547427589,   1), (0.49961304900276726, 1), (0.49961761143162153, 1),
(0.49961846688703204,  1), (0.49962445507490294, 1), (0.499629017503759,   1),
(0.4996355759952369,   1), (0.4996401384240914,  1), (0.49964042357589467, 1),
(0.4996486929781927,   1), (0.4996555366214759,  1), (0.5000139724383673,  1),
(0.5036356854935278,   1)]

perf_counter namespace(adjustable=False, 
implementation='QueryPerformanceCounter()', monotonic=True, 
resolution=2.851518034140655e-07)
Same clock as time.clock


And here's results from time.time earlier today (produced by an earlier version 
of the above script, same machine and interpreter):

time
FF.FF
total: 25 good: 1 bad: 24
[(0.49969983100891113, 7), (0.49970006942749023, 17), (0.5006990432739258, 1)]

--
components: Extension Modules, Windows
messages: 207125
nosy: haypo, tim.peters, zach.ware
priority: normal
severity: normal
status: open
title: Determine correct behavior for time functions on Windows
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 


[issue3982] support .format for bytes

2013-12-31 Thread Brett Cannon

Changes 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



[issue3982] support .format for bytes

2013-12-31 Thread Brett Cannon

Changes by Brett Cannon :


--
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue20096] Mention modernize and future in Python 2/3 porting HOWTO

2013-12-31 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20065] Python-3.3.3/Modules/socketmodule.c:1660:14: error: 'CAN_RAW' undeclared (first use in this function)

2013-12-31 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

Revision e767318baccd introduced usage of CAN_RAW.

--
keywords: +3.3regression
nosy: +Arfrever, neologix, pitrou
versions: +Python 3.4

___
Python tracker 

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



[issue6135] subprocess seems to use local encoding and give no choice

2013-12-31 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue19714] Add tests for importlib.machinery.WindowsRegistryFinder

2013-12-31 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +vajrasky

___
Python tracker 

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



[issue20055] On Windows NT 6 with administrator account, there are two failing tests on test_shutil.py

2013-12-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0f888589dbcd by Antoine Pitrou in branch '3.3':
Issue #20055: Fix test_shutil under Windows with symlink privileges held.
http://hg.python.org/cpython/rev/0f888589dbcd

New changeset 6fd3d473e1c2 by Antoine Pitrou in branch 'default':
Issue #20055: Fix test_shutil under Windows with symlink privileges held.
http://hg.python.org/cpython/rev/6fd3d473e1c2

--
nosy: +python-dev

___
Python tracker 

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



[issue20055] On Windows NT 6 with administrator account, there are two failing tests on test_shutil.py

2013-12-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Pushed, thank you!

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue20099] a new idea

2013-12-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This isn't a bug, please use 
https://mail.python.org/mailman/listinfo/python-ideas if you want to propose 
ideas.

--
nosy: +pitrou
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue1346238] A constant folding optimization pass for the AST

2013-12-31 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

8 years after the original patch, there's still no trivial constant folding in 
bytecode generated (because peephole of course is not a real optimizer to 
consistently catch all cases):

$ cat const.py 
FOO = 1
BAR = FOO + 2 + 4

$ python --version
Python 2.7.3

$ python -OO -m dis const.py
  1   0 LOAD_CONST   0 (1)
  3 STORE_NAME   0 (FOO)

  2   6 LOAD_NAME0 (FOO)
  9 LOAD_CONST   1 (2)
 12 BINARY_ADD  
 13 LOAD_CONST   2 (4)
 16 BINARY_ADD  
 17 STORE_NAME   1 (BAR)
 20 LOAD_CONST   3 (None)
 23 RETURN_VALUE

$ python3.3 --version
Python 3.3.3

$ python3.3 -OO -m dis const.py
  1   0 LOAD_CONST   0 (1) 
  3 STORE_NAME   0 (FOO) 

  2   6 LOAD_NAME0 (FOO) 
  9 LOAD_CONST   1 (2) 
 12 BINARY_ADD   
 13 LOAD_CONST   2 (4) 
 16 BINARY_ADD   
 17 STORE_NAME   1 (BAR) 
 20 LOAD_CONST   3 (None) 
 23 RETURN_VALUE

--
nosy: +pfalcon

___
Python tracker 

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