[issue5710] ctypes should return composite types from callbacks

2015-11-29 Thread Albert Zeyer

Albert Zeyer added the comment:

Any update here?

--
nosy: +Albert.Zeyer
versions: +Python 2.7

___
Python tracker 

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



[issue25608] ascynio readexactly() should raise ValueError if passed length <= 0 in argument

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Okay, https://github.com/python/asyncio/pull/298 is ready

--

___
Python tracker 

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



[issue25763] I cannot use absolute path in sqlite3 , python 2.7.9, windows

2015-11-29 Thread R. David Murray

R. David Murray added the comment:

Did you try just using the absolute file path without the file://?  That should 
work.  I don't believe uri interpretation is enabled by default, according to 
the docs you linked to.

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



Re: Generate config file from template using Python search and replace.

2015-11-29 Thread Mr Zaug
When I run this script on OS X El Capitan, I see,
  
  # permission sensitive cache
  $include "_dispatcher_shared_auth-checker: 

Was I supposed to incorporate it into the script I posted?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25766] __bytes__ doesn't work for str subclasses

2015-11-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Special __bytes__ method is purposed for converting to bytes with bytes 
constructor (as well as __str__ and __float__ for str and float). But this 
doesn't work if the class is a subclass of str.

>>> class X:
... def __bytes__(self):
... return b'abc'
... 
>>> bytes(X())
b'abc'
>>> class Y(str):
... def __bytes__(self):
... return b'abc'
... 
>>> bytes(Y())
Traceback (most recent call last):
  File "", line 1, in 
TypeError: string argument without an encoding

--
components: Interpreter Core
files: str___bytes__.patch
keywords: patch
messages: 255593
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: __bytes__ doesn't work for str subclasses
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41192/str___bytes__.patch

___
Python tracker 

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



[issue24660] Heapq + functools.partial : TypeError: unorderable types

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Yes, this is not a bug. Python 3.5 works as expected.

Orderable lambda is the bug in python2.7.

--

___
Python tracker 

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



What use is this class?

2015-11-29 Thread fl
Hi,

When I search around tutorial about None, I came across this link:

http://jaredgrubb.blogspot.ca/2009/04/python-is-none-vs-none.html

I don't understand what use of this class example:



>>> class Zero(): # a class that is zero
...def __nonzero__(self):
...   return False


I can only get the following code running:

cz1=Zero()
cz1.__nonzero__()
Out[119]: False


Here are my questions:
1. Is there any other means to use class Zero?
2. What connection to None on the original author's intention?


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


[issue25627] distutils : file "bdist_rpm.py" does not quote filenames when executing the rpm command

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

Okay so now I see 2.7 doesn’t support the context manager. I was mainly curious 
why you didn’t want to use subprocess. However a bigger problem with your first 
patch is shlex.quote() does not appear to be in Python 2 either.

If you want to use proc.communicate() rather than reading line by line, perhaps 
subprocess.check_output() would be simpler. I’m not familiar with the RPM 
command but if there is only a modest amount of output it should be good enough.

--

___
Python tracker 

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



[issue25764] PyObject_Call() is called with an exception set in subprocess

2015-11-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

http://buildbot.python.org/all/builders/x86%20OpenIndiana%203.x/builds/10847/steps/test/logs/stdio

[117/400] test_subprocess -- running: test_tokenize (65 sec), 
test_concurrent_futures (38 sec)
Assertion failed: !PyErr_Occurred(), file Objects/abstract.c, line 2158
Fatal Python error: Aborted

Current thread 0x0001 (most recent call first):
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/subprocess.py", 
line 1483 in _execute_child
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/subprocess.py", 
line 950 in __init__
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/test_subprocess.py",
 line 2295 in test_close_fds_after_preexec
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/case.py", 
line 600 in run
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/case.py", 
line 648 in __call__
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/unittest/runner.py",
 line 176 in run
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/support/__init__.py",
 line 1780 in _run_suite
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/support/__init__.py",
 line 1814 in run_unittest
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/test_subprocess.py",
 line 2657 in test_main
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/runtest.py",
 line 162 in runtest_inner
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/runtest.py",
 line 115 in runtest
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/runtest_mp.py",
 line 69 in run_tests_slave
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 379 in main
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 433 in main
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 455 in main_in_temp_cwd
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/regrtest.py", 
line 39 in 
  File "/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/runpy.py", 
line 85 in _run_code
  File "/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/runpy.py", 
line 170 in _run_module_as_main
Traceback (most recent call last):
  File "/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/runpy.py", 
line 170, in _run_module_as_main
"__main__", mod_spec)
  File "/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/runpy.py", 
line 85, in _run_code
exec(code, run_globals)
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/__main__.py", 
line 3, in 
regrtest.main_in_temp_cwd()
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 455, in main_in_temp_cwd
main()
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 433, in main
Regrtest().main(tests=tests, **kwargs)
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 392, in main
self.run_tests()
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/main.py",
 line 354, in run_tests
run_tests_multiprocess(self)
  File 
"/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/libregrtest/runtest_mp.py",
 line 212, in run_tests_multiprocess
raise Exception(msg)
Exception: Child error on test_subprocess: Exit code -6
make: *** [buildbottest] Error 1
program finished with exit code 2

--
components: Extension Modules
messages: 255586
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: PyObject_Call() is called with an exception set in subprocess
type: crash
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25761] Improve unpickling errors handling

2015-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +alexandre.vassalotti, pitrou

___
Python tracker 

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



[issue25765] Installation error

2015-11-29 Thread SilentGhost

Changes by SilentGhost :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
type: performance -> behavior

___
Python tracker 

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



[issue25696] "make -j9 install" fails because bininstall target requires the libainstall target

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

Please go ahead with bininstall-3.patch if you prefer. It certainly avoids the 
problem you reported. Although I still encourage you to not add the dash before 
the command.

--

___
Python tracker 

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



[issue5319] stdout error at interpreter shutdown fails to return OS error status

2015-11-29 Thread Robert Collins

Robert Collins added the comment:

@Martin I was wrong re: the defs - they only cover function vs data, not return 
codes. So it looks fine to me.

--

___
Python tracker 

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



[issue25765] Installation error

2015-11-29 Thread Ayushmaan Saxena

New submission from Ayushmaan Saxena:

installation error 0x80240004

--
components: Installation
files: Python 3.5.0 (32-bit)_20151130012741.log
messages: 255589
nosy: ayushmaan121
priority: normal
severity: normal
status: open
title: Installation error
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file41191/Python 3.5.0 
(32-bit)_20151130012741.log

___
Python tracker 

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



Installing the gcalcli Python app under windows

