Re: Grouping pairs - suggested tools

2010-09-21 Thread Alf P. Steinbach /Usenet
* Arnaud Delobelle, on 21.09.2010 11:13: On Sep 21, 7:19 am, "Alf P. Steinbach /Usenet" wrote: * Alf P. Steinbach /Usenet, on 21.09.2010 01:09: * Astley Le Jasper, on 20.09.2010 23:42: I have a list of tuples that indicate a relationship, ie a is related to b, b is related to

Re: Grouping pairs - suggested tools

2010-09-20 Thread Alf P. Steinbach /Usenet
* Alf P. Steinbach /Usenet, on 21.09.2010 01:09: * Astley Le Jasper, on 20.09.2010 23:42: I have a list of tuples that indicate a relationship, ie a is related to b, b is related to c etc etc. What I want to do is cluster these relationships into groups. An item will only be associated with a

Re: Grouping pairs - suggested tools

2010-09-20 Thread Alf P. Steinbach /Usenet
uivalent to. Then in second pass simply drag out each equivalence group (recurse on each symbol's list of equivalences). Approaches 1 and 2 seem to be pretty inefficient for a large number of symbols, but I think approach 1 may be a practical option for a small number of symbols. Cheers &a

Re: Static typing, Python, D, DbC

2010-09-12 Thread Alf P. Steinbach /Usenet
might be that its argument is a sorted array. So regarding the nature of the checks it's not hopelessly incompatible with Python. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: [Q] How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread Alf P. Steinbach /Usenet
* Standish P, on 16.08.2010 09:20: [garble garble] Nonsense article "We look for an exogenous stack" cross-posted to [comp.lang.c], [comp.lang.c++], [comp.theory], [comp.lang.python], [comp.lang.forth]. Please refrain from following up on Standish' article.

Re: Different python versions confusion under Windows Vista x64

2010-07-19 Thread Alf P. Steinbach /Usenet
em into your message (e.g. [Ctrl V]). And then, if you haven't already figured it out, somebody probably will. :-) Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

CPython 3.1.1 docs error in noddy3 example?

2010-07-19 Thread Alf P. Steinbach /Usenet
;U"). I suspect this is a leftover from Python 2.x, where strings were bytes, and that this is a bug? Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing: member type deduction for member pointers (Alf's device?)

2010-07-19 Thread Alf P. Steinbach /Usenet
* Vladimir Jovic, on 19.07.2010 09:41: Alf P. Steinbach /Usenet wrote: #include // PyWeakPtr, PyPtr, PyModule, PyClass using namespace progrock; namespace { using namespace cppy; struct Noddy { PyPtr first; PyPtr last; int number

Re: why is this group being spammed?

2010-07-17 Thread Alf P. Steinbach /Usenet
ey and might be one of the suckers responding to spam. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing: member type deduction for member pointers (Alf's device?)

2010-07-17 Thread Alf P. Steinbach /Usenet
* Alf P. Steinbach /Usenet, on 17.07.2010 11:50: [Cross-posted comp.lang.c++ and comp.lang.python] [snip] this occurred to me: #define CPPY_GETSET_FORWARDERS( name ) \ ::progrock::cppy::forwardersGetSet( \ &CppC

Sharing: member type deduction for member pointers (Alf's device?)

2010-07-17 Thread Alf P. Steinbach /Usenet
member pointer, which the macro supplies *twice*, once as run-time arg and once as compile-time. He he. Perhaps this trick is well-known already, but it was new to me, so! :-) Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested loop not working

2010-07-16 Thread Alf P. Steinbach /Usenet
cumented. This way is inefficient for small data set, but works. In order to get a better handle on the general problem -- not the Python technicalitities -- google up "KWIC", KeyWord In Context. It's a common exercise problem given to first or second-year students. So I thin

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-14 Thread Alf P. Steinbach /Usenet
* Hrvoje Niksic, on 14.07.2010 10:17: "Alf P. Steinbach /Usenet" writes: Also, things like the 'owned' option is just asking for trouble. Isn't owned=true (or equivalent) a necessity when initializing from a PyObject* returned by a function declared to return a &

Re: floatref

2010-07-13 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 14.07.2010 06:31: Gary did the right thing by pointing out that the simple-sounding term "points to" is anything but simple, it depends on what you mean by pointing and pointers. Possibly you have a point here. Cheers, - Alf -- blog at http://alfp

Re: floatref

2010-07-13 Thread Alf P. Steinbach /Usenet
ather, I'd make that as explicit as possible. Like, x = {"sharedVar": 123} y = x The one won't be surprised when changing x["sharedVar"] also changes y["sharedVar"]. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 13.07.2010 22:06: On 13 Jul, 21:39, "Alf P. Steinbach /Usenet" wrote: Thanks! It seems that SCXX does those things that I've been planning to do but haven't got around to (wrapping standard Python types), while what it doesn't do (abstracting away

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 13.07.2010 22:03: On 9 Jul, 17:52, "Alf P. Steinbach /Usenet" wrote: For an extension module it seems that Python requires each routine to be defined as 'extern "C"'. That is strange. PyMethodDef is just a jump table. So why should 'ext

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Alf P. Steinbach /Usenet
b ); // Should be OK with any compiler. } ... compiles, and works. Cheers, & thanks, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Alf P. Steinbach /Usenet
* Robert Kern, on 13.07.2010 17:16: On 7/13/10 2:34 AM, Alf P. Steinbach /Usenet wrote: PS: You (the reader) may be wondering, why why why Yet Another Python/C++ binding? Well, because I had this great name for it, "pyni", unfortunately already in use. But cppy is very different

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Alf P. Steinbach /Usenet
* geremy condra, on 09.07.2010 23:43: On Fri, Jul 9, 2010 at 5:22 PM, Ian Collins wrote: On 07/10/10 03:52 AM, Alf P. Steinbach /Usenet wrote: [Cross-posted comp.lang.python and comp.lang.c++] I lack experience with shared libraries in *nix and so I need to ask... This is about "

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 13.07.2010 01:34: On Mon, 12 Jul 2010 20:28:49 +0200, Alf P. Steinbach /Usenet wrote: As I see it it doesn't matter whether the implementation is CPython call frame slots or that mechanism called something else or a different mechanism called the same or a

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 13.07.2010 01:50: On Mon, 12 Jul 2010 22:57:10 +0200, Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you get a proper value

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Rami Chowdhury, on 13.07.2010 00:14: Perhaps I'm misunderstanding, but ... On Jul 12, 2010, at 13:57 , Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you

Standard distutils package problems with MSVC / lacking functionality?

2010-07-12 Thread Alf P. Steinbach /Usenet
= options ) setup( name= "noddy", version = '1.0', description = 'This is a demo package', ext_modules = [module1] ) Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
ut only creates one: foo("Monday") ('Locals:', {'day': 'Monday'}) foo.func_code.co_varnames ('day', 'x') foo.func_code.co_nlocals 2 So, the question is, is x a local variable or not? It's not in locals, but the function clearly kno

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 12.07.2010 04:39: On Mon, 12 Jul 2010 03:12:10 +0200, Alf P. Steinbach /Usenet wrote: * MRAB, on 12.07.2010 00:37: [...] In Java a variable is declared and exists even before the first assignment to it. In Python a 'variable' isn't declared and w

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 16:59: On 12 Jul, 07:51, "Alf P. Steinbach /Usenet" wrote: We're talking about defining a 'swap' routine that works on variables. I did not miss the point. One cannot make a swap function that rebinds its arguments in the callin

