Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-20 Thread Chris Angelico
On Mon, Oct 21, 2013 at 1:07 PM, Steven D'Aprano wrote: > One of the reasons multiple languages exist is because people find that > useful programming idioms and styles are *hard to use* or "ugly" in some > languages, so they create new languages with different syntax to make > those useful patter

Re: Printing a drop down menu for a specific field.

2013-10-20 Thread Ben Finney
Νίκος Αλεξόπουλος writes: > Any help would be appreciated. Please stop posting merely for grabbing attention. If someone is going to answer, they'll answer. Don't annoy the forum with pleas for attention. -- \“Program testing can be a very effective way to show the | `\

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-20 Thread Peter Cacioppi
I've written a fair bit of code in pure C, C++, C#, Java and now getting there in Python. The difference between C# and Java is fairly minor. The others have large and significant differences between them. Garbage collectors or not is huge. Exceptions or not is huge. Dynamic or static typing

Re: Printing a drop down menu for a specific field.

2013-10-20 Thread Νίκος Αλεξόπουλος
Στις 21/10/2013 2:30 πμ, ο/η Νίκος Αλεξόπουλος έγραψε: try: cur.execute( '''SELECT host, city, useros, browser, ref, hits, lastvisit FROM visitors WHERE counterID = (SELECT ID FROM counters WHERE url = %s) ORDER BY lastvisit DESC''', page ) data = cur.fetchall() for row in data:

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-20 Thread rusi
On Monday, October 21, 2013 7:51:12 AM UTC+5:30, Roy Smith wrote: > In article > Steven D'Aprano wrote: > > > According to > > some, Java, which has many low-level machine primitive types, is an > > object-oriented language, while Python, which has no machine primitives > > and where every v

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
That sound you hear is Roy Smith hitting the nail on the head. -- https://mail.python.org/mailman/listinfo/python-list

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
That sound you here is Roy Smith hitting the nail on the head re: C++ and Scott Meyers. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-20 Thread Mark Janssen
> Gccpy is an Ahead of time implementation of Python ontop of GCC. So it > works as you would expect with a traditional compiler such as GCC to > compile C code. Or G++ to compile C++ etc. That is amazing. I was just talking about how someone should make a front-end to GCC on this list a couple o

how to get current max_heap_size value of minimark in pypy 2.x

2013-10-20 Thread roadhome
Hello, I read some articles about setting PYPY_GC_MAX environment variable. But I can't find how to get current max_heap_size value of minimark. Please let me know how-to :) Thanks, Ricky -- https://mail.python.org/mailman/listinfo/python-list

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-20 Thread Roy Smith
In article <52648c54$0$29981$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > According to > some, Java, which has many low-level machine primitive types, is an > object-oriented language, while Python, which has no machine primitives > and where every value is an object, is not.

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-20 Thread Steven D'Aprano
On Fri, 18 Oct 2013 22:26:02 -0700, rusi wrote: > On Saturday, October 19, 2013 2:02:24 AM UTC+5:30, Peter Cacioppi wrote: >> >> I still say that object-based is a distinct and meaningful subset of >> object-oriented programming. > > Yes that is what is asserted by > http://www-public.int-evry.f

[RELEASED] Python 3.4.0a4

2013-10-20 Thread Larry Hastings
On behalf of the Python development team, I'm very pleased to announce the fourth and final alpha release of Python 3.4. This is a preview release, and its use is not recommended for production settings. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Ben Finney
Roy Smith writes: > Scott Meyers is an incredibly smart C++ wizard. His books are amazing. > The fact that it takes somebody that smart, and books that amazing, to > teach you how not to shoot yourself in the foot with a C++ compiler says > a lot about the language. +1 QotW -- \ “[W]

Printing a drop down menu for a specific field.

2013-10-20 Thread Νίκος Αλεξόπουλος
try: cur.execute( '''SELECT host, city, useros, browser, ref, hits, lastvisit FROM visitors WHERE counterID = (SELECT ID FROM counters WHERE url = %s) ORDER BY lastvisit DESC''', page ) data = cur.fetchall() for row in data: (host, city, useros,

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Roy Smith
In article , Peter Cacioppi wrote: > I read Scott Meyers books on C++ and STL a couple of times > each and helped design the protocol that kept us reasonably safe. Scott Meyers is an incredibly smart C++ wizard. His books are amazing. The fact that it takes somebody that smart, and books t

Re: Python Front-end to GCC

2013-10-20 Thread victorgarcianet
On Sunday, October 20, 2013 3:56:46 PM UTC-2, Philip Herron wrote: > I've been working on GCCPY since roughly november 2009 at least in its > concept. It was announced as a Gsoc 2010 project and also a Gsoc 2011 > project. I was mentored by Ian Taylor who has been an extremely big > influence on my

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
At the risk of sounding like a fogey, I actually think I did, at one time, know the distinctions between "our projects protocol" and "the language proper" for C++. I read Scott Meyers books on C++ and STL a couple of times each and helped design the protocol that kept us reasonably safe. But t

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Chris Angelico
On Mon, Oct 21, 2013 at 4:57 AM, Peter Cacioppi wrote: >> You certainly don't have to write a constructor for a subclass in C++. > > Ahh, this message board is so collectively well informed (once you get past > the trolls) > > The C++ project I worked on was religious about always overwriting pa

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Roy Smith
In article <0e9b51a9-bd78-4d34-b277-c463347e8...@googlegroups.com>, Peter Cacioppi wrote: > > You certainly don't have to write a constructor for a subclass in C++. > > Ahh, this message board is so collectively well informed (once you get past > the trolls) > > The C++ project I worked on

On click functions with turtle?

2013-10-20 Thread baujacob
Hi everyone, I have this program that writes out the name "John" in block letters. I was just messing around because we were just introduced to turtle a few weeks ago in class and I'm just getting the hang of it. Before I was using "goto" a certain angle, but now I'm using "seth" and it's so muc

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
> You certainly don't have to write a constructor for a subclass in C++. Ahh, this message board is so collectively well informed (once you get past the trolls) The C++ project I worked on was religious about always overwriting parent class constructors. I had assumed this was because the lan

Python Front-end to GCC

2013-10-20 Thread Philip Herron
Hey, I've been working on GCCPY since roughly november 2009 at least in its concept. It was announced as a Gsoc 2010 project and also a Gsoc 2011 project. I was mentored by Ian Taylor who has been an extremely big influence on my software development carrer. Gccpy is an Ahead of time implementati

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Devin Jeanpierre
On Sat, Oct 19, 2013 at 2:44 PM, Peter Cacioppi wrote: > Is the following considered poor Python form? > > class Foo (object) : > _lazy = None > def foo(self, x) : > self._lazy = self._lazy or self.get_something(x) > def get_something(self, x) : > # doesn't really matte

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Mark Lawrence
On 20/10/2013 08:09, Peter Cacioppi wrote: Personally, I find the ability of Python to subclass without overriding the constructor very elegant. __new__ is the constructor which to my knowledge you've not mentioned, __init__ is the initialiser as mentioned by Ben Finney. -- Roses are red,

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Roy Smith
In article , Peter Cacioppi wrote: > Personally, I find the ability of Python to subclass without overriding the > constructor very elegant. I don't believe the other languages I've worked in > can do this (C++, C#, Java)... I'm not sure what point you're trying to make here. You certainly d

Detecting whether a value was passed for a parameter (was: skipping __init__ and using exploiting a class member instead)

2013-10-20 Thread Ben Finney
Peter Cacioppi writes: > I was laboring under some misconception that there was Python magic > that allowed __init__ and only __init__ to add class attributes by > setting their values. Good to know this piece of magic isn't part of > Python, and thus lazy eval can be handled more cleanly than I

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-20 Thread Mark Lawrence
On 20/10/2013 03:13, Roy Smith wrote: In article , Chris Angelico wrote: Heck, I can't even really move off 2.6 because we use Amazon's EMR service, which is stuck on 2.6. Hrm. 2.6 is now in source-only security-only support, and that's about to end (there's a 2.6.9 in the pipeline, and th

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
> Why not simply have one, and use it to initialize your attributes, > even if it is to None? Think about it this way. None here really means "not yet initialized". It is a value that cannot occur naturally and thus functions as a not-initialized flag. But for different contexts, this value co

Re: converting letters to numbers

2013-10-20 Thread rusi
On Monday, October 14, 2013 10:32:36 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote: > > > def add(c1, c2): > > % Decode > > c1 = ord(c1) - 65 > > c2 = ord(c2) - 65 > > % Process > > i1 = (c1 + c2) % 26 > > % Encode > >

Re: skipping __init__ and using exploiting a class member instead

2013-10-20 Thread Peter Cacioppi
>The use of getattr here seems unfortunate Unfortunate how? It's a perfect for what I want here ... remember the context is such that the lazily stored value is always truthy (I assert this elsewhere). > I'm not sure why you want to avoid an __init__ method. Why do you want to keep it? The