Re: Why can not initialize the class?

2014-08-24 Thread alex23
On 23/08/2014 1:17 AM, Steven D'Aprano wrote: Luofeiyu, you are getting stuck on basic questions. Before working with advanced features like properties, you should learn the simply features. Has luofeiyu ever actually acknowledged any such comment or request people have made? I see we've given

Re: Python vs C++

2014-08-24 Thread alex23
On 24/08/2014 7:14 PM, Robert Kern wrote: On 2014-08-22 01:26, Chris Angelico wrote: Every time Cython gets discussed, I get a renewed desire to learn it. Trouble is, I don't have any project that calls for it - there's nothing I'm desperately wanting to do that involves both Python and C/C++. A

Re: GO vs Python

2014-08-24 Thread Terry Reedy
On 8/24/2014 10:57 PM, Sam Fourman Jr. wrote: my initial reason for even looking at GO, was because, I noticed that if I wanted to move my largest clients app from Python 2.x to 3.x it was almost a rewrite. idlelib comprises about 60 .py files. The 2.7 versus 3.4 versions are perhaps 99%

Python and RTSP client

2014-08-24 Thread Akshay Verma
I have to read a RTSP stream in my program and return network status while doing so. Can anybody guide me through it? I have searched online, there are few repos on github, gstreamer python binding and others. Which one is better? Best Regards, Akshay Verma. -- https://mail.python.org/mailman/li

Re: GO vs Python

2014-08-24 Thread Chris Angelico
On Mon, Aug 25, 2014 at 1:27 PM, Sam Fourman Jr. wrote: > I remember doing some browsing around, and the pooco people that make jinja2 > were not fans of python3(I forget the blog post), I got scared because a > very large portion of my income was based on a single client... So since we > were hav

Re: GO vs Python

2014-08-24 Thread Sam Fourman Jr.
On Sun, Aug 24, 2014 at 10:07 PM, Chris Angelico wrote: > On Mon, Aug 25, 2014 at 12:57 PM, Sam Fourman Jr. > wrote: > > my initial reason for even looking at GO, was because, I noticed that if > I > > wanted to move my largest clients app from Python 2.x to 3.x it was > almost a > > rewrite

Re: Challenge to convert a simple IDL code into Python

2014-08-24 Thread Steven D'Aprano
Cleo Drakos wrote: > Thanks for your response. > > The IDL code reads the given binary file, and prints out the data inside > it. The binary file structure is provided using the variable 'data' in the > IDL code. Then it print the only required data that in side the 'data > that is precip. > >

Re: GO vs Python

2014-08-24 Thread Chris Angelico
On Mon, Aug 25, 2014 at 12:57 PM, Sam Fourman Jr. wrote: > my initial reason for even looking at GO, was because, I noticed that if I > wanted to move my largest clients app from Python 2.x to 3.x it was almost a > rewrite. and then when I noticed the libraries for python 3.x were > limited, a

Re: Working with decimals

2014-08-24 Thread Chris Angelico
On Mon, Aug 25, 2014 at 12:51 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> I love this list. We can go off on a ridiculously long tangent, simply >> because I said that it's only *usually* best to put imports at the top >> of the file. We all agree that it normally is indeed best to hoi

Re: GO vs Python

2014-08-24 Thread Sam Fourman Jr.
On Sun, Aug 24, 2014 at 9:36 PM, Rodrick Brown wrote: > I spent a few weeks looking at Go and have to say you can see a lot of > Python's influence in Go, however my question to this list for others who > are doing real work with Go and Python have you encountered any scenarios > in which Go outm

Re: Working with decimals

2014-08-24 Thread Steven D'Aprano
Chris Angelico wrote: > I love this list. We can go off on a ridiculously long tangent, simply > because I said that it's only *usually* best to put imports at the top > of the file. We all agree that it normally is indeed best to hoist > them, and here we are, arguing over measurement methods on

GO vs Python

2014-08-24 Thread Rodrick Brown
I spent a few weeks looking at Go and have to say you can see a lot of Python's influence in Go, however my question to this list for others who are doing real work with Go and Python have you encountered any scenarios in which Go outmatched Python in terms of elegance or performance? --RB -- htt

Re: what do you get with 1 divide by 998001, interesting results

2014-08-24 Thread Chris Angelico
On Mon, Aug 25, 2014 at 10:04 AM, Everything You Need To Know wrote: > *** Please do not respond, I would like to see this thread dissapear and > reintroduce myself in 4 weeks! Just so you know, asking people to not respond almost never works. :) On the flip side, asking for responses often doe

Re: Working with decimals

2014-08-24 Thread Chris Angelico
On Mon, Aug 25, 2014 at 12:16 PM, Steven D'Aprano wrote: > Joshua Landau wrote: > > > python -c "import sys; print('math' in sys.modules)" >> False >> >> An even easier check: >> > python -c "import time; a = time.time(); import math; b = time.time(); > print(b-a)" >> 0.000601291656494

