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
* 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 single cluster. Before I started, I wondered if

Re: Static typing, Python, D, DbC

2010-09-12 Thread Alf P. Steinbach /Usenet
* Paul Rubin, on 13.09.2010 04:50: Ed Keithe_...@yahoo.com writes: I think DbC as envisioned by the Eiffel guy... the term is that it's a static verification technique, Eiffel throws an exception when a contract is violated. That is run time behavior, not static verification. The runtime

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
Extending and Embedding the Python Interpreter §2.1.2, the noddy3 extension module example, uses S as format character for string arguments in its call to PyArg_ParseTupleAndKeywords. This causes Noddy to only accept bytes as arguments, instead of strings (format U). I suspect this is a

Re: Different python versions confusion under Windows Vista x64

2010-07-19 Thread Alf P. Steinbach /Usenet
* Edward Diener, on 19.07.2010 14:53: In Windows Vista x64 I have installed python 2.6 64-bit version and python 3.1 64-bit version to separate folders. Within the command interpreter I add python 2.6 to the PATH. In the command interpreter, When I type python somescript.py with an import sys

Re: why is this group being spammed?

2010-07-18 Thread Alf P. Steinbach /Usenet
* be.krul, on 18.07.2010 07:01: why is this group being spammed? It depends a little on what you're asking, e.g. technical versus motivation. But I'll answer about something you probably didn't mean to ask, namely what human trait enables and almost forces that kind of behavior. And I

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

2010-07-17 Thread Alf P. Steinbach /Usenet
[Cross-posted comp.lang.c++ and comp.lang.python] Consider the following code, from an example usage of some C++ support for Python I'm working on, cppy: code struct Noddy { PyPtr first; PyPtr last; int number; Noddy( PyWeakPtr

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
* Johann Spies, on 16.07.2010 16:34: I am overlooking something stupid. I have two files: one with keywords and another with data (one record per line). I want to determine for each keyword which lines in the second file contains that keyword. The following code is not working. It loops

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
* Jonathan Lee, on 13.07.2010 16:41: Problem (C) is outside the realm of the C++ standard, since the C++ standard doesn't support shared libraries, and I've never actually used *nix shared libraries so I don't /know/... Is such dynamic initialization guaranteed? Not guaranteed, though I

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
* Gary Herron, on 14.07.2010 01:26: On 07/13/2010 03:02 PM, Roald de Vries wrote: Hi Gary, On Jul 13, 2010, at 8:54 PM, Gary Herron wrote: On 07/13/2010 10:26 AM, Roald de Vries wrote: Hi all, I have two objects that should both be able to alter a shared float. So i need something like 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 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
Hi. With the current cppy code the Python 3.1.1 doc's spam example extension module looks like this (actual working code): code #include progrock/cppx/devsupport/better_experience.h #include progrock/cppy/Module.h using namespace progrock; namespace { class Spam:

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
* Rhodri James, on 12.07.2010 22:19: On Mon, 12 Jul 2010 13:56:38 +0100, bart.c ba...@freeuk.com wrote: Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message news:4c3aedd5$0$28647$c3e8...@news.astraweb.com... On Mon, 12 Jul 2010 09:48:04 +0100, bart.c wrote: That's

Standard distutils package problems with MSVC / lacking functionality?

2010-07-12 Thread Alf P. Steinbach /Usenet
I let the setup.py script talk: code # 03_1__noddy from distutils.core import setup, Extension import distutils.ccompiler compilerName = distutils.ccompiler.get_default_compiler() options = [] if compilerName == msvc: # * distutils sets warning level 3: # Overriding with warning

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
* rantingrick, on 11.07.2010 08:50: On Jul 11, 1:22 am, Stephen Hansenme+list/pyt...@ixokai.io wrote: Utter nonsense. No one does that unless they are coming from C or some other language without a True/False and don't know about it, or if they are using a codebase which is supporting a very

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

2010-07-11 Thread Alf P. Steinbach /Usenet
* Stephen Hansen, on 11.07.2010 09:19: On 7/10/10 11:50 PM, rantingrick wrote: It was a typo not an on purpose misspelling If this had been the first time, perhaps. If you had not in *numerous* previous times spelled my name correctly, perhaps. If it were at all possible for f to be a typo

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

2010-07-11 Thread Alf P. Steinbach /Usenet
* rantingrick, on 11.07.2010 09:26: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i go on...?-- start with lowercase. Q: Well what the hell is

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* 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 is_my_extra_debugging_on: print ... when is_my_extra_debugging is set to

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
Hi. I built the [xxmodule.c] from the source distribution, as suggested by the Python 3.1.1 docs. I named this [xx.pyd], as I believed the module name was just xx. Indeed importing xx works fine, but when I do help(xx) I get ... example help( xx ) Help on module xx: NAME