Design questions for C++ support for Python extensions (cppy)

2010-07-12 Thread Alf P. Steinbach /Usenet
at no other threads execute while PyInit_spam is called? Can it be called simultaneously by two or more threads? 5. Reload of interpreter? My impression from the documentation is that finalization and reinit of the interpreter is something that an application shouldn't really do, a

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 06:52: On 11 Jul, 21:37, "Alf P. Steinbach /Usenet" wrote: Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like Java in this respect, that's all; neither Java nor Python support 'swap'. x,y = y,

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* MRAB, on 12.07.2010 04:09: Alf P. Steinbach /Usenet wrote: * MRAB, on 12.07.2010 00:37: Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* Stephen Hansen, on 12.07.2010 04:02: On 7/11/10 6:12 PM, Alf P. Steinbach /Usenet wrote: However, as stated up-thread, I do not expect facts, logic or general reasoning to have any effect whatsoever on such hard-core religious beliefs. Grow up, and/or get a grip, and/or get over yourself

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* MRAB, on 12.07.2010 00:37: Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the bytecode compiler optimize away expressions like: if

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
ce when one's goals require acceptance in a society dominated by a religious clique. And just as I'm not out to engage you in any debate on this issue (futile), neither am I calling you irrational. Perhaps your choice is the same as that author's. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Alf P. Steinbach /Usenet
numero uno all this nonsense would be rectified! Str, Float, List, Range, etc, etc. You think Python 3000 was a hump to climb over just wait for Python 4000. Just thoughts. Just do Str = str List = list Float = float and so on in module "myBasicTypes", and import that. :-) Che

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Alf P. Steinbach /Usenet
English, like "file" and "philosophy". So it's an error committed not by the limbic system but by a slightly higher level sound-to-text translator brain circuit. The text is generated from how the word sounds in one's head. Cheers & hth., - Alf -- blog at http://alfp

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Alf P. Steinbach /Usenet
stead of as a value of a different type. And write e.g. not_found = -1 ... if choiceIdx1 == choiceIdx2 == not_found: bah, none of them elif choice2Idx == not_found: use choice 1 elif choice1Idx == not_found: use choice 2 else: determine bestest choice C