2015-11-29 Thread rossmcm
gcalcli (https://github.com/insanum/gcalcli) is a Python application that 
provides a command-line interface to Google calendar.  All of the stuff I can 
find on installation seems to be written for *nix platforms and there is 
precious little for windows.  I'm wondering if anyone can provide the steps 
involved in getting this thing going under Windows.

My setup:
 - Windows 10
 - Python 2.7
 - PyDev Eclipse 

I don't want to clone the repository, I just want to get the source files I 
need and anything else I need to run this utility from a command prompt.

I downloaded a zip file from the GitHuib site and then ran a command line 
"setup.py install" and this produced a whole lot of output:


C:\Users\Public\Documents\Downloads\Python\gcalcli\gcalcli-master>setup.py 
install
running install
running bdist_egg
running egg_info
creating gcalcli.egg-info
writing requirements to gcalcli.egg-info\requires.txt
writing gcalcli.egg-info\PKG-INFO
writing top-level names to gcalcli.egg-info\top_level.txt
writing dependency_links to gcalcli.egg-info\dependency_links.txt
writing manifest file 'gcalcli.egg-info\SOURCES.txt'
reading manifest file 'gcalcli.egg-info\SOURCES.txt'
writing manifest file 'gcalcli.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
warning: install_lib: 'build\lib' does not exist -- no Python modules to install

creating build
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\EGG-INFO
installing scripts to build\bdist.win32\egg\EGG-INFO\scripts
running install_scripts
running build_scripts
creating build\scripts-2.7
copying and adjusting gcalcli -> build\scripts-2.7
creating build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\gcalcli -> build\bdist.win32\egg\EGG-INFO\scripts
copying gcalcli.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying gcalcli.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying gcalcli.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying gcalcli.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying gcalcli.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\gcalcli-3.3.2-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing gcalcli-3.3.2-py2.7.egg
Copying gcalcli-3.3.2-py2.7.egg to c:\python27\lib\site-packages
Adding gcalcli 3.3.2 to easy-install.pth file
Installing gcalcli script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\gcalcli-3.3.2-py2.7.egg
Processing dependencies for gcalcli==3.3.2
Searching for oauth2client<=1.4.12
Reading https://pypi.python.org/simple/oauth2client/
Reading http://code.google.com/p/google-api-python-client/
Reading http://github.com/google/oauth2client/
Best match: oauth2client 1.4.12
Downloading 
https://pypi.python.org/packages/2.7/o/oauth2client/oauth2client-1.4.12-py2.7.egg#md5=8265f6985905a5590c622741980a47e5
Processing oauth2client-1.4.12-py2.7.egg
Moving oauth2client-1.4.12-py2.7.egg to c:\python27\lib\site-packages
Adding oauth2client 1.4.12 to easy-install.pth file

Installed c:\python27\lib\site-packages\oauth2client-1.4.12-py2.7.egg
Searching for google-api-python-client
Best match: google-api-python-client 1.2
Downloading 
http://google-api-python-client.googlecode.com/files/google-api-python-client-1.2.zip
Processing google-api-python-client-1.2.zip
Writing 
c:\users\ross\appdata\local\temp\easy_install-a2jaif\google-api-python-client-1.2\setup.cfg
Running google-api-python-client-1.2\setup.py -q bdist_egg --dist-dir 
c:\users\ross\appdata\local\temp\easy_install-a2jaif\google-api-python-client-1.2\egg-dist-tmp-uumuki
warning: no files found matching '*.json' under directory 'apiclient'
zip_safe flag not set; analyzing archive contents...
Moving google_api_python_client-1.2-py2.7.egg to c:\python27\lib\site-packages
Adding google-api-python-client 1.2 to easy-install.pth file

Installed c:\python27\lib\site-packages\google_api_python_client-1.2-py2.7.egg
Searching for httplib2
Reading https://pypi.python.org/simple/httplib2/
Reading http://code.google.com/p/httplib2/
Reading https://github.com/jcgregorio/httplib2
Best match: httplib2 0.9.2
Downloading 
https://pypi.python.org/packages/source/h/httplib2/httplib2-0.9.2.zip#md5=404bac4a4e0d10b3ba498ce483c8c456
Processing httplib2-0.9.2.zip
Writing 
c:\users\ross\appdata\local\temp\easy_install-jps_ft\httplib2-0.9.2\setup.cfg
Running httplib2-0.9.2\setup.py -q bdist_egg --dist-dir 
c:\users\ross\appdata\local\temp\easy_install-jps_ft\httplib2-0.9.2\egg-dist-tmp-cpfwpj
zip_safe flag not set; analyzing archive contents...
httplib2.__init__: module references __file__
creating c:\python27\lib\site-packages\httplib2-0.9.2-py2.7.egg
Extracting httplib2-0.9.2-py2.7.egg to c:\python27\lib\site-packages

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal

Kovid Goyal added the comment:

Yes, I am aware. I embed python in my application, which includes large C++ 
libraries. Those libraries are going to start requiring to be compiled with a 
modern compiler soon, which means I need python to also be compiled with a 
modern compiler. I already manually compile all python extensions in my build 
system, so that is not a problem. And before someone suggests I upgrade to 
python 3, porting half a million lines of python is simply not worth it for me. 

I'll be happy to open a separate bug report, but first I want some advice. I 
have got all the other tests passing as well, except one single test. 
test_gzip.test_many_append. 

The reason that test fails is apparently because of a buffering bug in the 
stdio C functions in VS 2015. Combining lots of seeks relative to SEEK_CUR 
causes read() to return incorrect data. I can make the test pass by modify the 
gzip module to open files with bufferring=0, or by putting in a seek(0, 0) to 
cause the stdio layer to flush its read buffer at the appropriate point. 
However, this is not an actual fix, just an inefficient workaround.

My question is, how do I properly workaround this bug? And how come this bug is 
not triggered in Python 3.5.0? Am I diagnosing this correctly? Any other 
alternative explanations?

--

___
Python tracker 

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



[issue25752] asyncio.readline - add customizable line separator

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Well, https://github.com/python/asyncio/pull/297 is ready :)

--

___
Python tracker 

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



Re: New JSON encoding method proposal for custom objects

2015-11-29 Thread Denis McMahon
On Sun, 29 Nov 2015 07:05:30 -0800, cescus92 wrote:

> In this day I stumbled upon a very simple task: I had a list of
> instances of a custom class and I had to convert i into a JSON.

That's all well and good, but firstly you need to both dumps and loads to 
work properly with json, and secondly there's no mechanism in json that 
tells you what class of object you have.

So you may have a __json_dumps__ that will dump your object out to a json 
string representation, but then how does json.loads recognise that it's 
loading your object to call your object's __json_loads__?

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue12460] SocketServer.shutdown() does not have "timeout=None" parameter

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Please close this bug since asyncio is much more suitable, and things like 
socketserver is obsolete as I think.

--

___
Python tracker 

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



[issue25742] locale.setlocale does not work with unicode strings

2015-11-29 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
status: open -> closed

___
Python tracker 

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



[issue25762] Calculation Mistake 1.5 * 0.3

2015-11-29 Thread Yunus Emre Kursav

New submission from Yunus Emre Kursav:

Dear Authorized Person,

When I was using python, I found a bug. When I multiplied 1.5 time 0.3, I got 
0.44996 as a result.

Best Regards,
Yunus

--
files: Screenshot from 2015-11-29 17-39-20.png
messages: 255579
nosy: zeneregion
priority: normal
severity: normal
status: open
title: Calculation Mistake 1.5  * 0.3
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41190/Screenshot from 2015-11-29 
17-39-20.png

___
Python tracker 

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



[issue24731] Incorrect assert in str_subtype_new

2015-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2ea1a3bf448f by Serhiy Storchaka in branch '2.7':
Fixed Py3k warnings in tests for issue #24731.
https://hg.python.org/cpython/rev/2ea1a3bf448f

--

___
Python tracker 

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



[issue25762] Calculation Mistake 1.5 * 0.3

2015-11-29 Thread Ethan Furman

Ethan Furman added the comment:

Floating point calculations are not exact.

https://docs.python.org/3/tutorial/floatingpoint.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

--
nosy: +ethan.furman
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



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread R. David Murray

R. David Murray added the comment:

You are aware that you can't use existing pre-compiled extension modules with 
your 2015 build, right?

