[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Mikhail Gulyaev added the comment:

> Why can’t you do the file rewinding yourself, when you retry the request?
Actually I'm not retry to send a request. This behavior I met for httplib 
library while I'm send a single request, httplib send it to exist connection 
and then recreates connection on failure and send it again. Maybe this doing 
tcp socket
For GET POST and DELETE I meet the same behavior

> if someone wrote code that expects data to be sent from a non-zero file 
> position.
Well in this case I'd prefer to trunkate file before send.

--
Added file: http://bugs.python.org/file41285/httplib.pcapng

___
Python tracker 

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



trying to force stdout to utf-8 with errors='ignore' or 'replace'

2015-12-11 Thread Adam Funk
I'm fiddling with a program that reads articles in the news spool
using email.parser (standard library) &
email_reply_parser.EmailReplyParser (installed with pip).  Reading is
fine, & I don't get any errors writing output extracted from article
bodies *until* I try to suppress invalid characters.  This works:

if message.is_multipart():
body = message.get_payload(0, True)
else:
body = message.get_payload()
main_body = EmailReplyParser.parse_reply(body)
# fix quoted-printable stuff
if equals_regex.search(main_body):
main_body = quopri.decodestring(main_body)
# suppress attribution before quoted text
main_body = attrib_regex.sub('>', main_body)
# suppress sig
main_body = sig_regex.sub('\n', main_body)
main_body.strip()
stdout.write(main_body + '\n\n')

but the stdout includes invalid characters.  I tried adding this at
the beginning

if stdout.encoding is None:
   writer = codecs.getwriter("utf-8")
   stdout = writer(stdout, errors='replace')

and changing the output line to 

stdout.write(main_body.encode('utf-8', errors='replace') + '\n\n')

but with either or both of those, I get the dreaded
"UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
562: ordinal not in range(128)".  How can I force the output to be in
UTF-8 & silently suppress invalid characters?


-- 
Unit tests are like the boy who cried wolf.
-- 
https://mail.python.org/mailman/listinfo/python-list


tox-2.3.0: bug fixes, new plugin hooks

2015-12-11 Thread holger krekel

Just released tox-2.3.0, the python test configuration and automation tool.
It brings some important bug fixes and more hooks related to testenvironment
creation and installation, allowing upcoming plugins like tox-debian to add
extra steps during installation.

I'd like to send special thanks to the Tryton foundation who organized
some funding in order to tackle the proper fixing of a serious
regression of tox-2.2 (see changelog below).  thanks also to David Stanek,
Julien Castets, Nelfin for their contributions.

You'll find the current docs for tox here:

https://testrun.org/tox/latest/

and have fun,
holger krekel

-- 
about me:http://holgerkrekel.net/about-me/
contracting: http://merlinux.eu


2.3.0
-

- DEPRECATE use of "indexservers" in tox.ini.  It complicates
  the internal code and it is recommended to rather use the
  devpi system for managing indexes for pip.

- fix issue285: make setenv processing fully lazy to fix regressions
  of tox-2.2.X and so that we can now have testenv attributes like 
  "basepython" depend on environment variables that are set in 
  a setenv section. Thanks Nelfin for some tests and initial
  work on a PR.

- allow "#" in commands.  This is slightly incompatible with commands
  sections that used a comment after a "\" line continuation.
  Thanks David Stanek for the PR.

- fix issue289: fix build_sphinx target, thanks Barry Warsaw.

- fix issue252: allow environment names with special characters.
  Thanks Julien Castets for initial PR and patience.

- introduce experimental tox_testenv_create(venv, action) and 
  tox_testenv_install_deps(venv, action) hooks to allow
  plugins to do additional work on creation or installing
  deps.  These hooks are experimental mainly because of
  the involved "venv" and session objects whose current public 
  API is not fully guranteed.

- internal: push some optional object creation into tests because
  tox core doesn't need it.

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

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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

Sorry but I have a few concerns about your patch:

Why does this have to be in the HTTPConnection.send() method? Why can’t you do 
the file rewinding yourself, when you retry the request?

This could break compatibility if someone wrote code that expects data to be 
sent from a non-zero file position.

I think this would be new feature (for the next version of Python), and 
couldn’t be accepted as a bug fix for 2.7.

See also Issue 9740 (persistent HTTP client connections), where I suggested a 
few things you mentioned, including polling for an unsolicited response or 
closed connection, and reconnecting before sending a request.

Also beware that a general HTTP client shouldn’t automatically retry idempotent 
requests if there is a chance that the original request was already received. 
PUT is idempotent so that is okay. POST is not, however.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Changes by Mikhail Gulyaev :


Added file: http://bugs.python.org/file41286/Выделение_058.png

___
Python tracker 

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



Pylint and Pylint's Astroid projects moved to the Python Code-Quality Authority

2015-12-11 Thread Ian Cordasco
Hi everyone!

It's my pleasure to announce to you that PyLint and its Astroid library
have migrated to git from mercurial and have migrated from BitBucket to the
Python Code-Quality Authority (PyCQA) organization on GitHub.

The new URLs are:

- PyLint: https://github.com/pycqa/pylint

- Astroid: https://github.com/pycqa/astroid

For those who do not know, Pylint (http://www.pylint.org/) is a Python
source code analyzer which looks for programming errors, helps enforcing a
coding standard and sniffs for some code smells. Astroid provides a common
base representation of python source code for projects such as pychecker,
pyreverse, pylint.

Cheers,
Ian
PyCQA Administrator
Flake8, mccabe, pep8, and pyflakes core developer
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


PyCA cryptography 1.1.2 released

2015-12-11 Thread Paul Kehrer
PyCA/cryptography (https://github.com/pyca/cryptography) 1.1.2 has been 
released. cryptography is a package which provides cryptographic recipes and 
primitives to Python developers. Our goal is for it to be your "cryptographic 
standard library". We support Python 2.6-2.7, Python 3.3+, and PyPy.

Changelog:

* Fixed a SIGBUS crash with the OS X wheels caused by redefinition of a method.
* Fixed a runtime error "undefined symbol EC_GFp_nistp224_method" that occurred 
with some OpenSSL installations.
* Updated Windows and OS X wheels to be compiled against OpenSSL 1.0.2e.

-Paul Kehrer (reaperhulk)
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Changes by Mikhail Gulyaev :


Added file: http://bugs.python.org/file41288/Выделение_061.png

___
Python tracker 

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



Re: trying to force stdout to utf-8 with errors='ignore' or 'replace'

2015-12-11 Thread Peter Otten
Adam Funk wrote:

> I'm fiddling with a program that reads articles in the news spool
> using email.parser (standard library) &
> email_reply_parser.EmailReplyParser (installed with pip).  Reading is
> fine, & I don't get any errors writing output extracted from article
> bodies *until* I try to suppress invalid characters.  This works:
> 
> if message.is_multipart():
> body = message.get_payload(0, True)
> else:
> body = message.get_payload()
> main_body = EmailReplyParser.parse_reply(body)
> # fix quoted-printable stuff
> if equals_regex.search(main_body):
> main_body = quopri.decodestring(main_body)
> # suppress attribution before quoted text
> main_body = attrib_regex.sub('>', main_body)
> # suppress sig
> main_body = sig_regex.sub('\n', main_body)
> main_body.strip()
> stdout.write(main_body + '\n\n')
> 
> but the stdout includes invalid characters.  I tried adding this at
> the beginning
> 
> if stdout.encoding is None:
>writer = codecs.getwriter("utf-8")
>stdout = writer(stdout, errors='replace')
> 
> and changing the output line to
> 
> stdout.write(main_body.encode('utf-8', errors='replace') + '\n\n')
> 
> but with either or both of those, I get the dreaded
> "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 562: ordinal not in range(128)".  How can I force the output to be in
> UTF-8 & silently suppress invalid characters?

(I'm assuming you are using Python 2 and that main_body is a unicode 
instance)

Note that you are getting a *decode* error.

Either feed unicode to the modified stdout

> writer = codecs.getwriter("utf-8")
> stdout = writer(stdout, errors='replace')

  stdout.write(main_body + u'\n\n')

or encode manually and write to the original sys.stdout:

  sys.stdout.write(main_body.encode('utf-8', errors='replace') + '\n\n')



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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Changes by Mikhail Gulyaev :


Added file: http://bugs.python.org/file41287/Выделение_059.png

___
Python tracker 

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



Re: python script for dwonload free anything?

2015-12-11 Thread Laura Creighton
In a message of Fri, 11 Dec 2015 06:29:33 -0800, hienm...@gmail.com writes:
>i want create script for download free 3d model from nonecg.com like 
>https://github.com/nishad/udemy-dl-windows , this script download free udemy 
>video lesson. Anyone can tell e, how to create script like that?
>-- 
>https://mail.python.org/mailman/listinfo/python-list

I think you will find this PyPi project interesting.
https://github.com/rg3/youtube-dl/

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


mush 2.0 released! - Type-based dependency injection for scripts

2015-12-11 Thread Chris Withers

Hi All,

I'm very happy to announce a new release of Mush, a light weight 
dependency injection framework aimed at enabling the easy testing and 
re-use of chunks of code that make up scripts.


This release is a re-write dropping all the heuristic callable ordering 
in favour of building up defined sequences of callables with labelled 
insertion points.


For a worked example of how to use Mush to reduce the copy'n'paste in 
your scripts, please see here:


http://mush.readthedocs.org/en/latest/examples.html

Full docs are here:

http://mush.readthedocs.org/

Downloads are here:

https://pypi.python.org/pypi/mush

Compatible with Python 2.7, 3.3+:

https://travis-ci.org/Simplistix/mush

Any problems, please give me a shout on the simplis...@googlegroups.com 
list!


cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
https://mail.python.org/mailman/listinfo/python-list


Re: python script for dwonload free anything?

2015-12-11 Thread Mark Lawrence

On 11/12/2015 14:29, hienm...@gmail.com wrote:

i want create script for download free 3d model from nonecg.com like 
https://github.com/nishad/udemy-dl-windows , this script download free udemy 
video lesson. Anyone can tell e, how to create script like that?



Any (semi)decent IDE and/or editor should help you to create a script. 
Worst case if you're on Windows there's always Notepad but I would not 
recommend it.


If you need more data you'll need a better question so I suggest you 
read this http://www.catb.org/esr/faqs/smart-questions.html


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Frank Millman
"Igor Korot"  wrote in message 
news:CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=e...@mail.gmail.com...



Hi,

> To: python-list@python.org
> From: "Frank Millman" 
> Subject: Problem with sqlite3 and Decimal
> Date: Fri, 11 Dec 2015 11:21:53 +0200
> Lines: 71
>
> Hi all
>
> I need to store Decimal objects in a sqlite3 database, using Python 3.4 
> on

> Windows 7.
>

[...]


>
> I noticed one oddity - I am asking sqlite3 to store the value as a 
> string,

> but then I am asking it to perform arithmetic on it.

Is there a reason you are saving it as the string?
What happens when you save it as decimal?



Well, maybe you know something that I don't, but my understanding is that 
sqlite3 has a very limited range of supported data types, and decimal is not 
one of them.


The stackoverflow article explains how to emulate a decimal type, and it 
works well most of the time.


I found that I could reproduce the problem using sqlite3 directly, without 
using Python, so I have sent a post to the sqlite3 mailing list. I will 
report back with any info received.


Frank


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


[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread Mark Dickinson

Mark Dickinson added the comment:

This is something that comes up repeatedly on the bug tracker. There's no bug 
here in the complex type or the repr. What there *is* is a limitation resulting 
from the fact that Python doesn't have *imaginary* literals, only *complex* 
literals. So in:

-1-0j

the 0j is already a complex number with both real and imaginary parts equal to 
0.0. Then -1 gets promoted to a complex number with real part -1 and imaginary 
part 0.0.  And now you're doing:

complex(-1.0, 0.0) - complex(0.0, 0.0)

which naturally gives an imaginary part of +0.0 rather than 0.0.

You'll see the same issue in C: there was an attempt to fix it in C99 by 
introducing Imaginary types, but those Imaginary types haven't been widely 
adopted. The most recent reincarnation of the C standard finally introduces a 
macro that lets you instantiate a complex number in terms of its real and 
imaginary components (instead of doing real_part + imag_part * I); this is 
something that Python already has in the form of the complex constructor.

Closing as not a bug.

--
resolution:  -> not a bug
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: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Igor Korot
 Hi, Frank,

On Fri, Dec 11, 2015 at 9:27 AM, Frank Millman  wrote:
> "Igor Korot"  wrote in message
> news:CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=e...@mail.gmail.com...
>
>> Hi,
>>
>> > To: python-list@python.org
>> > From: "Frank Millman" 
>> > Subject: Problem with sqlite3 and Decimal
>> > Date: Fri, 11 Dec 2015 11:21:53 +0200
>> > Lines: 71
>> >
>> > Hi all
>> >
>> > I need to store Decimal objects in a sqlite3 database, using Python 3.4
>> > > on
>> > Windows 7.
>> >
>
> [...]
>>
>>
>> >
>> > I noticed one oddity - I am asking sqlite3 to store the value as a >
>> > string,
>> > but then I am asking it to perform arithmetic on it.
>>
>> Is there a reason you are saving it as the string?
>> What happens when you save it as decimal?
>>
>
> Well, maybe you know something that I don't, but my understanding is that
> sqlite3 has a very limited range of supported data types, and decimal is not
> one of them.
>
> The stackoverflow article explains how to emulate a decimal type, and it
> works well most of the time.
>
> I found that I could reproduce the problem using sqlite3 directly, without
> using Python, so I have sent a post to the sqlite3 mailing list. I will
> report back with any info received.

Yes, I saw your post to sqlite3 ML.
And I do know that by default sqlite3 does not have many types supported.

However, all you need to do is save it as DECIMAL(10,2).
It is supported is sqlite3 and it will have NUMERIC affinity (ref 1)
or REAL (ref 2), which means the data will
be stored as decimals and not a string.

Ref.: 1) http://www.tutorialspoint.com/sqlite/sqlite_data_types.htm
2) https://www.sqlite.org/datatype3.html

Thank you.

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


Re: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Igor Korot
Hi,

On Fri, Dec 11, 2015 at 8:45 AM, Laura Creighton  wrote:
> From python-list.
> Very weird.
> Another reason not to use sqlite3
>
> --- Forwarded Message
>
> To: python-list@python.org
> From: "Frank Millman" 
> Subject: Problem with sqlite3 and Decimal
> Date: Fri, 11 Dec 2015 11:21:53 +0200
> Lines: 71
>
> Hi all
>
> I need to store Decimal objects in a sqlite3 database, using Python 3.4 on
> Windows 7.
>
> I followed the instructions here -
>
> 
> http://stackoverflow.com/questions/6319409/how-to-convert-python-decimal-to-sqlite-numeric
>
> It seemed to work well, but then I hit a problem. Here is a stripped-down
> example -
>
> """
> from decimal import Decimal as D
> import sqlite3
>
> # Decimal adapter (store Decimal in database as str)
> sqlite3.register_adapter(D, lambda d:str(d))
>
> # Decimal converter (convert back to Decimal on return)
> sqlite3.register_converter('DEC', lambda s: D(s.decode('utf-8')))
>
> conn = sqlite3.connect(':memory:', detect_types=sqlite3.PARSE_DECLTYPES)
> cur = conn.cursor()
>
> cur.execute("CREATE TABLE fmtemp (acno INT, bal DEC)")
> cur.execute("INSERT INTO fmtemp (acno, bal) VALUES (?, ?)", ('A001',
> D('0')))
>
> sql1 = "SELECT bal FROM fmtemp"
> sql2 = "UPDATE fmtemp SET bal = bal + ?"
>
> while True:
> print(cur.execute(sql1).fetchone()[0])
> cur.execute(sql2, (D('123.45'),))
> q = input()
> if q == 'q':
> break
> """
>
> It initialises a decimal value in the database, then loops adding a decimal
> value and displaying the result.
>
> It runs fine for a while, and then the following happens -
>
> 5802.15
>
> 5925.6
>
> 6049.05
>
> 6172.49
>
> 6295.94
>
> It consistently switches to floating point at the same position. If you
> carry on for a while, it reverts back to two decimal places.
>
> If I initialise the value as D('6049.05'), the next value is 6172.5, so it
> is not the number itself that causes the problem.
>
> I tried displaying the type - even when it switches to 6172.4999, it is
> still a Decimal type.
>
> I noticed one oddity - I am asking sqlite3 to store the value as a string,
> but then I am asking it to perform arithmetic on it.

Is there a reason you are saving it as the string?
What happens when you save it as decimal?

Thank you.

>
> Any suggestions will be much appreciated.
>
> Frank Millman
>
>
> - --
> https://mail.python.org/mailman/listinfo/python-list
>
> --- End of Forwarded Message
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread Mark Dickinson

Mark Dickinson added the comment:

> As I understand the output of repr() is supposed to be something that can 
> evaluated to recreate the same object.

Right, but that's an ideal that's not always achieved in practice. If I had my 
druthers, I'd 'fix' the repr of the complex object to return something that's 
written in terms of the constructor (for example, "complex(2.3, -0.0)"). I 
don't think that's a reasonable change from the POV of backwards compatibility 
though.

--

___
Python tracker 

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



[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Previous discussions: #17336, #22548

--

___
Python tracker 

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



[issue24844] Python 3.5rc1 compilation error with Apple clang 4.2 included with Xcode 4

2015-12-11 Thread Mojca Miklavec

Mojca Miklavec added the comment:

Is anyone willing to help me a bit to come up with a pull request?

I took some ideas from here:
https://fossies.org/diffs/xscreensaver/5.30_vs_5.32/utils/thread_util.c-diff.html

Citation from that patch:
   Clang 3.0 has a partial implementation of GNU atomics; 3.1 rounds it out.

   
http://llvm.org/viewvc/llvm-project/cfe/tags/RELEASE_30/final/include/clang/Basic/Builtins.def?view=markup
   
http://llvm.org/viewvc/llvm-project/cfe/tags/RELEASE_31/final/include/clang/Basic/Builtins.def?view=markup

   Apple changes the Clang version to track Xcode versions; use
   __apple_build_version__ to distinguish between the two.

   Xcode 4.3 uses Apple LLVM 3.1, which corresponds to Clang 3.1.
   https://en.wikipedia.org/wiki/Xcode

One should probably adapt this into "at least clang 3.3 (or perhaps even 3.4?) 
is needed". Now, the basic test in configure.ac is the following:

volatile int val = 1;
int main() {
__atomic_load_n(, __ATOMIC_SEQ_CST);
return 0;
}

With clang on 10.7 (Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 
3.2svn)) this compiles, runs and returns 0. Evidently a more complex test is 
needed to trigger the error, but I'm not sure that that test should be since I 
don't have enough experience with "atomic". If you have a clue what 
functionality I should test, I will gladly do it and try to come up with a 
better test.

An alternative could be to blacklist a compiler and this is what I am proposing 
here as a very naive approach:

volatile int val = 1;
int main() {
 
__atomic_load_n(, __ATOMIC_SEQ_CST);

#define VERSION_CHECK(cc_major, cc_minor, req_major, req_minor) \
((cc_major) > (req_major) || \
(cc_major) == (req_major) && (cc_minor) >= (req_minor))

#if defined(__clang__)
#if defined(__apple_build_version__)
// either one test or the other should work
// #if __apple_build_version__ < 500
#if !VERSION_CHECK(__clang_major__, __clang_minor__, 5, 0)
this_should_fail();
#endif
// not sure if this is 3.3 or 3.4
#elif !VERSION_CHECK(__clang_major__, __clang_minor__, 3, 3)
this_should_fail();
#endif
#endif

  return 0;
}

--
nosy: +Mojca Miklavec

___
Python tracker 

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



Re: Python variable assigning problems...

2015-12-11 Thread Ian Kelly
On Fri, Dec 11, 2015 at 9:10 AM, ICT Ezy  wrote:
> Dear All,
> Very Sorry for the my mistake here. I code here with mu question ...
>
> My Question:
>
> A,B=C,D=10,11
> print(A,B,C,D)
> #(10,11,10,11) --> This is OK!
>
> a=1; b=2
> a,b=b,a
> print(a,b)
> # (1,2) --> This is OK!

This actually results in (2, 1), which is expected; you assign 1 to a
and 2 to b and then swap the values.

> x,y=y,x=2,3
> print(x,y)
> # (3,2) --> Question: How to explain it?
> # Not understand this process. Pl explain ...

The assignments happen from left to right. First, (2,3) is assigned to
(x,y), which has the effect of assigning 2 to x and then 3 to y. Next,
(2,3) is assigned to (y,x), whas the effect of assigning 2 to y and
then 3 to x, overwriting the previous assignments. Then when you do
the print, x has the value 3, and y has the value 2.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python variable assigning problems...

2015-12-11 Thread Ian Kelly
On Fri, Dec 11, 2015 at 9:24 AM, Robin Koch  wrote:
> Assigning goes from right to left:
>
> x,y=y,x=2,3
>
> <=>
>
> y, x = 2, 3
> x, y = y, x
>
> Otherwise the assignment x, y = y, x would not make any sense, since x and y
> haven't any values yet.
>
> And the execution from right to left is also a good choice, because one
> would like to do something like:
>
> x = y = z = 0
>
> Again, assigning from left to right woud lead to errors.

No, it actually happens left to right. "x = y = z = 0" means "assign 0
to x, then assign 0 to y, then assign 0 to z." It doesn't mean "assign
0 to z, then assign z to y, etc." This works:

>>> d = d['foo'] = {}
>>> d
{'foo': {...}}

This doesn't:

>>> del d
>>> d['foo'] = d = {}
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'd' is not defined
-- 
https://mail.python.org/mailman/listinfo/python-list


python 351x64

2015-12-11 Thread Jay Hamm
Hi

I was trying to use your windows version of python 3.5.1 x64.

It has a conflict with a notepad++ plugin NppFTP giving 
api-ms-win-crt-runtime-I1-1-0.dll error on start up.

This seems pretty well documented on the web. The work around is to delete the 
plugin and reinstall since it borks the install.

Since about every other admin I've ever known uses notepad++, you might want to 
fix this.

Also your installer fails to set the permissions correctly:

H:\>py -m pip install requests
Collecting requests
  Downloading requests-2.8.1-py2.py3-none-any.whl (497kB)
100% || 499kB 875kB/s
Installing collected packages: requests
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 
211, in mainstatus = self.run(options, args)
  File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", 
line 311, in runroot=options.root_path,
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 
646, in install**kwargs
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", 
line 803, in installself.move_wheel_files(self.source_dir, root=root)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", 
line 998, in move_wheel_filesisolated=self.isolated,
  File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 339, in 
move_wheel_filesclobber(source, lib_dir, True)
  File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 310, in 
clobberensure_dir(destdir)
  File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", 
line 71, in ensure_diros.makedirs(path)
  File "C:\Program Files\Python35\lib\os.py", line 241, in makedirs
mkdir(name, mode) PermissionError: [WinError 5] Access is denied: 'C:\\Program 
Files\\Python35\\Lib\\site-packages\\requests'

Once I gave myself control it started working.

This is pretty shoddy for released software.
Thanks,
Jacob Hamm (Jay) VCP-DCV, RHCE
Senior Cloud Services Engineer - VMware vCloud Air

380 Interlocken Crescent Blvd - Ste 500, Broomfield CO 80021
Office 303 942 4638 - ha...@vmware.com
Want to learn more about VMware vCloud Air?
Go to http://vcloud.vmware.com/tutorials
[vCloudAir]

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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread R. David Murray

R. David Murray added the comment:

This patch is definitely invalid.  There is no requirement that data be 
seekable.

Are you saying that there insufficient support in http(lib) for an application 
to handle this server timeout?  Can you provide a program that demonstrates the 
problem (even better would be a unit test that simulates the server timeout).  
I'm thinking it is likely that it is the responsibility of the layer above 
http(lib) to handle this, but the problem isn't clear enough to me to be sure 
(Martin probably has a better understanding of it).

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



[issue25841] In FancyURLopener error in example with http address.

2015-12-11 Thread R. David Murray

Changes by R. David Murray :


--
stage:  -> needs patch
versions: +Python 2.7 -Python 3.3, Python 3.4

___
Python tracker 

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



Re: trying to force stdout to utf-8 with errors='ignore' or 'replace'

2015-12-11 Thread Adam Funk
On 2015-12-11, Peter Otten wrote:

> Adam Funk wrote:

>> but with either or both of those, I get the dreaded
>> "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>> 562: ordinal not in range(128)".  How can I force the output to be in
>> UTF-8 & silently suppress invalid characters?
>
> (I'm assuming you are using Python 2 and that main_body is a unicode 
> instance)

The short answer turned out to be 'switch to Python 3', which I think
is what I'll do from now on unless I absolutely need a library that
isn't available there.

(AFAICT, the email parser in 2.7 returns the body as a bytestring &
doesn't actually look at the Content-Type header, & trying to decode
the body with that just made it barf in different places.)


-- 
Science is what we understand well enough to explain to a computer.  
Art is everything else we do.  --- Donald Knuth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python variable assigning problems...

2015-12-11 Thread Robin Koch

Am 11.12.2015 um 17:10 schrieb ICT Ezy:

Dear All,
Very Sorry for the my mistake here. I code here with mu question ...

My Question:

A,B=C,D=10,11
print(A,B,C,D)
#(10,11,10,11) --> This is OK!

a=1; b=2
a,b=b,a
print(a,b)
# (1,2) --> This is OK!

x,y=y,x=2,3
print(x,y)
# (3,2) --> Question: How to explain it?
# Not understand this process. Pl explain ...


What else would you expect?

Assigning goes from right to left:

x,y=y,x=2,3

<=>

y, x = 2, 3
x, y = y, x

Otherwise the assignment x, y = y, x would not make any sense, since x 
and y haven't any values yet.


And the execution from right to left is also a good choice, because one 
would like to do something like:


x = y = z = 0

Again, assigning from left to right woud lead to errors.

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


[issue25842] Installer does not set permissions correctly?

2015-12-11 Thread Laura Creighton

New submission from Laura Creighton:

This in from python-list.  2 complaints.  
conflict with a notepad++ plugin and incorrect permissions.

Date:Fri, 11 Dec 2015 16:30:32 +
To:  "python-l...@python.org" 
From:Jay Hamm 
Subject: python 351x64


Hi

I was trying to use your windows version of python 3.5.1 x64.

It has a conflict with a notepad++ plugin NppFTP giving api-ms-win-crt-runtime-
I1-1-0.dll error on start up.

This seems pretty well documented on the web. The work around is to delete the 
plugin and reinstall since it borks the install.

Since about every other admin I've ever known uses notepad++, you might want to
 fix this.

Also your installer fails to set the permissions correctly:

H:\>py -m pip install requests
Collecting requests
  Downloading requests-2.8.1-py2.py3-none-any.whl (497kB)
100% || 499kB 875kB/s
Installing collected packages: requests
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 2
11, in mainstatus = self.run(options, args)
  File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", l
ine 311, in runroot=options.root_path,
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 6
46, in install**kwargs
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", li
ne 803, in installself.move_wheel_files(self.source_dir, root=root)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", li
ne 998, in move_wheel_filesisolated=self.isolated,
  File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 339, in
 move_wheel_filesclobber(source, lib_dir, True)
  File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 310, in
 clobberensure_dir(destdir)
  File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", lin
e 71, in ensure_diros.makedirs(path)
  File "C:\Program Files\Python35\lib\os.py", line 241, in makedirsmkdir(na
me, mode) PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\P
ython35\\Lib\\site-packages\\requests'

Once I gave myself control it started working.

This is pretty shoddy for released software.
Thanks,
Jacob Hamm (Jay) VCP-DCV, RHCE
Senior Cloud Services Engineer - VMware vCloud Air

380 Interlocken Crescent Blvd - Ste 500, Broomfield CO 80021
Office 303 942 4638 - ha...@vmware.com
Want to learn more about VMware vCloud Air?
Go to http://vcloud.vmware.com/tutorials
[vCloudAir]

--
components: Installation, Windows
messages: 256223
nosy: lac, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Installer does not set permissions correctly?
versions: 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



[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread leewz

New submission from leewz:

Meaning:

filter(False, lst)
== (x for x in lst if not x)
== itertools.filterfalse(None, lst)

I understand that it is a very minor enhancement, and with not much benefit. I 
just happened to think about it, and wondered why it didn't already exist. I 
figured it wouldn't hurt to put the idea out here.

(If anyone is interested, I was looking into ways that filter/map/itertools 
could "unwrap" each other at the C level to improve composition of generators, 
inspired by the functools.partial optimization.)

--
messages: 256218
nosy: leewz
priority: normal
severity: normal
status: open
title: Allow `False` to be passed to `filter`
type: enhancement
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



[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread R. David Murray

R. David Murray added the comment:

I don't think it is worth adding as a special case.  Itertools has it because 
of what itertools is (a mini-language for manipulating iterables), but the 
legacy filter function has no reason to grow additional special cases beyond 
None.  (It's not even clear why it has that one special case :)

--
nosy: +r.david.murray
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



Re: Python variable assigning problems...

2015-12-11 Thread ICT Ezy
Dear All,
Very Sorry for the my mistake here. I code here with mu question ...

My Question:

A,B=C,D=10,11
print(A,B,C,D)
#(10,11,10,11) --> This is OK!

a=1; b=2
a,b=b,a
print(a,b)
# (1,2) --> This is OK!

x,y=y,x=2,3
print(x,y)
# (3,2) --> Question: How to explain it?
# Not understand this process. Pl explain ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python script for dwonload free anything?

2015-12-11 Thread hienmizu
thank you laura, but i know this paid 3d model: 
http://www.nonecg.com/tokyo-shibuya.html. do you know that
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25841] In FancyURLopener error in example with http address.

2015-12-11 Thread Denis Savenko

New submission from Denis Savenko:

In documentation from this page 
https://docs.python.org/3.5/library/urllib.request.html#examples in examples 
uses default address to python site with http. ( http://python.org/ ). But now 
python.org use https. When i try use example in ipython i get I/0 error, but 
error is very simple - http change by https. I found this error on many pages, 
where use http://python.org/ address, but on FancyURLopener example compiller 
error very difficult for understanding.

--
assignee: docs@python
components: Documentation
messages: 256221
nosy: Denis Savenko, docs@python
priority: normal
severity: normal
status: open
title: In FancyURLopener error in example with http address.
versions: 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



[issue24505] shutil.which wrong result on Windows

2015-12-11 Thread Toby Tobkin

Toby Tobkin added the comment:

I'm working on a patch and an accompanying unit test for this now. Should have 
it out today.

--
nosy: +tobytobkin

___
Python tracker 

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



Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread phamtony33
Can anyone direct me in the direction where to start the code for the 
randomized of the  ball  to start.

from Tkinter import *
window = Tk()
canvas = Canvas(window, width=500, height=500, background="green")
canvas.pack()

def mouse_paddle_move(event):
mouseY = event.y
current_coords = canvas.coords("paddle")
x1 = current_coords[0]
y1 = current_coords[1]
x2 = current_coords[2]
y2 = current_coords[3]
height = (y2 - y1)
canvas.coords("paddle", x1, mouseY - (height/2), x2, mouseY + 
(height/2))

def move_ball(speed_x, speed_y, score):
box = canvas.bbox("ball")
x1 = box[0]
y1 = box[1]
x2 = box[2]
y2 = box[3]


if x2 >= 500:
canvas.create_text(250, 250, text="Game Over!")
return


box = canvas.bbox("paddle")
px1 = box[0]
py1 = box[1]
px2 = box[2]
py2 = box[3]
if x2 > px1 and y2 > py1 and y1 < py2:

speed_x = -1.2 * (abs(speed_x))
speed_y = 1.2 * speed_y


score = score + 1
canvas.itemconfig("score_text", text="Score: " + str(score))


if x1 <= 0:
speed_x = -1 * speed_x


if y2 >= 500 or y1 <= 0:
speed_y = -1 * speed_y

canvas.move("ball", speed_x, speed_y)
canvas.after(30, move_ball, speed_x, speed_y, score) 


canvas.create_oval(225, 225, 275, 275, fill="blue", tags="ball")
canvas.create_rectangle(450, 200, 455, 300, fill="red", tags="paddle")
canvas.create_text(250, 10, tags = "score_text", text="Score: 0")


move_ball(-10, 7, 0)


canvas.bind('', mouse_paddle_move)

mainloop()
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue6478] time.tzset does not reset _strptime's locale time cache

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

Thanks Serhiy. Can we close this now?

--

___
Python tracker 

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



[issue25843] lambdas on the same line may incorrectly share code objects

2015-12-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The equality of code objects is determined by the code_richcompare() logic in 
Objects/codeobject.c.

Two code objects are equal if all of their attributes compare equal.  That 
includes co_name, co_argcount, co_kwonlyargcount, co_nlocals, co_flags, 
co_firstlineno, co_code, co_consts, co_names, co_varnames, co_freevars, and 
co_cellvars.

At the heart of David Murray's minimal example, the reason the two distinct 
code objects compare equal is that their co_consts compare as equal.

If you wanted to fix this, code objects would need to recursively check for 
both normal equality and type equality.

>>> f1 = lambda: 1
>>> f2 = lambda: 1.0
>>> f1.__code__.co_consts == f2.__code__.co_consts
True
>>> map(type, f1.__code__.co_consts) == map(type, f2.__code__.co_consts)
False

--
nosy: +rhettinger

___
Python tracker 

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



[issue5501] Update multiprocessing docs re: freeze_support

2015-12-11 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +davin

___
Python tracker 

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



[issue25757] Subclasses of property lose docstring

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cc1aa0e88626 by Berker Peksag in branch '3.5':
Issue #25755: Move PropertyWritableDoc into the test case
https://hg.python.org/cpython/rev/cc1aa0e88626

New changeset 8f52c9d72d9f by Berker Peksag in branch 'default':
Issue #25755: Move PropertyWritableDoc into the test case
https://hg.python.org/cpython/rev/8f52c9d72d9f

--
nosy: +python-dev

___
Python tracker 

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



[issue25755] Test test_property failed if run twice

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patch, Nan. I've updated your patch to apply Serhiy's advice.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue25822] Add docstrings to fields of urllib.parse results

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

Thanks, Swati. I left a few comments on Rietveld: 
http://bugs.python.org/review/25822/

A test wouldn't hurt, but you can wait for further review comments to avoid 
updating tests each time you get a comment.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue25730] invisible sidebar content with code snippets

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

This can be reproduced at https://docs.python.org/3/faq/windows.html

You can find the CSS file at Doc/tools/pydoctheme/static/pydoctheme.css. You 
can override .highlight there, but the actual problem is that Sphinx creates 
the outer highlight-python3 div with "position: relative;". I think your CSS 
fix is good enough to commit. Thanks!

--
nosy: +berker.peksag

___
Python tracker 

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



[issue25757] Subclasses of property lose docstring

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

fix_repetitions.diff was unrelated to this issue so subprop_doc_r2.diff still 
needs to be reviewed.

--

___
Python tracker 

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



[issue25757] Subclasses of property lose docstring

2015-12-11 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for fix_repetitions.diff, Torsten. The test_property failure was 
discussed in issue 25755.

--
nosy: +berker.peksag

___
Python tracker 

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



Re: Is vars() the most useless Python built-in ever?

2015-12-11 Thread Rick Johnson
On Tuesday, December 1, 2015 at 10:49:19 PM UTC-6, Ian wrote:
> > It's a well know fact that GvR was inspired to create
> > Python from his experiences working with a language
> > called ABC -- and ABC was designed *EXCLUSIVELY* to be a
> > beginners language.
> Which is exactly what made ABC itself unsuitable for Guido's purpose, which
> was to create an *applications* language with better productivity than C to
> support users of Amoeba, the OS that he was working on at the time.

The key word here is "productivity". Intuitiveness and productivity have a 
synergy like peas and carrots! One cannot be productive if one is fighting an 
unintuitive interface. Could you drive with your toes? How about your tongue? 

Sure, even the most atrocious interface can be "learned", but what i cannot 
understand, except in the case of you being a contrarian, is why you would 
argue *AGAINST* intuitive interfaces? And believe it or not, *SYNTAX* is an 
interface! As are paradigms! 

> > Even a noob can intuit what is going on here. First we
> > have an *OBJECT* named "stdout, and we can extrapolate
> > that stdout is an abbreviation for StandardOutput. Next,
> > we see a method called "write", and, if our IQ is above
> > room temperature, then we can extrapolate what that
> > method will do.
> 
> This is absurd. You postulate a beginner so rank that they can't understand
> what "print" means, yet you expect them to intuitively know:
> 
> 1) what an object is;
> 
> 2) what a method is;
> 
> 3) that a method is identified by placing a period between the object and
> the name of the method;
> 
> 4) what "output" is in the context of programming;
> 
> 5) and not be confused about what makes the output "standard".

