Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 3:56 PM, dieter wrote: > Chris Angelico writes: >> Frankly, I wouldn't write OO in anything, because I think the entire >> concept of a WYSIWYG editor is flawed. > > That would limit (so called) office applications to experts only. > But the success of these applications r

Re: Python vs C++

2014-08-22 Thread dieter
Chris Angelico writes: > Frankly, I wouldn't write OO in anything, because I think the entire > concept of a WYSIWYG editor is flawed. That would limit (so called) office applications to experts only. But the success of these applications relies on the fact, that even a complete novice can immedi

Re: Python vs C++

2014-08-22 Thread dieter
Christian Gollwitzer writes: > ... > * Java: I don't see that it is much higher level than C++. It has a > GC, but that's all, and you can have that in C++, too, if you want. On > the other hand, you loose the metaprogramming facilities provided by > C++ templates (needs a guru to make a library,

Re: the output in reference of descriptor.

2014-08-22 Thread CHIN Dihedral
On Friday, August 22, 2014 9:25:02 AM UTC+8, luofeiyu wrote: > class C(object): > Well, in python class is treated as onte of the first class built in operations. class "new_class_ame" ( parentclasses) Please check this syntax first in Python. > a = 'abc' > > def __getattri

Re: the output in reference of descriptor.

2014-08-22 Thread Ian Kelly
On Thu, Aug 21, 2014 at 7:25 PM, luofeiyu wrote: > >>> c2.d.a > __get__() is called <__main__.C2 object at 0x0297BE10> C2'> > __getattribute__() is called > 'abc' > > Why the result of c2.d.a is not : > > __get__() is called <__main__.C2 object at 0x0297BE10> C2'> > __getattribu

Re: python-daemon for Python v3

2014-08-22 Thread Terry Reedy
On 8/22/2014 9:09 PM, Y@i$el wrote: A mi si me ha dado problemas. No tengo forma de decirle que se ejecute como usuario www-data y cuando lo intento deja de funcionar abruptamente. I can almost, but not really understand and translate the question. Possiblemente debe visitar un grupo in espan

Re: Why can not initialize the class?

2014-08-22 Thread Terry Reedy
On 8/22/2014 7:28 PM, Ben Finney wrote: Terry Reedy writes: By posting code with an extra indent, you make it imposible to run by just cutting and pasting. You should already know that. I commonly do that, It is unnecessary and extra work on both ends. It is also ambiguous in that there m

Re: Halfway point between interactive and daemon?

2014-08-22 Thread Cameron Simpson
On 22Aug2014 12:27, Travis Griggs wrote: I’m curious if there’s a technique one could use to get half way there. Basically, with minimal modifications, I’d like to get it running at startup. So I can put a line like this in rc.local nohup python3 myMain.py 2>&1 > /var/log/mylog.log & Just

Re: python-daemon for Python v3

2014-08-22 Thread Y@i$el
A mi si me ha dado problemas. No tengo forma de decirle que se ejecute como usuario www-data y cuando lo intento deja de funcionar abruptamente. Saludos. -- https://mail.python.org/mailman/listinfo/python-list

Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Dan Stromberg
On Thu, Aug 21, 2014 at 12:55 AM, wrote: > Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic > (in a "we-are-all-grown-ups" fashion, ahem)enough to get its way into the > language > this is what yours truly thinks: don't we all know that ":" means the next > token mus

Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Dan Stromberg
On Thu, Aug 21, 2014 at 12:55 AM, wrote: > Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic > (in a "we-are-all-grown-ups" fashion, ahem)enough to get its way into the > language > this is what yours truly thinks: don't we all know that ":" means the next > token mus

Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu
One final version: class Contact(object): def __init__(self, email="haha@haha"): self.email = email def _get_email(self): return self._the_secret_private_email def _set_email(self, value): self.self._the_secret_private_email = value email = property(_get_em

Re: Why can not initialize the class?

2014-08-22 Thread Ben Finney
Terry Reedy writes: > By posting code with an extra indent, you make it imposible to run by > just cutting and pasting. You should already know that. I commonly do that, as I do with most block quotes in plain text. I think it's a reasonable expectation that programmers, reading a forum about p

Re: Why can not initialize the class?

2014-08-22 Thread Terry Reedy
On 8/22/2014 10:26 AM, luofeiyu wrote: System:win7+python34. class Contact(object): def __init__(self, first_name=None, last_name=None, display_name=None, email=None): self.first_name = first_name self.last_name = last_name

Re: Som confusion about the python library installation

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 1:46 AM, Jiafan Zhou wrote: > Another separate question in relation, do I really need to install the > python-nose in ubuntu. Can I not just go directly to pip and install the nose > library? > If you're going to use pip to install nose, I recommend not having it install

Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 7:56 AM, Michael Torrie wrote: > On 08/22/2014 03:49 PM, Chris Angelico wrote: >> My main issue with callbacks in either C or C++ is that functions >> aren't first-class objects. You can pass function pointers around (and >> you don't need (void *) to do it, you can use typ

Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/22/2014 03:49 PM, Chris Angelico wrote: > My main issue with callbacks in either C or C++ is that functions > aren't first-class objects. You can pass function pointers around (and > you don't need (void *) to do it, you can use typed function pointers > just fine), but you can't actually con

Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 7:38 AM, Michael Torrie wrote: > On 08/22/2014 02:06 PM, Marko Rauhamaa wrote: >> I tend to think the opposite: C++ barely has a niche left. I definitely >> wouldn't want to use C++ very far from its (very narrow) sweet spot. > > I agree that it's niche is narrowing. But i

Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/22/2014 02:06 PM, Marko Rauhamaa wrote: > I tend to think the opposite: C++ barely has a niche left. I definitely > wouldn't want to use C++ very far from its (very narrow) sweet spot. I agree that it's niche is narrowing. But it's still pretty wide and widely used. Many adobe products are

Re: Global indent

2014-08-22 Thread Dan Stromberg
On Fri, Aug 22, 2014 at 1:16 PM, Neil D. Cerutti wrote: >> Emacs and vim both have huge learning curves that I've decided aren't >> worth climbing. Notepad++ is an excellent GUI text editor for Windows. >> Geany is nearly as good, and runs on anything. > > > They do have a very long learning incl

Re: Global indent

2014-08-22 Thread Mark Lawrence
On 22/08/2014 21:20, Chris Angelico wrote: On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that.

Re: Halfway point between interactive and daemon?

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 5:27 AM, Travis Griggs wrote: > I’m curious if there’s a technique one could use to get half way there. > Basically, with minimal modifications, I’d like to get it running at startup. Okay, hold on a minute there. There are two quite separate things here: daemonization, a

Re: Global indent

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head wrote: > On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head > wrote: > >>Is there a way to indent everything again? >> >>Say I have a while statement with several lines of code and I want to >>add a while outside that. That means indenting everything.

Re: Global indent

2014-08-22 Thread Neil D. Cerutti
On 8/22/2014 3:54 PM, Rob Gaddi wrote: On Fri, 22 Aug 2014 15:46:33 -0400 Seymore4Head wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that.

Re: Global indent

2014-08-22 Thread Marko Rauhamaa
Rob Gaddi : > Emacs and vim both have huge learning curves Really now? When you start emacs, it advises you to start the builtin tutorial. That's how I learned it in the 1980's and didn't experience any learning curve. Nowadays, emacs has a GUI that makes you productive immediately without any

Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa
>> assembly >> C >>C++ >>Go >> Java/C# >> Python >> Scheme >> Bash > > > My point is that this picture is incomplete: it shows the programming > languages as *poi

Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Travis Griggs
On Aug 21, 2014, at 12:55 AM, icefap...@gmail.com wrote: > Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic > (in a "we-are-all-grown-ups" fashion, ahem)enough to get its way into the > language > this is what yours truly thinks: don't we all know that ":" means the n

Re: Global indent

2014-08-22 Thread Simon Ward
On 22 August 2014 19:44:39 BST, "Neil D. Cerutti" wrote: >This sort of simple task [indenting blocks of text] is why fancy text editors >were invented. > >I use and recommend gvim (press > in select mode using the standard >python plugin), but there are plenty of options out there. Even with

Re: Python vs C++

2014-08-22 Thread Stefan Behnel
If you want to add Cython to that (overly simplified) graph, you might get something like this: Christian Gollwitzer schrieb am 22.08.2014 um 21:25: > as |--| > c || > c++ |---| Cython || > python|---

Re: Global indent

2014-08-22 Thread Rob Gaddi
On Fri, 22 Aug 2014 15:46:33 -0400 Seymore4Head wrote: > On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head > wrote: > > >Is there a way to indent everything again? > > > >Say I have a while statement with several lines of code and I want to > >add a while outside that. That means indenting ever

Re: Global indent

2014-08-22 Thread Seymore4Head
On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head wrote: >Is there a way to indent everything again? > >Say I have a while statement with several lines of code and I want to >add a while outside that. That means indenting everything. Is there >a global way to do that? Ok.so the answer is no

Re: Halfway point between interactive and daemon?

2014-08-22 Thread Marko Rauhamaa
Travis Griggs : > nohup python3 myMain.py 2>&1 > /var/log/mylog.log & I don't recommend this (ubiquitous) technique. You should keep your daemon in the foreground until it has reserved and initialized all the resources it needs and daemonize only then. That way the caller does not have to guess w

Re: Python vs C++

2014-08-22 Thread Christian Gollwitzer
Am 22.08.14 11:29, schrieb Marko Rauhamaa: So my advise is, use as high-level programming language as you can. If you can't, deal with it, but often you can break your system into parts where only a small corner needs to be implemented at the low level. Agreed. This is called Ousterhout's dicho

Halfway point between interactive and daemon?

2014-08-22 Thread Travis Griggs
I have a python3 program that performs a long running service on a semi embedded linux device. I've been in the prototyping stage. I just run it from the command line and use print() statements to let me know the thing is making acceptable process. At some point, I need to properly daemonize i

Re: Global indent

2014-08-22 Thread Dan Stromberg
On Fri, Aug 22, 2014 at 11:44 AM, Neil D. Cerutti wrote: > On 8/22/2014 2:19 PM, Seymore4Head wrote: >> >> Is there a way to indent everything again? >> >> Say I have a while statement with several lines of code and I want to >> add a while outside that. That means indenting everything. Is there

Re: Python vs C++

2014-08-22 Thread CHIN Dihedral
On Friday, August 22, 2014 8:26:00 AM UTC+8, 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! > > >

Re: Global indent

2014-08-22 Thread Neil D. Cerutti
On 8/22/2014 2:19 PM, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? This sort of simple task is why fancy text e

Re: Global indent

2014-08-22 Thread Skip Montanaro
On Fri, Aug 22, 2014 at 1:19 PM, Seymore4Head wrote: > Say I have a while statement with several lines of code and I want to > add a while outside that. That means indenting everything. Is there > a global way to do that? Depends on your text editor/IDE. In Emacs using either python-mode.el or

Global indent

2014-08-22 Thread Seymore4Head
Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? -- https://mail.python.org/mailman/listinfo/python-list

Re: error building lxml.etree

2014-08-22 Thread Stefan Behnel
Robin Becker schrieb am 22.08.2014 um 17:50: > I'm trying to build a bunch of extensions in a 2.7 virtual environment on a > centos 7 VM. I don't know centos very well and I understand centos 7 is > quite new > >> building 'lxml.etree' extension >> >> creating build/temp.linux-x86_64-2.7 >> >> cre

Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa
Skip Montanaro : > On Fri, Aug 22, 2014 at 7:51 AM, Neil D. Cerutti wrote: >> But I contend you do need to be a Medieval Scholar to compile and link it. > > That's only because whoever wrote your Makefile wasn't skilled in the > art of make recipes. :-) Make shouldn't be involved in any serious