Re: any issues with long running python apps?

2010-07-10 Thread Alf P. Steinbach /Usenet
ans do everything in triplicate" - Old jungle proverb Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Not-quite-the-module-name qualified names in extension modules? What?

2010-07-10 Thread Alf P. Steinbach /Usenet
cation is not using the final module name but instead something like "xxmodule" or "_csv"? More to the point, what's the point? Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-09 Thread Alf P. Steinbach /Usenet
* Ian Collins, on 09.07.2010 23:22: On 07/10/10 03:52 AM, Alf P. Steinbach /Usenet wrote: [Cross-posted comp.lang.python and comp.lang.c++] I lack experience with shared libraries in *nix and so I need to ask... This is about "cppy", some support for writing Python extensions in

Re: Hello

2010-07-09 Thread Alf P. Steinbach /Usenet
rking in Windows the Notepad++ and PSPad and old Crimson Editor (all free) all work nicely and are reasonably light-weight. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-09 Thread Alf P. Steinbach /Usenet
me##_##name##_descriptor \ ); #define CPPY_MODULE_CROUTINE( cppClassName, name, docString ) \ CPPY_MODULE_CROUTINE_DEF( cppClassName, name ) \ CPPY_MODULE_CROUTINE_INSTALLDATA( cppClassName, name, docString ) TIA., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I add method dynamically to module using C API?

2010-07-08 Thread Alf P. Steinbach /Usenet
r, just a use-as-you-wish finalization callback. Nice! But I think that could be more clear in the docs... Code, for those who might be interested: // progrock.cppy -- "C++ plus Python" // A simple C++ framework for writing Python 3.x extensions. // // Copyright (C) Al

Re: How do I add method dynamically to module using C API?

2010-07-07 Thread Alf P. Steinbach /Usenet
looks like this: // progrock.cppy -- "C++ plus Python" // A simple C++ framework for writing Python 3.x extensions. // // Copyright (C) Alf P. Steinbach, 2010. #ifndef CPPY_MODULE_H #define CPPY_MODULE_H #include //-

How do I add method dynamically to module using C API?

2010-07-07 Thread Alf P. Steinbach /Usenet
ion_NewEx, and more criticially, I'm unable to find any documented way to turn a C or C++ function into a Python function object? Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Argh! Name collision!

