Re: Grouping pairs - suggested tools

2010-09-21 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

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 /Usenetalf.p.steinbach +use...@gmail.com 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

Re: Grouping pairs - suggested tools

2010-09-20 Thread Alf P. Steinbach /Usenet
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 hth., - Alf -- blog at url: http://alfps.wordpress.com -- http

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 url: 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. Cheers, - Alf -- blog

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 progrock/cppy/PyClass.h // PyWeakPtr, PyPtr, PyModule, PyClass using namespace progrock; namespace { using namespace cppy; struct Noddy { PyPtr first; PyPtr last

CPython 3.1.1 docs error in noddy3 example?

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

Re: Different python versions confusion under Windows Vista x64

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

Re: why is this group being spammed?

2010-07-18 Thread Alf P. Steinbach /Usenet
requirement is simply one of fitting in, conformance. Thus, if my hypothesis is right, almost any idiot can rise to any level of responsibility and social standing simply by fitting in, conforming. This idiot then has good money and might be one of the suckers responding to spam. Cheers, - Alf

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

2010-07-17 Thread Alf P. Steinbach /Usenet
, - Alf -- blog at url: 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( \ CppClass

Re: Nested loop not working

2010-07-16 Thread Alf P. Steinbach /Usenet
-- 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 think there should be an abundance of answers and discussion, although I haven't googled. Cheers hth., - Alf -- blog at url: http

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 /Usenetalf.p.steinbach+use...@gmail.com 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

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 Collinsian-n...@hotmail.com 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

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 from Boost

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

2010-07-13 Thread Alf P. Steinbach /Usenet
. } /code ... compiles, and works. Cheers, thanks, - Alf -- blog at url: 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:03: On 9 Jul, 17:52, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com 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 'extern C

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 /Usenetalf.p.steinbach +use...@gmail.com 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

Re: floatref

2010-07-13 Thread Alf P. Steinbach /Usenet
print x.var, y.var # prints: 99 99 This code goes through hoops to /hide/ the fact of the sharing. Rather, 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

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 url: http://alfps.wordpress.com

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 06:52: On 11 Jul, 21:37, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com 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,x

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

2010-07-12 Thread Alf P. Steinbach /Usenet
. Is it so? Cheers, - Alf -- blog at url: 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
* sturlamolden, on 12.07.2010 16:59: On 12 Jul, 07:51, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com 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 calling

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 won't exist until

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
(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 knows that it could be. So Alf P.S. could be right; x exists, but Python pretends

Standard distutils package problems with MSVC / lacking functionality?

2010-07-12 Thread Alf P. Steinbach /Usenet
= 'This is a demo package', ext_modules = [module1] ) /code Cheers, - Alf -- blog at url: 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
* 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 get

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
* 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 different

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

2010-07-11 Thread Alf P. Steinbach /Usenet
Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

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

2010-07-11 Thread Alf P. Steinbach /Usenet
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 url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo

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

2010-07-11 Thread Alf P. Steinbach /Usenet
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. :-) Cheers hth., - Alf -- blog at url

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
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 url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

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

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 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

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

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

Re: any issues with long running python apps?

2010-07-10 Thread Alf P. Steinbach /Usenet
in triplicate - Old jungle proverb Cheers, - Alf -- blog at url: 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
) \ CPPY_MODULE_CROUTINE_DEF( cppClassName, name ) \ CPPY_MODULE_CROUTINE_INSTALLDATA( cppClassName, name, docString ) /code TIA., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Hello

2010-07-09 Thread Alf P. Steinbach /Usenet
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 url: 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 C++ that I just

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

2010-07-08 Thread Alf P. Steinbach /Usenet
++ 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 progrock/cppx/devsupport/better_experience.h //- Dependencies: #include Ptr.h

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

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

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

2010-07-07 Thread Alf P. Steinbach /Usenet
employed that solution before, and so I wouldn't trust the result, and wouldn't waste the time trying. Cheers, - Alf -- blog at url: 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:12: On 7 Jul, 06:54, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com wrote: PyAPI_FUNC(void *) PyMem_Malloc(size_t); #define PyMem_MALLOC(n) (((n) 0 || (n) PY_SSIZE_T_MAX) ? NULL \ : malloc((n) ? (n) : 1

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 /Usenetalf.p.steinbach +use...@gmail.com 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

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

2010-07-07 Thread Alf P. Steinbach /Usenet
is risky. Oh. Well then. :-) Cheers, - Alf -- blog at url: 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
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 url: 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
* 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 2008

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 /Usenetalf.p.steinbach +use...@gmail.com wrote: pyni! Pronounced like tiny! Yay! hmm, how's about an alternate spelling... pyknee, or pynee, or pynie ... considering those are not taken either? Hm, for pure shock

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

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

2010-07-07 Thread Alf P. Steinbach /Usenet
? Cheers, - Alf -- blog at url: 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
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 :-) Cheers, - Alf -- blog at url: http://alfps.wordpress.com

Argh! Name collision!

2010-07-06 Thread Alf P. Steinbach /Usenet
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. url: http://code.google.com/p/pyni/, PyNI is [a] config file reader/writer. Argh! - Alf -- blog

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

2010-07-06 Thread Alf P. Steinbach /Usenet
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 url: http://alfps.wordpress.com -- http://mail.python.org

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 Naglena...@animats.com wrote: Not according to Vex's published package list: http://www.vex.net/info/tech/pkglist/ Hold on. That *is*