You accuse me of Reductio Ad Adsurdium, yet you commit the same offense, and 
then put words in my mouth?

Of course i don't expect a "rank noob" to understand these concepts 
*immediately*, however, the learning curve will be greatly reduced, and the 
depth of knowledge greatly expanded, when a clear path of consistent 
intuitiveness is baked-into the learning process -- it's all about breadcrumbs 
my dear boy, breadcrumbs!

THE PRINT FUNCTION HAS TWO MAJOR ISSUES IN THE CONTEXT OF INTUITIVENESS:

(1) When laymen consider the word "print" (in the context of computing), they 
first think of "sending a document to a printing device". LIKE IT NOT, "PRINT" 
IS A CONCEPTUAL CHAMELEON! It does the worst thing it can do, it distracts! 

(2) The path to the underlying process is not even remotely clear. LIKE IT NOT, 
PRINT IS "MAGIC SYNTAX". 

Of course the noob is not going to immediately intuit every atomic component of 
`stdout.write("blah")`, however, the road signs are there, and all he need to 
do is follow them. In fact, by learning from my example, not only will the noob 
learn the "magic" that exists under the hood, he will also learn a vital lesson 
(while dissecting the components) about the power of "divide and conquer". 

If we were to create a thought exercise that juxtaposes your argument with 
mine, we would find a great example in the "search for hidden treasure". You 
expect the noob to go into a dessert without a map and dig holes until he 
locates the treasure or dies of exhaustion. Whereas i will not only give the 
noob a map, i will draw a clear path on the map to the destination -- all he 
need to do is navigate! I don't know what's more absurd: your argument, or your 
ego?