Re: Python vs C++

2014-08-22 Thread Joseph Martinot-Lagarde
Le 22/08/2014 02:26, Chris Angelico a écrit : 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 desir

Re: Som confusion about the python library installation

2014-08-22 Thread Michael Torrie
On 08/22/2014 09:46 AM, Jiafan Zhou wrote: > I guess it must be the 1.3.3 version being used in the system, but > why apt-get still reports 1.1.2-3 and this worries me a little. > > Another separate question in relation, do I really need to install > the python-nose in ubuntu. Can I not just go di

error building lxml.etree

2014-08-22 Thread Robin Becker
I'm trying to build a bunch of extensions in a 2.7 virtual environment on a centos 7 VM. I don't know centos very well and I understand centos 7 is quite new building 'lxml.etree' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src creating build/temp.linu

Som confusion about the python library installation

2014-08-22 Thread Jiafan Zhou
Hi all, Need some explanation on my already done python library installation. I was informed to work on a python project which requires a number of python libraries. One of them is the python-nose unit testing framework Since I am in Ubuntu 12.04 lts, the first thing I did was to issue the bel

Re: Why can not initialize the class?

2014-08-22 Thread Steven D'Aprano
Luofeiyu, you are getting stuck on basic questions. Before working with advanced features like properties, you should learn the simply features. luofeiyu wrote: > >>> class Contact(object): > ... def __init__(self, first_name=None, last_name=None, > ... display_name=None, em

Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu
>>> class Contact(object): ... def __init__(self, first_name=None, last_name=None, ... display_name=None, email="haha@haha"): ... self.first_name = first_name ... self.last_name = last_name ... self.display_name = display_name ... self.email = e

Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:58 AM, luofeiyu wrote: class Contact(object): > ... def __init__(self, first_name=None, last_name=None, > ... display_name=None, email="haha@haha"): > ... self.first_name = first_name > ... self.last_name = last_name > ...

Re: Installing Problems - 'Key not valid for use in specified state.'

2014-08-22 Thread Michael Torrie
On 08/22/2014 05:51 AM, FreddieH wrote: > I am having trouble installing Python on my Windows 7 (x64) Laptop. > The MSI file for Python 3.4.1 that I have downloaded got to the set up page > containing 'Please wait while the Installer installs Python 3.4.1' and asks > for administrator permission

Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/21/2014 06:54 AM, David Palao wrote: > Hello, > I consider myself a python programmer, although C++ was one of the > first languages I learned (not really deeply and long time ago). > > Now I decided to retake C++, to broaden my view of the business. > However, as I progress in learning C++,

Re: Why can not initialize the class?

2014-08-22 Thread Joel Goldstick
On Fri, Aug 22, 2014 at 10:42 AM, luofeiyu wrote: > how to fix the code then? > > On 8/22/2014 10:36 PM, Larry Martell wrote: >> >> The 'in' operator requires an iterable. When you do 'self.email = email' >> set_email gets called and value is None. > > You might want to set your default values to

Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu
how to fix the code then? On 8/22/2014 10:36 PM, Larry Martell wrote: The 'in' operator requires an iterable. When you do 'self.email = email' set_email gets called and value is None. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:26 AM, luofeiyu wrote: > System:win7+python34. > > class Contact(object): > def __init__(self, first_name=None, last_name=None, > display_name=None, email=None): > self.first_name = first_name > self.last_name = la

Why can not initialize the class?

2014-08-22 Thread luofeiyu
System:win7+python34. class Contact(object): def __init__(self, first_name=None, last_name=None, display_name=None, email=None): self.first_name = first_name self.last_name = last_name self.display_name = display_name

Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Fri, Aug 22, 2014 at 10:51 PM, Neil D. Cerutti wrote: > C itself is very simple (albeit not simple to use). But I contend you do > need to be a Medieval Scholar to compile and link it. My mind boggles > watching a ./configure vomit ASCII all over my screen. I have to avert my > eyes, make a wis

Re: Python vs C++

2014-08-22 Thread Skip Montanaro
On Fri, Aug 22, 2014 at 7:51 AM, Neil D. Cerutti wrote: > But I contend you do need to be a Medieval Scholar to compile and link it. That's only because whoever wrote your Makefile wasn't skilled in the art of make recipes. :-) Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Python vs C++