Re: Working with decimals

2014-08-24 Thread Steven D'Aprano
Joshua Landau wrote: python -c "import sys; print('math' in sys.modules)" > False > > An even easier check: > python -c "import time; a = time.time(); import math; b = time.time(); print(b-a)" > 0.0006012916564941406 > python -c "import math, time; a = time.time(); import m

Re: Python makes Dilbert's list

2014-08-24 Thread William Ray Wing
On Aug 24, 2014, at 7:18 PM, Terry Reedy wrote: > For Sunday, Aug 24, 2014. > http://www.dilbert.com/dyn/str_strip/0//000/20/2/5000/500/225504/225504.strip.sunday.gif > — And at the risk of straying a bit OT, here is what Dilbert should have pointed his boss at wrt s

Re: what do you get with 1 divide by 998001, interesting results

2014-08-24 Thread Everything You Need To Know
> eyntk: > > I have a certain affection for your videos. I'm not sure they are > useful to all, but maybe interesting to some. Kudos to all who try to > spread their interest and knowledge. But this is a tough and very > fair and generous crowd here I believe. Its probably better to listen >

Python makes Dilbert's list

2014-08-24 Thread Terry Reedy
For Sunday, Aug 24, 2014. http://www.dilbert.com/dyn/str_strip/0//000/20/2/5000/500/225504/225504.strip.sunday.gif -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with decimals

2014-08-24 Thread Seymore4Head
On Sun, 24 Aug 2014 14:24:19 -0700, Larry Hudson wrote: >On 08/24/2014 08:12 AM, Seymore4Head wrote: >[snip] >> I almost moved, but I was looking at the print out again for this one: >> print('%3d $%-13.2f $%-14.2f' % (count, payment, balance)) >> >> I can't understand why the $%-13.2f is pushed

Re: Working with decimals

2014-08-24 Thread Larry Hudson
On 08/24/2014 08:12 AM, Seymore4Head wrote: [snip] I almost moved, but I was looking at the print out again for this one: print('%3d $%-13.2f $%-14.2f' % (count, payment, balance)) I can't understand why the $%-13.2f is pushed against the first column, but the $%-14.2f is not. It seems like the

Re: Working with decimals

2014-08-24 Thread Joshua Landau
On 24 August 2014 20:40, Ian Kelly wrote: > That's the same check I posted, just using the in operator instead of a > straight lookup and raising an error. I think I need to take a break from the internet. This is the second time in as many threads that I've responded with what I'm commenting on.

[ANN] Pylint 1.3.1 / Astroid 1.2.1 released

2014-08-24 Thread Claudiu Popa
Hello! I'm happy to announce that Pylint 1.3.1 and Astroid 1.2.1 were released. These releases include some bugfixes with the new string formatting checker and a couple of crash fixes. Please note that Pylint 1.3.X is the last version of Pylint which supports Python 2.5 and 2.6. Enjoy! -- https

Re: Working with decimals

2014-08-24 Thread Ian Kelly
On Sun, Aug 24, 2014 at 1:29 PM, Joshua Landau wrote: > > On 24 August 2014 20:25, Joshua Landau wrote: > > On 24 August 2014 20:19, Ian Kelly wrote: > >> On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly wrote: > >>> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: > >>> > Is math not already i

Re: Working with decimals

2014-08-24 Thread Ian Kelly
On Sun, Aug 24, 2014 at 1:25 PM, Joshua Landau wrote: > On 24 August 2014 20:19, Ian Kelly wrote: > > On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly > wrote: > >> > >> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau > wrote: > >> > Is math not already imported by start-up? > >> > >> Why would it be

Re: Working with decimals

2014-08-24 Thread Joshua Landau
On 24 August 2014 20:25, Joshua Landau wrote: > On 24 August 2014 20:19, Ian Kelly wrote: >> On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly wrote: >>> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: >>> > Is math not already imported by start-up? > > I don't mean into the global namespace, bu

Re: Som confusion about the python library installation

2014-08-24 Thread Michael Torrie
On 08/24/2014 03:17 AM, Heinz Schmitz wrote: > Don't forget to mention the hardware requirements for 14.04. > Me thinks that a single core CPU and a medium class graphics > card won't make the user happy with it. > Wouldn't it be friendly to the resources of our world if at least > some software

Re: Working with decimals

2014-08-24 Thread Joshua Landau
On 24 August 2014 20:19, Ian Kelly wrote: > On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly wrote: >> >> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: >> > Is math not already imported by start-up? >> >> Why would it be? > > It's easy to check, by the way: > > $ python -c "import sys; print(s

Re: Global indent

2014-08-24 Thread Joshua Landau
On 23 August 2014 22:55, Rustom Mody wrote: > On Sunday, August 24, 2014 2:27:56 AM UTC+5:30, Joshua Landau wrote: > >> Ay, so is any editor with an API. I use Sublime mostly because it's >> pretty, fast and has a Python-based API. The only actual feature it >> has that some others don't is multip