> You're describing this as if your hypothetical beginner were learning
> Python in a vacuum. In reality, people learn from a teacher, or a book, or
> at minimum a tutorial.

Hmm. I'll bet you create teeny tiny variable names and then write a paragraph 
to describe them. Does the concept of "Self Documentation" mean anything to 
you? And, when correctly designed, the only tutorial that is needed is the the 
syntax! Heck, we are not writing assembly code here man, we're writing Python 
code for Guido's sake!

> Here's how you teach somebody what "print" does: instruct them to type
> print("hello world") at the interactive prompt. Note that Python writes
> "hello world" as a result. If they really want, they can check their
> printer and see that nothing came out. That's it. The student now
> understands what "print" means.

Yes, the timeless method of "trial and error" is expected if you're a trail 
blazer and there exists no previous knowledge, however, when this sort of 
teaching paradigm is used in areas where the processes have been previously 
dissected, it reflects a sadistic nature within the teacher. I'm of the opinion 
that learning "old tech" should be as intuitive as possible, and that, as 
knowledge spreads, we all prosper. However, you seem to adopt the teaching 
methods of a drunken and disorderly college sorority house captain. Students 
are not pledges to be tortured. They are our the future. And when we undermine 
them, we undermine our ourselves. 

 PUT THAT IN YOUR INTERPRETER AND RUN IT!
