[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams

Steven Adams added the comment:

Shouldn't that mean it also breaks on py3.3?

As a workaround i just import uuid later within the thread method.

--

___
Python tracker 

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



Re: HTTPServer and SSL

2016-04-17 Thread Terry Reedy

On 4/18/2016 1:39 AM, Terry Reedy wrote:

My apologies for the tired, twitchy finger junk post that I noticed 1/2 
second after clicking the wrong button and I wish I oould delete.


--
Terry Jan Reedy

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


[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Xiang Zhang

Xiang Zhang added the comment:

It seems a matter of lib uuid. The comments in uuid.py tells that the module is 
not thread-safe. I try to comment out the code using ctypes and rerun your 
sample, it works well. 

In uuid's documentation it does not mention the non-thread-safe characteristic. 
Maybe we should add it.

--
nosy:  -pitrou

___
Python tracker 

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



Re: HTTPServer and SSL

2016-04-17 Thread Terry Reedy

On 4/17/2016 10:56 AM, Radek Holý wrote:

Hello,

some people recommend following implementation of a simple HTTP server
that supports SSL:

asdfghjkki
Handler = http.server.BaseHTTPRequestHandlerhttpd =
http.server.HTTPServer(("", 4443), Handler)
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()

I wonder whether this usage is *supported* or not. The documentation
is not explicit about whether the httpd.socket attribute can be safely
reassigned. Also there were some questions regarding a simple HTTPS
server on this list already and none of the answerers mentioned this
approach.

Also there used to be a HTTPSServer in the test suite of Python 2.7 in
2014 that did a similar thing but in the "get_request" method but it
isn't there anymore.

So, is there a *supported* way of combining http.server.HTTPServer and ssl?

Best regards




--
Terry Jan Reedy


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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Marko Rauhamaa
Steven D'Aprano :

> On Mon, 18 Apr 2016 10:27 am, Random832 wrote:
>
>> As an alternative, when you send them through can you put a note on
>> the bottom saying they're not subscribed, to remind people to CC them
>> in responses?
>
> That doesn't work so well from Usenet. I can reply via news (which
> definitely works), or I can reply via email (which may or may not
> work), but it is a pain to reply via *both*.

I don't like the Usenet+CC approach, but let's try it.

Did you get the CC, Steven.


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


[issue25987] collections.abc.Reversible

2016-04-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7d9f7d7a21ae by Georg Brandl in branch 'default':
#25987: add versionadded to Reversible.
https://hg.python.org/cpython/rev/7d9f7d7a21ae

--

___
Python tracker 

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



[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +pitrou, xiang.zhang

___
Python tracker 

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



Re: How much sanity checking is required for function inputs?

2016-04-17 Thread Ethan Furman

On 04/17/2016 12:34 PM, Christopher Reimer wrote:


How much sanity checking is too much in Python?


What happens if your extensive sanity checks turn up a bug?

In Python the usual answer is you raise an error:

raise ValueError('blahblah not a valid color')

What happens if you don't sanity check anything and the wrong color is 
passed in?


Python will raise an error for you:

Traceback
  ...
KeyError: 'blahblah' not found

---

I sanity check for three reasons:

1) raise a nicer error message

2) keep the point of failure close to the error

3) the consequences of bad data are Bad Bad Things (tm)

If none of those apply, I don't bother sanity checking.

--
~Ethan~

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


[issue26733] staticmethod and classmethod are ignored when disassemble class