Re: Decorators, with optional arguments

2010-07-02 Thread Alf P. Steinbach /Usenet
): return arg2 o = Thing() print( o.test1( 1.11 ) ) print( o.test2( 2.22 ) ) /code Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Classes

2010-06-24 Thread Alf P. Steinbach /Usenet
). Then the answer is to introduce some classes and OOP stuff. In essence, instead of letting general routines awkwardly and error-prone choose the right type-specific routines depending on the object, let the object specify the right type-specific routines directly. :-) Cheers hth., - Alf

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

2010-06-18 Thread Alf P. Steinbach
): p.stdin.write(%d\n % n) result = p.stdout.readline().strip() results.write('double(%s) = %2s\n' % (n, result)) results.close() --- end of call_double.pyw --- --- double.rb --- while true puts $stdin.gets().strip!.to_i * 2 STDOUT.flush end Cheers hth., - Alf

Re: Overriding __setattr__ of a module - possible?

2010-06-17 Thread Alf P. Steinbach
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 url: http://alfps.wordpress.com

Re: Archiving emails in Gmail

2010-06-15 Thread Alf P. Steinbach
an ordinary e-mail client. What's that called, POP protocol? I think the protocol for sending is SMTP. Any library handling those two protocols can be used. Cheers hth., - Alf, who, unfortunately, wrt. to your real code, is not a telepath :-) -- blog at url: http://alfps.wordpress.com -- http

Re: Community (A Modest Proposal)

2010-06-13 Thread Alf P. Steinbach
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 essentially design-by-committee. Cheers, - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo

Re: Tkinter Toplevel sizing issue (using a grid)

2010-06-12 Thread Alf P. Steinbach
the effective presentation area size is (seems to be) 400x300 pixels. Cheers hth., - Alf -- blog at url: 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.pack

Re: GUIs - A Modest Proposal

2010-06-06 Thread Alf P. Steinbach
RAM... Cheers, - Alf -- blog at url: 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
'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 the calls in 'First' and 'Second'. Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http

Re: one more exception newbie query

2010-06-04 Thread Alf P. Steinbach
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 about exceptions just yet: you lack the fundamentals. Cheers hth., - Alf -- blog at url

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
it already is a web forum. Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
the decisions to make it that way, want it that way. Cheers, - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: An empty object with dynamic attributes (expando)

2010-06-04 Thread Alf P. Steinbach
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 dropped like a stone? Huh. But OK, it was just a late-night posting, I couldn't

Re: An empty object with dynamic attributes (expando)

2010-06-03 Thread Alf P. Steinbach
. :-) Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI programs

2010-05-30 Thread Alf P. Steinbach
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 does not provide image resizing

Re: Address of an immutable object

2010-05-30 Thread Alf P. Steinbach
different id's for the same value. Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter function outout to text widget

2010-05-29 Thread Alf P. Steinbach
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 url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: confusing error with nntplib

2010-05-27 Thread Alf P. Steinbach
to trace the actual commands and responses. Cheers hth., - Alf -- blog at url: 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
There are also other ways. Cheers hth., - Alf -- blog at url: http://alfps.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list

Re: design question

2010-05-03 Thread Alf P. Steinbach
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: test lang=py3 t

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
). Agreed, at the Python level one doesn't in general have the necessary information to do it safely. 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

Re: Python dot-equals (syntax proposal)

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

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. Steinbachal...@start.no wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you want to include large amount of text; Yes

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. Steinbachal...@start.nowrote: On 28.04.2010 18:54, * Lie Ryan: Python

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 of text

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
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 suggested it, not me

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. Steinbachal...@start.no 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 *very first

Re: find integers in f.readline()

2010-04-29 Thread Alf P. Steinbach
) for line in lines: parts = line.split() if len( parts ) 0: try: v = int( parts[0] ) print( OK + line ) except ValueError: print( ! + line ) /code 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 goldtechgoldt...@worldpost.com wrote in message news:4e25733e-eafa-477b-a84d-a64d139f7

Re: function name

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

Re: assigning multi-line strings to variables

2010-04-27 Thread Alf P. Steinbach
and pasted from Wikipedia, and subjected to a few well chosen keystrokes in an editor. As a hopefully illuminating exercise, consider a Python program that uses this string (just import the above module and use its 'text') and generates the above source code as output. Cheers hth., - Alf

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
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). Cheers hth., - Alf -- http

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 the string of one character

Re: [ANN] pyjamas 0.7 released

2010-04-25 Thread Alf P. Steinbach
disabled by default. This option may be re-enabled by the project by placing a file with the name .htaccess with this line: Options +Indexes /result 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 a conforming Python

Re: when should I explicitly close a file?

2010-04-23 Thread Alf P. Steinbach
in a sufficiently large system. 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
. Cheers hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: string caracters:

2010-04-22 Thread Alf P. Steinbach
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: rfind bug ?

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

Re: when should I explicitly close a file?

2010-04-21 Thread Alf P. Steinbach
for a Very Long Time). Cheers hth., - 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
by using a finally clause (low level technique). 3.2.3 Performing cleanup by using a with statement. /contents 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. Partially that's

Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
I tested the reaction to typing [Ctrl C] at the first prompt. It then displayed the first part of traceback output, output part=1 C:\Documents and Settings\Alf sum.v4.py This program computes the sum of two numbers A and B. Number A, please: Traceback (most recent call last): /output

  1   2   3   4   5   6   7   >