-- 

Re: Is vars() the most useless Python built-in ever?

2015-12-11 Thread Rick Johnson
On Tuesday, December 1, 2015 at 1:34:54 AM UTC-6, Marko Rauhamaa wrote:
> Rick Johnson :
> 
> > python was originally created to be an easy language for noobs to
> > learn
> 
> Really? That's would be a silly objective for a programming language.
> 
> > many a noob has been stumped
> 
> So?
> 
> You have to first placate the experts and the "noobs" will follow.

Okay i get it. So in your opinion, a technology is *ONLY* worthy if it requires 
a large amount of special training to wield it? 

Well, in that case you'd better start organizing a revived Luddite movement, 
because i can assure you that as we progress into the future, more and more of 
the processes that required "human specialist" will be replaced with 
computational devices that are purposefully designed to expose the most 
intuitive interface possible. 

PSST: THIS IS THE FUTURE! AND IT'S ALREADY STEAMROLLING AHEAD WITHOUT YOU!

Just about anything a human specialist can do, a machine can already, or will 
in a short time, do better, faster, and more consistently. This is a fact! We 
humans are terrible at solving problems that require extreme precision, 
repetition, data mining, memory recall, and many other processes that 
computational machines do with great ease. 

Any problem solving process can be broken down into it's atomic components, and 
reassembled as a logical algorithm. Even doctors will soon be replaced with 
machines, which will raise the quality of health care to a level never seen. 
There is almost no skill that is beyond the clutches of the algorithm.

In fact, the only skill that we humans posses which cannot yet be emulated, is 
the power of our imagination. Therefor, our goal should not be to create more 
"specialist", who toil away doing menial tasks like slaves, no, but to foster 
the creative potential of the human mind. 

By first *understanding* algorithmic processes, and then *abstracting* those 
processes in logic form, and finally *relegating* those abstractions to 
computational machines (that expose intuitive interfaces), we will enter an age 
of creative enlightenment such as this world has never seen. Just as the 
information age brought all the worlds knowledge to our fingertips, the 
relegation of menial tasks will free our bodies so that our minds can utilize 
that vast trove of knowledge to drive our technological evolution into 
overdrive. 