Re: Working with decimals

2014-08-24 Thread Ian Kelly
On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly wrote: > > On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: > > Is math not already imported by start-up? > > Why would it be? It's easy to check, by the way: $ python -c "import sys; print(sys.modules['math'])" Traceback (most recent call last):

Re: Working with decimals

2014-08-24 Thread Ian Kelly
On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: > Is math not already imported by start-up? Why would it be? -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with decimals

2014-08-24 Thread Joshua Landau
On 23 August 2014 23:53, Chris Angelico wrote: > On Sun, Aug 24, 2014 at 8:47 AM, Joshua Landau wrote: >> On 23 August 2014 23:31, Chris Angelico wrote: >>> I'd say "never" is too strong (there are times when it's right to put >>> an import inside a function), but yes, in this case it should rea

Re: Challenge to convert a simple IDL code into Python

2014-08-24 Thread Gary Herron
On 08/24/2014 08:38 AM, Cleo Drakos wrote: Here is IDL code: |pro read_binary_file file= "3B42RT.2014010318.7.bin" num_lon= 1440 num_lat= 480 data= {header: bytarr(num_lon*2), precip: intarr(num_lon,num_lat), precip_error: intarr(num_lon,num_lat), $ source_of_estimate: byt

Challenge to convert a simple IDL code into Python

2014-08-24 Thread Cleo Drakos
Here is IDL code: pro read_binary_file file = "3B42RT.2014010318.7.bin" num_lon = 1440 num_lat = 480 data = {header: bytarr(num_lon*2), precip: intarr(num_lon,num_lat), precip_error: intarr(num_lon,num_lat), $ source_of_estimate: bytarr(num_lon,num_lat), precip_uncal: intarr(num_lon,num_l

Re: Working with decimals

2014-08-24 Thread Seymore4Head
On Sun, 24 Aug 2014 00:04:29 -0700, Larry Hudson wrote: >On 08/23/2014 02:13 PM, Seymore4Head wrote: >> On Sat, 23 Aug 2014 13:47:20 -0400, Seymore4Head >> >> I found this function that I will be saving for later. >> def make_it_money(number): >> import math >> return '$' + str(format(m

Re: Working with decimals

2014-08-24 Thread Seymore4Head
On Sun, 24 Aug 2014 00:04:29 -0700, Larry Hudson wrote: >On 08/23/2014 02:13 PM, Seymore4Head wrote: >> On Sat, 23 Aug 2014 13:47:20 -0400, Seymore4Head >> >> I found this function that I will be saving for later. >> def make_it_money(number): >> import math >> return '$' + str(format(m

Re: Python vs C++

2014-08-24 Thread Joseph Martinot-Lagarde
Le 23/08/2014 16:21, Chris Angelico a écrit : On Sun, Aug 24, 2014 at 12:02 AM, Ian Kelly wrote: I don't know how fast lilypond is, but perhaps one could write an editor that wraps lilypond and invokes it in realtime to show the output in an adjacent panel, perhaps with a brief delay when the u

Re: Som confusion about the python library installation

2014-08-24 Thread Heinz Schmitz
Michael Torrie wrote: >You could try Ubuntu 14.04. Don't forget to mention the hardware requirements for 14.04. Me thinks that a single core CPU and a medium class graphics card won't make the user happy with it. Wouldn't it be friendly to the resources of our world if at least some software wa

Re: Python vs C++

2014-08-24 Thread Robert Kern
On 2014-08-22 01:26, Chris Angelico wrote: On Fri, Aug 22, 2014 at 4:05 AM, Joseph Martinot-Lagarde wrote: For information, Cython works with C++ now: http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html. Now isn't that cool! Every time Cython gets discussed, I get a renewed desire t

Re: the output in reference of descriptor.

2014-08-24 Thread Steven D'Aprano
luofeiyu wrote: > let me paste it again to make my question more clear: > > >>>c2.d > __get__() is called <__main__.C2 object at 0x0297BE10> > > <__main__.C object at 0x0297BBA8> You have an instance c2. You do an attribute lookup on d, which is a descriptor, so d

Best place to start of learning the raspberry pi

2014-08-24 Thread Nicholas Cannon
Hey I bought a raspberry pi, a bread board and all this electronics stuff and i really enjoy programming stuff in python and i have had a decent of practise with python. I really wont to get into making things with electronics(i have had a lot of practise with soldering as well) and then program

Re: Working with decimals

2014-08-24 Thread Larry Hudson
On 08/23/2014 02:13 PM, Seymore4Head wrote: On Sat, 23 Aug 2014 13:47:20 -0400, Seymore4Head I found this function that I will be saving for later. def make_it_money(number): import math return '$' + str(format(math.floor(number * 100) / 100, ',.2f')) (I still need more practice to fi