2010-07-07 Thread Alf P. Steinbach /Usenet
* Alf P. Steinbach /Usenet, on 08.07.2010 01:47: enum DoAddRef { doAddRef }; class Ptr { private: PyObject* p_; public: Ptr( PyObject* p = 0 ): p_( p ) {} Ptr( PyObject* p, DoAddRef ): p_( p ) { assert( p

Re: Argh! Name collision!

2010-07-07 Thread Alf P. Steinbach /Usenet
* rantingrick, on 07.07.2010 07:42: On Jul 6, 9:11 pm, "Alf P. Steinbach /Usenet" wrote: "pyni"! Pronounced like "tiny"! Yay! hmm, how's about an alternate spelling... "pyknee", or "pynee", or "pynie" ... considering those

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
* Alf P. Steinbach /Usenet, on 07.07.2010 23:19: However developing an extension with MSVC 10 the extension will use the 10.0 CRT, which is not necessarily present on the end user's system. As I see it there are five solutions with different trade-offs: A Already having Visual Studio

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
ed until some new Python version. And I think the clue here is that the CRT state problems can be avoided by careful coding. Hence, for those who cannot do A I think B is a realistic practical option, and D would be nice... Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
that it crashed when passing FILE*. Then we started explaining that mixing CRTs is risky. Oh. Well then. :-) Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 07.07.2010 21:46: On 7 Jul, 21:41, "Alf P. Steinbach /Usenet" wrote: You still have two CRTs linked into the same process. So? CRT resources cannot be shared across CRT borders. That is the problem. Multiple CRTs are not a problem if CRT resources are ne

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 07.07.2010 21:12: On 7 Jul, 06:54, "Alf P. Steinbach /Usenet" wrote: PyAPI_FUNC(void *) PyMem_Malloc(size_t); #define PyMem_MALLOC(n) (((n)< 0 || (n)> PY_SSIZE_T_MAX) ? NULL \ : malloc((n) ? (n) : 1)) I wa

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Alf P. Steinbach /Usenet
her difficult to do with Microsoft's tools, for otherwise people would have employed that solution before, and so I wouldn't trust the result, and wouldn't waste the time trying. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Alf P. Steinbach /Usenet
e user the choice of automatically downloading from python.org, or perhaps direct from Microsoft. This scheme would support dependencies on new runtime lib versions not yet conceived when the user's version of Python was installed. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- htt

Argh! Name collision!

2010-07-06 Thread Alf P. Steinbach /Usenet
name "pyni" occurred to me. "pyni"! Pronounced like "tiny"! Yay! I sat down and made my first Python extension module, following the tutorial in the docs. It worked! But, wait, perhaps some other extension is already named "piny"? Google. http://code.g

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Alf P. Steinbach /Usenet
ks fine no matter what compiler you use, although it's many many years since I've done JNI things. Similarly, Python should IMHO just have a well defined compiler independent native code interface, e.g. "PNI", or "pynacoin", the PYthon NAtive COde INterface :-) C

Re: The real problem with Python 3 - no business case for conversion

2010-07-03 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 03.07.2010 16:24: On Sat, 03 Jul 2010 08:46:57 -0400, D'Arcy J.M. Cain wrote: On Fri, 02 Jul 2010 22:40:34 -0700 John Nagle wrote: Not according to Vex's published package list: http://www.vex.net/info/tech/pkglist/ Hold on. That *is* the generated list

Re: Decorators, with optional arguments

2010-07-02 Thread Alf P. Steinbach /Usenet
return wrapper class Thing(object): @expose() def test1(self, arg1): return arg1 @expose( "testing" ) def test2(self, arg2): return arg2 o = Thing() print( o.test1( 1.11 ) ) print( o.test2( 2.22 ) ) Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Classes

2010-06-24 Thread Alf P. Steinbach /Usenet
ht type-specific routines directly. :-) Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: using subprocess.Popen does not suppress terminal window on Windows

2010-06-18 Thread Alf P. Steinbach
rom a GUI subsystem program. results = open('results.txt', 'w') for n in range(10): p.stdin.write("%d\n" % n) result = p.stdout.readline().strip() results.write('double(%s) => %2s\n' % (n, result)) results.close() --- end of

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Alf P. Steinbach
ionary and bypass any overriden __getitem__/__setitem__ methods (an optimization, surely). I'm afraid it will be hard to intercept global variable usage in these circumstances. Great exposition. But who would have thunk that Python *isn't dynamic enough*? :-) Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Archiving emails in Gmail

2010-06-15 Thread Alf P. Steinbach
ted this way of marking emails, correct me if I am wrong here. But if its true, is there any other way or library in Python to meet my requirements? You can access GMail via an ordinary e-mail client. What's that called, POP protocol? I think the protocol for sending is SMTP. Any library ha

Re: Community (A Modest Proposal)

2010-06-13 Thread Alf P. Steinbach
s adopted the idea of PEPs from Python. In C++ they're called "proposals" or "papers" but it's much the same thing. Python has Guido, C++ has Bjarne. In both cases the original language was designed single-handedly by the god. And in both cases it's now essen

Re: Tkinter Toplevel sizing issue (using a grid)

2010-06-12 Thread Alf P. Steinbach
id( 10, 10, 20, 20 ) topwin = TopWin() topwin.mainloop() Here the effective presentation area size is (seems to be) 400x300 pixels. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter help - Why this behavior ? (py3)

2010-06-07 Thread Alf P. Steinbach
* Dodo, on 07.06.2010 12:38: Le 05/06/2010 19:07, Alf P. Steinbach a écrit : * Dodo, on 05.06.2010 15:46: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B

Re: GUIs - A Modest Proposal