It would be great if you could open a separate issue for the double close 
problem.  This should be a doc issue for fixing the docs.

--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, r.david.murray
stage:  -> needs patch
type: compile error -> behavior

___
Python tracker 

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



[issue25767] asyncio documentation section 18.5.2.3.1. (Windows) links to French Wikipedia in English docs

2015-11-29 Thread Elizabeth Myers

New submission from Elizabeth Myers:

The link for HPET in the asyncio documentation (18.5.2.3.1 Windows, final 
paragraph, see 
https://docs.python.org/3/library/asyncio-eventloops.html#windows) links to 
https://fr.wikipedia.org/wiki/High_Precision_Event_Timer for the HPET link even 
though the document is in English (it should link to the English Wikipedia 
version instead).

--
assignee: docs@python
components: Documentation
messages: 255598
nosy: Elizacat, docs@python
priority: normal
severity: normal
status: open
title: asyncio documentation section 18.5.2.3.1. (Windows) links to French 
Wikipedia in English docs
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25763] I cannot use absolute path in sqlite3 , python 2.7.9, windows

2015-11-29 Thread jingtao chen

New submission from jingtao chen:

I tried the way like here 
https://www.sqlite.org/c3ref/open.html#urifilenamesinsqlite3open but it is 
useless 

what I got is 

C:\Users\CJT-6220>python D:\NKUSearch\pr_cal\main.py
Traceback (most recent call last):
  File "D:\NKUSearch\pr_cal\main.py", line 7, in 
conn = sqlite3.Connection('file:///D:/NKU.db')
sqlite3.OperationalError: unable to open database file


and I tried some other ways to write the URI but none of them works and PEP 249 
did not mention anything about absolute path . So what can I do ?

--
components: Windows
messages: 255581
nosy: jingtao chen, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: I cannot use absolute path in sqlite3 , python 2.7.9, windows
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue25752] asyncio.readline - add customizable line separator

2015-11-29 Thread Guido van Rossum

Guido van Rossum added the comment:

If you hit EOF in the middle of a partial separator, treat it as a premature 
EOF just as if you hit EOF before the separator -- the record is not properly 
terminated so it shouldn't be accepted.

I prefer a single PR that has the full code.

We keep the CPython Lib version and the asyncio repo synchronized, a PR for the 
asyncio repo is easier to handle for me.

--

___
Python tracker 

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



I can't understand re.sub

2015-11-29 Thread Mr Zaug
I need to use re.sub to replace strings in a text file. I can't seem to 
understand how to use the re module to this end.

result = re.sub(pattern, repl, string, count=0, flags=0);

I think I understand that pattern is the regex I'm searching for and repl is 
the thing I want to substitute for whatever pattern finds but what is string?

The items I'm searching for are few and they do not change. They are 
"CONTENT_PATH", "ENV" and "NNN". These appear on a few lines in a template 
file. They do not appear together on any line and they only appear once on each 
line.

This should be simple, right?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I can't understand re.sub

2015-11-29 Thread Denis McMahon
On Sun, 29 Nov 2015 13:36:57 -0800, Mr Zaug wrote:

> result = re.sub(pattern, repl, string, count=0, flags=0);

re.sub works on a string, not on a file.

Read the file to a string, pass it in as the string.

Or pre-compile the search pattern(s) and process the file line by line:

import re

patts = [
 (re.compile("axe"), "hammer"),
 (re.compile("cat"), "dog"),
 (re.compile("tree"), "fence")
 ]

with open("input.txt","r") as inf, open("output.txt","w") as ouf:
line = inf.readline()
for patt in patts:
line = patt[0].sub(patt[1], line)
ouf.write(line)

Not tested, but I think it should do the trick.

Or use a single patt and a replacement func:

import re

patt = re.compile("(axe)|(cat)|(tree)")

def replfunc(match):
if match == 'axe':
return 'hammer'
if match == 'cat':
return 'dog'
if match == 'tree':
return 'fence'
return match

with open("input.txt","r") as inf, open("output.txt","w") as ouf:
line = inf.readline()
line = patt.sub(replfunc, line)
ouf.write(line)

(also not tested)

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25768] compileall functions do not document return values

2015-11-29 Thread Nicholas Chammas

New submission from Nicholas Chammas:

I'm using the public functions of Python's built-in compileall module.

https://docs.python.org/3/library/compileall.html#public-functions

There doesn't appear to be documentation of what each of these functions 
returns.

I figured out, for example, that compileall.compile_file() returns 1 when the 
file compiles successfully, and 0 if not.

If this is "official" behavior, it would be good to see it documented so that 
we can rely on it.

I'd be happy to submit a patch to fix this if a committer is willing to 
shepherd a new contributor (me) through the process. Otherwise, this is 
probably a quick fix for experienced contributors.

--
assignee: docs@python
components: Documentation
messages: 255600
nosy: Nicholas Chammas, docs@python
priority: normal
severity: normal
status: open
title: compileall functions do not document return values
type: behavior
versions: Python 3.5

___
Python tracker 

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



Re: Generate config file from template using Python search and replace.

2015-11-29 Thread Peter Otten
Mr Zaug wrote:

> When I run this script on OS X El Capitan, I see,
>   
>   # permission sensitive cache
>   $include "_dispatcher_shared_auth-checker:
> 
> Was I supposed to incorporate it into the script I posted?

Are you referring to my post? I'm sorry, I can't make sense of your 
question.

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


Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:23:19 +, Jon Ribbens writes:
>I don't know if, in future, pyvenv will be the way to go and
>virtualenv will be deprecated, but either way we do not appear
>to be there yet.

pyenv is going away.  python -m venv is the preferred way to get a venv

https://bugs.python.org/issue25154

Of course if you try it, you may get:

  Error: Command '['/bin/python3.4', '-Im', 'ensurepip', 
'--upgrade', '--default-pip']' returned non-zero exit status 1

which turns out to mean:

Your Python isn't configured with ensure-pip!

.

Right now, I personally don't know why there is a venv at all.  Despite
the similarity of names, it doesn't seem to be about doing what virtualenv
does.  I think it is only meant to be used by people who want to install
packages but not site-wide, but I am not sure about that.  I don't think
there are any plans to give venv the functionality of virtualenv, so
presumably there are people who like it just fine the way it is now.
They must have very different needs than I do.

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


[issue25742] locale.setlocale does not work with unicode strings

2015-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

http://buildbot.python.org/all/builders/x86%20XP-4%202.7/builds/3517/steps/test/logs/stdio
==
ERROR: test_setlocale_unicode (test.test_locale.TestMiscellaneous)
--
Traceback (most recent call last):
  File 
"d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_locale.py",
 line 497, in test_setlocale_unicode
old_loc = locale.getlocale(locale.LC_ALL)
  File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\locale.py", 
line 565, in getlocale
raise TypeError, 'category LC_ALL is not supported'
TypeError: category LC_ALL is not supported

--

--
nosy: +serhiy.storchaka
status: closed -> open

___
Python tracker 

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



[issue25696] "make -j9 install" fails because bininstall target requires the libainstall target

2015-11-29 Thread STINNER Victor

STINNER Victor added the comment:

bininstall-4.patch: IMHO it's overkill and makes Makefile more complex to 
follow. My patch  bininstall.patch proposed something similar, but Arfrever 
asked me to modify bininstall target. IMHO Getting "Creating directory xxx" 
message twice is a minor issue.

It becomes annoying to have nitpicking on my patch, I hate autotools, I hate 
having to care of Makefile, etc. Maybe I should just abandon my change, it 
looks like nobody cares that Python cannot be installed with -j9 anyway :-)

