Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread dieter
Mark Lawrence  writes:
> ...
> So I most humbly suggest, as I may have hinted at once or twice
> earlier in this thread, that people either put up or shut up.

In another of your contributions to this thread, you spoke of another
alternative: "do a bit of begging". That is what some of us are doing.

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


Re: How we can send mail with attachment in Python?

2015-07-20 Thread dieter
Kevin Peterson  writes:

> How we can send mail with attachment in Python? Is it any prerequisite for it?

You look at the "email" package to build the message
and the "smtplib" package to send the message -
both are part of Python's runtime library and documented in its
documentation.

Note that you need access to an "smtp" server (aka "mail server").
It ensures in cooperation with other "smtp" servers the distribution
of your email around the world. Access to an "smtp" server is a non-Python
issue.

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Devin Jeanpierre
I think you're missing the line where I said all the relevant
conversation happened in IRC, and that you should refer to logs.

On Sun, Jul 19, 2015 at 11:25 PM, Terry Reedy  wrote:
> On 7/19/2015 9:20 PM, Devin Jeanpierre wrote:
>
>> Search your logs for https://bugs.python.org/issue17094
>> http://bugs.python.org/issue5315
>>
>> I was most frustrated by the first case --
>
>> the patch was (informally) rejected
>
> By 'the patch', I presume you mean current-frames-cleanup.patch
> by Stefan Ring, who said it "is certainly not the most complete solution,
> but it solves my problem.". It was reviewed a month later by a core dev, who
> said it had two defects.  Do you expect us to apply defective patches?

No, I meant my patch. It was discussed in IRC, and I gave the search
term to grep for. (The issue URL.)

>> in favor of the "right" fix,
>
>
> "right" is your word. Natali simply uploaded an alternate patch that did not
> have the defects cited.  It went through 4 versions, two by Pitrou, before
> the commit and close 2 months later, with the comment "Hopefully there
> aren't any applications relying on the previous behaviour."

No, "right" is the word used by members of #python-dev, referrig to
Antoine's fix.

> Two years later, last May, you proposed and uploaded a patch with what looks
> to be a new and different approach.  It has been ignored.  In the absence of
> a core dev focused on 2.7, I expect that this will continue. Too bad you did
> not upload it in Feb 2013, before the review and fix started.

I'm not sure what you're implying here. It couldn't be helped.

>> and http://bugs.python.org/issue5315
>
> Another fairly obscure issue for most of us. Five years ago, this was turned
> into a doc issue, but no patch was ever submitted for either 2.x or 3.x.
> Again, no particular prejudice against 2.x.
>
> In May, you posted a bugfix which so far has been ignored.  Not too
> surprising.  I submitted a ping and updated the versions.  If anyone
> responds, you might be asked for a patch against 3.4 or 3.5.

Again, the prejudice was expressed in IRC. It was ignored because you
can just use asyncio in 3.x, and because the bug was old.

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


Re:New to python

2015-07-20 Thread Arthi Vigneshwari
Hi,
  Am interested to learn python!Can you please guide me how to start with
python which will help in my selenium automation?

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


Procedure for downloading and Installing Python 2.7 Modules

2015-07-20 Thread W. D. Allen

Would like to locate and install numpy, scipy and matplotlib
with Wing 101 for Python 2.7

Just beginning to use Python 2.7 for engineering work.

Any guidance would be appreciated.

Thanks,

WDA
balle...@gmail.com

end

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


Re: New to python

2015-07-20 Thread David Palao
2015-07-20 7:20 GMT+02:00 Arthi Vigneshwari :
> Hi,
>   Am interested to learn python!Can you please guide me how to start with
> python which will help in my selenium automation?
>
> Regards,
> Arthi
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Hi,
If you enter "learning python" in a search engine, you'll probably get
several interesting resources to start with it.
For instance, have you had a look at
https://www.python.org/about/gettingstarted/
?

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


Re: New to python

2015-07-20 Thread Arthi Vigneshwari
Hey David,
  Yeah,I had an overall look at
https://www.python.org/about/gettingstarted/! Let me dig deep into the
websites you shared me with!

Thanks,
Arthi

On Mon, Jul 20, 2015 at 1:19 PM, David Palao 
wrote:

> 2015-07-20 7:20 GMT+02:00 Arthi Vigneshwari :
> > Hi,
> >   Am interested to learn python!Can you please guide me how to start with
> > python which will help in my selenium automation?
> >
> > Regards,
> > Arthi
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
>
> Hi,
> If you enter "learning python" in a search engine, you'll probably get
> several interesting resources to start with it.
> For instance, have you had a look at
> https://www.python.org/about/gettingstarted/
> ?
>
> Best regards
>
-- 
https://mail.python.org/mailman/listinfo/python-list


File Upload in Restful Flask

2015-07-20 Thread subhabrata . banerji
Dear Group,

I am trying to learn Rest framework through Restful Flask. 
My initial exercises went fine with 
https://flask-restful.readthedocs.org/en/0.3.3/quickstart.html

Now I want to upload file through Restful Flask. I tried to check the web for 
reference. 
I got these urls, 
(i) 
http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
(ii) http://stackoverflow.com/questions/28982974/flask-restful-upload-image
(iii) http://blog.luisrei.com/articles/flaskrest.html

But the question I am stuck with what are the things I have to change in the 
example of quickstart tutorial so that I may be able to upload file. Or if any 
one may kindly suggest with a small example. 

If any one of the esteemed members may kindly suggest. 

Regards,
Subhabrata Banerjee. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Generating type annotations by tracing execution runs

2015-07-20 Thread Michael Williamson
Hello,

I've knocked together a quick proof-of-concept that allows type
annotations to be automatically added to Python source code by running
it:

https://github.com/mwilliamson/farthing

As the code, such as a test suite, runs, the types of arguments and
return values (for functions in the file/directory to be annotated) are
stored. After the code has finished, appropriate annotations are added.
(There's a tiny example in the README.rst in case that makes things a
little clearer.)

At the moment, this is just a small prototype that I've cobbled
together. I was curious if anybody knows if anybody else has done
anything similar?

Thanks

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Mark Lawrence

On 20/07/2015 03:16, Rustom Mody wrote:

On Monday, July 20, 2015 at 7:16:50 AM UTC+5:30, Mark Lawrence wrote:

On 20/07/2015 02:20, Devin Jeanpierre wrote:



I don't like how this is being redirected to "surely you
misunderstood" or "I don't believe you". The fact that some core devs
are hostile to 2.x development is really bleedingly obvious, you
shouldn't need quotes or context thrown at you. The rhetoric almost
always shies _just_ short of ceasing bugfixes (until 2020, when that
abruptly becomes a cracking good idea). e.g. in "2.7 is here until
2020, please don't call it a waste".



A couple of things.

First "some core devs are hostile", actually some have stated that
they're simply not interested in 2.7 and will not work on it.

Second how has the thread got here, as it was originally asking about
back porting bug fixes from 3.x to 2.7?  Further it said:-


If the vast majority of Python programmers are focused on 2.7, why are
volunteers to help fix 2.7 bugs so scarce?


So I most humbly suggest, as I may have hinted at once or twice earlier
in this thread, that people either put up or shut up.


I just ran the following command
$ hg log --template "{author|person}\n" | sort | uniq -c | sort -nr

as giving all the committers to python in sorted order.
I get the list below.
Dont see any Mark Lawrence there
Of course I dont know hg at all well... Just picked up the above command from
http://stackoverflow.com/questions/6126678/how-to-list-commiters-sorted-by-number-of-commits-commit-count