And as far as i'm concerned, we can't get there fast enough! 

So if you want to cling to a world where your "special skills" are nothing more 
than "job security", well then, go ahead. As for myself, and the vast majority 
of humanity, we will forge on with or without you!

 SO GOODBYE, AND GOOD RIDDANCE!!!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25823] Speed-up oparg decoding on little-endian machines

2015-12-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I verified that Clang and GCC both give the expected disassembly with Serhiy's 
patch.   We ought to restrict the #if to just the compilers that are known to 
optimize away the memcpy.

Clang (for 'BUILD_LIST_UNPACK')
---
  .loc10 2525 9   ## Python/ceval.c:2525:9
  movzwl  (%r13), %r9d
  addq$2, %r13
  Ltmp2042:
  ##DEBUG_VALUE: PyEval_EvalFrameEx:next_instr <- R13

GCC (for 'BUILD_LIST_UNPACK')
- 
  LM1275:
  movzwl  (%rdx), %r8d
  LVL1147:
  leaq2(%rdx), %rbp

[Mark]
> Benchmarks showing dramatic real-world speed improvements ...

Much of the doubling of speed for core Python that has occurred over the last 
ten decade has occurred one little step at a time, none of the them being 
individually "dramatic".  In general, if we have a chance to reduce the work 
load in the ceval inner-loop, we should take it.

A simple benchmark on clang shows a roughly 10+% speedup in code exercising 
simple and common opcodes that that have a oparg (there is no point of 
benchmarking the effect on opcodes like IMPORT_NAME where the total eval-loop 
overhead is already an insignificant proportion of the total work).

Baseline version with CLANG Apple LLVM version 7.0.2 (clang-700.1.81)
  $ ./python.exe exercise_oparg.py 
  0.22484053499647416
  $ ./python.exe exercise_oparg.py 
  0.22687773499637842
  $ ./python.exe exercise_oparg.py 
  0.22026274001109414

Patched version with CLANG Apple LLVM version 7.0.2 (clang-700.1.81)
  $ ./python.exe exercise_oparg.py 
  0.19516360601119231
  $ ./python.exe exercise_oparg.py 
  0.20087355599389412
  $ ./python.exe exercise_oparg.py 
  0.1980393300036667

To better isolate the effect, I suppose you could enable the READ_TIMESTAMP 
macros to precisely measure the effect of converting five sequentially 
dependent instructions with two independent instructions, but likely all it 
would show you is that the two are cheaper than the five.

--
Added file: http://bugs.python.org/file41289/exercise_oparg.py

___
Python tracker 

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



[issue25755] Test test_property failed if run twice

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cc1aa0e88626 by Berker Peksag in branch '3.5':
Issue #25755: Move PropertyWritableDoc into the test case
https://hg.python.org/cpython/rev/cc1aa0e88626

New changeset 8f52c9d72d9f by Berker Peksag in branch 'default':
Issue #25755: Move PropertyWritableDoc into the test case
https://hg.python.org/cpython/rev/8f52c9d72d9f

--
nosy: +python-dev

___
Python tracker 

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



[issue25757] Subclasses of property lose docstring

2015-12-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Can this be closed now or is there work left to be done?

--
nosy: +rhettinger

___
Python tracker 

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



[issue25768] compileall functions do not document or test return values

2015-12-11 Thread Brett Cannon

Brett Cannon added the comment:

Do the tests take much longer with all of the added stuff in 
setUp()/tearDown()? It's just that all of it has to run for all tests. You 
could make a mixin or put all of it in a method that you selectively call and 
which registers the proper cleanup method.