2010-06-06 Thread Alf P. Steinbach
uires 16 GiB or more RAM... Cheers, - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter help - Why this behavior ? (py3)

2010-06-05 Thread Alf P. Steinbach
op'. Don't. Except for modal dialogs the single top level 'mainloop' suffices (all it does is to dispatch "messages" to "handlers", such as your button press callback). So, just place a single call to 'mainloop' at the end of your program. Remove

Re: An empty object with dynamic attributes (expando)

2010-06-04 Thread Alf P. Steinbach
e recently in DDJ where the author seemed to be unaware of this, but I'm not going to pay for the privilege of commenting on articles. Cheers & hth., - Alf PS: How come that when I post a blog entry proving mathematically that the reader is really really smart, the number of views

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
ups (Google picked up that archive from Deja News). Until some replacement for Usenet appears, online discussion will in general be effectively /local/, unknown to all but the parties currently using a given web forum, and it will in general not be archived. As I see it, those who have made a

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
already *is* a forum. Whatever it is you think is needed, it's already a forum. Can you be more specific about what you would add? I meant a web forum. You can access [comp.lang.python] via Google Groups and other web based interfaces. So it already is a web forum. Cheers & hth

Re: one more exception newbie query

2010-06-04 Thread Alf P. Steinbach
uot;why is the door rectangular when sheep are known to dance in the moonlight only on dates divisible by cinnamon?". It's rather difficult to answer. I guess it's back to basics: read up on classes, instances, constructors. Experiment, create a lot of small programs. Don't think

Re: An empty object with dynamic attributes (expando)

2010-06-03 Thread Alf P. Steinbach
what to call such a class, and now it's clear. :-) Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Address of an immutable object

2010-05-30 Thread Alf P. Steinbach
ng the reference. You can think of it as the "reference value" if you want; it's what's copied by an assignment to a variable. Second, the reason that you get the same id for various 42 objects is that CPython uses a cache of "small integer" objects. As I recall the cache ranges from -5 to some 127 or so (or perhaps it was double that). Any value outside that cached range you'll see different id's for the same value. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI programs

2010-05-30 Thread Alf P. Steinbach
's more properly the domain of a special purpose library. The question then boils down to which GUI libraries your image/rich text library is compatible with. Perhaps if someone else has handled that combination they'll chime in. Cheers & hth., - Alf PS: Tkinter on its own d

Re: tkinter function outout to text widget

2010-05-29 Thread Alf P. Steinbach
ecall that Tkinter offers some automatic update magic via something-something), then I don't know. Would be very happy for any hints. Just update the widget whenever you change the text. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: confusing error with nntplib

2010-05-27 Thread Alf P. Steinbach
t might be an issue with the server itself, but still, any input would be very appreciated. Check if there's any way to specify time-outs. Check if there's any way to trace the actual commands and responses. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: Local variables persist across function calls

2010-05-15 Thread Alf P. Steinbach
( levels, result = None, key = '' ) if result is None: result = {} # Evaluated for each call. # Blah blah, the rest There are also other ways. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list

Re: design question

2010-05-03 Thread Alf P. Steinbach
evant info up front (holding a lock for hours seems ungood to me). Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dot-equals (syntax proposal)

2010-05-02 Thread Alf P. Steinbach
* Terry Reedy: * Alf P. Steinbach: * Aahz: and sometimes they rebind the original target to the same object. At the Python level that seems to be an undetectable null-operation. If you try t=(1,2,3); t[1]+=3, if very much matters that a rebind occurs. Testing: >&

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
e, to be meaningless. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
ly. Nothwithstanding the current CPython and Jython documentation error of sys.getrefcount (or whatever the name was) that indicates that it's available in any implementation. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
o stuff a potato into the tailpipe of your Chevrolet. The point is, what you're suggesting doesn't save work at all as you've shown it. There are other ways to do the same thing, for virtually no work at all. Don't put big text dumps in your program. Problem solved! Alf suggest

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 21:46, * Lie Ryan: On 05/01/10 05:43, Lie Ryan wrote: On 05/01/10 03:56, Alf P. Steinbach wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 19:31, * Lie Ryan: On 05/01/10 00:01, Alf P. Steinbach wrote: On 30.04.2010 12:51, * Lie Ryan: On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, "Alf P. Steinbach"wrote: On 28.04.2010 18:54, * Lie Ryan: Python h

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 12:51, * Lie Ryan: On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, "Alf P. Steinbach" wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you want to include large amount of text; Y