2016-04-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Looking at the history of the dis module, I'd now class this as a bug fix for 
3.5+ - it looks like dis.dis gained the ability to disassemble static and class 
methods as a side-effect of the removal of bound methods in Python 3 (see 
https://hg.python.org/cpython/rev/48af6375207e ) but because it was a side 
effect, the additional changes needed to also handle them when disassembling a 
class were missed.

--

___
Python tracker 

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



Re: How much sanity checking is required for function inputs?

2016-04-17 Thread Christopher Reimer

On 4/17/2016 3:18 PM, Michael Selik wrote:


I'd rather turn the question around: how much sanity checking is
necessary or useful? You'll find the answer is "surprisingly little"
compared to your experience in Java.


I'm looking for a pythonic approach to sanity checking. From what I read 
elsewhere, sanity checking belongs in the unit tests and/or library 
classes designed for other people to use. I haven't seen many examples 
of sanity checks that is common in Java.



For example, you don't need to
explicitly check whether the color is present in your dictionary,
because it'll give you a KeyError if you look up a bad key.


Without the sanity check against the constant dictionary, the color 
variable could be anything (it should be a string value). Looking at the 
code again, I should relocate the sanity checks in the Piece base class.



Why does the len of positions need to be 16?


The positions variable is list of coordinates for 16 chess pieces (eight 
pawns, two rooks, two knights, two bishops, a king and a queen) for each 
color, locating the pieces on either the bottom quarter (i.e., [(1,1), 
..., (2,8)]) or the top quarter (i.e., [(7,1), ..., (8,8)]) of the board.


Thanks,

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


[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams

Steven Adams added the comment:

I forgot to mention if i remove import uuid all works as expected.

--

___
Python tracker 

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



[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams

New submission from Steven Adams:

I've ran into a strange issue after trying to port a project to support py 3.x

The app uses a double os.fork to run in the background. On py 3.4+ it seems 
that when you have an import uuid statement it causes threading.threads to 
always return false on is_alive()..

Here is an example of the issue. You can see i've imported uuid. This script 
should fork into the background and stay alive for at least 3 loops (3 seconds) 
but it dies after 1 loop as self._thread.is_alive() return False??

http://paste.pound-python.org/show/WbDkqPqu94zEstHG6Xl1/

This does NOT happen in py 2.7 or py3.3. Only occurs py3.4+

--
components: Interpreter Core
messages: 263640
nosy: Steven Adams
priority: normal
severity: normal
status: open
title: uuid causing thread issues when forking using os.fork py3.4+
versions: Python 3.4, Python 3.5

___
Python tracker 

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



Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 2:09 PM, Sayth Renshaw  wrote:
>> > > > > > id="187674" idnumber="" regnumber="" blinkers="0" trainernumber="736" 
>> > > trainersurname="Martin" trainerfirstname="Tim" trainertrack="Rosehill" 
>> > > rsbtrainername="Tim Martin" jockeynumber="46930" jockeysurname="Angland" 
>> > > jockeyfirstname="Tye" barrier="6" weight="56" rating="88" description="B 
>> > > M 4 Street Cry(IRE) x Reggie(NZ) (Germano(GB))" colours="Yellow, Green 
>> > > Chevrons, Striped Cap" owners="President Bloodstock Pty Ltd (Mgr: R C 
>> > > Kemister)" dob="2011-08-12T00:00:00" age="5" sex="M" career="12-3-3-4 
>> > > $271520.00" thistrack="4-0-3-0 $41425.00" thisdistance="0-0-0-0" 
>> > > goodtrack="10-2-2-4 $214845.00" heavytrack="0-0-0-0" slowtrack="" 
>> > > deadtrack="" fasttrack="0-0-0-0" firstup="2-0-1-1 $20710.00" 
>> > > secondup="2-0-2-0 $24675.00" mindistancewin="0" maxdistancewin="0" 
>> > > finished="2" weightvariation="0" variedweight="56" decimalmargin="0.20" 
>> > > penalty="0" pricestarting="$3.80F" sectional200="0" sectional400="0" 
>> > > sectional600="0" sectional80
 0
>  ="0" sectional1200="0" bonusindicator="" />

You're getting very chatty with yourself, which is fine... but do you
need to quote your entire previous message every time? We really don't
need another copy of your XML file in every post.

Thanks!

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


Re: scipy install error,need help its important

2016-04-17 Thread Xristos Xristoou
Τη Δευτέρα, 18 Απριλίου 2016 - 6:53:30 π.μ. UTC+3, ο χρήστης Xristos Xristoou 
έγραψε:
> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
> 
> raise NotFoundError('no lapack/blas resources found')
> numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
> 
> 
> Command "C:\Python27\python.exe -u -c "import setuptools, 
> tokenize;__file__='c:\\users\\name\\appdata\\local\\temp\\pip-build-a3fjaf\\scipy\\setup.py';exec(compile(getattr(tokenize,
>  'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
> install --record 
> c:\users\name\appdata\local\temp\pip-pgtkuz-record\install-record.txt 
> --single-version-externally-managed --compile" failed with error code 1 in 
> c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\

i fllow you with anaconda route and i install scipy without error
but in the idle i write import scipy and show me erroe msg no module name 
scipy,why ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: scipy install error,need help its important

2016-04-17 Thread Xristos Xristoou
Τη Δευτέρα, 18 Απριλίου 2016 - 6:53:30 π.μ. UTC+3, ο χρήστης Xristos Xristoou 
έγραψε:
after google search to many post propose install  lapack and atla
bt=ut i dont know


> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
> 
> raise NotFoundError('no lapack/blas resources found')
> numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
> 
> 
> Command "C:\Python27\python.exe -u -c "import setuptools, 
> tokenize;__file__='c:\\users\\name\\appdata\\local\\temp\\pip-build-a3fjaf\\scipy\\setup.py';exec(compile(getattr(tokenize,
>  'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
> install --record 
> c:\users\name\appdata\local\temp\pip-pgtkuz-record\install-record.txt 
> --single-version-externally-managed --compile" failed with error code 1 in 
> c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25243] decouple string-to-boolean logic from ConfigParser.getboolean and offer as separate function

2016-04-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm not sure I see the point in moving this out to a separate method (i.e. I 
wouldn't want to see people importing configparser just to use this particular 
group of boolean word aliases).  In general, users would be better served by a 
simple dictionary that gives them the ability to say exactly which variants 
they want to allow ('y', 'n', 'enabled', 'disabled', etc).

Also, the preposition "from" in a method name usually indicates a classmethod 
that creates instances of the class where it is defined.

--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



Re: scipy install error,need help its important

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 13:53:30 UTC+10, Xristos Xristoou  wrote:
> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
> 
> raise NotFoundError('no lapack/blas resources found')
> numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
> 
> 
> Command "C:\Python27\python.exe -u -c "import setuptools, 
> tokenize;__file__='c:\\users\\name\\appdata\\local\\temp\\pip-build-a3fjaf\\scipy\\setup.py';exec(compile(getattr(tokenize,
>  'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
> install --record 
> c:\users\name\appdata\local\temp\pip-pgtkuz-record\install-record.txt 
> --single-version-externally-managed --compile" failed with error code 1 in 
> c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\

Oh and I would choose the anaconda route. Then you can use conda to easy manage 
libraries that could otherwise be dificult on windows.

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


Re: scipy install error,need help its important

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 13:53:30 UTC+10, Xristos Xristoou  wrote:
> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
> 
> raise NotFoundError('no lapack/blas resources found')
> numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
> 
> 
> Command "C:\Python27\python.exe -u -c "import setuptools, 
> tokenize;__file__='c:\\users\\name\\appdata\\local\\temp\\pip-build-a3fjaf\\scipy\\setup.py';exec(compile(getattr(tokenize,
>  'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
> install --record 
> c:\users\name\appdata\local\temp\pip-pgtkuz-record\install-record.txt 
> --single-version-externally-managed --compile" failed with error code 1 in 
> c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\

Either install and use anaconda

https://www.continuum.io/downloads

or use these builds to install.

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Cheers

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


Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 13:13:21 UTC+10, Sayth Renshaw  wrote:
> On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw  wrote:
> > On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw  wrote:
> > > Hi
> > > 
> > > I have an XML and using pyquery to obtain the elements within it and then 
> > > write it to csv.
> > > 
> > > What is the best most reliable way to take dictionaries of each element, 
> > > and print them(csv write later) based on each position so get item 0 of 
> > > each list and then it 1 and so on.
> > > 
> > > Any other code I post is open to criticism. Because there are many 
> > > attributes I will want to collect my thought is to create a list of 
> > > lists, again seems a bit clunky so could be wrong.
> > > 
> > > from pyquery import PyQuery as pq
> > > 
> > > 
> > > d = pq(filename='20160319RHIL0_edit.xml')
> > > res = d('nomination')
> > > # myAt = pq.each(res.attr('bbid'))
> > > # print(repr(res))
> > > # myAt = [res.eq(i).attr('horse') for i in range(len(res))]
> > > # print(myAt)
> > > 
> > > nomID = [res.eq(i).attr('horse') for i in range(len(res))]
> > > horseName = [res.eq(i).attr('horse') for i in range(len(res))]
> > > group = [nomID, horseName]
> > > 
> > > for items in group:
> > > print(items)
> > > 
> > > 
> > > This is my source.
> > > 
> > > 
> > >  > > date="2016-03-19T00:00:00" gearchanges="-1" stewardsreport="-1" 
> > > gearlist="-1" racebook="0" postracestewards="0" meetingtype="TAB" 
> > > rail="Timing - Electronic : Rail - +2m" weather="Fine  " 
> > > trackcondition="Good" nomsdeadline="2016-03-14T11:00:00" 
> > > weightsdeadline="2016-03-15T16:00:00" 
> > > acceptdeadline="2016-03-16T09:00:00" jockeydeadline="2016-03-16T12:00:00">
> > >> > associationclass="1" website="http://; />
> > >> > stage="Results" distance="1900" minweight="0" raisedweight="0" class="~   
> > >   " age="3U" grade="0" weightcondition="SWP   " 
> > > trophy="1000" owner="1000" trainer="0" jockey="0" strapper="0" 
> > > totalprize="15" first="9" second="3" third="15000" 
> > > fourth="7500" fifth="3000" time="2016-03-19T12:40:00" bonustype=" 
> > >  " nomsfee="0" acceptfee="0" trackcondition="Good  " 
> > > timingmethod="Electronic" fastesttime="1-56.83   " 
> > > sectionaltime="600/35.3  " formavailable="0" racebookprize="Of $15 
> > > and trophies of $1000. First $9 and trophies of $1000 to owner, 
> > > second $3, third $15000, fourth $7500, fifth $3000, sixth $1500, 
> > > seventh $1500, eighth $1500">
> > > Of $15 and trophies of $1000. First $9 
> > > and trophies of $1000 to owner, second $3, third $15000, fourth 
> > > $7500, fifth $3000, sixth $1500, seventh $1500, eighth $1500
> > > No class restriction, Set Weights plus Penalties, 
> > > For Three-Years-Old and Upwards, Fillies and Mares, (Group 3)
> > > No Allowances for apprentices. Field Limit: 14 + 
> > > 4 EM
> > >  > > idnumber="" regnumber="" blinkers="1" trainernumber="38701" 
> > > trainersurname="Cummings" trainerfirstname="Anthony" 
> > > trainertrack="Randwick" rsbtrainername="Anthony Cummings" 
> > > jockeynumber="86876" jockeysurname="McDonald" jockeyfirstname="James" 
> > > barrier="7" weight="55" rating="93" description="B M 5 Snippetson x 
> > > Graces Spirit (Flying Spur)" colours="Yellow, Red Epaulettes And Cap" 
> > > owners="Anthony Cummings Thoroughbreds Pty Ltd Syndicate (Mgrs: A  B 
> > > Cummings)  P C Racing Investments Syndicate (Mgr: P J Carroll)  " 
> > > dob="2010-10-07T00:00:00" age="6" sex="M" career="30-7-4-2 $295445.00" 
> > > thistrack="6-1-1-0 $90500.00" thisdistance="0-0-0-0" goodtrack="17-3-2-2 
> > > $101440.00" heavytrack="5-0-1-0 $20200.00" slowtrack="" deadtrack="" 
> > > fasttrack="0-0-0-0" firstup="7-2-1-2 $108340.00" secondup="7-1-1-0 
> > > $43200.00" mindistancewin="0" maxdistancewin="0" finished="1" 
> > > weightvariation="0" variedweight="55" decimalmargin="0.
 00" penalty="0" pricestarting="$12" sectional200="0" sectional400="0" 
sectional600="0" sectional800="0" sectional1200="0" bonusindicator="" />
> > >  > > id="187674" idnumber="" regnumber="" blinkers="0" trainernumber="736" 
> > > trainersurname="Martin" trainerfirstname="Tim" trainertrack="Rosehill" 
> > > rsbtrainername="Tim Martin" jockeynumber="46930" jockeysurname="Angland" 
> > > jockeyfirstname="Tye" barrier="6" weight="56" rating="88" description="B 
> > > M 4 Street Cry(IRE) x Reggie(NZ) (Germano(GB))" colours="Yellow, Green 
> > > Chevrons, Striped Cap" owners="President Bloodstock Pty Ltd (Mgr: R C 
> > > Kemister)" dob="2011-08-12T00:00:00" age="5" sex="M" career="12-3-3-4 
> > > $271520.00" thistrack="4-0-3-0 $41425.00" thisdistance="0-0-0-0" 
> > > goodtrack="10-2-2-4 $214845.00" heavytrack="0-0-0-0" slowtrack="" 
> > > deadtrack="" fasttrack="0-0-0-0" firstup="2-0-1-1 $20710.00" 
> > > secondup="2-0-2-0 $24675.00" mindistancewin="0" maxdistancewin="0" 
> > > finished="2" weightvariation="0" 

Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Rustom Mody
On Sunday, April 17, 2016 at 3:34:56 PM UTC+5:30, BartC wrote:
> On 17/04/2016 04:44, Rustom Mody wrote:
> > On Saturday, April 16, 2016 at 10:22:10 PM UTC+5:30, Marko Rauhamaa wrote:
> 
> >> It comes with the maxim that one function must be visible at once on the
> >> screen.
> >
> > Thats a strange self-contradiction.  I wrote this:
> >   http://blog.languager.org/2012/10/layout-imperative-in-functional.html
> > to make the case against PEP8 style line length strictures.
> > Which has the SAME code formatted in two styles:
> >
> > --  < 80 cols, 48 lines
> > --  115 cols 37 lines
> >
> > Clearly the 115 cols is MORE fittable in a page than the 80 cols
> > [Though my argument for that is based on other structural/semantic 
> > principles]
> 
> Um, that's a different language, or does PEP8 apply to Haskell too?
> 
> Haskell has a style that likes to be written horizontally (rather than 
> have statements one after another - /on separate lines/ - as in 
> imperative code).
> 
> I also have trouble regarding that code as a single function, as it 
> implements (AFAICS) an entire lexer. It resembles data more than 
> anything else, and data presumably is allowed to be scrolled. 

Thats a nice point ... and often neglected by even the aficionados of functional
programming.
See Data Orientation 
http://blog.languager.org/2012/10/functional-programming-lost-booty.html
[yeah funny that I am tell you this given your recent famous thread on lexing!]

Come to think of it take an SQL DBMS browser.
Should we say: Horizontal scrolls are BAD; just reformat the table after 
reaching 80 columns?

In fact much of the point of 
http://blog.languager.org/2012/10/layout-imperative-in-functional.html
is just this: that as code becomes more and more data-ish,
a more-lines-less-columns regime becomes correspondingly irksome.

> Otherwise things would be very restrictive!

Dont understand that comment
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating a hot vector (numpy)

2016-04-17 Thread Reto Brunner
Hi,
It is called broadcasting an array, have a look here:
http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html

Greetings,
Reto

On Mon, Apr 18, 2016, 02:54 Paulo da Silva 
wrote:

> Hi all.
>
> I have seen this "trick" to create a hot vector.
>
> In [45]: x
> Out[45]: array([0, 1])
>
> In [46]: y
> Out[46]: array([1, 1, 1, 0, 0, 1, 0, 0], dtype=uint8)
>
> In [47]: y[:,None]
> Out[47]:
> array([[1],
>[1],
>[1],
>[0],
>[0],
>[1],
>[0],
>[0]], dtype=uint8)
>
> In [48]: x==y[:,None]
> Out[48]:
> array([[False,  True],
>[False,  True],
>[False,  True],
>[ True, False],
>[ True, False],
>[False,  True],
>[ True, False],
>[ True, False]], dtype=bool)
>
> In [49]: (x==y[:,None]).astype(np.float32)
> Out[49]:
> array([[ 0.,  1.],
>[ 0.,  1.],
>[ 0.,  1.],
>[ 1.,  0.],
>[ 1.,  0.],
>[ 0.,  1.],
>[ 1.,  0.],
>[ 1.,  0.]], dtype=float32)
>
> How does this (step 48) work?
>
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


scipy install error,need help its important

2016-04-17 Thread Xristos Xristoou
guys i have big proplem i want to install scipy
but all time show me error
i have python 2.7 and windows 10
i try to use pip install scipy and i take that error

raise NotFoundError('no lapack/blas resources found')
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found


Command "C:\Python27\python.exe -u -c "import setuptools, 
tokenize;__file__='c:\\users\\name\\appdata\\local\\temp\\pip-build-a3fjaf\\scipy\\setup.py';exec(compile(getattr(tokenize,
 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record 
c:\users\name\appdata\local\temp\pip-pgtkuz-record\install-record.txt 
--single-version-externally-managed --compile" failed with error code 1 in 
c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\

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


Re: QWERTY was not designed to intentionally slow typists down

2016-04-17 Thread Michael Torrie
On 04/17/2016 07:39 PM, Steven D'Aprano wrote:
> Even though QWERTY wasn't designed with touch-typing in mind, it's
> interesting to look at some of the weaknesses of the system. It is almost
> as if it had been designed to make touch-typing as inefficient as
> possible :-) Just consider the home keys. The home keys require the least
> amount of finger or hand movement, and are therefore the fastest to reach.
> With QWERTY, the eight home keys only cover a fraction over a quarter of
> all key presses: ASDF JKL; have frequencies of
> 
> 8.12% 6.28% 4.32% 2.30% 0.10% 0.69% 3.98% and effectively 0%
> 
> making a total of 25.79%. If you also include G and H as "virtual
> home-keys", that rises to 33.74%.
> 
> But that's far less than the obvious tactic of using the most common
> letters ETAOIN as the home keys, which would cover 51.18% just from those
> eight keys alone. The 19th century Blickensderfer typewriter used a similar
> layout, with the ten home keys DHIATENSOR as the home keys. This would
> allow the typist to make just under 74% of all alphabetical key presses
> without moving the hands.

While they Dvorak layout also puts more coverage in the home row, and
also lets the touch typist alternate more equally between the fingers, I
had to quit using it because it just wasn't as comfortable to use with
vi, especially for things like cursor navigation, and I didn't really
want to remap all the keys.  vi is very flexible and I bet there are key
mappings for vi that work better with Dvorak.  Maybe if I try it again
I'll have another look.

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


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Rustom Mody
On Monday, April 18, 2016 at 8:49:33 AM UTC+5:30, Steven D'Aprano wrote:
> On Mon, 18 Apr 2016 11:39 am, Rustom Mody wrote:
> 
> > yes we can agree on this -- arbitrary line lengths are almost certainly
> > unreadable.
> > The problem then becomes so what is optimal?
> 
> I really don't think it is a problem. We have about 400 years
> of experience with printed text, and that experience tells us
> that the optimal width for reading prose in Western languages
> is about 60 characters, give or take. This width is optimal
> for eye movement, and minimizes the number of errors and 
> reduces eye-strain.

No disagreement so far

> 
> There's only so far that our eyes can follow a line to the
> right without increasing stress or reading errors, and 
> likewise when returning back to the left margin. The longer
> the line, the higher the chance of losing track, and the
> physical effort it takes to read. (You have to move the eyes
> further, and for extremely long lines, you may have to move
> your entire head.)
> 
> Long lines are simply harder to read because you have to
> move your eyes more, and the longer the lines, the greater
> the tendency to wander across the lines. Especially if the
> lines are close together and the height of the lines is
> small. (It boggles my mind how many programmers I've met who
> routinely view their code in tiny physical heights, even
> when reading it in fine detail.)
> 
> The optimal width for eye-tracking (that is, the maximum
> width for which the rate of such errors can be disregarded)
> is somewhere about sixty characters per line.

Maybe even this is ok

> 
> The same eye-tracking considerations apply to code

This is nonsense.

The last attempt of making code text-ish was Cobol -- by most accounts an 
unhappy experience.
What is more code needs to be read very intensively for comprehension
"x... what is x where is it defined? (scan backwards) ah there?
Uh no further back... No global..."
My own estimate of increased back-n-forth scanning of code vs plain text is 
probably an order of magnitude ie close to 10 times
Even if I grant that you are twice as good a programmer as I am it will become
5 times.
You would have to be 10 times better than me to equalize to (my) plaintext rate
But if you are that kind of genius you probably speed-read plain text as well.

tl;dr 
1. Different languages -- natural and computer -- have different optimal line 
lengths.

2. There is very scant data on that.

3. PEP8 style strictures only delay discovery and collection of such data
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Steven D'Aprano
On Mon, 18 Apr 2016 11:39 am, Rustom Mody wrote:

> yes we can agree on this -- arbitrary line lengths are almost certainly
> unreadable.
> The problem then becomes so what is optimal?

I really don't think it is a problem. We have about 400 years
of experience with printed text, and that experience tells us
that the optimal width for reading prose in Western languages
is about 60 characters, give or take. This width is optimal
for eye movement, and minimizes the number of errors and 
reduces eye-strain.

There's only so far that our eyes can follow a line to the
right without increasing stress or reading errors, and 
likewise when returning back to the left margin. The longer
the line, the higher the chance of losing track, and the
physical effort it takes to read. (You have to move the eyes
further, and for extremely long lines, you may have to move
your entire head.)

Long lines are simply harder to read because you have to
move your eyes more, and the longer the lines, the greater
the tendency to wander across the lines. Especially if the
lines are close together and the height of the lines is
small. (It boggles my mind how many programmers I've met who
routinely view their code in tiny physical heights, even
when reading it in fine detail.)

The optimal width for eye-tracking (that is, the maximum
width for which the rate of such errors can be disregarded)
is somewhere about sixty characters per line.

The same eye-tracking considerations apply to code, but:

when it comes to code, we don't always have to track all the
way back to the left-hand margin. If we start (say) up to 
twenty columns in, then we can afford to write up to twenty
columns further to the right too.


(Also, code tends to have VERY ragged right-hand margins.
Not all lines end up even close to sixty characters wide.)

There are other considerations though. Unlike prose, with
code, shorter lines *may* sometimes force an increase in
complexity. For instance, temporary variables need to be
created, or new functions created, just to avoid otherwise
excessively long lines. So one might be willing to accept a
little more eye-movement for a little less code complexity.

So allowing a total width of 80 (give or take) is already a
compromise from the optimal sixty characters. This compromise
allows for indented code, and allows up to 20 characters
extra to avoid creating more complexity elsewhere.


But there's another factor: long lines of code are themselves
a code-smell. Perhaps:

- you have indented too deeply, suggesting that your function
  is doing too much or has too much internal complexity:

  def func():
  if a:
  for b in seq:
  while c:
  with d:
  try:
  try:
  for e in it:
  block  # only 48 columns available here

  (But note also that even with this extreme example, eight
  indentation levels deep, you can still fit almost 
  characters per line without breaking the 80-char limit.
  You can do a lot in 50 characters.)


- you have too many expressions on one line, suggesting that
  the over-all complexity of the line is excessive;

- your variable or function names are needlessly verbose or
  are doing too much or are too specific
  ("calculate_number_of_pages_and_number_of_semicolons_in_chapter_one");

- or you are violating the rule of Demeter:
  get(customer.trousers.pocket.wallet).open().money.pay(1)


In other words, long lines of code are themselves an 
indication of poorly-designed code. Even though there are 
exceptions, we should resist strongly the urge to extend
beyond the 60-80 (or perhaps 90 in extreme cases) limit.
Whenever I hear people saying that they regularly need to
use 100 or even 120 columns for their code, what I hear is
"my code is badly written".



-- 
Steven

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


Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw  wrote:
> On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw  wrote:
> > Hi
> > 
> > I have an XML and using pyquery to obtain the elements within it and then 
> > write it to csv.
> > 
> > What is the best most reliable way to take dictionaries of each element, 
> > and print them(csv write later) based on each position so get item 0 of 
> > each list and then it 1 and so on.
> > 
> > Any other code I post is open to criticism. Because there are many 
> > attributes I will want to collect my thought is to create a list of lists, 
> > again seems a bit clunky so could be wrong.
> > 
> > from pyquery import PyQuery as pq
> > 
> > 
> > d = pq(filename='20160319RHIL0_edit.xml')
> > res = d('nomination')
> > # myAt = pq.each(res.attr('bbid'))
> > # print(repr(res))
> > # myAt = [res.eq(i).attr('horse') for i in range(len(res))]
> > # print(myAt)
> > 
> > nomID = [res.eq(i).attr('horse') for i in range(len(res))]
> > horseName = [res.eq(i).attr('horse') for i in range(len(res))]
> > group = [nomID, horseName]
> > 
> > for items in group:
> > print(items)
> > 
> > 
> > This is my source.
> > 
> > 
> >  > date="2016-03-19T00:00:00" gearchanges="-1" stewardsreport="-1" 
> > gearlist="-1" racebook="0" postracestewards="0" meetingtype="TAB" 
> > rail="Timing - Electronic : Rail - +2m" weather="Fine  " 
> > trackcondition="Good" nomsdeadline="2016-03-14T11:00:00" 
> > weightsdeadline="2016-03-15T16:00:00" acceptdeadline="2016-03-16T09:00:00" 
> > jockeydeadline="2016-03-16T12:00:00">
> >> website="http://; />
> >> stage="Results" distance="1900" minweight="0" raisedweight="0" class="~ 
> > " age="3U" grade="0" weightcondition="SWP   " trophy="1000" 
> > owner="1000" trainer="0" jockey="0" strapper="0" totalprize="15" 
> > first="9" second="3" third="15000" fourth="7500" fifth="3000" 
> > time="2016-03-19T12:40:00" bonustype="  " nomsfee="0" acceptfee="0" 
> > trackcondition="Good  " timingmethod="Electronic" fastesttime="1-56.83  
> >  " sectionaltime="600/35.3  " formavailable="0" racebookprize="Of $15 
> > and trophies of $1000. First $9 and trophies of $1000 to owner, second 
> > $3, third $15000, fourth $7500, fifth $3000, sixth $1500, seventh 
> > $1500, eighth $1500">
> > Of $15 and trophies of $1000. First $9 and 
> > trophies of $1000 to owner, second $3, third $15000, fourth $7500, 
> > fifth $3000, sixth $1500, seventh $1500, eighth $1500
> > No class restriction, Set Weights plus Penalties, 
> > For Three-Years-Old and Upwards, Fillies and Mares, (Group 3)
> > No Allowances for apprentices. Field Limit: 14 + 4 
> > EM
> >  > idnumber="" regnumber="" blinkers="1" trainernumber="38701" 
> > trainersurname="Cummings" trainerfirstname="Anthony" 
> > trainertrack="Randwick" rsbtrainername="Anthony Cummings" 
> > jockeynumber="86876" jockeysurname="McDonald" jockeyfirstname="James" 
> > barrier="7" weight="55" rating="93" description="B M 5 Snippetson x Graces 
> > Spirit (Flying Spur)" colours="Yellow, Red Epaulettes And Cap" 
> > owners="Anthony Cummings Thoroughbreds Pty Ltd Syndicate (Mgrs: A  B 
> > Cummings)  P C Racing Investments Syndicate (Mgr: P J Carroll)  " 
> > dob="2010-10-07T00:00:00" age="6" sex="M" career="30-7-4-2 $295445.00" 
> > thistrack="6-1-1-0 $90500.00" thisdistance="0-0-0-0" goodtrack="17-3-2-2 
> > $101440.00" heavytrack="5-0-1-0 $20200.00" slowtrack="" deadtrack="" 
> > fasttrack="0-0-0-0" firstup="7-2-1-2 $108340.00" secondup="7-1-1-0 
> > $43200.00" mindistancewin="0" maxdistancewin="0" finished="1" 
> > weightvariation="0" variedweight="55" decimalmargin="0.00
 " penalty="0" pricestarting="$12" sectional200="0" sectional400="0" 
sectional600="0" sectional800="0" sectional1200="0" bonusindicator="" />
> >  > id="187674" idnumber="" regnumber="" blinkers="0" trainernumber="736" 
> > trainersurname="Martin" trainerfirstname="Tim" trainertrack="Rosehill" 
> > rsbtrainername="Tim Martin" jockeynumber="46930" jockeysurname="Angland" 
> > jockeyfirstname="Tye" barrier="6" weight="56" rating="88" description="B M 
> > 4 Street Cry(IRE) x Reggie(NZ) (Germano(GB))" colours="Yellow, Green 
> > Chevrons, Striped Cap" owners="President Bloodstock Pty Ltd (Mgr: R C 
> > Kemister)" dob="2011-08-12T00:00:00" age="5" sex="M" career="12-3-3-4 
> > $271520.00" thistrack="4-0-3-0 $41425.00" thisdistance="0-0-0-0" 
> > goodtrack="10-2-2-4 $214845.00" heavytrack="0-0-0-0" slowtrack="" 
> > deadtrack="" fasttrack="0-0-0-0" firstup="2-0-1-1 $20710.00" 
> > secondup="2-0-2-0 $24675.00" mindistancewin="0" maxdistancewin="0" 
> > finished="2" weightvariation="0" variedweight="56" decimalmargin="0.20" 
> > penalty="0" pricestarting="$3.80F" sectional200="0" sectional400="0" 
> > sectional600="0" sectional800="
 0" sectional1200="0" bonusindicator="" />
> >  > idnumber="" regnumber="" blinkers="0" trainernumber="681" 
> > 

Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw  wrote:
> Hi
> 
> I have an XML and using pyquery to obtain the elements within it and then 
> write it to csv.
> 
> What is the best most reliable way to take dictionaries of each element, and 
> print them(csv write later) based on each position so get item 0 of each list 
> and then it 1 and so on.
> 
> Any other code I post is open to criticism. Because there are many attributes 
> I will want to collect my thought is to create a list of lists, again seems a 
> bit clunky so could be wrong.
> 
> from pyquery import PyQuery as pq
> 
> 
> d = pq(filename='20160319RHIL0_edit.xml')
> res = d('nomination')
> # myAt = pq.each(res.attr('bbid'))
> # print(repr(res))
> # myAt = [res.eq(i).attr('horse') for i in range(len(res))]
> # print(myAt)
> 
> nomID = [res.eq(i).attr('horse') for i in range(len(res))]
> horseName = [res.eq(i).attr('horse') for i in range(len(res))]
> group = [nomID, horseName]
> 
> for items in group:
> print(items)
> 
> 
> This is my source.
> 
> 
>  date="2016-03-19T00:00:00" gearchanges="-1" stewardsreport="-1" gearlist="-1" 
> racebook="0" postracestewards="0" meetingtype="TAB" rail="Timing - Electronic 
> : Rail - +2m" weather="Fine  " trackcondition="Good" 
> nomsdeadline="2016-03-14T11:00:00" weightsdeadline="2016-03-15T16:00:00" 
> acceptdeadline="2016-03-16T09:00:00" jockeydeadline="2016-03-16T12:00:00">
>website="http://; />
>stage="Results" distance="1900" minweight="0" raisedweight="0" class="~   
>   " age="3U" grade="0" weightcondition="SWP   " trophy="1000" 
> owner="1000" trainer="0" jockey="0" strapper="0" totalprize="15" 
> first="9" second="3" third="15000" fourth="7500" fifth="3000" 
> time="2016-03-19T12:40:00" bonustype="  " nomsfee="0" acceptfee="0" 
> trackcondition="Good  " timingmethod="Electronic" fastesttime="1-56.83   
> " sectionaltime="600/35.3  " formavailable="0" racebookprize="Of $15 and 
> trophies of $1000. First $9 and trophies of $1000 to owner, second 
> $3, third $15000, fourth $7500, fifth $3000, sixth $1500, seventh $1500, 
> eighth $1500">
> Of $15 and trophies of $1000. First $9 and 
> trophies of $1000 to owner, second $3, third $15000, fourth $7500, fifth 
> $3000, sixth $1500, seventh $1500, eighth $1500
> No class restriction, Set Weights plus Penalties, For 
> Three-Years-Old and Upwards, Fillies and Mares, (Group 3)
> No Allowances for apprentices. Field Limit: 14 + 4 
> EM
>  idnumber="" regnumber="" blinkers="1" trainernumber="38701" 
> trainersurname="Cummings" trainerfirstname="Anthony" trainertrack="Randwick" 
> rsbtrainername="Anthony Cummings" jockeynumber="86876" 
> jockeysurname="McDonald" jockeyfirstname="James" barrier="7" weight="55" 
> rating="93" description="B M 5 Snippetson x Graces Spirit (Flying Spur)" 
> colours="Yellow, Red Epaulettes And Cap" owners="Anthony Cummings 
> Thoroughbreds Pty Ltd Syndicate (Mgrs: A  B Cummings)  P C Racing 
> Investments Syndicate (Mgr: P J Carroll)  " dob="2010-10-07T00:00:00" age="6" 
> sex="M" career="30-7-4-2 $295445.00" thistrack="6-1-1-0 $90500.00" 
> thisdistance="0-0-0-0" goodtrack="17-3-2-2 $101440.00" heavytrack="5-0-1-0 
> $20200.00" slowtrack="" deadtrack="" fasttrack="0-0-0-0" firstup="7-2-1-2 
> $108340.00" secondup="7-1-1-0 $43200.00" mindistancewin="0" 
> maxdistancewin="0" finished="1" weightvariation="0" variedweight="55" 
> decimalmargin="0.00" 
 penalty="0" pricestarting="$12" sectional200="0" sectional400="0" 
sectional600="0" sectional800="0" sectional1200="0" bonusindicator="" />
>  idnumber="" regnumber="" blinkers="0" trainernumber="736" 
> trainersurname="Martin" trainerfirstname="Tim" trainertrack="Rosehill" 
> rsbtrainername="Tim Martin" jockeynumber="46930" jockeysurname="Angland" 
> jockeyfirstname="Tye" barrier="6" weight="56" rating="88" description="B M 4 
> Street Cry(IRE) x Reggie(NZ) (Germano(GB))" colours="Yellow, Green Chevrons, 
> Striped Cap" owners="President Bloodstock Pty Ltd (Mgr: R C Kemister)" 
> dob="2011-08-12T00:00:00" age="5" sex="M" career="12-3-3-4 $271520.00" 
> thistrack="4-0-3-0 $41425.00" thisdistance="0-0-0-0" goodtrack="10-2-2-4 
> $214845.00" heavytrack="0-0-0-0" slowtrack="" deadtrack="" 
> fasttrack="0-0-0-0" firstup="2-0-1-1 $20710.00" secondup="2-0-2-0 $24675.00" 
> mindistancewin="0" maxdistancewin="0" finished="2" weightvariation="0" 
> variedweight="56" decimalmargin="0.20" penalty="0" pricestarting="$3.80F" 
> sectional200="0" sectional400="0" sectional600="0" sectional800="0"
  sectional1200="0" bonusindicator="" />
>  idnumber="" regnumber="" blinkers="0" trainernumber="681" 
> trainersurname="Waller" trainerfirstname="Chris" trainertrack="Rosehill" 
> rsbtrainername="Chris Waller" jockeynumber="51661" jockeysurname="Berry" 
> jockeyfirstname="Tommy" barrier="5" weight="54" rating="85" description="BR M 
> 4 Shamardal(USA) x Zarinia(IRE) (Intikhab(USA))" 

Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 11:39 AM, Steven D'Aprano  wrote:
> With QWERTY, the eight home keys only cover a fraction over a quarter of
> all key presses: ASDF JKL; have frequencies of
>
> 8.12% 6.28% 4.32% 2.30% 0.10% 0.69% 3.98% and effectively 0%
>
> making a total of 25.79%. If you also include G and H as "virtual
> home-keys", that rises to 33.74%.

Hey, that's a little unfair. Remember, lots of people still have to
write C code, so the semicolon is an important character! :) In fact,
skimming the CPython source code (grouped by file extension) shows
that C code has more semicolons than j's or k's:

a 3.19% s 3.26% d 1.90% f 1.76% g 0.95% h 0.89% j 0.36% k 0.35% l 2.62% ; 1.40%

for a total of 16.69% of characters coming from the home row.

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


What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
Hi

I have an XML and using pyquery to obtain the elements within it and then write 
it to csv.

What is the best most reliable way to take dictionaries of each element, and 
print them(csv write later) based on each position so get item 0 of each list 
and then it 1 and so on.

Any other code I post is open to criticism. Because there are many attributes I 
will want to collect my thought is to create a list of lists, again seems a bit 
clunky so could be wrong.

from pyquery import PyQuery as pq


d = pq(filename='20160319RHIL0_edit.xml')
res = d('nomination')
# myAt = pq.each(res.attr('bbid'))
# print(repr(res))
# myAt = [res.eq(i).attr('horse') for i in range(len(res))]
# print(myAt)

nomID = [res.eq(i).attr('horse') for i in range(len(res))]
horseName = [res.eq(i).attr('horse') for i in range(len(res))]
group = [nomID, horseName]

for items in group:
print(items)


This is my source.



  http://; />
  
Of $15 and trophies of $1000. First $9 and 
trophies of $1000 to owner, second $3, third $15000, fourth $7500, fifth 
$3000, sixth $1500, seventh $1500, eighth $1500
No class restriction, Set Weights plus Penalties, For 
Three-Years-Old and Upwards, Fillies and Mares, (Group 3)
No Allowances for apprentices. Field Limit: 14 + 4 
EM











  


If I do this


nomID = [res.eq(i).attr('horse') for i in range(len(res))]
horseName = [res.eq(i).attr('horse') for i in range(len(res))]
print(nomID, horseName)

comes out correctly

In [7]: 171115 Vergara

Since I will be taking another 10 attributes out of nominmation category an 
efficient way that ensures data integrity would be valued.

Thanks

Sayth 

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


Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 21:39, Steven D'Aprano wrote:
> Oh no, it's the thread that wouldn't die! *wink*
>
> Actually, yes it is. At least, according to this website:
> 
> http://www.mit.edu/~jcb/Dvorak/history.html

I'd really rather see an instance of the claim not associated with
Dvorak marketing. It only holds up as an obvious inference from the
nature of how typing works if we assume *one*-finger hunt-and-peck
rather than two-finger. Your website describes two-finger as the method
that was being replaced by the 1878 introduction of ten-finger typing.

> The QWERTY layout was first sold in 1873 while the first known use of
> ten-fingered typing was in 1878, and touch-typing wasn't invented for
> another decade, in 1888.

Two-finger hunt-and-peck is sufficient for placing keys on opposite
hands to speed typing up rather than slow it down.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Steven D'Aprano
On Mon, 18 Apr 2016 10:27 am, Random832 wrote:

> As an alternative, when you send them through can you put a note on the
> bottom saying they're not subscribed, to remind people to CC them in
> responses?

That doesn't work so well from Usenet. I can reply via news (which
definitely works), or I can reply via email (which may or may not work),
but it is a pain to reply via *both*.


-- 
Steven

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


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2016 09:01 pm, Marko Rauhamaa wrote:

> In fact, if you find yourself introducing coding "paragraphs" with
> comments:
> 
> def f(...):
> # I'll start by doing this
> ...
> # segueing into the middle portion
> ...
> # and finish it off as follows
> ...
> 
> you had better break those paragraphs off into separate functions. Just
> turn your comments into function names.

I'm reminded of the book "Refactoring - Ruby Edition" by Jay Fields, Shane
Harvie and Martin Fowler (which I strongly recommend, for what it's worth).
It is full of sections like:

Change Value to Reference
Change Reference to Value

Decompose Conditional
Recompose Conditional

and most relevant to this discussion:

Extract Method
Inline Method

(For "Method", substitute "Function".)

The intro to Extract Method says:

"You have a code fragment that can be grouped together."

and then the author explains that he looks for methods which are too long,
or code that needs a comment to explain what it does, and turns that
fragment of code into its own method.

But then the same author goes on to introduce Inline Method:

"A method's body is just as clear as its name."

and explains "sometimes you do come across a method in which the body is as
clear as the name. ... When this happens, you should then get rid of the
method. Indirection can be helpful, but needless indirection is
irritating."

Indeed.

Once your code is the most straight-forward and simple implementation of the
needed algorithm, it is hard to reduce complexity any further. All you can
do is move the complexity around. You can hide the complexity inside the
function, where it exposes itself only to those who need to dig into the
body of the function to understand what it does.

Or you can extract the code into functions of their own, which decreases the
internal complexity of the function, but increases the complexity of the
application or module.

Extract Method hides complexity of the function by moving it into the
module:

def Do_The_Thing():
...

def internal_subpart_start(): ...

def internal_subpart_middle(): ...

def internal_subpart_end(): ...


Inline Method reduces module complexity by moving it into the function:

def Do_The_Thing():
...  # internal subpart start
...  # internal subpart middle
...  # internal subpart end


But the total complexity remains the same.


One technique which is common in Pascal, but less so in Python, is to get
the best of both worlds by using nested functions. In Python syntax:


def Do_The_Thing():
def internal_subpart_start(): ...
def internal_subpart_middle(): ...
def internal_subpart_end(): ...
...


This hides complexity of the function by moving it into the nested
functions, where they can be ignored, but without increasing the complexity
of the module. (Of course, the *total* complexity of module, function and
nested functions is the same.)




-- 
Steven

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


[issue26792] docstrings of runpy.run_{module,path} are rather sparse

2016-04-17 Thread Antony Lee

New submission from Antony Lee:

$ pydoc runpy

run_module(mod_name, init_globals=None, run_name=None, alter_sys=False)
Execute a module's code without importing it

Returns the resulting top level namespace dictionary

run_path(path_name, init_globals=None, run_name=None)
Execute code located at the specified filesystem location

Returns the resulting top level namespace dictionary

The file path may refer directly to a Python script (i.e.
one that could be directly executed with execfile) or else
it may refer to a zipfile or directory containing a top
level __main__.py script.

The meaning of the arguments should be documented (e.g. by copy-pasting the 
html docs).  (And some sentences are missing final dots.)

--
assignee: docs@python
components: Documentation
messages: 263638
nosy: Antony.Lee, docs@python
priority: normal
severity: normal
status: open
title: docstrings of runpy.run_{module,path} are rather sparse
versions: Python 3.5

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Rustom Mody
On Sunday, April 17, 2016 at 9:19:48 AM UTC+5:30, Chris Angelico wrote:
> On Sun, Apr 17, 2016 at 1:44 PM, Rustom Mody wrote:
> > Thats a strange self-contradiction.  I wrote this:
> >  http://blog.languager.org/2012/10/layout-imperative-in-functional.html
> > to make the case against PEP8 style line length strictures.
> > Which has the SAME code formatted in two styles:
> >
> > --  < 80 cols, 48 lines
> > --  115 cols 37 lines
> >
> > Clearly the 115 cols is MORE fittable in a page than the 80 cols
> > [Though my argument for that is based on other structural/semantic 
> > principles]
> 
> There are certain specific situations where 80 (79) is the correct
> width to aim for, but even if you aren't going for that, there's still
> the general principle that longer lines are harder to read. So maybe
> you declare that your codebase is allowed to go to 100, or 120, but
> you don't want to let it run to 2048. No matter WHAT screen you're on,
> that's too wide!

yes we can agree on this -- arbitrary line lengths are almost certainly
unreadable.
The problem then becomes so what is optimal?
Interesting question... and one that certainly has no bearing on the 
characteristics.
of 30 year old technology.
Remember that the most important characteristics of code are almost always 
un-legislatable
eg choose 'nice' names.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-17 Thread Steven D'Aprano
Oh no, it's the thread that wouldn't die! *wink*


On Sun, 10 Apr 2016 01:53 am, Random832 wrote:

> On Fri, Apr 8, 2016, at 23:28, Steven D'Aprano wrote:
>> This is the power of the "slowing typists down is a myth" meme: same
>> Wikipedia contributor takes an article which *clearly and obviously*
>> repeats the conventional narrative that QWERTY was designed to
>> decrease the number of key presses per second, and uses that to defend
>> the counter-myth that QWERTY wasn't designed to decrease the number of
>> key presses per second!
> 
> Er, the footnote is clearly and obviously being used to cite the claim
> that that is popularly believed, not the claim that it's incorrect.

That's not clear nor obvious to me. But I won't quibble, I'll accept that as
a plausible interpretation.


>> These are the historical facts:
> 
>> - Sholes spend significant time developing a layout which reduced the
>>   number of jams by intentionally moving frequently typed characters
>>   far apart, which has the effect of slowing down the rate at which
>>   the typist can hit keys;
> 
> "Moving characters far apart has the effect of slowing down the rate at
> which the typist can hit keys" is neither a fact nor historical.

Actually, yes it is. At least, according to this website:

http://www.mit.edu/~jcb/Dvorak/history.html

  [quote]
  Because typists at that time used the "hunt-and-peck" method,
  Sholes's arrangement increased the time it took for the typists
  to hit the keys for common two-letter combinations enough to
  ensure that each type bar had time to fall back sufficiently
  far to be out of the way before the next one came up.
  [end quote]


The QWERTY layout was first sold in 1873 while the first known use of
ten-fingered typing was in 1878, and touch-typing wasn't invented for
another decade, in 1888.

So I think it is pretty clear that *at the time QWERTY was invented*
it slowed down the rate at which keys were pressed, thus allowing an
overall greater typing speed thanks to the reduced jamming.

Short of a signed memo from Shole himself, commenting one way or another, I
don't think we're going to find anything more definitive.

Even though QWERTY wasn't designed with touch-typing in mind, it's
interesting to look at some of the weaknesses of the system. It is almost
as if it had been designed to make touch-typing as inefficient as
possible :-) Just consider the home keys. The home keys require the least
amount of finger or hand movement, and are therefore the fastest to reach.
With QWERTY, the eight home keys only cover a fraction over a quarter of
all key presses: ASDF JKL; have frequencies of

8.12% 6.28% 4.32% 2.30% 0.10% 0.69% 3.98% and effectively 0%

making a total of 25.79%. If you also include G and H as "virtual
home-keys", that rises to 33.74%.

But that's far less than the obvious tactic of using the most common
letters ETAOIN as the home keys, which would cover 51.18% just from those
eight keys alone. The 19th century Blickensderfer typewriter used a similar
layout, with the ten home keys DHIATENSOR as the home keys. This would
allow the typist to make just under 74% of all alphabetical key presses
without moving the hands.

https://en.wikipedia.org/wiki/Blickensderfer_typewriter

Letter frequencies taken from here:

http://www.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html


> Keys 
> that are further apart *can be hit faster without jamming* due to the
> specifics of the type-basket mechanism, and there's no reason to think
> that they can't be hit with at least equal speed by the typist.

You may be correct about that specific issue when it comes to touch typing,
but touch typing was 15 years in the future when Sholes invented QWERTY.
And unlike Guido, he didn't have a time-machine :-)



-- 
Steven

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


Re: [OT] Java generics (was: Guido sees the light: PEP 8 updated)

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 11:03 AM, Steven D'Aprano  wrote:
> On Mon, 18 Apr 2016 09:30 am, Chris Angelico wrote:
>
>> "Java" was originally four related, but separate, concepts: a source
>> language, a bytecode, a sandboxing system, and one other that I can't
>> now remember.
>
> The virtual machine? Or is that what you mean by bytecode?

Could be. I can't remember where it was that I read about the
four-part name overloading on "Java", but it doesn't much matter. The
VM and bytecode go together, and the sandboxing is the thing that
makes that better than just compiling to machine code.

> The Java Virtual Machine is probably the most successful part of Java, as it
> has spawned a whole lot of new languages that are built on the JVM,
> including Clojure, Groovy and Scala, as well as JVM implementations of
> Python, Ruby, Javascript, Perl6, TCL, Fortran, Oberon, Pascal and more.
>
> https://en.wikipedia.org/wiki/List_of_JVM_languages

Yes, but how long did it take before they came along? I didn't click
on all the links, but the five that Wikipedia lists as "High Profile"
are all post-2000. By that time, Flash had already established a
strong footing. NetRexx, in contrast, dates back to 1996, when the
battle was on. It could have been Java's game entirely if there'd been
enough interest in the early days.

> One of the more interesting approaches is of Fantom, a new language designed
> from the beginning to run on top of any of the JVM, the .Net CLR, or a
> Javascript VM.

I hadn't heard of that one specifically, but there have been some
extremely interesting forays into language layering. (PyPyJS, I'm
looking at you.) Code is code, compilers are compilers, you can
implement anything in anything. Although sometimes it's just for the
sake of showing off ("hey look, I just compiled Firefox to asm.js and
ran it inside Firefox!")... but that's fun too :)

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


Re: [OT] Java generics (was: Guido sees the light: PEP 8 updated)

2016-04-17 Thread Steven D'Aprano
On Mon, 18 Apr 2016 09:30 am, Chris Angelico wrote:

> "Java" was originally four related, but separate, concepts: a source
> language, a bytecode, a sandboxing system, and one other that I can't
> now remember. 

The virtual machine? Or is that what you mean by bytecode?

The Java Virtual Machine is probably the most successful part of Java, as it
has spawned a whole lot of new languages that are built on the JVM,
including Clojure, Groovy and Scala, as well as JVM implementations of
Python, Ruby, Javascript, Perl6, TCL, Fortran, Oberon, Pascal and more.

https://en.wikipedia.org/wiki/List_of_JVM_languages

One of the more interesting approaches is of Fantom, a new language designed
from the beginning to run on top of any of the JVM, the .Net CLR, or a
Javascript VM.



-- 
Steven

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


Re: Introducing the secrets module

2016-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2016 10:40 pm, Irmen de Jong wrote:

> On 17-4-2016 4:36, Steven D'Aprano wrote:
> 
>> And the documentation:
>> 
>> https://docs.python.org/3.6/library/secrets.html
>> 
>> 
>> Comments requested.
> 
> I've read about the "How many bytes should tokens use?" consideration. It
> suggests that to be secure, tokens need to have sufficient randomness. The
> default token length is subject to change at any time to remain secure
> against brute-force. However the API allows you to supply any token
> length, even one that is (a lot) shorter than the default.
> In view of the rationale for this new module ("Python's standard library
> makes it too easy for developers to inadvertently make serious security
> errors") should it perhaps not be allowed to use a value that is less than
> the default?
> 
> Hm, perhaps it should not; enforcing this could break code suddenly in the
> future when the default is raised...

Correct.

Also, consider that random tokens are not necessarily for high-security
purposes. Consider Youtube URLs that are intended to be hard to guess and
unpredictable, but permanent:

http://www.youtube.com/watch?v=kQFKtI6gn9Y

There are no security implications from revealing or guessing this URL.

On the other hand:

https://freedom-to-tinker.com/blog/vitaly/gone-in-six-characters-short-urls-considered-harmful-for-cloud-services/




-- 
Steven

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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Ben Finney
Random832  writes:

> As an alternative, when you send them through can you put a note on
> the bottom saying they're not subscribed, to remind people to CC them
> in responses?

That still relies on every participant manually changing from the
correct behaviour (reply to the mailing list only, by default).

> I think that's why we never get any followup on "newbie problem"
> questions

I think encouraging new posters to have a subscription in order to
participate is the right way forward.

-- 
 \ “Facts do not cease to exist because they are ignored.” —Aldous |
  `\Huxley |
_o__)  |
Ben Finney

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


Creating a hot vector (numpy)

2016-04-17 Thread Paulo da Silva
Hi all.

I have seen this "trick" to create a hot vector.

In [45]: x
Out[45]: array([0, 1])

In [46]: y
Out[46]: array([1, 1, 1, 0, 0, 1, 0, 0], dtype=uint8)

In [47]: y[:,None]
Out[47]:
array([[1],
   [1],
   [1],
   [0],
   [0],
   [1],
   [0],
   [0]], dtype=uint8)

In [48]: x==y[:,None]
Out[48]:
array([[False,  True],
   [False,  True],
   [False,  True],
   [ True, False],
   [ True, False],
   [False,  True],
   [ True, False],
   [ True, False]], dtype=bool)

In [49]: (x==y[:,None]).astype(np.float32)
Out[49]:
array([[ 0.,  1.],
   [ 0.,  1.],
   [ 0.,  1.],
   [ 1.,  0.],
   [ 1.,  0.],
   [ 0.,  1.],
   [ 1.,  0.],
   [ 1.,  0.]], dtype=float32)

How does this (step 48) work?

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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Ben Finney
Ethan Furman  writes:

> On 04/17/2016 03:08 PM, Matt Ruffalo wrote:
>
> > That seems like a reasonable approach, though I think there *really*
> > needs to be an option along the lines of "subscribed to the list for
> > the purposes of moderation, but not receiving list messages via
> > email".
>
> I don't understand what you are saying.
>
> If you are not receiving emails, how are you reading the list?  A news
> reader?

Another way is to receive messages to one email address, but to post
using a different email address that should not receive those messages.

E.g. the same person may wish to post as , but not
receive messages to that address because they receive the same messages
already at .

> If you are subscribed for moderation, how does that help with the lag
> time when you do post?

I think that (using the above example) the wish is for *both* those
addresses to be considered “subscribed for the purpose of moderation”,
without that also entailing delivery of messages.

-- 
 \ “What is needed is not the will to believe but the will to find |
  `\   out, which is the exact opposite.” —Bertrand Russell, _Free |
_o__)   Thought and Official Propaganda_, 1928 |
Ben Finney

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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 10:27 AM, Random832  wrote:
> As an alternative, when you send them through can you put a note on the
> bottom saying they're not subscribed, to remind people to CC them in
> responses? I think that's why we never get any followup on "newbie
> problem" questions (especially the crt dll thing and the modify remove
> repair thing). A couple other lists I'm on do this and it works well. I
> think most of the people who have objections to CC-ing are annoyed when
> they *receive* messages CC'd *to them*, rather than objecting on
> principle to doing it in reply to other people who aren't subscribed.

I'd rather insist that people actually join the community. It's too
hard to know when to keep cc'ing someone in.

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


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 19:56, Gregory Ewing wrote:
> And then legacy command-line exes will be supported by running
> cmd.exe under WINE in the Linux subsystem.

Running the command directly under WINE, more like. Because cmd.exe is
pretty terrible as a scripting language and command interpreter (MS
knows this, this is why they created PowerShell), and isn't required to
run console programs.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 18:08, Matt Ruffalo wrote:
> Hi-
> 
> That seems like a reasonable approach, though I think there *really*
> needs to be an option along the lines of "subscribed to the list for the
> purposes of moderation, but not receiving list messages via email".

There is. I'm on several other (non-python, but still using mailman)
mailing lists like that because they require you to be a subscriber to
post via gmane.

> On 2016-04-17 12:57, Tim Golden wrote:
> > First, a quick summary of the current settings of the list:
> >
> > * Any post from someone who's not subscribed to the list is held for
> > moderation

As an alternative, when you send them through can you put a note on the
bottom saying they're not subscribed, to remind people to CC them in
responses? I think that's why we never get any followup on "newbie
problem" questions (especially the crt dll thing and the modify remove
repair thing). A couple other lists I'm on do this and it works well. I
think most of the people who have objections to CC-ing are annoyed when
they *receive* messages CC'd *to them*, rather than objecting on
principle to doing it in reply to other people who aren't subscribed.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Gregory Ewing

Michael Torrie wrote:

On 04/17/2016 10:13 AM, Dennis Lee Bieber wrote:


On Sat, 16 Apr 2016 21:59:01 -0400, Random832 
declaimed the following:



I heard Windows 10 is going to finally fix this, anyway.


Probably by removing the old CLI window completely and making everyone
learn PowerShell ISE



Or a Linux ELF bash binary running on the new Linux subsystem for
Windows. :)


And then legacy command-line exes will be supported by running
cmd.exe under WINE in the Linux subsystem.

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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 8:08 AM, Matt Ruffalo  wrote:
> Hi-
>
> That seems like a reasonable approach, though I think there *really*
> needs to be an option along the lines of "subscribed to the list for the
> purposes of moderation, but not receiving list messages via email". I
> think I did this with the Git mailing list in the past, and it was quite
> useful. I prefer to read the mailing list over NNTP through Thunderbird
> -- if I have to decide between receiving every mailing list message via
> email, or not sending messages to the list, I'll probably decide to not
> send anything to the list at all.

That shouldn't be difficult. You should be able to subscribe, and then
go to the Mailman page and change your delivery options.

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

"""
Mail delivery

Set this option to Enabled to receive messages posted to this mailing
list. Set it to Disabled if you want to stay subscribed, but don't
want mail delivered to you for a while (e.g. you're going on
vacation). If you disable mail delivery, don't forget to re-enable it
when you come back; it will not be automatically re-enabled.
"""

It talks about temporarily disabling delivery, but it works fine for
permanent blocking, too. I run a Mailman list for the committee of a
non-profit organization, and several of the members are subscribed
under multiple addresses, with all but one of them in nomail mode; it
lets them post from any of their accounts, without moderation delay,
but not get spammed with all the copies.

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


Re: [OT] Java generics (was: Guido sees the light: PEP 8 updated)

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 8:02 AM, Tim Delaney
 wrote:
> I also wouldn't describe Java as a
> "perfectly good language" - it is at best a compromise language that just
> happened to be heavily promoted and accepted at the right time.
>
> Python is *much* closer to my idea of a perfectly good language.

"Java" was originally four related, but separate, concepts: a source
language, a bytecode, a sandboxing system, and one other that I can't
now remember. The published bytecode was way ahead of its day, and
coupled with the sandbox, it made Java into the one obvious language
for web browser applets (until the rise of Flash, and then the
increase in power of JavaScript etc).

If the source language and bytecode+sandbox had been more
disconnected, and the latter more standardized, Java might have been a
hugely popular language because of one important role (web browser
applets) that can also be used elsewhere. Instead, it made a promise
of "write once, run everywhere" that didn't really hold up (the
Australian Taxation Office let you file corporate taxes either on
paper or using their Java application - and it didn't run on OS/2
Java) and lost a ton of potential marketshare. Imagine how the world
would be today, if languages like NetRexx had had a chance to shine -
completely different source code language, compiling to the same Java
bytecode.

Jython might have been the one most popular language for applet development...

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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Ethan Furman

On 04/17/2016 03:08 PM, Matt Ruffalo wrote:


That seems like a reasonable approach, though I think there *really*
needs to be an option along the lines of "subscribed to the list for the
purposes of moderation, but not receiving list messages via email".


I don't understand what you are saying.

If you are not receiving emails, how are you reading the list?  A news 
reader?


If you are subscribed for moderation, how does that help with the lag 
time when you do post?


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


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Matt Ruffalo
Hi-

That seems like a reasonable approach, though I think there *really*
needs to be an option along the lines of "subscribed to the list for the
purposes of moderation, but not receiving list messages via email". I
think I did this with the Git mailing list in the past, and it was quite
useful. I prefer to read the mailing list over NNTP through Thunderbird
-- if I have to decide between receiving every mailing list message via
email, or not sending messages to the list, I'll probably decide to not
send anything to the list at all.

This is one of the reasons I'm not very active on this mailing list;
it's hard to effectively participate in a conversation when I know it
might be several hours or half a day before my message appears, and a
discussion will likely have changed enough in that time that a late
message may not be very useful.

MMR...

On 2016-04-17 12:57, Tim Golden wrote:
> There's been a bit of chatter lately about the moderation on the
> Python List (and, indirectly, comp.lang.python). The list moderators
> have suspended a couple of posters for a while and we've been
> discussing a little our policy towards non-subscribed posts.
>
> First, a quick summary of the current settings of the list:
>
> * Any post from someone who's not subscribed to the list is held for
> moderation
>
> * Subscribers are also held for moderation until a moderator clears
> that flag (which we usually do on the first post, unless there's some
> doubt). This is basically to prevent canny spammers from signing up
> and then posting garbage.
>
> * There are a few other rules which will cause posts to be held for
> moderation: unduly large posts, certain odd headers, large-scale
> cross-posting, etc.
>
> * All attachments are stripped
>
> Exactly how held posts are handled is down to each moderator:
> generally, though, it's quite obvious as most spam is very blatant.
> Occasionally, of course, we have a post which borders on (or is
> clearly) objectionable, and we have to decide whether to reject it at
> source or to let it through and let the community deal.
>
> Our approach to non-subscribed posts has been to let them through if
> they're clearly genuine, ie non-spam. However, as has been pointed out
> recently, this can quite easily result in useful advice falling on
> deaf ears. The OP isn't subscribed to the list, may not be reading it
> via gmane/ggroups etc. and may simply expect people to cc them
> directly. The list subscribers have no way of knowing whether
> someone's subscribed or not, so they reply to the List. And, of
> course, some people object to cc-ing individuals as well as the List.
>
> Our new approach (from as soon as we set it up) will be to reject
> unsubscribed posts with a friendly message indicating how to
> subscribe. The only exception we expect to make is if we spot a
> regular subscriber who's come in on a different address for some
> reason (eg posting from a phone).
>
> The main effect, we hope, will be that people asking questions
> actually see the answers. Of course, as we've seen in the past, some
> people will be confounded by the way in which a mailing list works (ie
> that they see all the chatter going through not just the answers to
> their question). But I don't see there's very much we can do about
> that except to help them to understand how it works.
>
> In general, please feel free to feed back to the list owners. Like
> everyone around here, we're all volunteers so we can't guarantee to
> respond in any particular timeframe, but we'll try.
>
> TJG

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


[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham

Hrvoje Abraham added the comment:

Sage:
http://doc.sagemath.org/html/en/reference/rings_numerical/sage/rings/complex_number.html

>>> log(ComplexNumber(NaN,1))
NaN - NaN*I

--

___
Python tracker 

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



[issue25987] collections.abc.Reversible

2016-04-17 Thread Guido van Rossum

Guido van Rossum added the comment:

Because it's a change to collections.abc, it goes in 3.6 only.

--

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham

Hrvoje Abraham added the comment:

Regarding NaN sign bit, IEEE-754 states:

"Note, however, that operations on bit strings—copy, negate, abs, 
copySign—specify the sign bit of a NaN result, sometimes based upon the sign 
bit of a NaN operand. The logical predicate totalOrder is also affected by the 
sign bit of a NaN operand."

So NaN sign bit information is used in the standard itself (section 5.10.d):

1) totalOrder(−NaN, y) is true where −NaN represents a NaN with negative sign 
bit and y is a
   floating-point number.
2) totalOrder(x, +NaN) is true where +NaN represents a NaN with positive sign 
bit and x is a
   floating-point number.

This fact alone implies the importance of its round-trip safety. I believe the 
quote you picked states this information doesn't have universal (standardized) 
meaning, not it is not important or used at all. It is reasonable to assume 
some will need to preserve it.

There are also some real-life usages, similar as signed zero, in determining 
the correct complex plane branch cut:
http://stackoverflow.com/questions/8781072/sign-check-for-nan-value
http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/catan.3M.html
catan(inf + iNAN) => π/2 + i0; catan(inf - iNAN) => π/2 - i0;

MSVC 2015 and MinGW-W64 v4.9.2 output (source below) for '-nan' values are:

MSVC:  -nan(ind)
MinGW-W64: -1.#IND00


#include 

int main()
{
double x = 0.0;
x = - x / x;
printf("%lf\n", x);

return 0;
}

--

___
Python tracker 

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



Re: How much sanity checking is required for function inputs?

2016-04-17 Thread Michael Selik
On Sun, Apr 17, 2016, 4:35 PM Christopher Reimer <
christopher_rei...@icloud.com> wrote:

> Greetings,
>
> I'm currently building a chess engine to learn the finer details of
> Python. When I learned all flavors of Java in community college a decade
> ago, we had to sanity check the hell out of the input values for every
> function and wrote a lot of redundant code in addition to the
> getters/setters code.
>
> Here's the input sanity checking I got for a generator function to
> return a set of chess pieces for a specified color and position.
>
>
> def generate_set(color, positions):
>
>  if color not in [VARS['COLOR_BLACK'], VARS['COLOR_WHITE']]:
>  raise Exception("Require \'{}\' or \'{}\' for input value, got
> \'{}\' instead.".format(VARS['COLOR_BLACK'], VARS['COLOR_WHITE'], color))
>
>  if len(positions) != 16:
>  raise Exception("Require 16 positions for input value, got {}
> instead.".format(len(positions)))
>
>
> The two sanity checks are fairly straight forward. Color input has to
> match the color constant strings. Positions input has to have 16 items.
>
> I *could* sanity check the positions input to determine if it had a list
> of 16 valid coordinates. The reason I don't is because the code that
> calls this function builds the coordinates from constants with valid
> coordinates. However, if I was doing this in my Java classes, one of my
> instructors rap me on the knuckles for not sanity checking to nth degree.
>
> How much sanity checking is too much in Python?
>

I'd rather turn the question around: how much sanity checking is necessary
or useful? You'll find the answer is "surprisingly little" compared to your
experience in Java. For example, you don't need to explicitly check whether
the color is present in your dictionary, because it'll give you a KeyError
if you look up a bad key.

Why does the len of positions need to be 16?

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


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Ben Finney
Marko Rauhamaa  writes:

> Chris Angelico :
>
> > What more often happens is that, once the function exceeds the
> > stipulated maximum, it gets split somewhat arbitrarily into a
> > "master" function and several "part" functions, with each part
> > having exactly one call site in the driver and exactly none
> > elsewhere. Even if the partial functions have reasonable names
> > (which they don't always), they're still tightly bound to the
> > master, and end up still functioning as a single unit.
>
> And? That's a feature, not a bug. It makes you analyze your approach a
> bit more. It makes you give names to things. It makes it more likely
> that your solution really works.

Yes. It also counters the tendency to let distant areas of code in a
function become too tightly dependent.

By identifying large functions with inherent “do this then do that then
do the other then …” structure as a problem in itself, the writer must
split it into small functions and think *explicitly* about how those
parts interact.

The interface between those parts is already part of the code design,
and if they're tightly coupled in a way difficult to describe simply, it
is a *bad* design already. A large function just obscures that, it
doesn't make it better.

Encouraging the split of large functions into small ones makes that
design explicit, and exposes places wehre the coupling is too complex or
too tight. The code writer is then explicitly and routinely thinking
about how best to narrow the coupling between the parts.

> > Unless you can genuinely make that subfunction useful in some other
> > context, there's not a lot of use splitting it into a function. You
> > don't generally see those perfect "paragraphs" in real-world code.

The point of splitting functions is not re-use (though that is a useful
side effect when it happens). The point is, in the face of trends that
are all toward code becoming difficult to understand and tangled, to
make the design as clear and simple and obviously correct as feasible.

-- 
 \ “Welchen Teil von ‘Gestalt’ verstehen Sie nicht?  [What part of |
  `\‘gestalt’ don't you understand?]” —Karsten M. Self |
_o__)  |
Ben Finney

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


[OT] Java generics (was: Guido sees the light: PEP 8 updated)

2016-04-17 Thread Tim Delaney
On 17 April 2016 at 23:38, Ian Kelly  wrote:


> > Java generics ruined a perfectly good language. I mean:
>
> The diamond operator in JDK 7 makes this a lot more tolerable, IMO:
>
> Map customersOfAccountManager =
> new HashMap<>();
>

To some extent - you can't use the diamond operator when creating an
anonymous subclass, and you often need to explicitly specify the types for
generic methods. The inference engine is fairly limited.

I wouldn't say generics ruined Java - they made it better in some ways (for
a primarily statically-typed language) but worse in others (esp. that
they're implemented by erasure). I also wouldn't describe Java as a
"perfectly good language" - it is at best a compromise language that just
happened to be heavily promoted and accepted at the right time.

Python is *much* closer to my idea of a perfectly good language.

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


[issue25386] msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch

2016-04-17 Thread Josh Snider

Josh Snider added the comment:

Here's a patch that raises an exception when _put[w]ch and _get[w]ch[e] are run 
without a console. Like Eryk Sun says, the get's work fine if you do unget 
before hand.

--
keywords: +patch
nosy: +Josh Snider
Added file: http://bugs.python.org/file42501/issue25386.patch

___
Python tracker 

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



Re: Dynamic inputs

2016-04-17 Thread Michael Selik
On Sun, Apr 17, 2016, 7:01 AM durgadevi1 <
srirajarajeswaridevikr...@gmail.com> wrote:

> On Saturday, April 16, 2016 at 5:31:39 PM UTC+8, Michael Selik wrote:
> > On Sat, Apr 16, 2016, 9:41 AM durgadevi1 <
> > srirajarajeswaridevikr...@gmail.com> wrote:
> >
> > > what does dynamic inputs mean and how is it implemented in python
> > > programming?
> > >
> >
> > In what context did you hear or read the phrase "dynamic inputs"?
> >
> > >
>
> Oh I read it in my assignment manual. The sentence is "Use dynamic inputs
> to  XOR the binary file. " Thanks for your replies :)
>

It seems the assignment wants you to ask a user for input. What input
source would you like to use?

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


[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham

Hrvoje Abraham added the comment:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit 
(AMD64)] on win32:

>>> import struct
>>> x=float("-nan")
>>> struct.pack('

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



[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson

Mark Dickinson added the comment:

Gah, sorry. I misdiagnosed the Python 2.7 issue (I was looking at the code for 
the wrong branch). See issue 22590 for the correct diagnosis.

--

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson

Mark Dickinson added the comment:

About the Python 2.7 behaviour:

>>> from math import copysign
>>> x = float("-nan")
>>> copysign(1.0, x)
1.0

I'd be interested to know what `struct.pack('

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



[issue26765] Factor out common bytes and bytearray implementation

2016-04-17 Thread Meador Inge

Meador Inge added the comment:

If I follow this correctly, then it seems like there are two
main pieces to this patch:

  1. Consolidating the following methods into `bytes_methods.c`:

 a. {bytes, bytearray}_find_internal

 b. {bytes, bytearray}_find

 c. {bytes, bytearray}_count

 d. {bytes, bytearray}_index

 e. {bytes, bytearray}_rfind

 f. {bytes, bytearray}_rindex

 g. {bytes, bytearray}_contains

 h. (_bytes, _bytearray}_tailmatch

 i. {bytes, bytearray}_startswith

 j. {bytes, bytearray}_endswith

  2. Consolidating the redundant implementations of the following functions
 into the stringlib:

 a. return_self

 b. countchar

 c. replace_interleave

 d. replace_delete_single_character

 e. replace_delete_substring

 f. replace_single_character_in_place

 g. replace_substring_in_place

 h. replace_single_character

 i. replace_substring

 j. replace

If so, then that seems reasonable to me and a nice cleanup.

A few comments:

  1. The diffs are fairly large.  It might be easier to follow if you stage
 the two steps above as separate commits (if possible).

  2. Why are some of the namings in stringlib inconsistent?  For example,
 `stringlib_method_find` and `stringlib_index`.  In other words, why
 do some names have the *_method_* part?

--
nosy: +meador.inge
stage:  -> patch review

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson

Mark Dickinson added the comment:

> it is actually used in real-life situations

Do you have any examples available?

--

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson

Mark Dickinson added the comment:

The current behaviour is deliberate, so any change would be an enhancement 
rather than a bugfix. I'm modifying the versions accordingly.

Unlike the sign of a zero, the sign of a NaN has no useful meaning: IEEE 754 
explicitly says "this standard does not interpret the sign of a NaN". Yes, that 
sign is copied by copysign, but I don't think that in itself means that the 
sign should be included in the repr, and I'm not aware of any applications 
where the sign matters in that context.

A NaN also has 51 payload bits (or 52 if you're not distinguishing between 
quiet and signalling NaNs), but like the sign, those bits are rarely important 
in applications.

I'm not really seeing a case for representing either the sign or the payload 
bits in the repr. Do you know of any applications that make use of the sign of 
a NaN?

--
versions:  -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Michael Torrie
On 04/17/2016 10:13 AM, Dennis Lee Bieber wrote:
> On Sat, 16 Apr 2016 21:59:01 -0400, Random832 
> declaimed the following:
> 
>>
>> I heard Windows 10 is going to finally fix this, anyway.
> 
>   Probably by removing the old CLI window completely and making everyone
> learn PowerShell ISE

Or a Linux ELF bash binary running on the new Linux subsystem for
Windows. :)



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


[issue26733] staticmethod and classmethod are ignored when disassemble class

2016-04-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

Nick, do you consider this as a new feature, or as a fix?

--

___
Python tracker 

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



How much sanity checking is required for function inputs?

2016-04-17 Thread Christopher Reimer

Greetings,

I'm currently building a chess engine to learn the finer details of 
Python. When I learned all flavors of Java in community college a decade 
ago, we had to sanity check the hell out of the input values for every 
function and wrote a lot of redundant code in addition to the 
getters/setters code.


Here's the input sanity checking I got for a generator function to 
return a set of chess pieces for a specified color and position.



def generate_set(color, positions):

if color not in [VARS['COLOR_BLACK'], VARS['COLOR_WHITE']]:
raise Exception("Require \'{}\' or \'{}\' for input value, got 
\'{}\' instead.".format(VARS['COLOR_BLACK'], VARS['COLOR_WHITE'], color))


if len(positions) != 16:
raise Exception("Require 16 positions for input value, got {} 
instead.".format(len(positions)))



The two sanity checks are fairly straight forward. Color input has to 
match the color constant strings. Positions input has to have 16 items.


I *could* sanity check the positions input to determine if it had a list 
of 16 valid coordinates. The reason I don't is because the code that 
calls this function builds the coordinates from constants with valid 
coordinates. However, if I was doing this in my Java classes, one of my 
instructors rap me on the knuckles for not sanity checking to nth degree.


How much sanity checking is too much in Python?

Thank you,

Chris R


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


[issue26642] Replace stdout and stderr with simple standard printers at Python exit

2016-04-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I meant that C files stderr and stdout can be closed. Or it's file descriptors 
can be closed. I think in these cases fileno() or PyFile_NewStdPrinter() will 
fail.

I'm trying to consider all possible cases. Standard streams can be:

* Left original.
* Set to None.
* Reopened with different encoding/errors/etc.
* Redirected to a file (/dev/null).
* Redirected to a socket.
* Redirected to inherited file descriptor (pipe) in a subprocess.
* Be a high level wrapper around RPC (IDLE subprocess).

If the stream was reopened with the same file descriptor and closefd=True, 
closing it invalidates just opened "standard printer".

I would replace stdout and stderr after PyImport_Cleanup(). But 
PyImport_Cleanup() cleans up the sys module! Thus we should do this inside 
PyImport_Cleanup().

--

___
Python tracker 

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



Re: read datas from sensors and plotting

2016-04-17 Thread ranran



Check out plotly

https://plot.ly/python/


nice!
but it's no completely free...for example I should plot 4 chart of 
temperatures in the same time. I think I can plot only 1 chart.
Anyway I need to be connected to internet instead sometimes I want to 
show it only in my webserver.

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


Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread eryk sun
On Sun, Apr 17, 2016 at 11:13 AM, Dennis Lee Bieber
 wrote:
> On Sat, 16 Apr 2016 21:59:01 -0400, Random832 
> declaimed the following:
>>
>>I heard Windows 10 is going to finally fix this, anyway.
>
> Probably by removing the old CLI window completely and making everyone
> learn PowerShell ISE

PowerShell ISE doesn't support interactive console applications. It
runs console apps with a hidden console (conhost.exe) and sets the
StandardOutput and StandardError to pipes. It leaves StandardInput set
to the console input handle. If you run python.exe in this
environment, you can use ctypes to show the console. Then enter
commands in the console, and get the output in ISE. Or rebind
sys.stdout and sys.stderr to \\.\CONOUT$ handles and forget about ISE,
which is really only meant for developing PowerShell scripts.

Microsoft won't abandon existing console programs, such as python.exe.
The console system was fairly stagnant between NT 4 and Vista. In
Windows 7, they changed how it interacts with a Windows session, by
moving the server out of csrss.exe to multiple conhost.exe instances.
In Windows 8, they reimplemented the API to use a kernel device
driver, condrv.sys. For Windows 10, they've focused on improving the
user interface:

https://blogs.windows.com/buildingapps/2014/10/07/
  console-improvements-in-the-windows-10-technical-preview

There's a new blog dedicated to Windows command-line tools, which
should be the place to look for announcements about the console
subsystem and the new Linux command-line environment that depends on
the console:

https://blogs.msdn.microsoft.com/commandline
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26788] test_gdb fails all tests on a profile-opt build configured --with-lto

2016-04-17 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I will investigate this issue to understand what is happening there and submit 
a fix. Thank you for pointing out the exact OS and toolchain used.

--

___
Python tracker 

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



Re:

2016-04-17 Thread eryk sun
On Sun, Apr 17, 2016 at 2:27 AM, B N  wrote:
> I found that when the “black” screen comes on, I am unable to read/see
> any characters even if I turn up the brightness of the screen.

Do you mean the console, i.e. the window used by the command prompt
(cmd.exe)? For a novice, you'll probably be better off using Python
IDLE. It should be in the start menu under "Python 3.5". Or just type
"idle" to search for it.

If you want to continue using the console, you can modify the default
text and background colors for the current application. Click on the
system menu in the upper left-hand corner of the window and choose
"Properties". On the "Colors" tab change the color of the screen text
and background. On the "Font" tab I recommend selecting a TrueType
font such as Consolas.

To change the default settings, select "Defaults" instead of
"Properties". You can also modify per-shortcut settings by
right-clicking a shortcut and selecting "Properties". The console
applies saved settings starting with the defaults, then the
application settings, and then the shortcut settings.

cmd also has a built-in "color" command to modify the text and
background colors in a command prompt. Enter "color /?" to get a list
of the 16 supported colors, which are numbered 0-F. For example,
"color 0F" uses bright white (F) text on a black (0) background.

> Also I have not ben ale to save it on C/programmes/files

You shouldn't be saving files to system directories. Save your scripts
in your personal folder.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Tim Golden

On 17/04/2016 18:21, Wildman via Python-list wrote:

On Sun, 17 Apr 2016 17:57:51 +0100, Tim Golden wrote:


[... snip my explanation of new moderation for non-subscribers ...]


How will this change affect posts to comp.lang.python?



Not at all, in the sense that the moderation doesn't apply to 
comp.lang.python, except insofar as posts which are sent to the list and 
which we reject obviously won't make it to comp.lang.python either.


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


[issue26787] test_distutils fails when configured --with-lto

2016-04-17 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I will investigate this and submit a fix. At a first glance, it seems the test 
is failing because it does not have the knowledge of the LTO flags.

--

___
Python tracker 

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



Re: Falsehoods People Believe about PEP 8 (was: Guido sees the light: PEP 8 updated)

2016-04-17 Thread Chris Angelico
On Sun, Apr 17, 2016 at 6:21 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> Maybe we need a blog post "Falsehoods Programmers Believe About PEP
>> 8", along the lines of the ones about time and names.
>
> Great suggestion. (Do you have a blog on which you could post an article
> like this?)

An initial list has been posted here:

http://rosuav.blogspot.com/2016/04/falsehoods-programmers-believe-about.html

Additional contributions are still welcome.

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


[issue26720] memoryview from BufferedWriter becomes garbage

2016-04-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python implementation passes bytearray to underlying write and delete it's 
content just after that. Thus saving written data was never worked, and making 
it working don't worth efforts. I agree with you, we should add a warning 
against saving. This might be a part of issue20699.

As for original issue, this is potential crash, and we should fix this.

--

___
Python tracker 

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



Re: error with tkinter, help

2016-04-17 Thread Chris Angelico
On Mon, Apr 18, 2016 at 3:17 AM, BlueRidiculous
 wrote:
>> How did you install Python?  The Windows PSF installer from python.org
>> will create this directory unless you uncheck the box to include tcl/tk.
>>
>> --
>> Terry Jan Reedy
>
> What is a PSF installer? Anyway, I installed the "Windows x86 MSI installer" 
> from https://www.python.org/downloads/release/python-344/ Is that correct?

Yep, that answers the question! Thanks. For the TLDR version, skip to
the next email now. If you're curious, this is what Terry meant by
"PSF installer".

Python is available from a number of places. The most simple and
straight-forward installers come direct from the Python Software
Foundation, and are downloaded from python.org, which is what you've
done. You can also get prepackaged distributions from Enthought,
ActiveState, Anaconda, and other redistributors. They may charge money
for what they give you (this is legal, even with free software like
the Python interpreter), and they can promise things that the PSF
doesn't, such as support for old/obscure operating systems, guaranteed
response times on support requests, or pre-included (and
compatibility-guaranteed) third-party libraries.

What's significant here is that your problem is with the *installer*,
not with the language itself. When an organization repackages Python
in some way, they may replace the installer with something that puts
things in different places, or has different default options. It's not
very helpful for us to say "Rerun the installer, go to this point, and
tick this box" if you're actually using (say) Anaconda's installer and
it all looks different! So Terry was basically clarifying that he was
talking about the vanilla installer that you can get off python.org,
as opposed to any of the others.

Hope that helps!

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


[issue26627] IDLE incorrectly labeling error as internal

2016-04-17 Thread ppperry

ppperry added the comment:

Duplicate issue24252, although the consequences are slightly different.

--
nosy: +ppperry

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Tim Chase
On 2016-04-17 16:35, Coos Haak wrote:
> Op Sat, 16 Apr 2016 20:30:52 -0500 schreef Tim Chase:
> >> Try `mode con cols=120 lines=30`.
> > 
> > Yeah, that will do it, as will going into the settings and
> > changing it. But basically every other program on Windows, and
> > every console on Linux/BSD/Mac will let me resize a terminal
> > running while another program is running.  For a cmd.exe window,
> > I have to quit, issue the `mode` command, restart my application,
> > and return to where I was.
> 
> No need to close. Right-click on statusbar and set properties.

By "close", I meant "close the application running within the cmd.exe
window" rather than "close the cmd.exe window".

In most *nix programs, they understand the SIGWINCH (window-size
changed) signal and respond accordingly.  In the Win32 world, it was
pretty fixed in size, so most terminal programs don't readily
accommodate changed size while they're running.  So as Eryk Sun
mentions, the program has to jump through hoops to run "mode" in a
subprocess to change the terminal size, or use
GetConsoleScreenBufferInfoEx/SetConsoleScreenBufferInfoEx or other
such mechanisms.

It's not that it *can't* be done, it's just done in an *inconvenient*
way (if done at all).

-tkc



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


[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2016-04-17 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

> @mbussonn - I don't see an updated non-tty-checking patch from you?

Sorry for the delay, trying to get back on this. 

Please find attached a new patch that does not check whether is is a tty.
Still struggling a bit with HG (looking fwd to migration to GH)

--
Added file: 
http://bugs.python.org/file42500/enable_deprecation_warnings_in_repl_no_check_tty.patch

___
Python tracker 

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



RE: read datas from sensors and plotting

2016-04-17 Thread Albert-Jan Roskam


> From: ran...@nospam.it
> Subject: read datas from sensors and plotting
> Date: Sun, 17 Apr 2016 18:46:25 +0200
> To: python-list@python.org
> 
> I'm reading in python some values from some sensors and I write them in 
> a csv file.
> My problem now is to use this datas to plot a realtime graph for a 
> example in a web server.
> Is it possible to read in the same time the values, writing in the file 
> and plot them in a webpage with python?


tail -F data.log | python myprogram.py
http://stackoverflow.com/questions/1712276/tail-read-a-growing-dynamic-file-and-extract-two-columns-and-then-print-a-graphhttp://code.activestate.com/recipes/577968-log-watcher-tail-f-log/
  
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Issue26767 looks too complex and resolving it needs much more rewriting.

--
resolution: remind -> fixed
status: open -> closed

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e5149789e4ea by Serhiy Storchaka in branch 'default':
Issue #26745: Removed redundant code in _PyObject_GenericSetAttrWithDict.
https://hg.python.org/cpython/rev/e5149789e4ea

--
nosy: +python-dev

___
Python tracker 

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



[issue26773] Shelve works inconsistently when carried over to child processes

2016-04-17 Thread Paul Ellenbogen

Paul Ellenbogen added the comment:

I think this behavior is due to the underlying behavior of the dbm. The same 
code using dbm, rather than shelve, also throws KeyErrors:

from multiprocessing import Process
import dbm

db = dbm.open("example.dbm", "c")
for i in range(100):
db[str(i)] = str(i ** 2)


def parallel():
for i in range(100):
print(db[str(i)])

a = Process(target = parallel)
b = Process(target = parallel)
a.start()
b.start()
a.join()
b.join()

--

___
Python tracker 

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



[issue26767] Inconsistant error messages for failed attribute modification

2016-04-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
priority: normal -> low

___
Python tracker 

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



Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Wildman via Python-list
On Sun, 17 Apr 2016 17:57:51 +0100, Tim Golden wrote:

> There's been a bit of chatter lately about the moderation on the Python 
> List (and, indirectly, comp.lang.python). The list moderators have 
> suspended a couple of posters for a while and we've been discussing a 
> little our policy towards non-subscribed posts.
> 
> First, a quick summary of the current settings of the list:
> 
> * Any post from someone who's not subscribed to the list is held for 
> moderation
> 
> * Subscribers are also held for moderation until a moderator clears that 
> flag (which we usually do on the first post, unless there's some doubt). 
> This is basically to prevent canny spammers from signing up and then 
> posting garbage.
> 
> * There are a few other rules which will cause posts to be held for 
> moderation: unduly large posts, certain odd headers, large-scale 
> cross-posting, etc.
> 
> * All attachments are stripped
> 
> Exactly how held posts are handled is down to each moderator: generally, 
> though, it's quite obvious as most spam is very blatant. Occasionally, 
> of course, we have a post which borders on (or is clearly) 
> objectionable, and we have to decide whether to reject it at source or 
> to let it through and let the community deal.
> 
> Our approach to non-subscribed posts has been to let them through if 
> they're clearly genuine, ie non-spam. However, as has been pointed out 
> recently, this can quite easily result in useful advice falling on deaf 
> ears. The OP isn't subscribed to the list, may not be reading it via 
> gmane/ggroups etc. and may simply expect people to cc them directly. The 
> list subscribers have no way of knowing whether someone's subscribed or 
> not, so they reply to the List. And, of course, some people object to 
> cc-ing individuals as well as the List.
> 
> Our new approach (from as soon as we set it up) will be to reject 
> unsubscribed posts with a friendly message indicating how to subscribe. 
> The only exception we expect to make is if we spot a regular subscriber 
> who's come in on a different address for some reason (eg posting from a 
> phone).
> 
> The main effect, we hope, will be that people asking questions actually 
> see the answers. Of course, as we've seen in the past, some people will 
> be confounded by the way in which a mailing list works (ie that they see 
> all the chatter going through not just the answers to their question). 
> But I don't see there's very much we can do about that except to help 
> them to understand how it works.
> 
> In general, please feel free to feed back to the list owners. Like 
> everyone around here, we're all volunteers so we can't guarantee to 
> respond in any particular timeframe, but we'll try.
> 
> TJG

How will this change affect posts to comp.lang.python?

-- 
 GNU/Linux user #557453
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: error with tkinter, help

2016-04-17 Thread BlueRidiculous
On Sunday, April 17, 2016 at 10:18:09 AM UTC-7, BlueRidiculous wrote:
> On Saturday, April 16, 2016 at 9:30:39 PM UTC-7, Terry Reedy wrote:
> > On 4/16/2016 9:31 PM, blueridicul...@gmail.com wrote:
> > > So I was reading https://wiki.python.org/moin/TkInter for help.
> >  > I got to step 3 under "Checking your Tkinter support."
> >  > Nothing happens when I do steps 1 or 2, and when I do step 3,
> >  > I get this error:
> > >
> > > Traceback (most recent call last):
> > >   File "", line 301, in runcode
> > >   File "", line 1, in 
> > >   File "C:\Python34\lib\tkinter\__init__.py", line 3882, in _test
> > > root = Tk()
> > >   File "C:\Python34\lib\tkinter\__init__.py", line 1856, in __init__
> > > self.tk = _tkinter.create(screenName, baseName, className, 
> > > interactive, wantobjects, useTk, sync, use)
> > > _tkinter.TclError: Can't find a usable init.tcl in the following 
> > > directories:
> > > C:/Python34/lib/tcl8.6 C:/lib/tcl8.6 C:/lib/tcl8.6 C:/library 
> > > C:/library C:/tcl8.6.1/library C:/tcl8.6.1/library
> > >
> > > This probably means that Tcl wasn't installed properly.
> > > "
> > 
> > The directory list is obsolete.  You should have C:/Python34/tcl
> > How did you install Python?  The Windows PSF installer from python.org 
> > will create this directory unless you uncheck the box to include tcl/tk.
> > 
> > -- 
> > Terry Jan Reedy
> 
> What is a PSF installer? Anyway, I installed the "Windows x86 MSI installer" 
> from https://www.python.org/downloads/release/python-344/ Is that correct?

Actually nevermind, I uninstalled and reinstalled Python and it works now. I 
remember I uninstalled and reinstalled before, and it worked, then stopped 
working, so I'm not sure how permanent this fix will be. Stay tuned for 
updates. Thanks again.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: error with tkinter, help

2016-04-17 Thread BlueRidiculous
On Saturday, April 16, 2016 at 9:30:39 PM UTC-7, Terry Reedy wrote:
> On 4/16/2016 9:31 PM, blueridicul...@gmail.com wrote:
> > So I was reading https://wiki.python.org/moin/TkInter for help.
>  > I got to step 3 under "Checking your Tkinter support."
>  > Nothing happens when I do steps 1 or 2, and when I do step 3,
>  > I get this error:
> >
> > Traceback (most recent call last):
> >   File "", line 301, in runcode
> >   File "", line 1, in 
> >   File "C:\Python34\lib\tkinter\__init__.py", line 3882, in _test
> > root = Tk()
> >   File "C:\Python34\lib\tkinter\__init__.py", line 1856, in __init__
> > self.tk = _tkinter.create(screenName, baseName, className, interactive, 
> > wantobjects, useTk, sync, use)
> > _tkinter.TclError: Can't find a usable init.tcl in the following 
> > directories:
> > C:/Python34/lib/tcl8.6 C:/lib/tcl8.6 C:/lib/tcl8.6 C:/library 
> > C:/library C:/tcl8.6.1/library C:/tcl8.6.1/library
> >
> > This probably means that Tcl wasn't installed properly.
> > "
> 
> The directory list is obsolete.  You should have C:/Python34/tcl
> How did you install Python?  The Windows PSF installer from python.org 
> will create this directory unless you uncheck the box to include tcl/tk.
> 
> -- 
> Terry Jan Reedy

What is a PSF installer? Anyway, I installed the "Windows x86 MSI installer" 
from https://www.python.org/downloads/release/python-344/ Is that correct?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to setup for localhost:8000

2016-04-17 Thread Pierre Quentel

> > 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
>  Hi Pierre,
> 
> When I type http://localhost:8000, I did not see anything in the console 
> after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran 
> was not correct as shown below:
> > python -m http.server 
> Serving HTTP on 0.0.0.0 port 8000 ...
> 
> Also if I use internet Explorer, it shows HTTP 404 errors.
> Do you think the way I am doing of the localhost:8000 setting was not correct?
> 
> Thanks,
> Wen-Ruey

If you're not seeing anything there, it is sure that the Python server doesn't 
serve requests on port 8000. But if you're seeing a blank screen or a 404 error 
instead of a message saying that a connection couldn't be set up, it is likely 
that another HTTP server is running on your machine on port 8000.

Could you try to start the server on another port, eg "python -m http.server 
8085" and see what happens in the browser with "http://127.0.0.1:8085; ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: read datas from sensors and plotting

2016-04-17 Thread Joel Goldstick
On Sun, Apr 17, 2016 at 1:00 PM, Larry Martell  wrote:
> On Sunday, April 17, 2016, ranran  wrote:
>
>> I'm reading in python some values from some sensors and I write them in a
>> csv file.
>> My problem now is to use this datas to plot a realtime graph for a example
>> in a web server.
>> Is it possible to read in the same time the values, writing in the file
>> and plot them in a webpage with python?
>>
>
> Check out plotly
>
> https://plot.ly/python/
> --
> https://mail.python.org/mailman/listinfo/python-list


Matplotlib and pygals are two others.

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


[issue26789] Please do not log during shutdown

2016-04-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +vinay.sajip

___
Python tracker 

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



Re: read datas from sensors and plotting

2016-04-17 Thread Larry Martell
On Sunday, April 17, 2016, ranran  wrote:

> I'm reading in python some values from some sensors and I write them in a
> csv file.
> My problem now is to use this datas to plot a realtime graph for a example
> in a web server.
> Is it possible to read in the same time the values, writing in the file
> and plot them in a webpage with python?
>

Check out plotly

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


[issue26791] shutil.move fails to move symlink (Invalid cross-device link)

2016-04-17 Thread Renato Alves

Renato Alves added the comment:

Also related to http://bugs.python.org/issue212317

--

___
Python tracker 

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



Moderation and slight change of (de facto) policy

2016-04-17 Thread Tim Golden
There's been a bit of chatter lately about the moderation on the Python 
List (and, indirectly, comp.lang.python). The list moderators have 
suspended a couple of posters for a while and we've been discussing a 
little our policy towards non-subscribed posts.


First, a quick summary of the current settings of the list:

* Any post from someone who's not subscribed to the list is held for 
moderation


* Subscribers are also held for moderation until a moderator clears that 
flag (which we usually do on the first post, unless there's some doubt). 
This is basically to prevent canny spammers from signing up and then 
posting garbage.


* There are a few other rules which will cause posts to be held for 
moderation: unduly large posts, certain odd headers, large-scale 
cross-posting, etc.


* All attachments are stripped

Exactly how held posts are handled is down to each moderator: generally, 
though, it's quite obvious as most spam is very blatant. Occasionally, 
of course, we have a post which borders on (or is clearly) 
objectionable, and we have to decide whether to reject it at source or 
to let it through and let the community deal.


Our approach to non-subscribed posts has been to let them through if 
they're clearly genuine, ie non-spam. However, as has been pointed out 
recently, this can quite easily result in useful advice falling on deaf 
ears. The OP isn't subscribed to the list, may not be reading it via 
gmane/ggroups etc. and may simply expect people to cc them directly. The 
list subscribers have no way of knowing whether someone's subscribed or 
not, so they reply to the List. And, of course, some people object to 
cc-ing individuals as well as the List.


Our new approach (from as soon as we set it up) will be to reject 
unsubscribed posts with a friendly message indicating how to subscribe. 
The only exception we expect to make is if we spot a regular subscriber 
who's come in on a different address for some reason (eg posting from a 
phone).


The main effect, we hope, will be that people asking questions actually 
see the answers. Of course, as we've seen in the past, some people will 
be confounded by the way in which a mailing list works (ie that they see 
all the chatter going through not just the answers to their question). 
But I don't see there's very much we can do about that except to help 
them to understand how it works.


In general, please feel free to feed back to the list owners. Like 
everyone around here, we're all volunteers so we can't guarantee to 
respond in any particular timeframe, but we'll try.


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


[issue26791] shutil.move fails to move symlink (Invalid cross-device link)

2016-04-17 Thread Renato Alves

Changes by Renato Alves :


--
versions: +Python 2.7, Python 3.5

___
Python tracker 

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



[issue26791] shutil.move fails to move symlink (Invalid cross-device link)

2016-04-17 Thread Renato Alves

New submission from Renato Alves:

Hi everyone,

I'm not really sure if this is a new issue but digging through the bug reports 
from the past I couldn't find an answer.
There's http://bugs.python.org/issue1438480 but this seems to be a different 
issue.
I also found http://bugs.python.org/issue9993 that addressed problems with 
symlinks but didn't correct the behavior reported here.

The problem can be visualized with the following code.
Code fails on python 2.7 as well as python 3.4+. Not tested in python <2.7 and 
<3.4.


import shutil
import os

TMPDIR = "/tmp/tmpdir"
TESTLINK = "test_dir"

if not os.path.isdir(TMPDIR):
os.mkdir(TMPDIR)

if not os.path.islink(TESTLINK):
os.symlink(TMPDIR, TESTLINK)

shutil.move(TESTLINK, TMPDIR)


When executed it gives me:

% python3 test.py
Traceback (most recent call last):
  File "test.py", line 14, in 
shutil.move(TESTLINK, TMPDIR)
  File "/usr/lib64/python3.4/shutil.py", line 516, in move
os.rename(src, dst)
OSError: [Errno 18] Invalid cross-device link: 'test_dir' -> '/tmp/tmpdir'


This happens because /tmp is:

  tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,nodiratime)


In the past the recommendation to handle this problem was to stop using 
os.rename and use shutil.move instead.
This was even discussed in a bug report - http://bugs.python.org/issue14848

If one searches for this exception there's plenty of advice [1][2][3][4] in the 
same direction.
However, given that shutil.move uses os.rename internally, the problem returns.

On the other end doing the equivalent action in the shell with 'mv' works fine.


[1] - http://stackoverflow.com/a/15300474
[2] - https://mail.python.org/pipermail/python-list/2005-February/342892.html
[3] - 
http://www.thecodingforums.com/threads/errno-18-invalid-cross-device-link-using-os-rename.341597/
[4] - https://github.com/pypa/pip/issues/103

--
components: Library (Lib)
messages: 263616
nosy: Unode
priority: normal
severity: normal
status: open
title: shutil.move fails to move symlink (Invalid cross-device link)
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



[issue26790] bdist_msi package duplicates everything to a bogus location when run with /passive or /q

2016-04-17 Thread SilentGhost

Changes by SilentGhost :


--
versions:  -Python 3.2, 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



read datas from sensors and plotting

2016-04-17 Thread ranran
I'm reading in python some values from some sensors and I write them in 
a csv file.
My problem now is to use this datas to plot a realtime graph for a 
example in a web server.
Is it possible to read in the same time the values, writing in the file 
and plot them in a webpage with python?

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


HTTPServer and SSL

2016-04-17 Thread Radek Holý
Hello,

some people recommend following implementation of a simple HTTP server
that supports SSL:


Handler = http.server.BaseHTTPRequestHandlerhttpd =
http.server.HTTPServer(("", 4443), Handler)
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()

I wonder whether this usage is *supported* or not. The documentation
is not explicit about whether the httpd.socket attribute can be safely
reassigned. Also there were some questions regarding a simple HTTPS
server on this list already and none of the answerers mentioned this
approach.

Also there used to be a HTTPSServer in the test suite of Python 2.7 in
2014 that did a similar thing but in the "get_request" method but it
isn't there anymore.

So, is there a *supported* way of combining http.server.HTTPServer and ssl?

Best regards
-- 

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


Re: how to setup for localhost:8000

2016-04-17 Thread Monte Milanuk

On 2016-04-16 15:35, wrh8...@gmail.com wrote:


When you type http://localhost:8000, do you see something in the
console after the line  "Serving HTTP on 0.0.0.0 port 8000 ..." ?

If the server actually serves requests on port 8000 you should see
a log message such as

127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -

Hi Pierre,

When I type http://localhost:8000, I did not see anything in the
console after the line "Serving HTTP on 0.0.0.0 port 8000 ... I
believe the way I ran was not correct as shown below:

python -m http.server

Serving HTTP on 0.0.0.0 port 8000 ...

Also if I use internet Explorer, it shows HTTP 404 errors. Do you
think the way I am doing of the localhost:8000 setting was not
correct?



Do you have any anti-virus programs running?  Its possible they may be 
interfering with letting your python installation open a server on the 
local host at all, or with letting your browser access it, if it is running.


What I get in the console looks like this:

Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

PS C:\Users\Monte Milanuk> python -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...

...and then once I open a browser window to 'localhost:8000', I get the 
following in the console:


127.0.0.1 - - [17/Apr/2016 09:21:49] "GET / HTTP/1.1" 200 -

Which is the python http.server telling you that it responded to a 
request from 127.0.0.1, completion code (200), etc.  If you're not 
seeing that, and you're instead getting 404 codes in the browswer 
window, something on your machine is blocking it from seeing the server.


You might try '127.0.0.1:8000' instead of 'localhost:8000' in the 
browser window, or you might try specifying different interface or port 
numbers for the server when you start it.  It *should* 'just work' as 
is, with the basic 'python -m http.server' command, but obviously it 
isn't, for whatever reason.


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


[issue26790] bdist_msi package duplicates everything to a bogus location when run with /passive or /q

2016-04-17 Thread Ivan Pozdeev

New submission from Ivan Pozdeev:

First, the background information so you understand what I am talking about.

bdist_msi-produced packages work in the following way:

The files to install are presented as at least 3 equivalent sets (implemented 
as Features): "Python" (for Python from registry), "PythonX" (for 
Python from a custom location) and a hidden but always selected "Python" - a 
"source" set.
Files in them are linked together with DuplicateFiles, with "real" files in the 
"Python" set.

"Python" has the installation target set to TARGETDIR that has the default 
value specified as "SourceDir" (practice shows it's initially set to the root 
of the drive where the .msi being installed is).
The other two have default locations set to subdirectories of TARGETDIR, but 
PYTHON is changed to the root of the installed Python early on (at 
AppSearch stage and custom actions just after it in both InstallUISequence and 
InstallExecuteSequence) if an installtion is detected.

Now, at SelectFeaturesDlg in InstallUISequence, TARGETDIR is changed to a 
location for one of the features selected for install (initially, 
"Python" is selected if an installation was found). Later, as a public 
property, it's passed to InstallExecuteSequence, acting as the new default 
value.

Finally, the files are installed to TARGETDIR and _duplicated_ to locations for 
all other features that have been selected. So, if only one feature was 
selected (the common scenario), TARGETDIR is equal to its location, so no 
duplication takes place. If nothing was selected, everything is unpacked to the 
directory where the .msi is, like `tar' does. (The latter is extremely weird 
for an .msi but is quite in line with the logic for other types of `bdist_' 
packages.)



Now, the problem is:
* the aforementioned TARGETDIR switch is implemented as an event handler in the 
SelectFeaturesDlg dialog.
* if I run with /passive or /q, InstallUISequence isn't done, the dialog isn't 
shown, and the event never happens.
* so TARGETDIR remains the default, and MSI installs everything to whatever 
that default happened to be, then duplicates to the correct location.



To fix this, we need to somehow duplicate the Python detection and TARGETDIR 
switch to InstallExecuteSequence, avoiding overwriting the results of earlier 
actions.

Current workaround is to pass "TARGETDIR=" to msiexec.

--
components: Distutils, Library (Lib), Windows
files: mercurial-3.7.3.log.gz
messages: 263615
nosy: Ivan.Pozdeev, dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: bdist_msi package duplicates everything to a bogus location when run 
with /passive or /q
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42499/mercurial-3.7.3.log.gz

___
Python tracker 

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



  1   2   >