As for skip_curdir, if you look at 
https://hg.python.org/cpython/file/default/Lib/compileall.py#l188 you will 
notice it requires the current directory to be on sys.path and I don't see you 
make any such change to sys.path (and if you do you can use 
test_importlib.util.import_state to temporarily mutate sys.path 
(https://hg.python.org/cpython/file/default/Lib/test/test_importlib/util.py#l165).

--

___
Python tracker 

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



[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

As far as I understand, httplib should not be automatically reconnecting and 
re-sending requests. I still suspect your script may be causing the retry, but 
you are welcome to prove me wrong.

Can you clarify “send PUT request to closed socket”: is the local OS socket 
closed (file descriptor is released)? Or is it that the remote end of the 
connection has been shut down? If it is the remote end, in Python 2 usually you 
would see a BadStatusLine or some kind of socket.error exception, and nothing 
would be retried.

I think we really need to know what your script is doing to be able to help. 
For instance, in the 059 screen shot, what API calls were made to cause data to 
be initially sent (presumably from local port 40736), and then the reconnection 
(local port 40757) with more data?

--
stage:  -> test needed

___
Python tracker 

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



[issue25845] _ctypes\cfield.c identical subexpressions in Z_set

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

History is good for understanding how things became the way they are. :) Thanks 
Alexander and Random!

--
nosy: +martin.panter
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> enhancement
versions: +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



[issue25843] lambdas on the same line may incorrectly share code objects

2015-12-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Here's another variant (courtesy of Nick Coghlan):

python3.5 -c "seq1 = [1.0 for x in range(5)]; seq2 = [True for x in range(5)]; 
print(seq1); print(seq2)"

--

___
Python tracker 

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



[issue25843] lambdas on the same line may incorrectly share code objects

2015-12-11 Thread Kevin Shweh

Kevin Shweh added the comment:

A type-based check runs into problems with 0.0 vs -0.0. For example, on Python 
2.7.11:

>>> x, y = lambda: 0.0, lambda: -0.0
>>> y()
0.0

I wasn't able to reproduce the -0.0 problem with Python 3.4 on Ideone; 
y.__code__.co_consts seems to have an unused 0.0 in it on 3.4. I don't have 
access to Python 3.5, so I don't know what the situation is like on that 
version.

--
nosy: +Kevin Shweh

___
Python tracker 

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



[issue25841] In FancyURLopener error in example with http address.

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

Assuming you meant http://www.python.org/ (added the www), I cannot produce any 
error with any example that requests directly to the site. The “http:” server 
already redirects to “https:”, so there is no problem. Obviously the examples 
that depend on made-up servers like proxy.example.com are going to fail.

In particular, the second FancyURLopener example works for me. Modified 
slightly to avoid copious output:

$ python3.5 -bWall
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.request
>>> opener = urllib.request.FancyURLopener({})
__main__:1: DeprecationWarning: FancyURLopener style of invoking requests is 
deprecated. Use newer urlopen functions/methods
>>> with opener.open("http://www.python.org/;) as f:
... response = f.read().decode('utf-8')
... 
>>> response[:100]
'\n\n

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



[issue25844] Pylauncher, launcher.c: Assigning NULL to a pointer instead of testing against NULL

2015-12-11 Thread Alexander Riccio

New submission from Alexander Riccio:

I found this while writing up a separate bug (CPython doesn't use static 
analysis!).

In PC/launcher.c, get_env has a bug:

/* Large environment variable. Accept some leakage */
wchar_t *buf2 = (wchar_t*)malloc(sizeof(wchar_t) * (result+1));
if (buf2 = NULL) {
error(RC_NO_MEMORY, L"Could not allocate environment buffer");
}
GetEnvironmentVariableW(key, buf2, result);
return buf2;

See: https://hg.python.org/cpython/file/tip/PC/launcher.c#l117


Instead of `buf2 == NULL`, Vinay Sajip wrote `buf2 = NULL`. The commit where 
the error was introduced: https://hg.python.org/cpython/rev/4123e002a1af

Thus, whatever value was in buf2 is lost, the branch is NOT taken (because buf2 
evaluates to false), and GetEnvironmentVariableW will (probably) cause an 
access violation. 


Compiling with /analyze found this quite easily:

c:\pythondev\repo\pc\launcher.c(117): warning C6282: Incorrect operator:  
assignment of constant in Boolean context. Consider using '==' instead.

--
components: Windows
messages: 256254
nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, vinay.sajip, 
zach.ware
priority: normal
severity: normal
status: open
title: Pylauncher, launcher.c: Assigning NULL to a pointer instead of testing 
against NULL

___
Python tracker 

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



[issue25844] Pylauncher, launcher.c: Assigning NULL to a pointer instead of testing against NULL

2015-12-11 Thread Alexander Riccio

Changes by Alexander Riccio :


--
type:  -> crash

___
Python tracker 

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



[issue25846] Use of Py_ARRAY_LENGTH on pointer in posixmodule.c, win32_wchdir

2015-12-11 Thread Alexander Riccio

New submission from Alexander Riccio:

I found this while writing up a separate bug (CPython doesn't use static 
analysis!).

In modules/posixmodule.c, win32_wchdir uses Py_ARRAY_LENGTH on a wchar_t*:

wchar_t _new_path[MAX_PATH], *new_path = _new_path;
int result;
wchar_t env[4] = L"=x:";

if(!SetCurrentDirectoryW(path))
return FALSE;
result = GetCurrentDirectoryW(Py_ARRAY_LENGTH(new_path), new_path);


...instead of using Py_ARRAY_LENGTH(_new_path), the programmer wrote 
Py_ARRAY_LENGTH(new_path), doesn't work on pointers:

/* Get the number of elements in a visible array

   This does not work on pointers, or arrays declared as [], or function
   parameters. With correct compiler support, such usage will cause a build
   error (see Py_BUILD_ASSERT_EXPR).

   Written by Rusty Russell, public domain, http://ccodearchive.net/
*/
#define Py_ARRAY_LENGTH(array) \
(sizeof(array) / sizeof((array)[0]))


The same issue occurs two lines later:

if (result > Py_ARRAY_LENGTH(new_path)) {



Compiling with /analyze found this quite easily:

c:\pythondev\repo\modules\posixmodule.c(1354): warning C6384: Dividing sizeof a 
pointer by another value.

--
components: Windows
messages: 256260
nosy: Alexander Riccio, larry, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Use of Py_ARRAY_LENGTH on pointer in posixmodule.c, win32_wchdir

___
Python tracker 

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



[issue25845] _ctypes\cfield.c identical subexpressions in Z_set

2015-12-11 Thread random832

random832 added the comment:

Looks like a result of searching and replacing PyInt with PyLong - the diff can 
be found here, if anyone cares. 
https://hg.python.org/cpython-fullhistory/rev/f324631462a2.

Oddly, there was _another, older_ revision that fixed this correctly: 
https://hg.python.org/cpython-fullhistory/rev/003d35215ef2 - looks like there 
was a bad merge somewhere along the line.

--
nosy: +random832

___
Python tracker 

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



[issue25822] Add docstrings to fields of urllib.parse results

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

[padding]
I left some comments.

I wonder if the doc strings are too specific when they mention “request”, 
“file”, “download”, “page”, etc. Maybe these could just be examples of what the 
fields are used for (e.g. “The hierarchical path, such as the path to a file to 
download”). Or maybe they could be changed to general terms, but this may be 
hard.

Also, some of them seem redundant. Does it really add anything to say the 
“query” field is “the query parameter”?

--

___
Python tracker 

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



[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread R. David Murray

R. David Murray added the comment:

The issue is definitely in httplib2, then.  You should open an issue on their 
bug tracker.

--
resolution:  -> third party
stage: test needed -> 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: Is vars() the most useless Python built-in ever?

2015-12-11 Thread Steven D'Aprano
On Sat, 12 Dec 2015 09:13 am, Rick Johnson wrote:

> Intuitiveness and productivity have a
> synergy like peas and carrots! One cannot be productive if one is fighting
> an unintuitive interface. Could you drive with your toes? How about your
> tongue?

Drive a car with my tongue? Perhaps not, but I could drive a car with my
mouth if it were equipped with a sufficiently powerful interface.

"Driver, please take me to the airport."


> Sure, even the most atrocious interface can be "learned", but what i
> cannot understand, except in the case of you being a contrarian, is why
> you would argue *AGAINST* intuitive interfaces? And believe it or not,
> *SYNTAX* is an interface! As are paradigms!

I do believe that you are arguing against a strawman. I don't think that
anyone here has argued *against* "intuitiveness", all else being equal. But
you are glossing over a whole lot of real complexity:

- what makes you think all else actually is equal?

- who decides what is intuitive and what isn't? why should we take 
  your word over what's intuitive and what isn't?

- intuitive for who? my dad, who has never used a computer? my mum, 
  who has used a computer but only for word processing and web 
  browsing? a ten year old maths prodigy? a thirty year veteran 
  of C programming? a beginner to programming with a month's 
  experience in PHP?

- what level of power are we willing to forgo in order to keep 
  the language "intuitive"?

- what the hell does "intuitive" mean anyway?

I know what the definition of the word is, but it doesn't apply to
programming language interfaces. As has been pointed out many times, the
only truly intuitive interface is the nipple. Everything else has to be
learned.

In practice, "intuitive interface" gets bandied about in two ways:

(1) Some people use it as a thought-terminating cliché. What they really
mean is that they want this interface feature, for reasons of their own,
and by calling it 'intuitive', they hope to bamboozle or intimidate others
into backing down and accepting the feature. Who could possibly be
against "intuitive" interfaces? That's like being against "usefulness",
or "flexibility".

When people start protesting about others being "against intuitive
interfaces" (especially if they SHOUT the word "against", that's an good
sign that they're using it as a thought-terminating cliché. To these
people, "intuitive" is like "New And Improved!!!" to advertisers.

(2) Others use it to mean an interface which is:

* predictable;
* consistent;
* easy to explore and learn;
* and "easy to use" in some vague sense.


They recognise that what seems unpredictable to one person may be perfectly
predictable to a more experienced user.

They recognise that consistency is partly a function of the user's own
understanding, not just they language alone. Even if the language is
designed with a single, consistent model (e.g. "everything is an object"),
if the user's mental model is wrong, they will fail to recognise the
consistency, or look for it in the wrong places.

And most importantly, they recognise that programmers are beginners for
perhaps 1% of their programming life: you might be completely new to
programming for three months out of a 30 year span of programming. Why
optimize the language for something that you will use for less than 1% of
your productive lifespan? Apart from intentional beginner's languages like
Scratch, for most languages it makes sense to add power even if it
increases the learning curve.

https://scratch.mit.edu/about/


[...]
> THE PRINT FUNCTION HAS TWO MAJOR ISSUES IN THE CONTEXT OF INTUITIVENESS:
> 
> (1) When laymen consider the word "print" (in the context of computing),
> they first think of "sending a document to a printing device". 

No they don't. They think of printing to the screen, not printing to paper.

Even if they think of printing to paper, it takes them less than a second to
learn otherwise. That's a fantastic user interface: you can learn and
explore the functionality of the language very easily.

(One of the weaknesses of Python, and nearly all mainstream programming
languages, is that there is nothing even remotely like an easy-to-explore
UI for programming GUI applications.)


> (2) The path to the underlying process is not even remotely clear. LIKE IT
> NOT, PRINT IS "MAGIC SYNTAX".

print does what it says of the tin: it prints (to the screen). You don't
have to understand how it manages that to use it effectively, just as you
don't have to understand calculus in order to use math.sqrt().



-- 
Steven

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


Re: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Frank Millman
"Igor Korot"  wrote in message 
news:CA+FnnTyZY_1=62rbk_kkz39tkeoa6jvmfn9qs17as-2yd4d...@mail.gmail.com...


Yes, I saw your post to sqlite3 ML.
And I do know that by default sqlite3 does not have many types supported.

However, all you need to do is save it as DECIMAL(10,2).
It is supported is sqlite3 and it will have NUMERIC affinity (ref 1)
or REAL (ref 2), which means the data will
be stored as decimals and not a string.



Do you mean CREATE TABLE fmtemp (acno INT, balance DECIMAL(10,2));  ?

I tried that, but I got exactly the same result.

The answer, as explained by several people on the sqlite3 ML, is that 
sqlite3 does not have a true decimal type and therefore uses floating point 
internally. As we all know from many questions asked on this forum, floating 
point and exact decimal representation are incompatible.


Frank


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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Mikhail Gulyaev added the comment:

Thanks for attention

--

___
Python tracker 

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



[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 850cc65ceda4 by Martin Panter in branch '3.5':
Issue #19771: Omit irrelevant message if package could not be initialized
https://hg.python.org/cpython/rev/850cc65ceda4

New changeset 323c10701e5d by Martin Panter in branch 'default':
Issue #19771: Merge runpy error adjustment from 3.5
https://hg.python.org/cpython/rev/323c10701e5d

--
nosy: +python-dev

___
Python tracker 

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



[issue25809] "Invalid" tests on locales

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4f24a6dc934b by Martin Panter in branch '3.5':
Issue #25809: Skip testing platform-dependent French thousands separator
https://hg.python.org/cpython/rev/4f24a6dc934b

New changeset 7c5c03143923 by Martin Panter in branch 'default':
Issue #25809: Merge French locale test from 3.5
https://hg.python.org/cpython/rev/7c5c03143923

--
nosy: +python-dev

___
Python tracker 

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



[issue25845] _ctypes\cfield.c identical subexpressions in Z_set

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 26859a7e385c by Martin Panter in branch '3.5':
Issue #25845: Drop redundant checks leftover from int to long conversion
https://hg.python.org/cpython/rev/26859a7e385c

New changeset 9be59ad8af80 by Martin Panter in branch 'default':
Issue #25845: Merge PyLong_Check() cleanup from 3.5
https://hg.python.org/cpython/rev/9be59ad8af80

--
nosy: +python-dev

___
Python tracker 

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



[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Martin Panter

Changes by Martin Panter :


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



[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Mikhail Gulyaev

Mikhail Gulyaev added the comment:

You right I found who resend requests!

My request is goes through httplb2(which use httplib and resends request on 
failure), but the issue is that if request body contains file and then that 
file is read out and on retry there is nothing to read since we already read it 
in httplib. 
So what solution could you suggest for me? Is it some patch for httplib2 or 
totally my own troubles

This issue is on border of interacting httplib and httplib2
 - httplib sends request and reads out a file
 - httplib2 resends a request but file is already readed out

Will it be honest if we rereads file in httplib2? and could we able assume that 
readable object(hasattr(data,'read') == True) has also tell and seek methods

--

___
Python tracker 

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



Re: Is vars() the most useless Python built-in ever?

2015-12-11 Thread Chris Angelico
On Sat, Dec 12, 2015 at 3:44 PM, Steven D'Aprano  wrote:
> On Sat, 12 Dec 2015 09:13 am, Rick Johnson wrote:
>
>> Intuitiveness and productivity have a
>> synergy like peas and carrots! One cannot be productive if one is fighting
>> an unintuitive interface. Could you drive with your toes? How about your
>> tongue?
>
> Drive a car with my tongue? Perhaps not, but I could drive a car with my
> mouth if it were equipped with a sufficiently powerful interface.
>
> "Driver, please take me to the airport."

Bring on the self-driving cars! They're already comparable to human
drivers in skill. Instead of getting my sister to chauffeur me around,
I could just hop in my automatic car, tell it my destination, and sit
back with my laptop. All I need is for them to become more affordable.

> In practice, "intuitive interface" gets bandied about in two ways:
>
> (2) Others use it to mean an interface which is:
>
> * predictable;
> * consistent;
> * easy to explore and learn;
> * and "easy to use" in some vague sense.
>
>
> They recognise that what seems unpredictable to one person may be perfectly
> predictable to a more experienced user.

Which really means that "intuitive" is a feature of
skill/comprehension transference. This is the exact reason for the
extensive use of metaphors in design - even though those metaphors
often get orphanned, they are useful. How many people have actually
carried around a folder full of documents? A few of you, maybe? How
many of you instantly understand what a folder is, and that you can
drag documents into it? Everyone. It makes perfect sense that you
should be able to put stuff inside other stuff, so we can extend that
to "compressed folders" or "shared folders" or "backed-up folders" or
any other adjective you care to use. These are then touted as
"intuitive" - eg I can use Dropbox by just sticking something into the
Dropbox folder, ergo this interface is intuitive.

Most modern languages seem to assume at least some knowledge of
mathematics (maybe as far as algebra). It's considered intuitive that
(1.0 + 2.0 / 6.0) should be equal to 1.333, because the fraction bar
translates fairly readily into the slash. (And it doesn't equal 0.5,
because the order of operations demands it.) Learning that you need
the asterisk for multiplication is usually not a problem - at worst,
it's the price you pay for multi-letter names (xy is distinct from
x*y). Give people a staircase of small comprehensions and they'll
master it; shove them up against a wall of new knowledge and they
can't mantle up.

>> (1) When laymen consider the word "print" (in the context of computing),
>> they first think of "sending a document to a printing device".
>
> No they don't. They think of printing to the screen, not printing to paper.
>
> Even if they think of printing to paper, it takes them less than a second to
> learn otherwise. That's a fantastic user interface: you can learn and
> explore the functionality of the language very easily.

Maybe if you had people entering code on a typewriter and seeing the
output two hours later on parchment, then they'd assume it meant print
to paper. Does anyone these days even print out listings?

There are two broad types of code: Simple and complex. There are two
broad types of job: Common and unusual. If you see a very simple piece
of code, you will generally expect that it's doing something common.
Let's posit a domain-specific language for building objects for a
MMORPG. Here's a piece of code, with all crucial keywords replaced
with names from my current D campaign:

soyutlanma on_wield(player)
[[[
   parildiyor player#level >> 72
   [[[
  dogmakta «You cannot wield this weapon.»
  uzakta
   ]]]
   parildiyor player#classes << {«bard»}
   [[[
  dogmakta «You can ne'er wield this weapon.»
  uzakta
   ]]]
   dogmakta «It feels strong and sturdy in your hand.»
   taneleri item, inventory
   [[[
  parildiyor kaylee<->item
  [[[
  dogmakta «Your helmet glows brightly with increased magic!»
  ]]]
   ]]]
]]]

So, what operations do you think would be sufficiently common to
justify language keywords? I've deliberately made them nonsense so
there's no clues from the words themselves, but I expect that anyone
here should have a reasonable shot at figuring out what things might
mean. Voila! I've made an intuitive language. Right?

Sending content to a printer is at least as complicated as writing to
a file on disk. I would expect that any language keyword or built-in
function for generating paper output should, at a minimum, stipulate
which printer it's going to, and have a means of saying "I'm done with
that page now". We don't tend tto "log to prn" these days, so you
wouldn't expect to see a command/function to "write this line to the
printer, and if there are 66 lines written, push that page out and
bring the next one in".

> (One of the weaknesses of Python, and nearly all mainstream programming
> languages, is that there 

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue25845] _ctypes\cfield.c identical subexpressions in Z_set

2015-12-11 Thread Alexander Riccio

New submission from Alexander Riccio:

I found this while writing up a separate bug (CPython doesn't use static 
analysis!).


In _ctypes/cfield.c, Z_set has a bug of some sort:

if (PyLong_Check(value) || PyLong_Check(value)) {

See: https://hg.python.org/cpython/file/tip/Modules/_ctypes/cfield.c#l1378

...which has been there for at least 5 years: 
https://hg.python.org/cpython/rev/cab14be0ada1


I'm not sure what the original programmer meant - it's been around forever & I 
don't know what was there before it - but PyLong_Check(value) is evaluated 
twice. Which doesn't really make sense.

Compiling with /analyze found this quite easily:

c:\pythondev\repo\modules\_ctypes\cfield.c(1378): warning C6287: Redundant 
code:  the left and right sub-expressions are identical.



There's a similar issue in P_set, at line 1486.

--
components: ctypes
messages: 256256
nosy: Alexander Riccio, amaury.forgeotdarc, belopolsky, meador.inge
priority: normal
severity: normal
status: open
title: _ctypes\cfield.c identical subexpressions in Z_set

___
Python tracker 

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



Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Frank Millman

"Frank Millman"  wrote in message news:n4ei3l$b98$1...@ger.gmane.org...

I need to store Decimal objects in a sqlite3 database, using Python 3.4 on 
Windows 7.


I followed the instructions here -


http://stackoverflow.com/questions/6319409/how-to-convert-python-decimal-to-sqlite-numeric

It seemed to work well, but then I hit a problem.


[...]

I have found a workaround for my problem, but first I needed to understand 
what was going on more clearly. This is what I have figured out.


1. The solution in the SO article is a bit of sleight of hand, though very 
effective. It does not create a Decimal type in sqlite3. It simply provides 
a way of converting Decimal objects to strings when you pass them into the 
database, and converting them back to Decimal types when you read them back.


2. This works if you only use sqlite3 as a storage mechanism, and use Python 
to perform any arithmetic required. It fails when you try to use sqlite3 to 
perform arithmetic, as it uses floating point internally and suffers from 
the same problem that Python does when trying to mix floating point and 
precise decimal representation.


3. Normally I do use Python to perform the arithmetic, but in this situation 
I wanted to do the following -


   UPDATE table SET balance = balance + ? WHERE date > ?

It would be very inefficient to read every row into Python, perform the 
addition, and write it back again.


4. The Python sqlite3 module allows you to create a user-defined function 
that you can use from within SQL statements. I realised I could use this to 
get the best of both worlds. I wrote the following function -


   def aggregate(curr_value, aggr_value):
   return '#{}'.format(D(curr_value[1:]) + D(aggr_value[1:]))

and added this to the connection -

   conn.create_function('aggregate', 2, aggregate)

I could then rewrite my statement as -

   UPDATE table SET balance = aggregate(balance, ?) WHERE date > ?

5. The reason for the '#' in the above function is that sqlite3 passes the 
current value of 'balance' into my function, and it has a bad habit of 
trying to second-guess the data-type to use. Even though I store it as a 
string, it passes in an integer or float. Prefixing it with a '#' forces it 
to remain as a string.


My adapters therefore now look like this -

   # Decimal adapter (store Decimal in database as str)
   sqlite3.register_adapter(D, lambda d:'#'+str(d))

   # Decimal converter (convert back to Decimal on return)
   sqlite3.register_converter('DEC', lambda s: D(s.decode('utf-8')[1:]))

6. Putting it all together, I can now run my test program -

   while True:
   print(cur.execute("SELECT bal FROM fmtemp").fetchone()[0])
   cur.execute("UPDATE fmtemp SET bal = aggregate(bal, ?)", 
(D('123.45'),))

   q = input()
   if q == 'q':
   break

and it runs up to 123450.00 without misbehaving.

Hope this is of interest.

Frank


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


Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread phamtony33
On Friday, December 11, 2015 at 7:55:59 PM UTC-5, Steven D'Aprano wrote:
> On Sat, 12 Dec 2015 10:19 am, phamton...@gmail.com wrote:
> 
> > Can anyone direct me in the direction where to start the code for the
> > randomized of the  ball  to start.
> 
> [...]
> > move_ball(-10, 7, 0)
> 
> 
> That starts the ball moving, with x-speed of -10 and y-speed of 7. Instead
> use something similar to this:
> 
> 
> import random
> xspeed = random.randint(-20, 20)
> yspeed = random.randint(-10, 10)
> 
> move_ball(xspeed, yspeed, 0)
> 
> 
> 
> 
> -- 
> Steven

Oh yes! Thank you so much!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Erik

Hi,

On 11/12/15 23:19, phamton...@gmail.com wrote:

Can anyone direct me in the direction where to start the code for the 
randomized of the  ball  to start.


Your questions over the last week or so appear to be homework 
assignments. However, I'll give you a hint: in the interactive 
interpreter shell, try:


>>> import random
>>> help(random)

Read that and try to work out how you might apply one of the functions 
to your problem.


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


Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Erik

Hi,

On 11/12/15 23:19, phamton...@gmail.com wrote:

Can anyone direct me in the direction where to start the code for the 
randomized of the  ball  to start.


Your questions over the last week or so appear to be homework 
assignments. However, I'll give you a hint: in the interactive 
interpreter shell, try:


>>> import random
>>> help(random)

Read that and try to work out how you might apply one of the functions 
to your problem.


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


[issue25843] lambdas on the same line may incorrectly share code objects

2015-12-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

One possible solution for all these variants is to let code objects track both 
the co.firstlineno and co.firstrowno.

--

___
Python tracker 

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



Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Chris Angelico
On Sat, Dec 12, 2015 at 4:10 PM, Frank Millman  wrote:
> I can reproduce your example above. However, if I set the initial value to
> 5678.7, then the sequence goes
>
> 5678.7
> 5802.15
> 5925.6
> 6049.05
> 6172.5
>
> I would have thought that adding 123.45 to 5802.15 would always produce the
> same result, but here it seems to depend on prior events.
>
> Any idea why? Academic interest only, but I am curious.

You weren't adding 123.45 to 5802.15. Here's why.

The number 123.45 is actually represented as:

>>> 123.45.as_integer_ratio()
(8687021468732621, 70368744177664)

that is, 8687021468732621/2**46. The exact value you want is actually
a repeating binary fraction:

0b011.0111001100110011001100...

with the 1100 part repeating. Python rounds this up to
0b0110111001100110011001100110011001100110011001101, with a
notation that this has an exponent of -46. (Presumably SQLite3 is
doing the same, but I'm using Python's introspection here. This is all
IEEE 754 floating point.)

So when you set the initial value to 0 and then add 123.45 fifty
times, you're adding that tiny bit of rounding error fifty times, too.
When you set your initial value to 5678.7, you're skipping most of the
accumulated error, and so the result still looks the same. When you
printed out something that looked fine, it's because it actually
rounded to the value you started with; that is to say, you weren't
working with 5802.15, but with something really REALLY close to it.
When you added one more of that rounding error, you tipped the sum
across a boundary mark, and suddenly it didn't look like the decimal
number you were expecting; but in reality, it never was.

There's a lot of academic interest to be found in this, and a lot of
fun to be had playing around. If you want to learn more, separate this
from SQLite3 and just play around in Python - you'll find it easier.

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


[issue25838] Lib/httplib.py: Resend http request on server close connection

2015-12-11 Thread Martin Panter

Martin Panter added the comment:

Okay that makes a lot more sense! I agree that this should either be fixed in 
httplib2 or in your own script. The problem parallels Issue 5038, where 
urlopen() is used (rather than httplib2), and the request is retried after 
getting an authorization failure (rather than after a disconnection).

One option, if you can use Python 3.2+, might be to use a custom iterable 
object as the body. Then you get a hook to rewind the file every time it is 
iterated.

--

___
Python tracker 

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



Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Chris Angelico
IOn Sat, Dec 12, 2015 at 6:31 PM, Frank Millman  wrote:
> I have found a workaround for my problem, but first I needed to understand
> what was going on more clearly. This is what I have figured out.
>
> 1. The solution in the SO article is a bit of sleight of hand, though very
> effective. It does not create a Decimal type in sqlite3. It simply provides
> a way of converting Decimal objects to strings when you pass them into the
> database, and converting them back to Decimal types when you read them back.
>
> 2. This works if you only use sqlite3 as a storage mechanism, and use Python
> to perform any arithmetic required. It fails when you try to use sqlite3 to
> perform arithmetic, as it uses floating point internally and suffers from
> the same problem that Python does when trying to mix floating point and
> precise decimal representation.

There's another possibility, and that's fixed-point arithmetic. You
store the numbers as integers - probably cents, if you're talking
about dollar amounts - and as long as the scaled values fit inside the
available integer type (probably 64-bit), you'll be fine.

Or, of course, you could switch to a database back end that actually
supports NUMERIC data.

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


Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Steven D'Aprano
On Sat, 12 Dec 2015 10:19 am, phamton...@gmail.com wrote:

> Can anyone direct me in the direction where to start the code for the
> randomized of the  ball  to start.

[...]
> move_ball(-10, 7, 0)


That starts the ball moving, with x-speed of -10 and y-speed of 7. Instead
use something similar to this:


import random
xspeed = random.randint(-20, 20)
yspeed = random.randint(-10, 10)

move_ball(xspeed, yspeed, 0)




-- 
Steven

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


[issue25822] Add docstrings to fields of urllib.parse results

2015-12-11 Thread Swati Jaiswal

Changes by Swati Jaiswal :


Added file: http://bugs.python.org/file41290/iss_25822_2.patch

___
Python tracker 

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



[issue25829] Mixing multiprocessing pool and subprocess may create zombie process, and cause program to hang.

2015-12-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I wouldn't _assume_ that there was a good design reason for that in 
multiprocessing... it already mixed threads and fork() without realizing that 
you cannot safely do that.

--
nosy: +gregory.p.smith -gps

___
Python tracker 

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



[issue25847] CPython not using Visual Studio code analysis!

2015-12-11 Thread Alexander Riccio

New submission from Alexander Riccio:

Visual Studio comes with static analysis, enabled by /analyze (command line) or 
"Code analysis" in the project configuration dialog. Currently, none of the 
CPython projects in PCbuild have Code Analysis turned on, in any configuration.

I was going to write my first patch, for issue25386, but noticed this, ran a 
(partial) build with /analyze, and ended up filing three bugs instead 
(Issue25844, Issue25845, Issue25846) from bugs /analyze found.

There's quite a bad signal-to-noise ratio at the moment, as there's lots of 
variable shadowing, and there's lots of code that /analyze doesn't understand 
is benign (parsing a tuple into a variable confuses /analyze), but there is 
also lots of code that isn't *obviously* incorrect.

Of the code that's not obviously incorrect, /analyze usually complains about 
possibly out-of-bounds reads in very complex conditions, and I really can't 
tell. Some assertions would probably help.


Thoughts?

--
components: Build
messages: 256265
nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: CPython not using Visual Studio code analysis!

___
Python tracker 

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



[issue25809] "Invalid" tests on locales

2015-12-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 903a2664d32d by Martin Panter in branch '2.7':
Issue #25809: Skip testing platform-dependent French thousands separator
https://hg.python.org/cpython/rev/903a2664d32d

--

___
Python tracker 

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



[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread Emanuel Barry

Emanuel Barry added the comment:

Do you mean like 'filter(None, lst)' does?

--
nosy: +ebarry

___
Python tracker 

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



Re: SystemError in python 2.5.4

2015-12-11 Thread Steven D'Aprano
On Thu, 10 Dec 2015 10:29 pm, Palpandi wrote:

> Hi All,
> 
> I am getting the error mentioned below in python 2.5.4.
> 
> SystemError: \loewis\25\python\Objects\longobject.c:225: bad argument to
> internal function.

Sounds like your installation of Python is broken. You should never get an
internal error like that.

If it was working, and now isn't, I would strongly suspect the application
has been corrupted, or possibly infected by a virus. I would start with a
virus scan and a disk check, and after fixing any faults that come up,
re-install Python 2.5 (or upgrade to 2.7, which is much better).



-- 
Steven

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


[issue25711] Rewrite zipimport from scratch

2015-12-11 Thread STINNER Victor

STINNER Victor added the comment:

Can you both publish your WIP work?

--
nosy: +haypo

___
Python tracker 

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



[issue25809] "Invalid" tests on locales

2015-12-11 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Same here. Thanks Martin.

--

___
Python tracker 

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



Re: SystemError in python 2.5.4

2015-12-11 Thread dieter
Palpandi  writes:

> I am getting the error mentioned below in python 2.5.4.
>
> SystemError: \loewis\25\python\Objects\longobject.c:225: bad argument to 
> internal function.
>
> I also ran the same code in python 2.7.
> There I am not getting this error.
>
> I don't know which causes this error. Any solution for this?
>
> Note: The error is coming from the method call findall(path).

I do not have the code for Python 2.5.4 around - therefore,
I looked into that for Python 2.4.6. Based on this (older) version,
the "SystemError" above may come from the "PyLong_AsLong" function
(converting a Python "long" into a "C" "long"). In this case,
the error would be caused by provding a wrong parameter
(neither Python "int" nor Python "long") to "PyLong_AsLong".

At your place, I would have a look at the Python 2.5.4 code
and check there where precisely the "SystemError" comes from.
Then I would try to find out why it gets wrong (this might
require the use of a "C" level debugger).

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


[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread Mark Lundeberg

New submission from Mark Lundeberg:

Although -0.0 and +0.0 compare as equal using the == operator, they are 
distinct floating point numbers and in some cases behave differently. (See more 
information on the wikipedia article "Signed zero".) The distinction between 
+0.0 and -0.0 is most important in complex arithmetic, for example it is 
conventional and useful that sqrt(-1+0i) ==> +i and sqrt(-1-0i) ==> -i. Python 
currently allows the floating point number -0.0 to be entered as a literal:

>>> -0.0
-0.0

Complex floating point numbers in python also can hold negative zero 
components, as shown in their repr()

>>> -(1+0j)
(-1-0j)

However they cannot be input directly as literals; it is currently necessary to 
use the above construction. Unfortunately the output of the repr() cannot be 
used as a string literal to obtain the same number:

>>> (-1-0j)
(-1+0j)

except, in contrast:

>>> complex('-1-0j')
(-1-0j)


The literal -1-0j should yield a complex number with negative zero imaginary 
part. Note also that complex literals with negative zero real parts have the 
same bug, e.g. -0+1j is not the same as -(0-1j)

--
components: Interpreter Core
messages: 256209
nosy: Mark Lundeberg
priority: normal
severity: normal
status: open
title: negative zero components are ignored in complex number literals
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker 

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



Re: How to use internal python c funtions, from python code

2015-12-11 Thread dieter
srinivas devaki  writes:

> but still I think it would be cool to be able to access internal c
> functions without any fuss. I can use such feature with heapq too(sift
> operations),

Have a look at "Cython". It is a compiler which compiles
a language similar to Python with special extensions for an efficient
interface to "C" and "C++" into "C"/"C++" source which then can be built
into a Python extension module and used from Python like any other
Python module.

In a "Cython" source, you can quite easily use C functions, among
others C functions defined by Python itself.

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


[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread STINNER Victor

STINNER Victor added the comment:

You should use complex(a, b) to have a reliable behaviour.

Python parse doesn't see "-1-0j" as a complex literal, but as (-1)-(0j): 
int-complex. Example with the AST output:

>>> ast.dump(ast.parse('-1-0j'))
'Module(body=[Expr(value=BinOp(left=UnaryOp(op=USub(), operand=Num(n=1)), 
op=Sub(), right=Num(n=0j)))])'


It looks like complex has the same behaviour than float:

>>> x=-0.0; x=0+x; x.real
0.0
>>> x=-0.0; x=0-x; x.real
0.0
>>> x=complex(0.0, -0.0); x=0+x; (x.real, x.imag)
(0.0, 0.0)
>>> x=complex(0.0, -0.0); x=0-x; (x.real, x.imag)
(0.0, 0.0)

zero sign is lost on int+complex, int-complex, int+complex, int-complex.

--
nosy: +haypo, mark.dickinson

___
Python tracker 

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



[issue25839] negative zero components are ignored in complex number literals

2015-12-11 Thread Mark Lundeberg

Mark Lundeberg added the comment:

Good point, it is doing (int-complex), observe also the following pecularities:

>>> -0 - 0j
0j
>>> -0. - 0j
(-0+0j)
>>> -0j
-0j
>>> 0-0j
0j
>>> -(0j)
(-0-0j)
>>> 0.+(-0j)
0j

Does this mean the bug is in repr() ? As I understand the output of repr() is 
supposed to be something that can evaluated to recreate the same object. 
However I am unsure whether it would be nicer if repr() were to yield 
'complex(-0.,-0.)' or '-(-0.+0j)'.

--

___
Python tracker 

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



[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread leewz

leewz added the comment:

ebarry, note that `filter(None, lst)` is equivalent to `filter(bool, lst)`, 
which is the opposite of `filterfalse(None, lst)`. (Though `filter(True, lst) 
== filter(bool, lst)` would be a parallel.)

--

___
Python tracker 

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



[issue25843] unexpected output using pythons ternary operator in combination with lambda

2015-12-11 Thread Tijs Van Oevelen

Tijs Van Oevelen added the comment:

Apologies for not posting a summary of the bug. I really had no idea how to 
describe the problem, as it is over my head. I could only refer to my question 
on Stack Overflow that triggered the discovery of the bug.

--

___
Python tracker 

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



[issue25842] Installer does not set permissions correctly?

2015-12-11 Thread Zachary Ware

Zachary Ware added the comment:

Right, I should have been more specific here.  Sorry about that.

--

___
Python tracker 

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



[issue25843] unexpected output using pythons ternary operator in combination with lambda

2015-12-11 Thread Tijs Van Oevelen

Tijs Van Oevelen added the comment:

It's definitely also in 3.4 by the way.

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



Re: python 351x64

2015-12-11 Thread Ian Kelly
On Fri, Dec 11, 2015 at 9:30 AM, Jay Hamm  wrote:
> Hi
>
> I was trying to use your windows version of python 3.5.1 x64.
>
> It has a conflict with a notepad++ plugin NppFTP giving 
> api-ms-win-crt-runtime-I1-1-0.dll error on start up.
>
> This seems pretty well documented on the web. The work around is to delete 
> the plugin and reinstall since it borks the install.
>
> Since about every other admin I've ever known uses notepad++, you might want 
> to fix this.

Laura Creighton has filed an issue based on your post to the Python
issue tracker at http://bugs.python.org/issue25842. Would you please
add some details on this issue? Googling for "python nppftp" failed to
turn up anything useful for me.

> Also your installer fails to set the permissions correctly:

How do you expect them to be set?
-- 
https://mail.python.org/mailman/listinfo/python-list


wrappers for C/C++

2015-12-11 Thread Ginga, Dick
I have inherited a product build that uses SWIG to product wrapper libraries 
for our C/C++ code. It currently builds these wrappers for 2.5, 2.6, 3.1 and 
3.2.

Is it necessary to have version specific wrappers?


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


  1   2   >