Re: find integers in f.readline()

2010-04-29 Thread Alf P. Steinbach
ns? #Py3 lines = ( "83927 300023_25_5_09_FL 9086 9134 F3LQ2BE01AQLXF 1 49 + 80 ZA8Z89HIB7M", "blah blah", "2 small tortoises" ) for line in lines: parts = line.split() if len( parts ) > 0: try: v = int( parts[0] ) print( "OK " + line ) except ValueError: print( "! " + line ) Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning multi-line strings to variables

2010-04-29 Thread Alf P. Steinbach
On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, "Alf P. Steinbach" wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you want to include large amount of text; Yes, that's been mentioned umpteen times in this thread, including the *ver

Re: function name

2010-04-28 Thread Alf P. Steinbach
getframeinfo( frame ) s = "Pleased to meet you, I was originally called '{}'!".format( info.function ) print( s ) bar = foo del foo bar() Pleased to meet you, I was originally called 'foo'! But as mentioned, I'd personally choose a "real" object instead of a bare function. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning multi-line strings to variables

2010-04-28 Thread Alf P. Steinbach
On 28.04.2010 18:54, * Lie Ryan: On 04/28/10 15:34, Alf P. Steinbach wrote: On 28.04.2010 07:11, * Sagar K: Use triple quote: d = """ this is a sample text which does not mean anything""" "goldtech" wrote in message news:4e25733e-eafa-477b-a84d-a

Re: assigning multi-line strings to variables

2010-04-27 Thread Alf P. Steinbach
jous day! callooh! callay!\"\n" " He chortled in his joy.\n" "\n" "'Twas brillig, and the slithy toves\n" "Did gyre and gimble in the wabe;\n" " All mimsy were the borogoves,\n" "And the mome raths ou

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
On 26.04.2010 22:26, * Dodo: Le 26/04/2010 22:26, Alf P. Steinbach a écrit : On 26.04.2010 22:12, * Dodo: Hi all, Under python 2.6, chr() "Return a string of one character whose ASCII code is the integer i." (quoted from docs.python.org) Under python 3.1, chr() "Return th

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
convert a ASCII code back to a character under python 3, not Unicode. How can I do that? Just use chr(). ASCII (7-bit) is a subset of ISO Latin-1 (7-bit), which is a subset of Unicode's Basic Multilingual Plane (BMP, original Unicode, 16-bit) which is a subset of Unicode (21-bit). Chee

Re: [ANN] pyjamas 0.7 released

2010-04-25 Thread Alf P. Steinbach
by default. This option may be re-enabled by the project by placing a file with the name ".htaccess" with this line: Options +Indexes Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: when should I explicitly close a file?

2010-04-24 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 23 Apr 2010 13:19:41 +0200, Alf P. Steinbach wrote: But for a literal context-free interpretation e.g. the 'sys.getrefcount' function is not documented as CPython only and thus an implementation that didn't do reference counting would not be

Re: when should I explicitly close a file?

2010-04-23 Thread Alf P. Steinbach
;Objects that have __del__() methods and are part of a reference cycle cause the entire reference cycle to be uncollectable, including objects not necessarily in the cycle but reachable only from it." ... which means that a programming style assuming current CPython semantics and employing

Re: string caracters:

2010-04-22 Thread Alf P. Steinbach
i ask for the len of the sting it include also the"'%0D%0A". My question is how i can cut the last part of the string if it is every time different? Try rtrim. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: a.extend(b) better than a+=b ?

2010-04-22 Thread Alf P. Steinbach
n easy language. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: when should I explicitly close a file?

2010-04-21 Thread Alf P. Steinbach
ssarily complete for a Very Long Time). Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: rfind bug ?

2010-04-21 Thread Alf P. Steinbach
nd conversely, the third parameter "end" signifies where the search starts. :-) Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Req. for feedback -- writings on error handling & cleanup (Py3)

2010-04-19 Thread Alf P. Steinbach
erforming cleanup by using a finally clause (low level technique). 3.2.3 Performing cleanup by using a with statement. Comments welcome! Cheers, - Alf Notes: [1] I'm posting this only to [comp.lang.python], for now seeking feedback mainly on the language aspects and general approach. Parti

Re: Incorrect scope of list comprehension variables

2010-04-16 Thread Alf P. Steinbach
} } So, yes, considering Ada, C++, Java and C# -- and so on. ;-) Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   >