Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Ian Kelly
On Sun, Aug 3, 2014 at 11:41 PM, Marko Rauhamaa wrote: > Steven D'Aprano : > And I'm talking about a third kind: object-based. It is in active > (albeit limited) use in scheme: http://irreal.org/blog/?p=40>. I'm > currently using the principle in a project of mine. > > In Java, you use anonymous c

Re: Python Programing for the Absoulte Beginner

2014-08-03 Thread Bob Martin
in 726123 20140803 090919 Steven D'Aprano wrote: >Steve Hayes wrote: > >> I've got too big an investment in books on Python 2, and there are no >> books available on Python 3 (I don't regard downloadable PDFs or other >> onlines stuff as "books")

Re: how to call back a method in python3?

2014-08-03 Thread Gregory Ewing
Marko Rauhamaa wrote: Do this: class MyClass: def my_method(self): def callback(x): return self.do(x) return callback def do(self, x): print("done: {}".format(x)) Or more simply: def my_method(self): retur

Re: how to call back a method in python3?

2014-08-03 Thread Marko Rauhamaa
"水静流深" <1248283...@qq.com>: > I want to call back a function which is the method of a class . > > def callback(self.do,x): > return(self.do(x)) > > That is what i want to write,when i input > > def callback(self.do,x): > > error message: Do this: class MyClass:

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Marko Rauhamaa
Steven D'Aprano : > Marko Rauhamaa wrote: > >> I've reached a point where I think classes are a superfluous OO concept. >> You only need objects. > > I don't know whether "superfluous" is correct, but they certainly are > *optional*. There are at least two types of object oriented programming: > c

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Terry Reedy
On 8/3/2014 9:19 PM, Steven D'Aprano wrote: stuff based on an understandable misunderstanding of what I wrote. Terry Reedy wrote: The object class is used to implement duck typing. It is the delegation of operations to class instance methods that makes extensible duck typing possible. I le

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 23:14, Glenn Linderman wrote: > Having read a bit about ConEmu, it seems that it is a "pretty face" built on > top of Windows Console, by screen scraping the real (but hidden) Windows > Console, and providing a number of interesting display features and modes. So > while it adds funct

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Glenn Linderman
On 8/3/2014 5:17 PM, Glenn Linderman wrote: On 8/3/2014 4:25 PM, Andrew Berg wrote: On 2014.08.03 18:08, Chris Angelico wrote: The best way to do it is to use the Unicode codepage, but cmd.exe just plain has issues. There are underlying Windows APIs for displaying text that have problems with a

Re: CodeSkulptor

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 1:03 PM, Steven D'Aprano wrote: I think it's not a bug, but a restriction; since it's letting you run code on their server, and since Python sandboxing is a hard problem, CodeSkulptor cuts down the available modules. From the docs: http://www.codeskulpto

Re: CodeSkulptor

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 12:38 PM, Seymore4Head wrote: > BTW Just read the instructions seems like a daunting task at the > moment. You knew what instructions you were looking for. I am > clueless. Yeah, that's called experience :) Part of that experience is the rather painful one of spending a

Re: CodeSkulptor

2014-08-03 Thread Steven D'Aprano
Seymore4Head wrote: > On Sun, 03 Aug 2014 22:08:21 -0400, Seymore4Head > wrote: > >>On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico >>wrote: >> >>>On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano >>> wrote: > Putting that in codeskulptor gets > > Line 4: ImportError: No module nam

how to call back a method in python3?

2014-08-03 Thread 水静流深
I want to call back a function which is the method of a class . def callback(self.do,x): return(self.do(x)) That is what i want to write,when i input def callback(self.do,x): error message: File "", line 1 def callback(self.do,x): ^

Re: CodeSkulptor

2014-08-03 Thread Seymore4Head
On Sun, 03 Aug 2014 22:08:21 -0400, Seymore4Head wrote: >On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico >wrote: > >>On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano >> wrote: Putting that in codeskulptor gets Line 4: ImportError: No module named datetime >>> >>> Well that's a b

Re: how to call back a method ?

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 12:33 PM, elearn wrote: > I want to call back a function which is the method of a class . > > def callback(self.do,x): > return(self.do(x)) > > That is what i want to write,when i input > > def callback(self.do,x): > > error message: > > > File "", line

how to call back a method ?

2014-08-03 Thread elearn
I want to call back a function which is the method of a class . def callback(self.do,x): return(self.do(x)) That is what i want to write,when i input def callback(self.do,x): error message: File "", line 1 def callback(self.do,x): ^ Synt

Re:Python crashing when script is running against live system

2014-08-03 Thread Dave Angel
Igor Korot Wrote in message: > Hi, ALL, > I'm working on the script that should starting from the given > directory enumerate all directories and files underneath and > calculates the hash value of such file. > It works fine when I start it from some particular directory, but when > I give the "C:

Re: CodeSkulptor

2014-08-03 Thread Seymore4Head
On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico wrote: >On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano > wrote: >>> Putting that in codeskulptor gets >>> >>> Line 4: ImportError: No module named datetime >> >> Well that's a bug in CodeSkultor. datetime is a standard Python library, if >> Code

Re: CodeSkulptor

2014-08-03 Thread Seymore4Head
On Mon, 04 Aug 2014 02:56:34 +0100, Mark Lawrence wrote: >On 04/08/2014 02:41, Seymore4Head wrote: >> On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano >> wrote: >> >>> Seymore4Head wrote: >>> >>> [...] The second thing I am doing is using codeskulptor to try out a few things I have

Re: CodeSkulptor

2014-08-03 Thread Mark Lawrence
On 04/08/2014 02:41, Seymore4Head wrote: On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano wrote: Seymore4Head wrote: [...] The second thing I am doing is using codeskulptor to try out a few things I have learned at codecademy. What's CodeSkulptor? Putting that in codeskulptor gets Li

Re: CodeSkulptor

2014-08-03 Thread Seymore4Head
On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano wrote: >Seymore4Head wrote: > >[...] >> The second thing I am doing is using codeskulptor to try out a few >> things I have learned at codecademy. > >What's CodeSkulptor? > >> Putting that in codeskulptor gets >> >> Line 4: ImportError: No modu

Re: try/exception - error block

2014-08-03 Thread Steven D'Aprano
You also posted this question to the tu...@python.org mailing list, which is where I gave an answer. This is a much better place, so I'll re-post the most important parts of my answer here. If you read nothing else, scroll down to the end and read the last part of my comment. bruce wrote: > I ha

Re: CodeSkulptor

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano wrote: >> Putting that in codeskulptor gets >> >> Line 4: ImportError: No module named datetime > > Well that's a bug in CodeSkultor. datetime is a standard Python library, if > CodeSkulptor doesn't provide it, that's a serious bug. I think it's no

Re: CodeSkulptor

2014-08-03 Thread Steven D'Aprano
Seymore4Head wrote: [...] > The second thing I am doing is using codeskulptor to try out a few > things I have learned at codecademy. What's CodeSkulptor? > Putting that in codeskulptor gets > > Line 4: ImportError: No module named datetime Well that's a bug in CodeSkultor. datetime is a stand

Re: Python 3 is killing Python

2014-08-03 Thread Kevin Walzer
RIck, On 7/17/14, 2:15 PM, Rick Johnson wrote: Sadly, all of my calls to improve IDLE have been meet with rebukes about me "whining". The "powers that be" would wise to*UTILIZE* and*ENCOURAGE* my participation instead of *IGNORING* valuable talent and*IMPEDING* the expansion of this "private

Re: CodeSkulptor

2014-08-03 Thread Mark Lawrence
On 04/08/2014 02:06, Seymore4Head wrote: I am very new to Python. Right now I am using two tools. I am trying the tutorials at codecademy.com which is walking me through it pretty slow. The second thing I am doing is using codeskulptor to try out a few things I have learned at codecademy. I am g

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Steven D'Aprano
Terry Reedy wrote: > The object class is used to implement duck typing. It is the delegation > of operations to class instance methods that makes extensible duck > typing possible. That cannot possibly be true, because Python had duck typing before it had object. object and new-style classes wer

CodeSkulptor

2014-08-03 Thread Seymore4Head
I am very new to Python. Right now I am using two tools. I am trying the tutorials at codecademy.com which is walking me through it pretty slow. The second thing I am doing is using codeskulptor to try out a few things I have learned at codecademy. I am getting a mismatch. The example I am workin

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Gregory Ewing
Steven D'Aprano wrote: I don't know enough about prototyped OOP to really give a definitive answer, but I believe that the popularity of class-based OOP is because there is a huge body of theory on types, I think it's more than that. I thought about prototype-based OO systems in some depth a wh

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Roy Smith
In article <53ded02e$0$29980$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Marko Rauhamaa wrote: > > > I've reached a point where I think classes are a superfluous OO concept. > > You only need objects. > > I don't know whether "superfluous" is correct, but they certainly are >

Re: Python crashing when script is running against live system

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 10:20 AM, Igor Korot wrote: > I'm working on the script that should starting from the given > directory enumerate all directories and files underneath and > calculates the hash value of such file. > It works fine when I start it from some particular directory, but when > I g

Python crashing when script is running against live system

2014-08-03 Thread Igor Korot
Hi, ALL, I'm working on the script that should starting from the given directory enumerate all directories and files underneath and calculates the hash value of such file. It works fine when I start it from some particular directory, but when I give the "C:\" it crashes python. The last thing the

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Glenn Linderman
On 8/3/2014 4:25 PM, Andrew Berg wrote: On 2014.08.03 18:08, Chris Angelico wrote: The best way to do it is to use the Unicode codepage, but cmd.exe just plain has issues. There are underlying Windows APIs for displaying text that have problems with astral characters (I think that's what it is),

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Steven D'Aprano
Marko Rauhamaa wrote: > I've reached a point where I think classes are a superfluous OO concept. > You only need objects. I don't know whether "superfluous" is correct, but they certainly are *optional*. There are at least two types of object oriented programming: class-bases, and prototype-based

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 9:39 AM, Chris Angelico wrote: > I just played around with a CP-437 decode of everything 128-255, > rendered in various different fonts, all using my MUD client on > Windows. (For what it's worth, it renders using GTK2 and Pango. But I > suspect this is more a font issue tha

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 9:25 AM, Andrew Berg wrote: > On 2014.08.03 18:08, Chris Angelico wrote: >> The best way to do it is to use the Unicode codepage, but cmd.exe just >> plain has issues. There are underlying Windows APIs for displaying >> text that have problems with astral characters (I think

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Mark Lawrence
On 04/08/2014 00:25, Andrew Berg wrote: On 2014.08.03 18:08, Chris Angelico wrote: The best way to do it is to use the Unicode codepage, but cmd.exe just plain has issues. There are underlying Windows APIs for displaying text that have problems with astral characters (I think that's what it is),

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 18:08, Chris Angelico wrote: > The best way to do it is to use the Unicode codepage, but cmd.exe just > plain has issues. There are underlying Windows APIs for displaying > text that have problems with astral characters (I think that's what it > is), so ultimately, you're largely stuc

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Mark Lawrence
On 03/08/2014 23:52, Wiktor wrote: Hi, as OO programming exercise, I'm trying to port to Python one of my favorite game from early'90 (Atari 65XL/XE) - Kolony (here's video from original version on C64 https://www.youtube.com/watch?v=UFycYOp2cbE, and here's video from modern rewritten (for Atar

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 8:52 AM, Wiktor wrote: > I have to ask - is there a way to make that original concept work? I know, > that CP437 has symbols "╖", "╢" and "╘", but does not have polish letters - > and I need to display them too. Yeah, that's exactly the problem with codepages :) The best w

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Terry Reedy
On 8/3/2014 10:51 AM, Marko Rauhamaa wrote: Peter Otten <__pete...@web.de>: i. e. you have a per-class and per-instance memory consumption. The latter is smaller, so with regards to memory consumption instantiating only pays off when there is more than one employee. I've reached a point where

cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Wiktor
Hi, as OO programming exercise, I'm trying to port to Python one of my favorite game from early'90 (Atari 65XL/XE) - Kolony (here's video from original version on C64 https://www.youtube.com/watch?v=UFycYOp2cbE, and here's video from modern rewritten (for Atari emulators) version: Kolony 2106 htt

Re: Why does not pprint work?

2014-08-03 Thread Mark Lawrence
On 03/08/2014 22:34, robkote...@gmail.com wrote: [snipped to bits] Please don't top post, further would you read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pythonistas, ask not what

Re: try/exception - error block

2014-08-03 Thread Peter Otten
bruce wrote: > Hi. > > I have a long running process, it generates calls to a separate py > app. The py app appears to generate errors, as indicated in the > /var/log/messages file for the abrtd daemon.. The errors are > intermittent. > > So, to quickly capture all possible exceptions/errors, I

Re: Tcl/Tk alpha channel bug on OSX Mavericks is fixeded, but how/when can I use the fix?

2014-08-03 Thread Kevin Walzer
On 8/3/14, 1:24 PM, Peter Tomcsanyi wrote: I think that it is because of this problem in Mavericks: http://core.tcl.tk/tk/tktview?name=99b84e49ff The above link says that it has been solved in Tcl/Tk. But: what does it mean for me - a Python user? Can anyone say when a version containing the a

Re: Why does not pprint work?

2014-08-03 Thread robkotenko
With the way you have imported, you trying to use the module pprint instead of the function pprint.pprint. You need to use pprint.pprint or you need to import as: from pprint import pprint if you want to use the shorter form. On Tuesday, July 22, 2014 5:42:02 PM UTC-4, fl wrote: > Hi, > >

Re: try/exception - error block

2014-08-03 Thread bruce
Hi Alan. Yep, the err file in the exception block gets created. and the weird thing is it matches the time of the abrtd information in the /var/log/messages log.. Just nothing in the file! On Sun, Aug 3, 2014 at 4:01 PM, Alan Gauld wrote: > On 03/08/14 18:52, bruce wrote: > >>> but in all tha

Re: try/exception - error block

2014-08-03 Thread CHIN Dihedral
On Sunday, August 3, 2014 10:39:19 PM UTC+8, Roy Smith wrote: > In article , > > bruce wrote: > > > > > I'm posting the test code I'm using. Pointers/comments would be > > > helpful/useful. > > > > It would be really helpful if you could post a minimal code example > > which demonstrat

Re: try/exception - error block

2014-08-03 Thread Alan Gauld
On 03/08/14 18:52, bruce wrote: but in all that.. no one could tell me .. why i'm not getting any errs/exceptions in the err file which gets created on the exception!!! Does the file actually get created? Do you see the print statement output - are they what you expect? Did you try the things

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-03 Thread Dietmar Schwertberger
Am 03.08.2014 02:04, schrieb Gregory Ewing: MRAB wrote: RISC OS didn't have a menu bar at the top of each window either; its menus were all pop-up. You didn't have to keep flicking the mouse at all! The main reason for having a menu bar is discoverability. The idea is that you can browse throug

Re: try/exception - error block

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 3:52 AM, bruce wrote: > chris.. my bad.. I wasnt intending to mail you personally. > > Or I wouldn't have inserted the "thanks guys"! > > >> thanks guys... >> >> but in all that.. no one could tell me .. why i'm not getting any >> errs/exceptions in the err file which gets c

Re: try/exception - error block

2014-08-03 Thread bruce
chris.. my bad.. I wasnt intending to mail you personally. Or I wouldn't have inserted the "thanks guys"! > thanks guys... > > but in all that.. no one could tell me .. why i'm not getting any > errs/exceptions in the err file which gets created on the exception!!! > > but thanks for the informat

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > On 02/08/2014 20:58, Ben Finney wrote: > > Steven D'Aprano writes: > > > >> If you need instances which carry state, then object is the wrong > >> class. > > > > Right. The ‘types’ module provides a SimpleNamespace class for the > > common “bag of attri

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Mark Lawrence
On 02/08/2014 20:58, Ben Finney wrote: Steven D'Aprano writes: If you need instances which carry state, then object is the wrong class. Right. The ‘types’ module provides a SimpleNamespace class for the common “bag of attributes” use case:: >>> import types >>> foo = types.SimpleN

Tcl/Tk alpha channel bug on OSX Mavericks is fixeded, but how/when can I use the fix?

2014-08-03 Thread Peter Tomcsanyi
Hello to all, My OSX is 10.9 Mavericks. I use Python 3.4. with ActiveTcl 8.5.15.1. I was struggling with several approaches to using PNG files with alpha channel (partial transparency). Following my question in this newsgroup (see the thread "Python 3.4.1 installer on Mac links Python to old T

Re: try/exception - error block

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 2:27 AM, Roy Smith wrote: > It says there, "most readers will stop reading by 100 lines of code". I > guess I have a short attention span relative to "most readers", because > my tl;dnr threshold is a lot shorter than that. "by" 100 lines includes everyone who stops at 10

Re: try/exception - error block

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > How to go about this is at "Short, Self Contained, Correct (Compilable), > Example" at http://sscce.org/ It says there, "most readers will stop reading by 100 lines of code". I guess I have a short attention span relative to "most readers", because my tl;

Re: try/exception - error block

2014-08-03 Thread Mark Lawrence
On 03/08/2014 15:29, bruce wrote: [snipped to bits] Please see this http://sscce.org/ as already requested on the main mailing list. -- 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/lis

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Marko Rauhamaa
Roy Smith : > Marko Rauhamaa wrote: > >> I've reached a point where I think classes are a superfluous OO >> concept. You only need objects. > > comp.lang.javascript is over that way --> Thanks for the insight. I'm currently more absorbed by comp.lang.scheme, though. Now, Python is ducktyped. I

python-list@python.org

2014-08-03 Thread Alexander Williams
I want to break a PKCS7 signature that contains data + signature into separate: raw data & detached PKCS7 signature in python. I can get the data fro the signature because the verification routine returns it, but how can I get the detached signature ? def verify_pkcs7(data_bio, signature_bio, c

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Roy Smith
In article <87wqaplj8h@elektro.pacujo.net>, Marko Rauhamaa wrote: > I've reached a point where I think classes are a superfluous OO concept. > You only need objects. comp.lang.javascript is over that way --> -- https://mail.python.org/mailman/listinfo/python-list

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Chris Angelico
On Mon, Aug 4, 2014 at 12:36 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Sun, Aug 3, 2014 at 11:25 PM, Roy Smith wrote: >> > in which case, I've said, "make Foos just like objects, except for, oh, >> > never mind, there aren't any differences". But, in reality, the syst

Re: try/exception - error block

2014-08-03 Thread Mark Lawrence
On 03/08/2014 15:39, Roy Smith wrote: In article , bruce wrote: I'm posting the test code I'm using. Pointers/comments would be helpful/useful. It would be really helpful if you could post a minimal code example which demonstrates the problem you're having. Leave out everything (including

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > i. e. you have a per-class and per-instance memory consumption. The > latter is smaller, so with regards to memory consumption instantiating > only pays off when there is more than one employee. I've reached a point where I think classes are a superfluous OO conc

Re: try/exception - error block

2014-08-03 Thread Roy Smith
In article , bruce wrote: > I'm posting the test code I'm using. Pointers/comments would be > helpful/useful. It would be really helpful if you could post a minimal code example which demonstrates the problem you're having. Leave out everything (including the commented-out code) which isn't

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Aug 3, 2014 at 11:25 PM, Roy Smith wrote: > > in which case, I've said, "make Foos just like objects, except for, oh, > > never mind, there aren't any differences". But, in reality, the system > > bolted on the ability to have user-defined attribute

try/exception - error block

2014-08-03 Thread bruce
Hi. I have a long running process, it generates calls to a separate py app. The py app appears to generate errors, as indicated in the /var/log/messages file for the abrtd daemon.. The errors are intermittent. So, to quickly capture all possible exceptions/errors, I decided to wrap the entire "ma

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Akira Li
Albert-Jan Roskam writes: > I find the following obscure (to me at least) use of type() useful > exactly for this "bag of attributes" use case: employee = type("Employee", (object,), {}) employee.name = "John Doe" employee.position = "Python programmer" You could write it as:

asyncio with map&reduce flavor and without flooding the event loop

2014-08-03 Thread Valery Khamenya
Hi all I am trying to use asyncio in real applications and it doesn't go that easy, a help of asyncio gurus is needed badly. Consider a task like crawling the web starting from some web-sites. Each site leads to generation of new downloading tasks in exponential(!) progression. However we don't w

Re: Getting a list of all modules

2014-08-03 Thread Mark Lawrence
On 01/08/2014 16:41, Steven D'Aprano wrote: On Fri, 01 Aug 2014 14:39:09 +0100, Robert Kern wrote: Take a look at what has already been implemented in IPython: https://github.com/ipython/ipython/blob/master/IPython/core/ completerlib.py#L208 Awesome! Thank you! Is Lib/idlelib/AutoComplete

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Chris Angelico
On Sun, Aug 3, 2014 at 11:25 PM, Roy Smith wrote: > in which case, I've said, "make Foos just like objects, except for, oh, > never mind, there aren't any differences". But, in reality, the system > bolted on the ability to have user-defined attributes without telling > me. I don't think it's un

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Aug 3, 2014 at 10:40 PM, Roy Smith wrote: > > I usually just do: > > > > class Data: > >pass > > my_obj = Data() > > > > That's all you really need. It's annoying that you can't just do: > > > > my_obj = object() > > > > which would be even sim

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Chris Angelico
On Sun, Aug 3, 2014 at 10:40 PM, Roy Smith wrote: > I usually just do: > > class Data: >pass > my_obj = Data() > > That's all you really need. It's annoying that you can't just do: > > my_obj = object() > > which would be even simpler, because (for reasons I don't understand), > you can't cr

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > On 02/08/2014 20:58, Ben Finney wrote: > > Steven D'Aprano writes: > > > >> If you need instances which carry state, then object is the wrong > >> class. > > > > Right. The ‘types’ module provides a SimpleNamespace class for the > > common “bag of attri

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Mark Lawrence
On 02/08/2014 20:58, Ben Finney wrote: Steven D'Aprano writes: If you need instances which carry state, then object is the wrong class. Right. The ‘types’ module provides a SimpleNamespace class for the common “bag of attributes” use case:: >>> import types >>> foo = types.SimpleN

Re: How to turn off Python's event log window in the background?

2014-08-03 Thread Chris Angelico
On Sun, Aug 3, 2014 at 9:05 PM, wrote: > It was suggested to me on another forum that I use pythonw.exe instead of > python.exe to prevent the window from being displayed, but I don't know how > to do this, because it is all automatic: I just click on the .py file, and > the python interpreter

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Peter Otten
Albert-Jan Roskam wrote: > > > - Original Message - > >> From: Peter Otten <__pete...@web.de> >> To: python-list@python.org >> Cc: >> Sent: Sunday, August 3, 2014 11:37 AM >> Subject: Re: Correct type for a simple "bag of attributes" namespace >> object >> >> Albert-Jan Roskam wrote: >

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Albert-Jan Roskam
- Original Message - > From: Albert-Jan Roskam > To: Terry Reedy ; "python-list@python.org" > > Cc: > Sent: Sunday, August 3, 2014 11:17 AM > Subject: Re: Correct type for a simple "bag of attributes" namespace object >   Right. The 'types' module provides a SimpleNamespace >

How to turn off Python's event log window in the background?

2014-08-03 Thread dufriz
Hi, whenever I run the Leo editor (a Python application) from Windows (8.1), there is always an event log window in the background. I want to turn it off. It was suggested to me on another forum that I use pythonw.exe instead of python.exe to prevent the window from being displayed, but I don't

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Albert-Jan Roskam
- Original Message - > From: Peter Otten <__pete...@web.de> > To: python-list@python.org > Cc: > Sent: Sunday, August 3, 2014 11:37 AM > Subject: Re: Correct type for a simple "bag of attributes" namespace object > > Albert-Jan Roskam wrote: > >> I find the following obscure (to me a

Re: SQLAlchemy tutorial

2014-08-03 Thread Ben Finney
Martin S writes: > Problem is the [SQLAlchemy] tutorials I've been looking at all produce > various errors when following them (and pretty early on). SQLAlchemy has been progressively adding support for Python 3, so it matters which version of SQLAlchemy you install. For best results, it seems

SQLAlchemy tutorial

2014-08-03 Thread Martin S
Hi, I've been looking at various tutorials on SQLAlchemy as I am planning to do fill a void among the Linux applications (unless someone has seen a diabetic result "analyser" thingy that's common for Android et al). But I need to get a database working. Problem is the Alchemy tutorials I've been

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Peter Otten
Albert-Jan Roskam wrote: > I find the following obscure (to me at least) use of type() useful exactly > for this "bag of attributes" use case: employee = type("Employee", (object,), {}) employee.name = "John Doe" employee.position = "Python programmer" employee.name, employee.p

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Albert-Jan Roskam
--- Original Message - > From: Terry Reedy > To: python-list@python.org > Cc: > Sent: Sunday, August 3, 2014 4:43 AM > Subject: Re: Correct type for a simple "bag of attributes" namespace object > > On 8/2/2014 8:59 PM, Ian Kelly wrote: >> On Sat, Aug 2, 2014 at 2:46 PM, Mark Summerfield >

Re: Python Programing for the Absoulte Beginner

2014-08-03 Thread Steven D'Aprano
Steve Hayes wrote: > I've got too big an investment in books on Python 2, and there are no > books available on Python 3 (I don't regard downloadable PDFs or other > onlines stuff as "books"). I love Python 3, it's way better than Python 2, and there's less and less reason to stick to Python 2 no