2014-08-22 Thread Neil D. Cerutti
On 8/22/2014 5:29 AM, Marko Rauhamaa wrote: C is readily supported by all extension APIs. Its calling conventions are stable and well-understood. Its runtime requirements are trivial. Plus, you don't have to be a Medieval Scholar to program in it. C itself is very simple (albeit not simple to u

Installing Problems - 'Key not valid for use in specified state.'

2014-08-22 Thread FreddieH
I am having trouble installing Python on my Windows 7 (x64) Laptop. The MSI file for Python 3.4.1 that I have downloaded got to the set up page containing 'Please wait while the Installer installs Python 3.4.1' and asks for administrator permission to continue the installation. After I give admin

Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Aug 22, 2014 at 6:05 PM, Christian Gollwitzer wrote: >> I'm not even convinced that the development time is significantly >> lower in Python within this overlap. > > It usually will be, though not always. Even more to the point, it is far easier to program correctly in

Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Fri, Aug 22, 2014 at 6:05 PM, Christian Gollwitzer wrote: > I'm not even convinced that the development time is significantly lower in > Python within this overlap. It usually will be, though not always. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python vs C++

2014-08-22 Thread Christian Gollwitzer
Am 21.08.14 14:54, schrieb David Palao: I consider myself a python programmer, although C++ was one of the first languages I learned (not really deeply and long time ago). Now I decided to retake C++, to broaden my view of the business. However, as I progress in learning C++, I cannot take out o

Re: when the method __get__ will be called?

2014-08-22 Thread Steven D'Aprano
Luofeiyu, you are asking very advanced questions. How experienced with Python are you? Asking about __get__ is nearly never needed. __get__ is used internally by built-ins like property, classmethod and staticmethod. 99.99% of Python programmers will never need to write a __get__ method, and of the

Re: when the method __get__ will be called?

2014-08-22 Thread Peter Otten
luofeiyu wrote: > class C(object): > a = 'abc' > def __getattribute__(self, *args, **kwargs): > print("__getattribute__() is called") > return object.__getattribute__(self, *args, **kwargs) > def __getattr__(self, name): > print("__getattr__() is called ")

when the method __get__ will be called?

2014-08-22 Thread luofeiyu
class C(object): a = 'abc' def __getattribute__(self, *args, **kwargs): print("__getattribute__() is called") return object.__getattribute__(self, *args, **kwargs) def __getattr__(self, name): print("__getattr__() is called ") return name + " from getatt