--

___
Python tracker 

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



New JSON encoding method proposal for custom objects

2015-11-29 Thread cescus92
Hello everyone!

I'm writing here since I've read on the Pyhton's documentation that this is the 
most common path that a new proposal should follow. I'd be really glad if this 
proposal could become a PEP if I see a good response from the community or, in 
the worst case, understand why this proposal is not good enough.

In this day I stumbled upon a very simple task: I had a list of instances of a 
custom class and I had to convert i into a JSON.

Actually, from what I've discovered, there are 2 ways to get the JSON out of a 
custom non serializable instance:
- defining a new method ( e.g. to_json() ) inside the class that converts the 
item manually (quicker)
- a custom encoder/decoder that goes to extend the ones from the json lib 
(cleander, I think)

Since I thought it was the most cost-effective and I was in hurry, I took the 
first way that drove me to a "problem": if I wanted to get the JSON out from my 
list, it obviously would have given me the "non serializable object" error 
since the json lib didn't know how to transform it into JSON!

I was astonished that Python was requiring me such ugly ways to accomplish this 
simple task! JSON WebServices are becoming more and more popular and Python 
_must_ keep the pace of time! And here it is my proposal to make this task 
easier in the best Pythonic way :)

I propose that every custom class that wants to allow its instances to have a 
JSON representation could implement a simple method, __json__().

The way how it works it very straightforward: every time json lib is required 
to convert an object that doesn't know, it looks for the __json__() method to 
learn how to treat the object. The duty of this method should be to reduce the 
complexity of an object instance into an elementary data type (int, str, list, 
dict, etc..).

Often the process to get the JSON out of an object is a one-way need, in this 
way it would become even simpler to do it in the most flawless way so the 
programmer should no more care to implement some custom logic to handle quickly 
these situations.

Let me give you a very small example of what a __json__ method could be like:

class CustomObj():
  def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2

  def __json__(self):
return {
  'p1': self.p1,
  'p2': self.p2
}

Once more, the job of __json__ should simply be the one of make our object 
json-readable :)

What do you think of it? Do you think it's good? If not, why?

Do you have any guidance to make this idea advance?

Do you advice me to write down a preliminary PEP or to make directly a pull 
request to the Python's source code?

Thank you for you're time!
I'm waiting for your feedback :)
Have a good Sunday!

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


https://www.python.org/downloads/ offline

2015-11-29 Thread Pablo Lucena
Is anyone else getting 503 errors when accessing the downloads page of
python.org?


-- 
*Pablo Lucena*
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2015-11-29 Thread Armin Rigo

Armin Rigo added the comment:

This is a known general issue which is documented in 
Lib/test/crashers/borrowed_ref_1 inside the 2.7 branch.  In trunk, I see that 
this file has been deleted, although the issue has not been solved in general.  
Only the particular crash in the file has been solved.  (Somebody with 
motivation should restore the crashers that have been solved superficially 
only.  But finding actual crashing code takes more effort than I'm willing to 
put into this rather pointless process, so CPython still gets the occasional 
bug report like this one instead.)

--
nosy: +arigo

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2015-11-29 Thread Jeroen Demeyer

Jeroen Demeyer added the comment:

Thanks for the pointer. My patch does fix the crash in 
Lib/test/crashers/borrowed_ref_2.py on Python 2.7.10.

--

___
Python tracker 

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



Re: https://www.python.org/downloads/ offline

2015-11-29 Thread Chris Angelico
On Sun, Nov 29, 2015 at 7:14 PM, Pablo Lucena  wrote:
> Is anyone else getting 503 errors when accessing the downloads page of
> python.org?
>
>
> --
> *Pablo Lucena*
> --
> https://mail.python.org/mailman/listinfo/python-list

Yes, the whole site seems to be down. Cc'ing the www list, although
someone probably knows already.

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


[issue25627] distutils : file "bdist_rpm.py" does not quote filenames when executing the rpm command

2015-11-29 Thread SilentGhost

SilentGhost added the comment:

Yeah, it would be great, Martin, if only that code worked in python2. Anyway, 
here is an alternative patch.

--
Added file: http://bugs.python.org/file41189/issue25627_3.diff

___
Python tracker 

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



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal

Kovid Goyal added the comment:

I missed a few places in my initial patch, updated patch:
https://github.com/kovidgoyal/cpython/commit/a9ec814d466d3c0139d10b69666f88eed10e4940

Also fixed the code not clearing errno before calling CRT functions, while I 
was there. Regardless of whether you want to allow your fork to be compiled 
with VS 2015 or not, I suggest you consider merging this patch, anyway, since 
the errno clearing is the correct thing to do, regardless. You can always 
cherrypick the errno clearing bits if you like :)

Just FYI, the code in my fork of 2.7 passes all tests on 64bit builds with VS 
2015, except for 5 small ones that I have yet to track down. (test_ctypes 
test_distutils test_gzip test_mailbox test_zipfile)

I dont anticipate any difficulty in fixing the remaining test failures. Famous 
last words ;)

--

___
Python tracker 

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



Re: Writing SOME class methods in C

2015-11-29 Thread Stefan Behnel
Oscar Benjamin schrieb am 18.11.2015 um 13:52:
> On 18 November 2015 at 07:50, Daniel Haude wrote:
>>
>> I'm trying to implement some (but not all) methods of a Python class in C.
>> What I've found on the Net is:
>>  - how to implement entire modules in C so that I can import that module and
>>use the C functions (successfully done it, too).
>>  - how to implement entire classes in C
> 
> I would suggest to use Cython here. You can write your class in Python
> (that will be compiled to C) and then call out to any C code from any
> of its methods.

Or, in fact, do the reverse: Implement the base class in Cython and inherit
from it in a Python class that extends it. That would give you a fast,
native extension type at the base and leaves you with all the freedom to
extend it in Python code or even natively in other Cython code.

I strongly recommend not to resort to writing real C code here (using the
C-API of CPython). It will be slower and will contain more bugs.

Stefan


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


Re: Python 3 virtualenvs

2015-11-29 Thread Jon Ribbens
On 2015-11-29, Laura Creighton  wrote:
> In a message of Sun, 29 Nov 2015 13:19:46 +0100, Lele Gaifax writes:
>>Jon Ribbens  writes:
> No, Pyvenv is precisely what Daniele can not use.
> The problem is that venv does not come with a big sign saying
>
> ONLY FOR PYTHON 3.x
> ABSOLUTELY DOES NOT WORK FOR BUILDING 2.7 VIRTUALENVS
> USE virtualenv INSTEAD for Python 2.7
>
> 
>
> which means you can waste a whole lot of time finding this out
> the hard way.

More specifically, "only for Python >= 3.4", because before that
it does not install pip, which makes it fairly useless.

In my experience the best thing to do is ignore pyvenv and ignore
Debian's package management for anything other than installing
the Python interpreter itself. Install pip by hand, then use that
to install virtualenv, then just use those to create virtualenvs
to run your stuff.

I don't know if, in future, pyvenv will be the way to go and
virtualenv will be deprecated, but either way we do not appear
to be there yet.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25627] distutils : file "bdist_rpm.py" does not quote filenames when executing the rpm command

2015-11-29 Thread SilentGhost

SilentGhost added the comment:

I tried re-writing that bit using subprocess.Popen but since the 2.7 support is 
needed I genuinely don't see any benefit that would add on top of the submitted 
patch.

--

___
Python tracker 

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