So... May I humbly ask where are your precious commits??



Thank you for showing your complete ignorance as to how Python works.

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

Mark Lawrence

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


Re: File Upload in Restful Flask

2015-07-20 Thread Simmo

On 20/07/2015 11:13, subhabrata.bane...@gmail.com wrote:

Dear Group,

I am trying to learn Rest framework through Restful Flask.
My initial exercises went fine with 
https://flask-restful.readthedocs.org/en/0.3.3/quickstart.html

Now I want to upload file through Restful Flask. I tried to check the web for 
reference.
I got these urls,
(i) 
http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
(ii) http://stackoverflow.com/questions/28982974/flask-restful-upload-image
(iii) http://blog.luisrei.com/articles/flaskrest.html

But the question I am stuck with what are the things I have to change in the 
example of quickstart tutorial so that I may be able to upload file. Or if any 
one may kindly suggest with a small example.

If any one of the esteemed members may kindly suggest.

Regards,
Subhabrata Banerjee.



I'm no expert on Python or REST but the example

>>> url = 'http://httpbin.org/post'
>>> files = {'file': open('report.xls', 'rb')}

>>> r = requests.post(url, files=files)
>>> r.text
...

seems quite straightforward so I would suggest substituting your URL for 
'http://httpbin.org' and your file name (possibly with full pathname) 
for 'report.xls'.


Give it a try and report back...

Steve S

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


Does the Class UserGroup (issue 11588) exist for python 2.7 ?

2015-07-20 Thread CARANNANTE, MARTINE
Hi
Could you tell me if the Class UserGroup (method add_usage_group to support 
inclusive groups) exist for python 2.7 ?
The patch that I found on internet is only for python 3.

Thanks in advance for your answer
Best regards

Martine Carannante




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


Re: File Upload in Restful Flask

2015-07-20 Thread subhabrata . banerji
On Monday, July 20, 2015 at 4:40:09 PM UTC+5:30, Simmo wrote:
> On 20/07/2015 11:13, wrote:
> > Dear Group,
> >
> > I am trying to learn Rest framework through Restful Flask.
> > My initial exercises went fine with 
> > https://flask-restful.readthedocs.org/en/0.3.3/quickstart.html
> >
> > Now I want to upload file through Restful Flask. I tried to check the web 
> > for reference.
> > I got these urls,
> > (i) 
> > http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
> > (ii) http://stackoverflow.com/questions/28982974/flask-restful-upload-image
> > (iii) http://blog.luisrei.com/articles/flaskrest.html
> >
> > But the question I am stuck with what are the things I have to change in 
> > the example of quickstart tutorial so that I may be able to upload file. Or 
> > if any one may kindly suggest with a small example.
> >
> > If any one of the esteemed members may kindly suggest.
> >
> > Regards,
> > Subhabrata Banerjee.
> >
> 
> I'm no expert on Python or REST but the example
> 
>   >>> url = 'http://httpbin.org/post'
>   >>> files = {'file': open('report.xls', 'rb')}
> 
>   >>> r = requests.post(url, files=files)
>   >>> r.text
>  ...
> 
> seems quite straightforward so I would suggest substituting your URL for 
> 'http://httpbin.org' and your file name (possibly with full pathname) 
> for 'report.xls'.
> 
> Give it a try and report back...
> 
> Steve S

Dear Sir,

Thanks. I could change the quickstart api.py slightly. I ran your suggestion
on it. Some result seems coming but I may have to improve some portion, I am 
not getting. Please see the same.

>>> import requests
>>> url='http://127.0.0.1:5000/toworks/post'
>>> files = {'file': open('C:\Python27\NEWS.txt', 'rb')}
>>> r = requests.post(url, files=files)
>>> r.text
u'{\n"message": "Method Not Allowed", \n"status": 405\n}\n'
>>> 

Regards,
Subhabrata Banerji
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Does the Class UserGroup (issue 11588) exist for python 2.7 ?

2015-07-20 Thread Mark Lawrence

On 20/07/2015 12:27, CARANNANTE, MARTINE wrote:

Hi
Could you tell me if the Class UserGroup (method add_usage_group to
support inclusive groups) exist for python 2.7 ?
The patch that I found on internet is only for python 3.
Thanks in advance for your answer
Best regards
*Martine Carannante
*


Almost certainly no as the patch has never been commited, which is why 
http://bugs.python.org/issue11588 is till open.  Even if the patch were 
committed there is no guarantee that the patch will be back ported to 2.7.


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

Mark Lawrence

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


Re: File Upload in Restful Flask

2015-07-20 Thread Simmo

On 20/07/2015 12:57, subhabrata.bane...@gmail.com wrote:

On Monday, July 20, 2015 at 4:40:09 PM UTC+5:30, Simmo wrote:

On 20/07/2015 11:13, wrote:

Dear Group,

I am trying to learn Rest framework through Restful Flask.
My initial exercises went fine with 
https://flask-restful.readthedocs.org/en/0.3.3/quickstart.html

Now I want to upload file through Restful Flask. I tried to check the web for 
reference.
I got these urls,
(i) 
http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
(ii) http://stackoverflow.com/questions/28982974/flask-restful-upload-image
(iii) http://blog.luisrei.com/articles/flaskrest.html

But the question I am stuck with what are the things I have to change in the 
example of quickstart tutorial so that I may be able to upload file. Or if any 
one may kindly suggest with a small example.

If any one of the esteemed members may kindly suggest.

Regards,
Subhabrata Banerjee.



I'm no expert on Python or REST but the example

>>> url = 'http://httpbin.org/post'
>>> files = {'file': open('report.xls', 'rb')}

>>> r = requests.post(url, files=files)
>>> r.text
  ...

seems quite straightforward so I would suggest substituting your URL for
'http://httpbin.org' and your file name (possibly with full pathname)
for 'report.xls'.

Give it a try and report back...

Steve S


Dear Sir,

Thanks. I could change the quickstart api.py slightly. I ran your suggestion
on it. Some result seems coming but I may have to improve some portion, I am 
not getting. Please see the same.


import requests
url='http://127.0.0.1:5000/toworks/post'
files = {'file': open('C:\Python27\NEWS.txt', 'rb')}
r = requests.post(url, files=files)
r.text

u'{\n"message": "Method Not Allowed", \n"status": 405\n}\n'




Regards,
Subhabrata Banerji



OK, so that message is telling you that whatever server is sitting 
behind 127.0.0.1 is not allowing you (your code) to POST to it.  There 
are many reasons why this could be happening.  Here are a couple for you 
to investigate...


- port 5000 is not not 'open' for POSTs
- your code may not have permission to POST to the server

It would help if you could tell us what OS you are using (Windows or 
Linux or ...) and what server is sitting behind 127.0.0.1.


I'n not going to be around for the next 24hrs but I'm sure someone else 
on the list will have some suggestions for you...


Happy bug hunting

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


Fast 12 bit to 16 bit sample conversion?

2015-07-20 Thread Peter Heitzer
I am currently writing a python script to extract samples from old Roland 12 
bit sample
disks and save them as 16 bit wav files.

The samples are layouted as follows

0 [S0 bit 11..4] [S0 bit 3..0|S1 bit 3..0] [S1 bit 11..4]
3 [S2 bit 11..4] [S2 bit 3..0|S3 bit 3..0] [S3 bit 11..4]