Re: any issues with long running python apps?

2010-07-10 Thread Alf P. Steinbach /Usenet
* John Nagle, on 10.07.2010 20:54: On 7/9/2010 12:13 PM, Les Schaffer wrote: i have been asked to guarantee that a proposed Python application will run continuously under MS Windows for two months time. And i am looking to know what i don't know. The app would read instrument data from a

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

2010-07-09 Thread Alf P. Steinbach /Usenet
[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 started on (some days ago almost known as pynis (not funny after all)). For an extension

Re: Hello

2010-07-09 Thread Alf P. Steinbach /Usenet
* Dani Valverde, on 09.07.2010 18:31: Hello! I am new to python and pretty new to programming (I have some expertise wit R statistical programming language). I am just starting, so my questions may be a little bit stupid. Can anyone suggest a good editor for python? Cheers! If you're working

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
* Martin v. Loewis, on 07.07.2010 21:10: Python 3.1.1, file [pymem.h]: PyAPI_FUNC(void *) PyMem_Malloc(size_t); #define PyMem_MALLOC(n)(((n) 0 || (n) PY_SSIZE_T_MAX) ? NULL \ : malloc((n) ? (n) : 1)) The problem with the latter that it seems that it's intended for

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
* Martin v. Loewis, on 07.07.2010 21:56: Perhaps (if it isn't intentional) this is a bug of the oversight type, that nobody remembered to update the macro? Update in what way? I was guessing that at one time there was no PyMem_Malloc. And that it was introduced to fix Windows-specific

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

2010-07-07 Thread Alf P. Steinbach /Usenet
* Christian Heimes, on 07.07.2010 22:47: The main problem that the required MSVC redistributables are not necessarily present on the end user's system. It's not a problem for Python anymore. It took a while to sort all problems out. Martin and other developers have successfully figured out how

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
The code below, very much work in progress, just trying things, is C++. Sorry about the formatting, I had to reformat manually for this posting: code class Module { private: Ptr p_; public: Module( PyModuleDef const def ) : p_(

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

2010-07-06 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 06.07.2010 17:50: Just a little reminder: Microsoft has withdrawn VS2008 in favor of VS2010. The express version is also unavailable for download.:(( We can still get a VC++ 2008 compiler required to build extensions for the official Python 2.6 and 2.7 binary installers

Argh! Name collision!

2010-07-06 Thread Alf P. Steinbach /Usenet
Donald Knuth once remarked (I think it was him) that what matters for a program is the name, and that he'd come up with a really good name, now all he'd had to do was figure out what it should be all about. And so considering Sturla Molden's recent posting about unavailability of MSVC 9.0

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

2010-07-06 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 06.07.2010 19:35: On 6 Jul, 19:09, Thomas Jollanstho...@jollans.com wrote: Okay, you need to be careful with FILE*s. But malloc and free? You'd normally only alloc free something within the same module, using the same functions (ie not mixing PyMem_Malloc and malloc),

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
* Stephen Hansen, on 02.07.2010 19:41: Okay, so! I actually never quite got around to learning to do deep and useful magic with decorators. I've only ever done the most basic things with them. Its all been a little fuzzy in my head: things like what order decorators end up being called in if

Re: Using Classes

2010-06-24 Thread Alf P. Steinbach /Usenet
* Mag Gam, on 24.06.2010 13:58: I have been using python for about 1 year now and I really like the language. Obviously there was a learning curve but I have a programing background which made it an easy transition. I picked up some good habits such as automatic code indenting :-), and making my

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

2010-06-18 Thread Alf P. Steinbach
* Steven, on 18.06.2010 18:23: I am calling a ruby program from a python gui and using subprocess.Popen in Windows XP using python 2.6. Unfortunately, whenever the ruby program is called a blank command window appears on screen, annoying my users. Is there a way to suppress this behaviour?

Re: Overriding __setattr__ of a module - possible?

2010-06-17 Thread Alf P. Steinbach
* Gabriel Genellina, on 17.06.2010 09:25: En Wed, 16 Jun 2010 19:56:39 -0300, Ian Kelly ian.g.ke...@gmail.com escribió: On Wed, Jun 16, 2010 at 3:38 PM, John Nagle na...@animats.com wrote: That just leaves things in a state where even sys and import are undefined. Say what? It works fine

Re: Archiving emails in Gmail

2010-06-15 Thread Alf P. Steinbach
* teja, on 15.06.2010 09:03: Hi, I have a requirement that I want to log-in into a gmail account read all unread mails, mark them as read and then archive them. I am using libgmail (version 0.1.11) library to do so, using which I am able to log-in into a gmail account fetch all unread message

Re: Community (A Modest Proposal)

2010-06-13 Thread Alf P. Steinbach
* Steven D'Aprano, on 13.06.2010 19:57: On Sun, 13 Jun 2010 08:42:57 -0700, rantingrick wrote: i will start a fork. That is the most sensible thing you have said yet. Please do so, it will be a great thing for the Python community. Not nice to quote out of context, there was an if and a

Re: Tkinter Toplevel sizing issue (using a grid)

2010-06-12 Thread Alf P. Steinbach
* random joe, on 12.06.2010 01:40: Hello all, Hi this i my first post here. I would like to create a tkinter toplevel window with a custom resize action based on a grid. From the Tk docs it say you can do this but for the life of me i cannot figure out how? In my app i wish for the main window

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
* pyt...@bdurham.com, on 06.06.2010 17:17: Why not a GUI based on HTML, CSS and Javascript? To paraphrase another poster and to borrow from SQLite: Pick any *THREE*: - Simple - Beautiful - Cross-platform I'm not sure what this discussion is about, but anyway, modern GUI frameworks /are/

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

2010-06-05 Thread Alf P. Steinbach
* 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() self.root.mainloop() def op(self): Second(self) print(print) class Second: def

Re: one more exception newbie query

2010-06-04 Thread Alf P. Steinbach
* Payal, on 04.06.2010 12:10: Hi all, In http://docs.python.org/tutorial/errors.html#handling-exceptions it says, | try: | ...raise Exception('spam', 'eggs') Why would I want to use a class for exception? I could simply use raise w/o it? Also the help() says, class

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
* Andreas Waldenburger, on 04.06.2010 20:21: On Fri, 04 Jun 2010 00:57:15 +1000 Ben Finney ben+pyt...@benfinney.id.au wrote: Andreas Waldenburgeruse...@geekmail.invalid writes: But consolidation is the *only* way to go, really. The parallelism between c.l.p. and python-list is great

Re: Python Forum

2010-06-04 Thread Alf P. Steinbach
* John Bokma, on 04.06.2010 20:19: Steven D'Apranost...@remove-this-cybersource.com.au writes: But the really sad thing is that you think that bigger automatically equals better. I don't think that was the point. Anyway, not everbody can pick a provider, there are plenty of places that

Re: An empty object with dynamic attributes (expando)

2010-06-04 Thread Alf P. Steinbach
* Terry Reedy, on 05.06.2010 03:01: On 6/4/2010 8:01 PM, dmtr wrote: Why does it have to be a one-liner? Is the Enter key on your keyboard broken? Nah. I was simply looking for something natural and intuitive, like: m = object(); m.a = 1; Usually python is pretty good providing these natural

Re: An empty object with dynamic attributes (expando)

2010-06-03 Thread Alf P. Steinbach
* dmtr, on 03.06.2010 23:00: How can I create an empty object with dynamic attributes? It should be something like: m = object() m.myattr = 1 But this doesn't work. And I have to resort to: class expando(object): pass m = expando() m.myattr = 1 Is there a one-liner that would do the

Re: GUI programs

2010-05-30 Thread Alf P. Steinbach
* jyoun...@kc.rr.com, on 30.05.2010 03:13: Just curious if anyone would be willing to share their thoughts about different Python GUI programming modules. I've been doing a bit of research and am trying to find something that: 1. Is portable. Would like to be able to send the module along

Re: Address of an immutable object

2010-05-30 Thread Alf P. Steinbach
* candide, on 30.05.2010 19:38: Suppose a Python program defines an integer object with value 42. The object has an address we can capture with the built-in function id() : a=42 id(a) 152263540 Now I was wondering if any integer object with value 42 will be refered at the same adress

Re: tkinter function outout to text widget

2010-05-29 Thread Alf P. Steinbach
* Johan Lans, on 29.05.2010 22:51: Hi I'm totally new on python and I'm doing an assignement where I'm doing a class that manipulates a text. The program is also supposed to have a GUI, for which I have used tkinter. So far I have entry widgets for file names and buttons, its all working like I

Re: confusing error with nntplib

2010-05-27 Thread Alf P. Steinbach
* Eduardo Alvarez, on 27.05.2010 03:01: When trying to use nntplib to connect to the news server nntp.aioe.org, a bizarre sequence of events occurs: 1) I import the module, and create an instance, as follows: s = nntplib.NNTP('nntp.aioe.org') I get no errors, which leads me to believe all

Re: Local variables persist across function calls

2010-05-15 Thread Alf P. Steinbach
On 15.05.2010 19:18, * Dave: I've been writing Python for a few years now, and tonight I ran into something that I didn't understand. I'm hoping someone can explain this to me. I'm writing a recursive function for generating dictionaries with keys that consist of all permutations of a certain

Re: design question

2010-05-03 Thread Alf P. Steinbach
* Tim Arnold: This is a question about system design I guess. I have a django website that allows users to change/view configuration details for documentation builds. The database is very small. The reason I'm using a database in the first place is to make it easy for users to change the

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
On 01.05.2010 14:13, * Tim Chase: On 05/01/2010 12:08 AM, Patrick Maupin wrote: +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in- place operator methods, actually) *modify* the lhs object. Your proposed .= syntax conceptually *replaces* the lhs object (actually, rebinds the

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
On 02.05.2010 06:06, * Aahz: In article4bdcd631$0$27782$c3e8...@news.astraweb.com, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: The += family of operators really do rebind the symbol, not modify the object. They potentially

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
On 30.04.2010 21:40, * Lie Ryan: On 05/01/10 04:08, Neil Cerutti wrote: On 2010-04-30, Lie Ryanlie.1...@gmail.com 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-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

Re: find integers in f.readline()

2010-04-29 Thread Alf P. Steinbach
On 30.04.2010 04:22, * elsa: Hi people, I'm having a problem getting the info I need out of a file. I've opened the file with f=open('myFile','r'). Next, I take out the first line with line=f.readline() line looks like this: '83927 300023_25_5_09_FL 9086 9134 F3LQ2BE01AQLXF 1 49 + 80

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
* Richard Lamboj: is there any way to get the name from the actual called function, so that the function knows its own name? There was an earlier thread about this not very long ago. General consensus, as I recall, to replace function with an object of a class (possibly with __call__ method

Re: assigning multi-line strings to variables

2010-04-27 Thread Alf P. Steinbach
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...@u34g2000yqu.googlegroups.com... On Apr 27, 7:31 pm, Brendan Abel007bren...@gmail.com wrote: On

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
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 whose Unicode codepoint is the integer i. I want to convert a ASCII code back

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
* Luke Kenneth Casson Leighton: http://pyjs.org/examples/asteroids/public/Space.html result An error has been encountered in accessing this page. 1. Server: pyjs.org 2. URL path: /examples/asteroids/public/examples/asteroids/public/bootstrap.js 3. Error notes: NONE 4. Error type: 404 5.

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
* Adam Tauno Williams: On Fri, 2010-04-23 at 16:29 +1200, Lawrence D'Oliveiro wrote: In message mailman.2119.1271898215.23598.python-l...@python.org, Chris Rebert wrote: On Wed, Apr 21, 2010 at 5:53 PM, Lawrence D'Oliveiro wrote: In message 4bc9aad...@dnews.tpgi.com.au, Lie Ryan wrote: Since

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

2010-04-22 Thread Alf P. Steinbach
* candide: Suppose a and b are lists. What is more efficient in order to extend the list a by appending all the items in the list b ? I imagine a.extend(b)to be more efficient for only appendinding the items from b while a+=b creates a copy of a before appending, right ? No. But in

Re: string caracters:

2010-04-22 Thread Alf P. Steinbach
* luca72: i get a string from a web server and i save it in to a file, that i open the file and i read the string: the string looks like : http://lhti.gs/JKBTYD after the read i use webbrowser open (sting), but i get the error because at the end of the string are added '%0D%0A', and if i ask for

Re: rfind bug ?

2010-04-21 Thread Alf P. Steinbach
* Chris Rebert: On Wed, Apr 21, 2010 at 2:59 AM, Stef Mientki stef.mien...@gmail.com wrote: On 21-04-2010 10:56, Chris Rebert wrote: On Wed, Apr 21, 2010 at 1:51 AM, Stef Mientki stef.mien...@gmail.com wrote: With the following code, I would expect a result of 5 !! a= 'word1 word2 word3'

Re: when should I explicitly close a file?

2010-04-21 Thread Alf P. Steinbach
* Lawrence D'Oliveiro: In message 4bc9aad...@dnews.tpgi.com.au, Lie Ryan wrote: Since in python nothing is guaranteed about implicit file close ... It is guaranteed that objects with a reference count of zero will be disposed. Only in current CPython. In my experiments, this happens

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

2010-04-19 Thread Alf P. Steinbach
After at least 3 false starts on my programming introduction's chapter 3, and some good and bad feedback from this group[1], I finally think the present chapter 3 approach is Good (enough). So no, I haven't given up in this book project, even though 4 months to produce these chapter 3's first

Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
Python 3.1.1 in Windows XP Prof: code filename=sum.v4.py language=Py3 def number_from_user( prompt ): while True: spec = input( prompt ) try: return float( spec ) except ValueError: s = Sorry, '{}' is not a valid number spec. Try e.g. '3.14'.

  1   2   3   4   5   6   >