[issue25627] distutils : file "bdist_rpm.py" does not quote filenames when executing the rpm command

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

I don’t understand what 2.7 has got to do with using subprocess or not. Jumping 
through a shell quoting hoop only to pass a command to the shell to be unquoted 
seems like double handling. This is how I might rewrite it (untested):

q_cmd = ("rpm", "-q", "--qf", r"%s %s\n" % (...), "--specfile", spec_path)
with subprocess.Popen(q_cmd, stdout=PIPE, universal_newlines=?) as proc:
for line in proc.stdout:
...
if proc.returncode:
raise DistutilsExecError(...)

--
nosy: +martin.panter
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: Python 3 virtualenvs

2015-11-29 Thread Lele Gaifax
Jon Ribbens  writes:

> On 2015-11-28, D.M. Procida  
> wrote:
>>
>> Is something else required?
>
> Debian's package management is mysterious and apparently bizarre
> and frankly in respect to Python, not very good.

I do not agree with you on the quality of Python support on Debian systems,
but I think Daniele is missing the package "pythonX.Y-venv": they install the
needed stuff, and in particular /usr/bin/pyvenv-X-Y.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

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


Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:19:46 +0100, Lele Gaifax writes:
>Jon Ribbens  writes:
>
>> On 2015-11-28, D.M. Procida  
>> wrote:
>>>
>>> Is something else required?
>>
>> Debian's package management is mysterious and apparently bizarre
>> and frankly in respect to Python, not very good.
>
>I do not agree with you on the quality of Python support on Debian systems,
>but I think Daniele is missing the package "pythonX.Y-venv": they install the
>needed stuff, and in particular /usr/bin/pyvenv-X-Y.
>
>ciao, lele.

No, Pyvenv is precisely what Daniele can not use.
The problem is that venv does not come with a big sign saying

ONLY FOR PYTHON 3.x
ABSOLUTELY DOES NOT WORK FOR BUILDING 2.7 VIRTUALENVS
USE virtualenv INSTEAD for Python 2.7



which means you can waste a whole lot of time finding this out
the hard way.

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


[issue25761] Improve unpickling errors handling

2015-11-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

This issue is for better detecting and reporting errors in broken pickle data.

--
assignee: serhiy.storchaka
components: Extension Modules, Library (Lib), Tests
messages: 255567
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve unpickling errors handling
type: enhancement

___
Python tracker 

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



[issue25761] Improve unpickling errors handling

2015-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d47e5b162072 by Serhiy Storchaka in branch '3.4':
Issue #25761: Added more test cases for testing unpickling broken data.
https://hg.python.org/cpython/rev/d47e5b162072

New changeset c7e7d77ef8bf by Serhiy Storchaka in branch '2.7':
Issue #25761: Added more test cases for testing unpickling broken data.
https://hg.python.org/cpython/rev/c7e7d77ef8bf

New changeset 4897438543da by Serhiy Storchaka in branch '3.5':
Issue #25761: Added more test cases for testing unpickling broken data.
https://hg.python.org/cpython/rev/4897438543da

New changeset c852c7d8d681 by Serhiy Storchaka in branch 'default':
Issue #25761: Added more test cases for testing unpickling broken data.
https://hg.python.org/cpython/rev/c852c7d8d681

--
nosy: +python-dev

___
Python tracker 

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



[issue25761] Improve unpickling errors handling

2015-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch allows unpickler to detect errors related to reading a stack 
behind a mark.

For now Python implementation just pops a sentinel used as a mark. This can 
cause TypeError, AttributeError or UnpicklingError besides IndexError:

>>> pickle._loads(b'}(NNs.')
Traceback (most recent call last):
  ...
TypeError: 'object' object does not support item assignment
>>> pickle._loads(b'](Na.')
Traceback (most recent call last):
  ...
AttributeError: 'object' object has no attribute 'append'

Or can silently expose the mark object:

>>> pickle._loads(b')(.')

>>> pickle._loads(b']](a.')
[]

C implementation just ignores incorrect mark:

>>> pickle.loads(b'}(NNs.')
{None: None}
>>> pickle.loads(b'](Na.')
[None]
>>> pickle.loads(b')(.')
()
>>> pickle.loads(b']](a.')
[[]]

But in case of complex data this can cause errors later.

With the patch C implementation always raises UnpicklingError with relevant 
message and Python implementation always raises IndexError.

>>> pickle.loads(b'}(NNs.')
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'pickle' is not defined
>>> import pickle, pickletools
>>> pickle.loads(b'}(NNs.')
Traceback (most recent call last):
  File "", line 1, in 
_pickle.UnpicklingError: unexpected MARK found
>>> pickle.loads(b'](Na.')
Traceback (most recent call last):
  File "", line 1, in 
_pickle.UnpicklingError: unexpected MARK found
>>> pickle.loads(b')(.')
Traceback (most recent call last):
  File "", line 1, in 
_pickle.UnpicklingError: unexpected MARK found
>>> pickle.loads(b']](a.')
Traceback (most recent call last):
  File "", line 1, in 
_pickle.UnpicklingError: unexpected MARK found
>>> pickle._loads(b'}(NNs.')
Traceback (most recent call last):
  ...
IndexError: list index out of range
>>> pickle._loads(b'](Na.')
Traceback (most recent call last):
  ...
IndexError: list index out of range
>>> pickle._loads(b')(.')
Traceback (most recent call last):
  ...
IndexError: pop from empty list
>>> pickle._loads(b']](a.')
Traceback (most recent call last):
  ...
IndexError: pop from empty list

--
keywords: +patch
stage:  -> patch review
versions: +Python 3.6
Added file: http://bugs.python.org/file41188/unpickling_mark_errors.patch

___
Python tracker 

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



[issue25742] locale.setlocale does not work with unicode strings

2015-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d7481ebeaa4f by Victor Stinner in branch '2.7':
Issue #25742: Try to fix test_locale on Windows
https://hg.python.org/cpython/rev/d7481ebeaa4f

--

___
Python tracker 

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



[issue25752] asyncio.readline - add customizable line separator

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

When I reported that bug, I want to suggest multibyte separators, but 
implementation is much complex than current one. For example, we should decide 
what to do if partial separator is read and EOF occur.

So, I think we should merge ability to use custom one-byte separator, and next 
create another pull-request to make support of multibyte separator (like 
'\r\n').

Okay, I can make pull request on asyncio, but asyncio now is the part of 
Python. Does not it ?

--

___
Python tracker 

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



[issue25514] better startup error messages in IDLE when stdlib modules shadowed

2015-11-29 Thread Laura Creighton

Laura Creighton added the comment:

webmaster got another one of these today.

--

___
Python tracker 

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



Re: New JSON encoding method proposal for custom objects

2015-11-29 Thread Peter Otten
cescu...@gmail.com wrote:

> Hello everyone!
> 
> I'm writing here since I've read on the Pyhton's documentation that this
> is the most common path that a new proposal should follow. I'd be really
> glad if this proposal could become a PEP if I see a good response from the
> community or, in the worst case, understand why this proposal is not good
> enough.
> 
> In this day I stumbled upon a very simple task: I had a list of instances
> of a custom class and I had to convert i into a JSON.
> 
> Actually, from what I've discovered, there are 2 ways to get the JSON out
> of a custom non serializable instance: - defining a new method ( e.g.
> to_json() ) inside the class that converts the item manually (quicker) - a
> custom encoder/decoder that goes to extend the ones from the json lib
> (cleander, I think)
> 
> Since I thought it was the most cost-effective and I was in hurry, I took
> the first way that drove me to a "problem": if I wanted to get the JSON
> out from my list, it obviously would have given me the "non serializable
> object" error since the json lib didn't know how to transform it into
> JSON!
> 
> I was astonished that Python was requiring me such ugly ways to accomplish
> this simple task! JSON WebServices are becoming more and more popular and
> Python _must_ keep the pace of time! And here it is my proposal to make
> this task easier in the best Pythonic way :)
> 
> I propose that every custom class that wants to allow its instances to
> have a JSON representation could implement a simple method, __json__().
> 
> The way how it works it very straightforward: every time json lib is
> required to convert an object that doesn't know, it looks for the
> __json__() method to learn how to treat the object. The duty of this
> method should be to reduce the complexity of an object instance into an
> elementary data type (int, str, list, dict, etc..).
> 
> Often the process to get the JSON out of an object is a one-way need, in
> this way it would become even simpler to do it in the most flawless way so
> the programmer should no more care to implement some custom logic to
> handle quickly these situations.
> 
> Let me give you a very small example of what a __json__ method could be
> like:
> 
> class CustomObj():
>   def __init__(self, p1, p2):
> self.p1 = p1
> self.p2 = p2
> 
>   def __json__(self):
> return {
>   'p1': self.p1,
>   'p2': self.p2
> }
> 
> Once more, the job of __json__ should simply be the one of make our object
> json-readable :)
> 
> What do you think of it? Do you think it's good? If not, why?

I'm not sure if that is needed often enough so that adding yet another 
__dunder__ method is worthwhile, particularly as the current mechanism 
already makes an implementation of your idea a matter of a few lines:

>>> import json
>>> class Encoder(json.JSONEncoder):
...   def default(self, obj):
... try: encode = obj.__json__
... except AttributeError: return super().default(obj)
... return encode()
... 
>>> class Foo:
... def __json__(self): return dict(bar=1, baz=2)
... 
>>> json.dumps({1:2, 3:Foo()}, cls=Encoder)
'{"1": 2, "3": {"baz": 2, "bar": 1}}'

Personally I would find it more interesting if there were a unified 
mechanism for json and pickle. At the very least you should come up with a 
decoding mechanism.

> Do you have any guidance to make this idea advance?

Go to python-ideas for a lengthy discussion ;)

> Do you advice me to write down a preliminary PEP or to make directly a
> pull request to the Python's source code?
> 
> Thank you for you're time!
> I'm waiting for your feedback :)
> Have a good Sunday!
> 
> Francesco


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


Re: How can I count word frequency in a web site?