In other words 
sample0=(data[0]<<4)|(data[1]>>4)
sample1=(data[2]<<4)|(data[1] & 0x0f)

I use this code for the conversion (using the struct module)

import struct
from array import array

def getWaveData(diskBuffer):
  offset=0
  words=array('H')
  for i in range(len(diskBuffer)/3):
h0=struct.unpack_from('>h',diskBuffer,offset)
h1=struct.unpack_from('hxhxhxhx' for 4 
even samples
and 'https://mail.python.org/mailman/listinfo/python-list


Re: File Upload in Restful Flask

2015-07-20 Thread subhabrata . banerji
On Monday, July 20, 2015 at 6:39:29 PM UTC+5:30, Simmo wrote:
> On 20/07/2015 12:57, wrote:
> > On Monday, July 20, 2015 at 4:40:09 PM UTC+5:30, Simmo wrote:
> >> On 20/07/2015 11:13, wrote:
> >>> Dear Group,
> >>>
> >>> I am trying to learn Rest framework through Restful Flask.
> >>> My initial exercises went fine with 
> >>> https://flask-restful.readthedocs.org/en/0.3.3/quickstart.html
> >>>
> >>> Now I want to upload file through Restful Flask. I tried to check the web 
> >>> for reference.
> >>> I got these urls,
> >>> (i) 
> >>> http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
> >>> (ii) 
> >>> http://stackoverflow.com/questions/28982974/flask-restful-upload-image
> >>> (iii) http://blog.luisrei.com/articles/flaskrest.html
> >>>
> >>> But the question I am stuck with what are the things I have to change in 
> >>> the example of quickstart tutorial so that I may be able to upload file. 
> >>> Or if any one may kindly suggest with a small example.
> >>>
> >>> If any one of the esteemed members may kindly suggest.
> >>>
> >>> Regards,
> >>> Subhabrata Banerjee.
> >>>
> >>
> >> I'm no expert on Python or REST but the example
> >>
> >>>>> url = 'http://httpbin.org/post'
> >>>>> files = {'file': open('report.xls', 'rb')}
> >>
> >>>>> r = requests.post(url, files=files)
> >>>>> r.text
> >>   ...
> >>
> >> seems quite straightforward so I would suggest substituting your URL for
> >> 'http://httpbin.org' and your file name (possibly with full pathname)
> >> for 'report.xls'.
> >>
> >> Give it a try and report back...
> >>
> >> Steve S
> >
> > Dear Sir,
> >
> > Thanks. I could change the quickstart api.py slightly. I ran your suggestion
> > on it. Some result seems coming but I may have to improve some portion, I 
> > am not getting. Please see the same.
> >
>  import requests
>  url='http://127.0.0.1:5000/toworks/post'
>  files = {'file': open('C:\Python27\NEWS.txt', 'rb')}
>  r = requests.post(url, files=files)
>  r.text
> > u'{\n"message": "Method Not Allowed", \n"status": 405\n}\n'
> 
> >
> > Regards,
> > Subhabrata Banerji
> >
> 
> OK, so that message is telling you that whatever server is sitting 
> behind 127.0.0.1 is not allowing you (your code) to POST to it.  There 
> are many reasons why this could be happening.  Here are a couple for you 
> to investigate...
> 
> - port 5000 is not not 'open' for POSTs
> - your code may not have permission to POST to the server
> 
> It would help if you could tell us what OS you are using (Windows or 
> Linux or ...) and what server is sitting behind 127.0.0.1.
> 
> I'n not going to be around for the next 24hrs but I'm sure someone else 
> on the list will have some suggestions for you...
> 
> Happy bug hunting
> 
> Steve

Dear Sir,

Thanks. I am on MS-Windows 7 and I use mostly Firefox. I am checking other 
issues.

Regards,
Subhabrata Banerjee. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fast 12 bit to 16 bit sample conversion?

2015-07-20 Thread MRAB

On 2015-07-20 14:10, Peter Heitzer wrote:

I am currently writing a python script to extract samples from old Roland 12 
bit sample
disks and save them as 16 bit wav files.

The samples are layouted as follows

0 [S0 bit 11..4] [S0 bit 3..0|S1 bit 3..0] [S1 bit 11..4]
3 [S2 bit 11..4] [S2 bit 3..0|S3 bit 3..0] [S3 bit 11..4]

In other words
sample0=(data[0]<<4)|(data[1]>>4)
sample1=(data[2]<<4)|(data[1] & 0x0f)

I use this code for the conversion (using the struct module)

import struct
from array import array

def getWaveData(diskBuffer):
   offset=0
   words=array('H')
   for i in range(len(diskBuffer)/3):


If the 2 12-bit values are [0xABC, 0xDEF], the bytes will be [0xAB, 
0xCF, 0xDE].



 h0=struct.unpack_from('>h',diskBuffer,offset)


This gives 0xABCF, which is ANDed to give 0xABC0. Good.


 h1=struct.unpack_from('

This gives 0xDECF, which is ANDed to give 0xDEC0. Not what you want.


 words.append(h0[0] & 0xfff0)
 words.append(h1[0] & 0xfff0)
 offset+=3
   return words

I unpack the samples in an array of unsigned shorts for I later can use the 
byteswap() method
if the code is running on a big endian machine.

What options using pure python do I have to make the conversion faster?
I thought of unpacking more bytes at once e.g. using a format '>hxhxhxhx' for 4 
even samples
and '

You could try using lookup tables to decode even-numbered and 
odd-numbered pairs of bytes.



Can I map the '& 0xfff0' to the whole array?


That's something the numpy could do.

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


Re: Fast 12 bit to 16 bit sample conversion?

2015-07-20 Thread edmondo . giovannozzi
Il giorno lunedì 20 luglio 2015 15:10:22 UTC+2, Peter Heitzer ha scritto:
> I am currently writing a python script to extract samples from old Roland 12 
> bit sample
> disks and save them as 16 bit wav files.
> 
> The samples are layouted as follows
> 
> 0 [S0 bit 11..4] [S0 bit 3..0|S1 bit 3..0] [S1 bit 11..4]
> 3 [S2 bit 11..4] [S2 bit 3..0|S3 bit 3..0] [S3 bit 11..4]
> 
> In other words 
> sample0=(data[0]<<4)|(data[1]>>4)
> sample1=(data[2]<<4)|(data[1] & 0x0f)
> 
> I use this code for the conversion (using the struct module)
> 
> import struct
> from array import array
> 
> def getWaveData(diskBuffer):
>   offset=0
>   words=array('H')
>   for i in range(len(diskBuffer)/3):
> h0=struct.unpack_from('>h',diskBuffer,offset)
> h1=struct.unpack_from(' words.append(h0[0] & 0xfff0)
> words.append(h1[0] & 0xfff0)
> offset+=3
>   return words
> 
> I unpack the samples in an array of unsigned shorts for I later can use the 
> byteswap() method
> if the code is running on a big endian machine.
> 
> What options using pure python do I have to make the conversion faster?
> I thought of unpacking more bytes at once e.g. using a format '>hxhxhxhx' for 
> 4 even samples
> and ' Can I map the '& 0xfff0' to the whole array?

I'll try to read the binary data with numpy.fromfile, reshape the array in 
[n,3] matrix, and then you can operate with the columns to get what you want.
:-)
 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fast 12 bit to 16 bit sample conversion?

2015-07-20 Thread Peter Heitzer
MRAB  wrote:
>On 2015-07-20 14:10, Peter Heitzer wrote:
>> I am currently writing a python script to extract samples from old Roland 12 
>> bit sample
>> disks and save them as 16 bit wav files.
>>
>> The samples are layouted as follows
>>
>> 0 [S0 bit 11..4] [S0 bit 3..0|S1 bit 3..0] [S1 bit 11..4]
>> 3 [S2 bit 11..4] [S2 bit 3..0|S3 bit 3..0] [S3 bit 11..4]
>>
>> In other words
>> sample0=(data[0]<<4)|(data[1]>>4)
>> sample1=(data[2]<<4)|(data[1] & 0x0f)
>>
>> I use this code for the conversion (using the struct module)
>>
>> import struct
>> from array import array
>>
>> def getWaveData(diskBuffer):
>>offset=0
>>words=array('H')
>>for i in range(len(diskBuffer)/3):

>If the 2 12-bit values are [0xABC, 0xDEF], the bytes will be [0xAB, 
>0xCF, 0xDE].

>>  h0=struct.unpack_from('>h',diskBuffer,offset)

>This gives 0xABCF, which is ANDed to give 0xABC0. Good.

>>  h1=struct.unpack_from('This gives 0xDECF, which is ANDed to give 0xDEC0. Not what you want.
You are right! It looked to me as if it was little endian, but only for the MSB.

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


Re: how to play

2015-07-20 Thread sohcahtoa82
On Sunday, July 19, 2015 at 12:04:26 PM UTC-7, Aron Barsam wrote:
> i have trouble trying to play python please can you respond soon 

...

> play python

http://i.imgur.com/x2KwTbw.jpg
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Does the Class UserGroup (issue 11588) exist for python 2.7 ?

2015-07-20 Thread Chris Angelico
On Mon, Jul 20, 2015 at 10:15 PM, Mark Lawrence  wrote:
> On 20/07/2015 12:27, CARANNANTE, MARTINE wrote:
>>
>> Hi
>> Could you tell me if the Class UserGroup (method add_usage_group to
>> support inclusive groups) exist for python 2.7 ?
>> The patch that I found on internet is only for python 3.
>> Thanks in advance for your answer
>> Best regards
>> *Martine Carannante
>> *
>
>
> Almost certainly no as the patch has never been commited, which is why
> http://bugs.python.org/issue11588 is till open.  Even if the patch were
> committed there is no guarantee that the patch will be back ported to 2.7.

There's almost a guarantee that it will NOT be backported to 2.7,
actually; it looks like a completely new feature. But if you're
interested, you might be able to apply the patch to a backported
argparse, such as:

https://pypi.python.org/pypi/argparse

Or just patch your own local version, but that's a bit dodgier.

If you're willing to migrate your code to Python 3, and you want this
feature, post in the tracker issue; even better, help with testing the
patch. The patch was updated for Python 3.5 roughly a year ago, and I
suspect that that version will still work; the lack of response after
that suggests that nobody has the time to test it and make sure it
works in all cases.

Since argparse is written in Python, you don't even need to play
around with a C compiler to test this. It's a nice easy thing to play
with - have a shot!

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


Re: Generating type annotations by tracing execution runs

2015-07-20 Thread Chris Angelico
On Mon, Jul 20, 2015 at 7:59 PM, Michael Williamson  wrote:
> I've knocked together a quick proof-of-concept that allows type
> annotations to be automatically added to Python source code by running
> it:
>
> https://github.com/mwilliamson/farthing
>
> As the code, such as a test suite, runs, the types of arguments and
> return values (for functions in the file/directory to be annotated) are
> stored. After the code has finished, appropriate annotations are added.
> (There's a tiny example in the README.rst in case that makes things a
> little clearer.)

Sounds to me like a type inference system. Can be pretty handy in some
codebases.

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


Re: Generating type annotations by tracing execution runs

2015-07-20 Thread Paul Rubin
Chris Angelico  writes:
>> As the code, such as a test suite, runs, the types of arguments and
>> return values...
> Sounds to me like a type inference system. Can be pretty handy in some
> codebases.

I haven't tried it out yet but it sounds more like the type extraction
part of a JIT compiler, i.e. the types are collected from actual
execution traces rather than statically.  I think of "type inference" as
meaning syntactic inference at compile time.  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to play

2015-07-20 Thread Ian Kelly
On Mon, Jul 20, 2015 at 10:29 AM, Aron Barsam  wrote:
> what is an 0S comand line?

What OS are you using? In Windows it's a program called Command
Prompt. In Mac OS X it's an application called Terminal. In Linux it's
usually called something like Terminal or xterm.

However, if you don't know how to use the CLI (command-line
interface), then you're probably better off using IDLE, a development
environment that is included with the Python installation and includes
an interactive interpreter. Just look for the IDLE program and run
that.
-- 
https://mail.python.org/mailman/listinfo/python-list


linux os.rename() not an actual rename?

2015-07-20 Thread Jason H
I have a server process that looks (watches via inotify)  for files to be moved 
(renamed) into a particular directory from elsewhere on the same filesystem. We 
do this because it is an atomic operation, and our server process can see the 
modify events of the file being written before it is closed. The rename 
functions as a 'completed' event.  We have a python script that attempts to 
perform this behavior - to os.rename() a file into the watched directory after 
it is done being written. However unlike other tools, we don't see a proper 
'rename' event. Instead we just see a 'changed' event. I've changed the 
implementation of the script to os.system('mv ...') and we get the expected 
'rename' event. 

Is this known issue? Should I be seeing a proper rename event? The only mention 
in the docs about the rename behavior is that it is atomic, as required by 
POSIX. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: linux os.rename() not an actual rename?

2015-07-20 Thread Jon Ribbens
On 2015-07-20, Jason H  wrote:
> I have a server process that looks (watches via inotify)  for files
> to be moved (renamed) into a particular directory from elsewhere on
> the same filesystem. We do this because it is an atomic operation,
> and our server process can see the modify events of the file being
> written before it is closed. The rename functions as a 'completed'
> event.  We have a python script that attempts to perform this
> behavior - to os.rename() a file into the watched directory after it
> is done being written. However unlike other tools, we don't see a
> proper 'rename' event. Instead we just see a 'changed' event. I've
> changed the implementation of the script to os.system('mv ...') and
> we get the expected 'rename' event. 
>
> Is this known issue? Should I be seeing a proper rename event? The
> only mention in the docs about the rename behavior is that it is
> atomic, as required by POSIX. 

os.rename() should just be calling the operating system rename(2)
function. I think you must be doing something wrong.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: linux os.rename() not an actual rename?

2015-07-20 Thread Marko Rauhamaa
"Jason H" :

> I have a server process that looks (watches via inotify) for files to
> be moved (renamed) into a particular directory from elsewhere on the
> same filesystem. We do this because it is an atomic operation, and our
> server process can see the modify events of the file being written
> before it is closed. The rename functions as a 'completed' event. We
> have a python script that attempts to perform this behavior - to
> os.rename() a file into the watched directory after it is done being
> written. However unlike other tools, we don't see a proper 'rename'
> event. Instead we just see a 'changed' event. I've changed the
> implementation of the script to os.system('mv ...') and we get the
> expected 'rename' event.

Don't know about inotify(). However, strace reveals that python3's
os.rename() performs a regular rename(2) system call.


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


Re: linux os.rename() not an actual rename?

2015-07-20 Thread Christian Heimes
On 2015-07-20 20:50, Marko Rauhamaa wrote:
> "Jason H" :
> 
>> I have a server process that looks (watches via inotify) for files to
>> be moved (renamed) into a particular directory from elsewhere on the
>> same filesystem. We do this because it is an atomic operation, and our
>> server process can see the modify events of the file being written
>> before it is closed. The rename functions as a 'completed' event. We
>> have a python script that attempts to perform this behavior - to
>> os.rename() a file into the watched directory after it is done being
>> written. However unlike other tools, we don't see a proper 'rename'
>> event. Instead we just see a 'changed' event. I've changed the
>> implementation of the script to os.system('mv ...') and we get the
>> expected 'rename' event.
> 
> Don't know about inotify(). However, strace reveals that python3's
> os.rename() performs a regular rename(2) system call.

So does Python 2.7:

$ touch test
$ strace -e trace=file -- python -c 'import os; os.rename("test", "test2")'
execve("/bin/python", ["python", "-c", "import os; os.rename(\"test\",
\"te"...], [/* 76 vars */]) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
...
rename("test", "test2") = 0
+++ exited with 0 +++


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


Re: linux os.rename() not an actual rename?

2015-07-20 Thread Jason H
> From: "Christian Heimes" 
> On 2015-07-20 20:50, Marko Rauhamaa wrote:
> > "Jason H" :
> > 
> >> I have a server process that looks (watches via inotify) for files to
> >> be moved (renamed) into a particular directory from elsewhere on the
> >> same filesystem. We do this because it is an atomic operation, and our
> >> server process can see the modify events of the file being written
> >> before it is closed. The rename functions as a 'completed' event. We
> >> have a python script that attempts to perform this behavior - to
> >> os.rename() a file into the watched directory after it is done being
> >> written. However unlike other tools, we don't see a proper 'rename'
> >> event. Instead we just see a 'changed' event. I've changed the
> >> implementation of the script to os.system('mv ...') and we get the
> >> expected 'rename' event.
> > 
> > Don't know about inotify(). However, strace reveals that python3's
> > os.rename() performs a regular rename(2) system call.
> 
> So does Python 2.7:
> 
> $ touch test
> $ strace -e trace=file -- python -c 'import os; os.rename("test", "test2")'
> execve("/bin/python", ["python", "-c", "import os; os.rename(\"test\",
> \"te"...], [/* 76 vars */]) = 0
> access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
> open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
> ...
> rename("test", "test2") = 0
> +++ exited with 0 +++

Hrm, provably, you're right. But I was seeing 'rename', then two 'changed' 
events on the dest name, but the last thing the process did was rename before 
it exited. 

I'll look into it some more now that I know python should be using the OS 
implementation of rename. 

Thanks everyone.

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


Re: Procedure for downloading and Installing Python 2.7 Modules

2015-07-20 Thread Mark Lawrence

On 19/07/2015 23:14, W. D. Allen wrote:

Would like to locate and install numpy, scipy and matplotlib
with Wing 101 for Python 2.7

Just beginning to use Python 2.7 for engineering work.

Any guidance would be appreciated.

Thanks,

WDA
balle...@gmail.com

end



Just use pip from the command line for your OS.

It might even be that:-

pip install scipy

grabs everything that you've asked for above, why not try it and see?

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

Mark Lawrence

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


Re: Procedure for downloading and Installing Python 2.7 Modules

2015-07-20 Thread Steven D'Aprano
On Mon, 20 Jul 2015 08:14 am, W. D. Allen wrote:

> Would like to locate and install numpy, scipy and matplotlib
> with Wing 101 for Python 2.7


Wing is an IDE, that is, a fancy editor. As far as I know, you shouldn't
have to take any special steps to get numpy etc. working with Wing, you
just install them in the usual fashion.

Do you need help with installing Python packages?

If you have pip installed, you can just type:

pip install numpy scipy matplotlib

from your *operating system* command prompt. Not the Python shell! On Linux,
you would open a terminal and you should see a prompt that ends with a $
sign. On Windows, you run cmd.exe or command.com or whatever it is called,
I forget. If you see a prompt >>> then you're in the Python shell and pip
won't work.

However, installing numpy and scipy from scratch like this is often
difficult on Windows, as you need access to a Fortran or C compiler. Many
people prefer to use a Python environment that has numpy etc. already
pre-installed. Start here:

https://courses.p2pu.org/he/groups/scientific-python/content/setting-up-a-scientific-python-environment/

Does this help? Feel free to reply to the group with any follow up
questions.


-- 
Steven

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


Re: Fast 12 bit to 16 bit sample conversion?

2015-07-20 Thread Mark Lawrence

On 20/07/2015 14:10, Peter Heitzer wrote:

I am currently writing a python script to extract samples from old Roland 12 
bit sample
disks and save them as 16 bit wav files.

The samples are layouted as follows

0 [S0 bit 11..4] [S0 bit 3..0|S1 bit 3..0] [S1 bit 11..4]
3 [S2 bit 11..4] [S2 bit 3..0|S3 bit 3..0] [S3 bit 11..4]

In other words
sample0=(data[0]<<4)|(data[1]>>4)
sample1=(data[2]<<4)|(data[1] & 0x0f)

I use this code for the conversion (using the struct module)

import struct
from array import array

def getWaveData(diskBuffer):
   offset=0
   words=array('H')
   for i in range(len(diskBuffer)/3):
 h0=struct.unpack_from('>h',diskBuffer,offset)
 h1=struct.unpack_from('

By "pure python" I'm assuming you mean part of the stdlib.

Referring to https://wiki.python.org/moin/PythonSpeed/PerformanceTips 
you could end with something like this (untested).


def getWaveData(diskBuffer):
offset = 0
words = array('H')
wx = words.extend #saves two lookups and a function call
su = struct.unpack_from #saves two lookups
# 'i' not used in the loop so throw it away
for _ in range(len(diskBuffer)/3): # use xrange on Python 2
h0 = su('>h',diskBuffer,offset)
h1 = su('wx((h0[0] & 0xfff0), (h1[0] & 0xfff0)) # MRAB pointed out a 
problem with the masking in the second section???

offset += 3
return words


I thought of unpacking more bytes at once e.g. using a format '>hxhxhxhx' for 4 
even samples
and '

If that reduces the number of times around the loop why not?  Combine it 
with MRAB's suggestion of lookups and I'd guess you'd get a speedup, but 
knowing Python I'm probably way out on that?  There's only one way to 
find out.


I'm also thinking that you could user one of the itertools functions or 
recipes to grab the data and hence simplify the loop even more, but it's 
now 3:45 BST, so I can't think straight, hence bed.



Can I map the '& 0xfff0' to the whole array?


If it works :)

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

Mark Lawrence

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


Can I copy/paste Python code?

2015-07-20 Thread ryguy7272
I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
to test out the code, and I can copy it, but when I paste it into the Shell, 
everything is all screwed up because of the indentation. Every time I paste in 
any kind of code, it seems like everything is immediately left-justified, and 
then nothing works.

Any idea how to make this work easily?  Without re-typing hundreds of lines of 
code...

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


Re: Can I copy/paste Python code?

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272  wrote:
> I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
> to test out the code, and I can copy it, but when I paste it into the Shell, 
> everything is all screwed up because of the indentation. Every time I paste 
> in any kind of code, it seems like everything is immediately left-justified, 
> and then nothing works.
>
> Any idea how to make this work easily?  Without re-typing hundreds of lines 
> of code...

Sounds like a flaw in the PDF - it creates indentation in some way
other than leading spaces/tabs. See if the PDF has a corresponding
file of ready-to-go code, that might save you some trouble.

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


Re: Can't Install Pandas

2015-07-20 Thread ryguy7272
On Sunday, July 19, 2015 at 11:05:46 PM UTC-4, ryguy7272 wrote:
> Hello experts.  I odwnloaded Pandas, and put it here.
> C:\Python34\Scripts\pandas-0.16.2
> 
> Then, I ran this in what most people call the c-prompt, but I call it the 
> 'Python 3.4.3 Shell'
> "C:\Python34\Scripts\pandas-0.16.2>" "pip install 'setup.py'" 
> 
> It seems like everything ran fine, so I try this.
> import pandas as pd
> 
> Then I get this error.
> Traceback (most recent call last):
>   File "", line 1, in 
> import pandas as pd
> ImportError: No module named 'pandas'
> 
> Any idea what I'm doing wrong?
> 
> 
> I tried to follow the instructions here.
> https://pip.pypa.io/en/latest/installing.html
> 
> 
> That doesn't work either.
> python get-pip.py
> SyntaxError: invalid syntax
> 
> I won't even ask the most obvious question, because I guess it's impossible 
> to do.  Rather, can someone please help me to get this working?
> 
> Thanks.

Ok.  Back to the basics.
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can't Install Pandas

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 12:51 PM, ryguy7272  wrote:
> On Sunday, July 19, 2015 at 11:05:46 PM UTC-4, ryguy7272 wrote:
>> Hello experts.  I odwnloaded Pandas, and put it here.
>> C:\Python34\Scripts\pandas-0.16.2
>>
>> Then, I ran this in what most people call the c-prompt, but I call it the 
>> 'Python 3.4.3 Shell'
>> "C:\Python34\Scripts\pandas-0.16.2>" "pip install 'setup.py'"
>>
>> It seems like everything ran fine, so I try this.
>> import pandas as pd
>>
>> Then I get this error.
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> import pandas as pd
>> ImportError: No module named 'pandas'
>>
>> Any idea what I'm doing wrong?
>>
>>
>> I tried to follow the instructions here.
>> https://pip.pypa.io/en/latest/installing.html
>>
>>
>> That doesn't work either.
>> python get-pip.py
>> SyntaxError: invalid syntax
>>
>> I won't even ask the most obvious question, because I guess it's impossible 
>> to do.  Rather, can someone please help me to get this working?
>>
>> Thanks.
>
> Ok.  Back to the basics.
> Thanks.

If by "basics" you mean this, then yes.

http://www.catb.org/esr/faqs/smart-questions.html

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


Is there a way to install ALL Python packages?

2015-07-20 Thread ryguy7272
I'd like to install ALL Python packages on my machine.  Even if it takes up 
4-5GB, or more, I'd like to get everything, and then use it when I need it.  
Now, I'd like to import packages, like numpy and pandas, but nothing will 
install.  I figure, if I can just install everything, I can simply use it when 
I need it, and if I don't need it, then I just won't use it.

I know R offers this as an option.  I figure Python must allow it too.

Any idea  how to grab everything?

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Rick Johnson
On Sunday, July 19, 2015 at 9:17:11 PM UTC-5, Rustom Mody wrote:


> List of python committers:
> -
>  11081 Guido van Rossum
> [snip: long list]

Thanks for posting this list of names. I had put in a pyFOIA
request for this data a few years ago, but to my surprise, was
flat out denied. I'm not sure how exhaustive this list may be,
but publicly displaying the "commit hierarchy" within the Python
community is very import for those who may want to get involved.

[Talking to Mark Lawrence, Rustom said:]
> So... May I humbly ask where are your precious commits??

Thanks for putting Mark in his place. He has been brow
beating folks on this list (myself included) for years, and
i'll bet he now feels as tiny as D'Aprano did -- when GvR
scolded him for disrespecting a Noob on Python-ideas.

  Yeah, i was watching! 

  I'M *ALWAYS* WATCHING!

  ಠ_ಠ

Now that Mark's lack of "commit cred" has been exposed, we can
safely ignore his hollow and hypocritical bullying. And now
that he has been de-fanged, he will be forced to seek employment
elsewhere. Hmm, my suggestion is that he market himself as an
on-call "peanut butter removal service". A venture that will
no doubt be successful, seeing that he has two "heads up" on
his competition! 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 12:57 PM, ryguy7272  wrote:
> I'd like to install ALL Python packages on my machine.  Even if it takes up 
> 4-5GB, or more, I'd like to get everything, and then use it when I need it.  
> Now, I'd like to import packages, like numpy and pandas, but nothing will 
> install.  I figure, if I can just install everything, I can simply use it 
> when I need it, and if I don't need it, then I just won't use it.
>
> I know R offers this as an option.  I figure Python must allow it too.
>
> Any idea  how to grab everything?
>

pip install `wget https://pypi.python.org/simple/ -qO- |html2text`

Then figure out if there are any conflicts.

And make sure you stay up-to-date as packages get new versions released.

Good luck.

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Rustom Mody
On Tuesday, July 21, 2015 at 8:34:30 AM UTC+5:30, Rick Johnson wrote:
> On Sunday, July 19, 2015 at 9:17:11 PM UTC-5, Rustom Mody wrote:
> 
> 
> > List of python committers:
> > -
> >  11081 Guido van Rossum
> > [snip: long list]
> 
> Thanks for posting this list of names. I had put in a pyFOIA
> request for this data a few years ago, but to my surprise, was
> flat out denied. I'm not sure how exhaustive this list may be,
> but publicly displaying the "commit hierarchy" within the Python
> community is very import for those who may want to get involved.
> 
> [Talking to Mark Lawrence, Rustom said:]
> > So... May I humbly ask where are your precious commits??
> 
> Thanks for putting Mark in his place. He has been brow
> beating folks on this list (myself included) for years, and
> i'll bet he now feels as tiny as D'Aprano did -- when GvR
> scolded him for disrespecting a Noob on Python-ideas.
> 
>   Yeah, i was watching! 
> 
>   I'M *ALWAYS* WATCHING!
> 
>   ಠ_ಠ
> 
> Now that Mark's lack of "commit cred" has been exposed, we can
> safely ignore his hollow and hypocritical bullying. And now
> that he has been de-fanged, he will be forced to seek employment
> elsewhere. Hmm, my suggestion is that he market himself as an
> on-call "peanut butter removal service". A venture that will
> no doubt be successful, seeing that he has two "heads up" on
> his competition!

Hey Rick!
Lets have a useful discussion
And cut the rhetoric
Please

[Chris already showed that this list is inaccurate -- probably related 
to hg not having sighoff distinct from commit like git]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-20 Thread Rustom Mody
On Tuesday, July 21, 2015 at 8:47:29 AM UTC+5:30, Chris Angelico wrote:
> On Tue, Jul 21, 2015 at 12:57 PM, ryguy7272  wrote:
> > I'd like to install ALL Python packages on my machine.  Even if it takes up 
> > 4-5GB, or more, I'd like to get everything, and then use it when I need it. 
> >  Now, I'd like to import packages, like numpy and pandas, but nothing will 
> > install.  I figure, if I can just install everything, I can simply use it 
> > when I need it, and if I don't need it, then I just won't use it.
> >
> > I know R offers this as an option.  I figure Python must allow it too.
> >
> > Any idea  how to grab everything?
> >
> 
> pip install `wget https://pypi.python.org/simple/ -qO- |html2text`
> 
> Then figure out if there are any conflicts.
> 
> And make sure you stay up-to-date as packages get new versions released.
> 
> Good luck.
> 
> ChrisA

Dear Sir,

This is to inform you we have just received your application which is being 
duly considered.

Office of Bofh
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 1:15 PM, Rustom Mody  wrote:
> [Chris already showed that this list is inaccurate -- probably related
> to hg not having sighoff distinct from commit like git]

It's also the manner of workflow. If you want to accept patches and
have them acknowledged to their original authors, the patches need to
carry metadata identifying the authors. I went to the tracker and hit
"Random Issue" and got one with an attached file as the first hit:

http://bugs.python.org/issue12982
http://bugs.python.org/file26008/issue12982.diff

Repeated the exercise and won again:

http://bugs.python.org/issue4733
http://bugs.python.org/file12437/urlopen_text.diff

Notice how the patch files start straight in with content. There's no
authorship information retained.

By comparison, a patch created with 'git format-patch' and applied
with 'git am' starts with RFC 822 headers, provides a commit message,
and generally is intended as a way of transmitting a *commit*, rather
than simply some changes. I'm not overly familiar with Mercurial
workflows, but I think 'hg export' and 'hg import' give the same sort
of information; I tried on CPython and got this:

# HG changeset patch
# User Robert Collins 
# Date 1436838700 -43200
#  Tue Jul 14 13:51:40 2015 +1200
# Branch 3.5
# Node ID 7021d46c490e8d9d3422737c69980dc1602f90db
# Parent  0127b0cad5ecb83c39ce58a4be27bf6d43a78d91
Issue #23661: unittest.mock side_effects can now be exceptions again.

This was a regression vs Python 3.4. Patch from Ignacio Rossi

diff -r 0127b0cad5ec -r 7021d46c490e Lib/unittest/mock.py
--- a/Lib/unittest/mock.py  Sat Jul 11 16:33:39 2015 -0700
+++ b/Lib/unittest/mock.py  Tue Jul 14 13:51:40 2015 +1200
@@ -506,7 +506,8 @@
 if delegated is None:

(chomp actual details)

Whether it's possible to have authorship retained or not, though, a
lot of patches can logically be credited to multiple people. Whose
name goes on it? With the CPython workflow, it's always the core
committer who applied it, nobody else. (That's consistent, at least.)
So the names in the log are of the people who have write access to the
repo, and nobody else.

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


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-20 Thread Rustom Mody
On Sunday, July 19, 2015 at 10:15:37 AM UTC+5:30, Steven D'Aprano wrote:
> > JFTR: My kids (um... students) have just managed to add devanagari
> > numerals to python.
> > ie we can now do
> > 
>  १ + २
> > 3
> 
> That is actually quite awesome, and I would support a new feature that set
> the numeric characters to a particular script, e.g. Latin, Arabic,
> Devanagari, whatever, and printed them in that same script. It seems
> unfortunate that १ + २ prints as 3 rather than ३.

BTW my boys have just mailed me their latest:

>>> 九.九九

9.99

Can some unicode/Chinese literate person inform me whether
that ideograph is equivalent to roman '9' or roman 'nine'?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-20 Thread Michael Torrie
On 07/20/2015 08:57 PM, ryguy7272 wrote:
> I'd like to install ALL Python packages on my machine.  Even if it
> takes up 4-5GB, or more, I'd like to get everything, and then use it
> when I need it.  Now, I'd like to import packages, like numpy and
> pandas, but nothing will install.  I figure, if I can just install
> everything, I can simply use it when I need it, and if I don't need
> it, then I just won't use it.
> 
> I know R offers this as an option.  I figure Python must allow it
> too.
> 
> Any idea  how to grab everything?

Since I'm sure there are conflicts between some packages as well as
completely broken packages, I suspect this isn't really possible or
desirable.

And it won't solve your problem.  If you can't get numpy and pandas to
install, you may have troubles with "everything" also.

Are you sure you followed the instructions on the page you linked to in
your pandas install thread?  Seems like you typed "python get-pip.py" in
a python prompt instead of your operating system command prompt.  I
recall telling you about this before.  You download the get-pip.py file,
put it somewhere, like on your desktop, then open the command prompt
window, cd to that directory, and then run "python get-pip.py" from your
cmd.exe C: prompt.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-20 Thread Parul Mogra
Hi,
You could probably get the work done via the following script:
https://pypi.python.org/pypi/PythonTidy/




On Mon, Jul 20, 2015 at 7:49 PM, ryguy7272  wrote:

> I'm trying to copy some Python code from a PDF book that I'm reading.  I
> want to test out the code, and I can copy it, but when I paste it into the
> Shell, everything is all screwed up because of the indentation. Every time
> I paste in any kind of code, it seems like everything is immediately
> left-justified, and then nothing works.
>
> Any idea how to make this work easily?  Without re-typing hundreds of
> lines of code...
>
> Thanks to all.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 1:30 PM, Rustom Mody  wrote:
> BTW my boys have just mailed me their latest:
>
 九.九九
>
> 9.99
>
> Can some unicode/Chinese literate person inform me whether
> that ideograph is equivalent to roman '9' or roman 'nine'?

I'm not Chinese-literate, but I know how to dig up info from the
Unicode side of things.

'\u4e5d' CJK UNIFIED IDEOGRAPH-4E5D

Thanks, very helpful.

Perhaps slightly more useful:

https://en.wiktionary.org/wiki/%E4%B9%9D

But it still doesn't disambiguate digit vs word.

Playing around with Google Translate suggests that it functions mostly
like a digit; 九九 means "Ninety-nine" and 九八 means "Ninety-eight". But
I'll leave further confirmation to someone who fits your second
description.

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Rick Johnson
On Monday, July 20, 2015 at 12:59:53 AM UTC-5, Steven D'Aprano wrote:
> > Not quite; one is @yahoo.co.uk, and the other is @gmail.com.
> 
> Ah, so they are. You're right, I was wrong, they're not
> the same email address. But still, accusations of sock-
> puppetry from a change in email provider is unreasonable,
> and I believe that Rick should acknowledge that he over-
> reacted.

I'm not sure if i misinterpreted the puppetry, or not. I
thought Mark was hiding behind the "bream" account, but i'm
not so sure now. Weird things were happening yesterday with my
quotes (i even mentioned the strangeness in one of my
replies, check the archives).

But even if i am wrong, the worse thing i did was mis-
interpret his and another post. But since he still owes me
an apology for insulting my integrity, i'd say we're even.
Funny thing is, no one called for Mark to apologize... GO
FIGURE! I guess pets get preferential treatment.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Rick Johnson
On Monday, July 20, 2015 at 1:30:03 AM UTC-5, dieter wrote: 
> Experience like this (in another project) causes me to be
> very reluctant to become a core contributor (in the sense
> of actively fixing things in the core). You need a lot of
> knowledge (coding conventions, test setup, change
> workflow, ...) whichs goes far beyond the functionality of
> the fix -- and you must be resilient, patient and maybe
> even fighting to get the work accepted.

Thanks for sharing your experiences. I hope many more will
come forward and do the same. We are obviously ignoring some
talented people out there, and as i stressed before, we need
to prevent further hemorrhaging of this talent. I know there
are tons of folks who will get involved if we can remove the
onerous barriers.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-20 Thread Terry Reedy

On 7/20/2015 10:57 PM, ryguy7272 wrote:

I'd like to install ALL Python packages on my machine.


There is no official list of Python packages to upload all of.


 Even if it takes up 4-5GB, or more, I'd like to get everything,


There are 1 packages on Pypi, and perhaps an equal number elsewhere.

> and then use it when I need it.

Many are just names or junk that you would never use and do not want on 
your machine.  Many are specialized add-ons to another package.  It 
seems that Python is different from R.


pip can load a list of packages.  This is used daily to build machines 
with Python + a specified list.  It would be an interesting project for 
someone to make, publish, and update a 'sumo' list of the most useful 
packages that can all be loaded together.


--
Terry Jan Reedy

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Terry Reedy

On 7/20/2015 11:33 PM, Chris Angelico wrote:


It's also the manner of workflow. If you want to accept patches and
have them acknowledged to their original authors, the patches need to
carry metadata identifying the authors. Notice how the patch files start 
straight in with content. There's no
authorship information retained.

By comparison, a patch created with 'git format-patch' and applied
with 'git am' starts with RFC 822 headers, provides a commit message,
and generally is intended as a way of transmitting a *commit*, rather
than simply some changes. I'm not overly familiar with Mercurial
workflows, but I think 'hg export' and 'hg import' give the same sort
of information; I tried on CPython and got this:


hg has an option to produce git-format patches.  However, they do not 
work with the Rietveld code review tool, and so are discouraged.  I do 
not know if the extra information would survive an hg commit.


--
Terry Jan Reedy

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


Re: Is there a way to install ALL Python packages?

2015-07-20 Thread Chris Angelico
On Tue, Jul 21, 2015 at 1:24 PM, Rustom Mody  wrote:
> Dear Sir,
>
> This is to inform you we have just received your application which is being 
> duly considered.
>
> Office of Bofh

Thank you for your consideration. I shall endeavour to provide
satisfaction, unless you reject my application, in which case I shall
publish what I know about you, the boss's secretary, and the low-light
camera placed in the boardroom prior to the Christmas break-up party.

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


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Rick Johnson
On Monday, July 20, 2015 at 1:47:00 AM UTC-5, dieter wrote:
> Thinking of myself, I am not sure. Ensuring the quality of
> a "distribution" goes far beyond a single bug fix. While I
> usually are ready to share a bug fix I have found, I am
> reluctant to get involved in the complete quality
> ensurance process (such as the test suite, review process,
> style guides, ...).

Of course. I believe there are many folks out there like
yourself, who come across this or that bug, but don't bother
sharing the patch because of the reluctance to deal with red
tape or fear of a brow beating.

Participation, on a regular basis, requires a special kind
of person with special talents. For example: Terry Reedy has
been working over at "pybugs" for years. I don't think
everyone wants to be, or can be, a Terry Reedy. But i do
believe the current system is presenting obstacles to those
that could offer help in whatever limited capacity they can
handle.


OUTLINE OF FOUR POSSIBLE LEVELS OF PARTICIPATION:

  LEVEL1: Anyone, no matter what coding skills they have,
  can bring attention to a problem, and allow someone else
  to write the code. "HEY, I FOUND A PROBLEM -> BLAH, BLAH,
  BLAH". Also, not all programmers are experts with the
  written word. And a poorly described problem can result in
  it never getting the attention is deserves. We not only
  need coders, we need writer who can peruse the complaints
  and reformat them for comprehension and coherency. We need
  a diversity of talent, and not just "code monkey talent",
  all forms!

  LEVEL2: Even someone with "sketchy knowledge" of the fix
  can write up an outline, or a list of steps that could be
  taken, in order to fix the problem. Possibly pointing out
  some of the subtle bugs that may crop up if not carefully
  considered. Very few of us know *everything* about every
  module or dark corner of Python. For example, I've talked
  with a few "grand masters", who had little or no knowledge
  of Tkinter or IDLE.

  LEVEL3: The next level would be to write draft code. Maybe
  the code would not even be considered "professional". But
  it could serve as a "rough draft" that a more experienced
  programmer can build from.
  
  LEVEL4 The last level is a fully functioning patch. This
  would be written, or approved by, one of the trustees.

And even if the "contributor" can only participate at level1
or level2, if they find the process is smooth, then they are
more likely to participate again. And as they become more
experienced, will offer help at a higher level of expertise.
I know the wheel is being re-invented all the time, simply
because of the obstacles inherent in the patching process.
  
There needs to exist a linear path from bug to patch. We
don't want Terry Reedy wasting his expertise on the first
two or three levels, no, we need to place him at a level
where his talents are not wasted reading ridiculous feature
requests that will never go beyond level1 or level2.

My point is, we're unproductive because: (1) we're scaring
away intermediate and specialized talents (2) and we're mis-
applying the limited talent we do have.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Terry Reedy

On 7/19/2015 6:19 PM, Terry Reedy wrote:


I, and others, have already made some changes to eliminate differences
that are unnecessary, at least for 2.7 versus 3.3+ or now 3.4+.


I just got smacked in the face by a difference I had not run into 
before.  I added about 10 lines to a test file is a section that is 
identical in 2.7 and 3.4+.  One line is

self.assertEqual(type(obj), intended class)
It failed in 2.7.

Quiz: when is the type of an instance not the class that the instance is 
an instance of.  (I expect Steven A. is raising his hand now.)


Give up?

Answer: When you write a class in 2.x without making it a subclass of 
object.


>>> class Class():
pass

>>> inst = Class()
>>> type(inst) is Class
False
>>> type(inst)


Since I do not remember how to fix the assert, and was not prepared to 
make the class, in a file other than the one tested, new-style, I just 
commented it out.


This is an example of my claim that backports are best written by 
someone who is a current 2.x user with the particular 2.x knowledge 
needed.  I am not sure I ever had all the knowledge needed to handle the 
backport properly and I now I would prefer to forget about old-style 
classes.


--
Terry Jan Reedy

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


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-20 Thread Rustom Mody
On Tuesday, July 21, 2015 at 9:13:49 AM UTC+5:30, Chris Angelico wrote:
> On Tue, Jul 21, 2015 at 1:30 PM, Rustom Mody wrote:
> > BTW my boys have just mailed me their latest:
> >
>  九.九九
> >
> > 9.99
> >
> > Can some unicode/Chinese literate person inform me whether
> > that ideograph is equivalent to roman '9' or roman 'nine'?
> 
> I'm not Chinese-literate, but I know how to dig up info from the
> Unicode side of things.
> 
> '\u4e5d' CJK UNIFIED IDEOGRAPH-4E5D
> 
> Thanks, very helpful.
> 
> Perhaps slightly more useful:
> 
> https://en.wiktionary.org/wiki/%E4%B9%9D
> 
> But it still doesn't disambiguate digit vs word.
> 
> Playing around with Google Translate suggests that it functions mostly
> like a digit; 九九 means "Ninety-nine" and 九八 means "Ninety-eight". But
> I'll leave further confirmation to someone who fits your second
> description.
> 
> ChrisA

Well Cant make much sense of it:

>>> import unicodedata as ud
>>> ud.numeric('२')
2.0
>>> ud.category('२')
'Nd'
>>> ud.numeric('九')
9.0
>>> ud.category('九')
'Lo'
>>> 
-- 
https://mail.python.org/mailman/listinfo/python-list