2015-11-29 Thread Cem Karan
You might want to look into Beautiful Soup 
(https://pypi.python.org/pypi/beautifulsoup4), which is an HTML screen-scraping 
tool.  I've never used it, but I've heard good things about it.

Good luck,
Cem Karan

On Nov 29, 2015, at 7:49 PM, ryguy7272  wrote:

> I'm trying to figure out how to count words in a web site.  Here is a sample 
> of the link I want to scrape data from and count specific words.
> http://finance.yahoo.com/q/h?s=STRP+Headlines
> 
> I only want to count certain words, like 'fraud', 'lawsuit', etc.  I want to 
> have a way to control for specific words.  I have a couple Python scripts 
> that do this for a text file, but not for a web site.  I can post that, if 
> that's helpful.
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: variable vs. object

2015-11-29 Thread Ben Finney
André Roberge  writes:

> In Python, a "variable" is a name given to an object. In Python, the
> "=" sign is used to assign a name to an object: the name is on the
> left-hand side, and the object is on the right hand side. Multiple
> names can be assigned to the same object.

Take care with the directionality of those statements.

In Python we don't give the name *to* the object, which would imply that
the object “has” that name in some sense. The object is totally
unaffected, and assignment does not give the object any knowledge about
that name.

We also don't assign names *to* objects; if anything, we assign the
object to the name.

It is the name that “has” the object. Or perhaps less confusingly, the
name is *bound to* the object.

It is frequently a point of confusion that assignment *never* affects
the object, so it's best to avoid giving that false impression.

> In the example you gave, "a" is a name given to the object "10" which
> is an integer.

Rather, I'd prefer to say that ‘a’ now refers to the object ‘10’. The
object ‘10’ was not “given” anything.

-- 
 \   “When I get new information, I change my position. What, sir, |
  `\ do you do with new information?” —John Maynard Keynes |
_o__)  |
Ben Finney

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


[issue12460] SocketServer.shutdown() does not have "timeout=None" parameter

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

Closing as retracted by original reporter.

(Also, I wonder how useful the timeout would be. Adding a timeout isn’t going 
to fix a hanging server.)

--
nosy: +martin.panter
resolution:  -> rejected
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



[issue25763] I cannot use absolute path in sqlite3 , python 2.7.9, windows

2015-11-29 Thread jingtao chen

jingtao chen added the comment:

wow...It works...

--
status: open -> closed

___
Python tracker 

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



Re: Generate config file from template using Python search and replace.

2015-11-29 Thread Mr Zaug
On Sunday, November 29, 2015 at 5:50:51 PM UTC-5, Peter Otten wrote:
> Mr Zaug wrote:
> 
> > When I run this script on OS X El Capitan, I see,
> >   
> >   # permission sensitive cache
> >   $include "_dispatcher_shared_auth-checker:
> > 
> > Was I supposed to incorporate it into the script I posted?
> 
> Are you referring to my post? I'm sorry, I can't make sense of your 
> question.

I seem to be heading in this direction.

#!/usr/bin/env python
import re
from os.path import exists

script, template_file = argv
print "Opening the template file..."

with open (template_file, "r") as a_string:
data=a_string.read().replace('BRAND', 'Fluxotine')
print(data)

So now the challenge is to use the read().replace magic for multiple values.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate config file from template using Python search and replace.

2015-11-29 Thread Rob Hills
A program I am writing at present does exactly this and I simply do
multiple calls to string.replace (see below)

On 30/11/15 10:31, Mr Zaug wrote:
> I seem to be heading in this direction.
>
> #!/usr/bin/env python
> import re
> from os.path import exists
>
> script, template_file = argv
> print "Opening the template file..."
>
> with open (template_file, "r") as a_string:
> data=a_string.read().replace('BRAND', 'Fluxotine')

data=data.replace('STRING_2', 'New String 2')
data=data.replace('STRING_3', 'New String 3')

> print(data)
>
> So now the challenge is to use the read().replace magic for multiple values.

It's crude, but it works well for me!

-- 
Rob Hills
Waikiki, Western Australia

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


Re: How can I count word frequency in a web site?

2015-11-29 Thread ryguy7272
On Sunday, November 29, 2015 at 9:32:22 PM UTC-5, Cem Karan wrote:
> You might want to look into Beautiful Soup 
> (https://pypi.python.org/pypi/beautifulsoup4), which is an HTML 
> screen-scraping tool.  I've never used it, but I've heard good things about 
> it.
> 
> Good luck,
> Cem Karan
> 
> On Nov 29, 2015, at 7:49 PM, ryguy7272 wrote:
> 
> > I'm trying to figure out how to count words in a web site.  Here is a 
> > sample of the link I want to scrape data from and count specific words.
> > http://finance.yahoo.com/q/h?s=STRP+Headlines
> > 
> > I only want to count certain words, like 'fraud', 'lawsuit', etc.  I want 
> > to have a way to control for specific words.  I have a couple Python 
> > scripts that do this for a text file, but not for a web site.  I can post 
> > that, if that's helpful.
> > 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list

Ok, this small script will grab everything from the link.

import requests
from bs4 import BeautifulSoup
r = requests.get("http://finance.yahoo.com/q/h?s=STRP+Headlines;)
soup = BeautifulSoup(r.content)
htmltext = soup.prettify()
print htmltext


Now, how can I count specific words like 'fraud' and 'lawsuit'?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate config file from template using Python search and replace.

2015-11-29 Thread MRAB

On 2015-11-30 02:40, Rob Hills wrote:

A program I am writing at present does exactly this and I simply do
multiple calls to string.replace (see below)

On 30/11/15 10:31, Mr Zaug wrote:

I seem to be heading in this direction.

#!/usr/bin/env python
import re
from os.path import exists

script, template_file = argv
print "Opening the template file..."

with open (template_file, "r") as a_string:
data=a_string.read().replace('BRAND', 'Fluxotine')


 data=data.replace('STRING_2', 'New String 2')
 data=data.replace('STRING_3', 'New String 3')


print(data)

So now the challenge is to use the read().replace magic for multiple values.


It's crude, but it works well for me!


You do need to watch out for matches that are part of something else.

For example, if you had this:

template = "REPLACE_THIS but DONT_REPLACE_THIS"

and you did:

result = template.replace("REPLACE_THIS", "Python")

you would get:

"Python but DONT_Python"

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


[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal

Kovid Goyal added the comment:

To answer part of my question, the reason the fseek()+fread() bug does not 
affect python 3.5.0 appears to be because it implements its own buffering and 
does not use fseek()/fread() at all. 

Sigh, I really hope the answer does not end up being that I have to 
re-implement fseek()/ftell()/fread()/fwrite() using lseek()/read()/write() on 
windows. Or I could wait and hope Microsoft fixes the bug :)

As a first step, to confirm that the bug is in the CRT, I'll have the gzip 
module record all reads/seeks/tells and then see if I can reproduce the bug in 
a plain C program.

--

___
Python tracker 

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



Re: I can't understand re.sub

2015-11-29 Thread Mr Zaug
Thanks. That does help quite a lot.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25764] PyObject_Call() is called with an exception set in subprocess

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

This looks like an intermittent (1 in ~5) failure in at least the Open Indiana 
3.5 and 3.x buildbots.

My guess is that fork() has failed, and because preexec_fn is in use, the code 
tries to call gc.enable() with the fork() exception already set. My patch adds 
a test and fixes that.

Victor already fixed a similar error for the cleanup branch of 
subprocess_fork_exec() in Issue 22290.

--
keywords: +patch
nosy: +martin.panter
stage:  -> patch review
Added file: http://bugs.python.org/file41193/preexec-fork.patch

___
Python tracker 

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



Re: I can't understand re.sub

2015-11-29 Thread Rick Johnson
On Sunday, November 29, 2015 at 3:37:34 PM UTC-6, Mr Zaug wrote:

> The items I'm searching for are few and they do not change. They are 
> "CONTENT_PATH", "ENV" and "NNN". These appear on a few lines in a template 
> file. They do not appear together on any line and they only appear once on 
> each line. This should be simple, right?

Yes. In fact so simple that string methods and a "for loop" will suffice. Using 
regexps for this tasks would be like using a dump truck to haul a teaspoon of 
salt.

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


Re: I can't understand re.sub

2015-11-29 Thread Mr Zaug
On Sunday, November 29, 2015 at 8:12:25 PM UTC-5, Rick Johnson wrote:
> On Sunday, November 29, 2015 at 3:37:34 PM UTC-6, Mr Zaug wrote:
> 
> > The items I'm searching for are few and they do not change. They are 
> > "CONTENT_PATH", "ENV" and "NNN". These appear on a few lines in a template 
> > file. They do not appear together on any line and they only appear once on 
> > each line. This should be simple, right?
> 
> Yes. In fact so simple that string methods and a "for loop" will suffice. 
> Using regexps for this tasks would be like using a dump truck to haul a 
> teaspoon of salt.

I rarely get a chance to do any scripting so yeah, I stink at it.

Ideally I would have a script that will spit out a config file such as 
087_pre-prod_snakeoil_farm.any and not need to manually rename said output file.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate config file from template using Python search and replace.

2015-11-29 Thread Mr Zaug
On Sunday, November 29, 2015 at 5:50:51 PM UTC-5, Peter Otten wrote:
> Mr Zaug wrote:
> 
> > When I run this script on OS X El Capitan, I see,
> >   
> >   # permission sensitive cache
> >   $include "_dispatcher_shared_auth-checker:
> > 
> > Was I supposed to incorporate it into the script I posted?
> 
> Are you referring to my post? I'm sorry, I can't make sense of your 
> question.

Yes. The snippet you posted went way over my head. When I ran it, it printed 

# permission sensitive cache 
  $include "_dispatcher_shared_auth-checker: 
-- 
https://mail.python.org/mailman/listinfo/python-list


variable vs. object

2015-11-29 Thread fl
Hi,

I read several parts on line about Python that everything in Python is an 
object. Yes, it is a key difference with other languages. Then, I read a page
it says variables: global and local variable at:

http://www.tutorialspoint.com/python/python_functions.htm


I have a question that whether variables are objects?

For example,

a=10

'a' is an integer. Is it an object too?

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


How can I count word frequency in a web site?

2015-11-29 Thread ryguy7272
I'm trying to figure out how to count words in a web site.  Here is a sample of 
the link I want to scrape data from and count specific words.
http://finance.yahoo.com/q/h?s=STRP+Headlines

I only want to count certain words, like 'fraud', 'lawsuit', etc.  I want to 
have a way to control for specific words.  I have a couple Python scripts that 
do this for a text file, but not for a web site.  I can post that, if that's 
helpful.

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


Re: How can I count word frequency in a web site?

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 21:31:49 -0500, Cem Karan writes:
>You might want to look into Beautiful Soup 
>(https://pypi.python.org/pypi/beautifulsoup4), which is an HTML 
>screen-scraping tool.  I've never used it, but I've heard good things about it.
>
>Good luck,
>Cem Karan

http://codereview.stackexchange.com/questions/73887/finding-the-occurrences-of-all-words-in-movie-scripts

scrapes a site of movie scripts and then spits out the 10 most common
words.  I suspect the OP could modify this script to suit his or her needs.

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


[issue5319] stdout error at interpreter shutdown fails to return OS error status

2015-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6b08429a3932 by Martin Panter in branch 'default':
Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failure
https://hg.python.org/cpython/rev/6b08429a3932

--

___
Python tracker 

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



[issue25763] I cannot use absolute path in sqlite3 , python 2.7.9, windows

2015-11-29 Thread Eryk Sun

Changes by Eryk Sun :


--
resolution:  -> not a bug
stage:  -> resolved

___
Python tracker 

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



[issue5319] stdout error at interpreter shutdown fails to return OS error status

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

Thanks everyone for helping to get this right.

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



Re: How can I count word frequency in a web site?

2015-11-29 Thread Michiel Overtoom

> On 30 Nov 2015, at 03:54, ryguy7272  wrote:
> 
> Now, how can I count specific words like 'fraud' and 'lawsuit'?

- convert the page to plain text
- remove any interpunction
- split into words
- see what words occur
- enumerate all the words and increase a counter for each word

Something like this:

s = """Today we're rounding out our planetary tour with ice giants Uranus
and Neptune. Both have small rocky cores, thick mantles of ammonia, water,
and methane, and atmospheres that make them look greenish and blue. Uranus
has a truly weird rotation and relatively dull weather, while Neptune has
clouds and storms whipped by tremendous winds. Both have rings and moons,
with Neptune's Triton probably being a captured iceball that has active
geology."""

import collections
cleaned = s.lower().replace("\n", " ").replace(".", "").replace(",", 
"").replace("'", " ")
count = collections.Counter(cleaned.split(" "))
for interesting in ("neptune", "and"):
print "The word '%s' occurs %d times" % (interesting, count[interesting])


# Outputs:

The word 'neptune' occurs 3 times
The word 'and' occurs 7 times




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


[issue25769] Crash due to using weakref referent without acquiring a strong reference

2015-11-29 Thread lplatypus

New submission from lplatypus:

I have encountered some crashes in a multithreaded application which appear to 
be due to a bug in weakref_richcompare in Objects/weakref.c

(I am using Python 2.7.9, but the same weakref code exists in 3.5 and hg 
default branch too)

weakref_richcompare ends with the statement:

return PyObject_RichCompare(PyWeakref_GET_OBJECT(self),
PyWeakref_GET_OBJECT(other), op);

At this point the code has established that the referents of "self" and "other" 
are still alive, and it is trying to compare the referents.  However it has not 
acquired a strong reference to the referents, so I think it is possible for one 
of them to be deleted half way through this comparison.  This can lead to a 
crash, because PyObject_RichCompare assumes that the PyObject*’s it was passed 
will remain usable for the duration of the call.

The crash dumps I have seen involve data corruption consistent with one of 
these PyObject's being deleted and the memory used for something else, eg:

00 python27!try_3way_compare+0x15 [objects\object.c @ 712]
01 python27!try_3way_to_rich_compare+0xb [objects\object.c @ 901]
02 python27!do_richcmp+0x2c [objects\object.c @ 935]
03 python27!PyObject_RichCompare+0x99 [objects\object.c @ 982]
04 python27!weakref_richcompare+0x6a [objects\weakrefobject.c @ 212]

In this example, in try_3way_compare the value of v->ob_type was 0x5f637865, 
which is ASCII "exc_" and not a valid pointer at all.

Other places in weakrefobject.c seem to have a similar weakness, eg in 
weakref_hash and weakref_repr.

I have not been successful in producing a small test case to demonstrate this 
crash.

--
components: Interpreter Core
messages: 255608
nosy: ldeller
priority: normal
severity: normal
status: open
title: Crash due to using weakref referent without acquiring a strong reference
type: crash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



Re: variable vs. object

2015-11-29 Thread Marko Rauhamaa
fl :

> I read several parts on line about Python that everything in Python is
> an object.

Python has two distinct entities: objects and references.

All numbers, strings, classes, modules, class instances, files etc are
objects.

Variables, however, are not objects. They are references. Here are
different references:

   a  # variable
   a.x# attribute
   a[3]   # subscription

> Yes, it is a key difference with other languages.

Python shares this feature with many higher-level languages.


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


[issue25701] Document that tp_setattro and tp_setattr are used for deleting attributes

2015-11-29 Thread Martin Panter

Martin Panter added the comment:

In the python-dev thread, Nick Coghlan gave some arguments and examples where 
PyObject_SetAttr() is intended to be used for deletion. So I will keep my 
changes for PyObject_SetAttr(), and also _SetAttrString() for consistency.

My second patch documents deletion with sq_ass_item(), mp_ass_subscript(), and 
PySequence_SetItem().

PyObject_SetItem() does not look like it deletes items. It explicitly considers 
value == NULL to be an error. As a consequence, PyMapping_SetItemString() does 
not delete either.

PySequence_SetItem() does accept NULL to delete the item. I think this is 
reasonable, to keep it consistent with sq_ass_item(), so I documented it.

PySequence_SetSlice() also accepts NULL to delete the slice. But I am more 
reluctant to document this, because I don’t know of any slot or other code that 
would benefit. So I have left it as is for the time being.

--
Added file: http://bugs.python.org/file41194/setattr.2.patch

___
Python tracker 

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



Re: What use is this class?

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:36:58 -0800, fl writes:
>Hi,
>
>When I search around tutorial about None, I came across this link:
>
>http://jaredgrubb.blogspot.ca/2009/04/python-is-none-vs-none.html
>
>I don't understand what use of this class example:
>
>
>
 class Zero(): # a class that is zero
>...def __nonzero__(self):
>...   return False
>
>
>I can only get the following code running:
>
>cz1=Zero()
>cz1.__nonzero__()
>Out[119]: False
>
>
>Here are my questions:
>1. Is there any other means to use class Zero?
>2. What connection to None on the original author's intention?

The person who wrote this was curious as to why PEP 8 says:
"Comparisons to singletons like None should always be done 
 with 'is' or 'is not', never the equality operators."

He wrote this class to play around with, to see if it really made
a difference whether you write:

if x is None:

vs

if x == None:

and it does.  A class is free to implement its own version of '==' if
if likes, and there, 'being equal to None' might means something
complicated and crazy.  People who are just testing against None will
burn their fingers if they use '==' there.

Also its a bad problem when porting code to Jython.
A java null is supposed to be None.
But using '==' will call the underlying .equals method.
If you call that on a null, Java will spit out a Null Pointer Exception.

Laura

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


Re: variable vs. object

2015-11-29 Thread Joel Goldstick
On Sun, Nov 29, 2015 at 9:06 PM, fl  wrote:

> Hi,
>
> I read several parts on line about Python that everything in Python is an
> object. Yes, it is a key difference with other languages. Then, I read a
> page
> it says variables: global and local variable at:
>
> http://www.tutorialspoint.com/python/python_functions.htm
>
>
> I have a question that whether variables are objects?
>
> For example,
>
> a=10
>
> 'a' is an integer. Is it an object too?
>

yes

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



-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable vs. object

2015-11-29 Thread André Roberge
On Sunday, 29 November 2015 22:06:58 UTC-4, fl  wrote:
> Hi,
> 
> I read several parts on line about Python that everything in Python is an 
> object. Yes, it is a key difference with other languages. Then, I read a page
> it says variables: global and local variable at:
> 
> http://www.tutorialspoint.com/python/python_functions.htm
> 
> 
> I have a question that whether variables are objects?
> 
> For example,
> 
> a=10
> 
> 'a' is an integer. Is it an object too?
> 
> Thanks,

In Python, a "variable" is a name given to an object.  In Python, the "=" sign 
is used to assign a name to an object: the name is on the left-hand side, and 
the object is on the right hand side.   Multiple names can be assigned to the 
same object.  In the example you gave, "a" is a name given to the object "10" 
which is an integer.

If you do:

a = 10
b = a
a = "hello"

b will be 10.  b was just another name given to object 10 to which the name "a" 
was referring to at that point, even though we decided later that a should 
refer to the string "hello" (which is an object).

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


[issue18161] call fchdir if subprocess.Popen(cwd=integer|fileobject)

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Do not understand what should be done in order to fix that...

It will be nice if I can create pull request by myself

--

___
Python tracker 

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



[issue24523] coroutine asyncio.wait() does not preserve order of elements

2015-11-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Yes this is not a bug.

Use asyncio.gather(), it preserves order of elements :)

--

___
Python tracker 

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



[issue15500] Python should support naming threads

2015-11-29 Thread Марк Коренберг

Changes by Марк Коренберг :


--
nosy: +mmarkk

___
Python tracker 

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