Re: Function parameter type safety?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? No, and that's considered a GoodThing(tm). > For example, say the first parameter in a function of > mine is required to be a string. If the user passes in an integer, I > want

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Chris Fonnesbeck a écrit : > I have a class that does MCMC sampling (Python 2.5) that uses decorators > -- one in particular called _add_to_post that appends the output of the > decorated method to a class attribute. > However, when I > subclass this base class, the decorator no longer works: >

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Lee Harr a écrit : >> Traceback (most recent call last): >> File "/Users/chris/Projects/CMR/closed.py", line 132, in >> class M0(MetropolisHastings): >> File "/Users/chris/Projects/CMR/closed.py", line 173, in M0 >> @_add_to_post >> NameError: name '_add_to_post' is not defined >> >> y

Re: How to create new files?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > Hi, > > I'm trying to create a Python equivalent of the C++ "ifstream" class, > with slight behavior changes. > > Basically, I want to have a "filestream" object that will allow you to > overload the '<<' and '>>' operators to stream out and stream in data, > respectivel

Re: bool behavior in Python 3000?

2007-07-13 Thread Bruno Desthuilliers
Miles a écrit : > On Jul 12, 8:37 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: >> I do not like that bool(False-True) is True. > > I've never seen the "A-B" used to represent "A and not B", nor have I > seen any other operator used for that purpose in boolean algebra, > though my experience is limite

Re: bool behavior in Python 3000?

2007-07-13 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > It makes more sense to explicitly cast bools to ints s/cast bools to ints/build ints from bools/ AFAICT, there's no such thing as typecast in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: access to the namespace of a function from within its invocation

2007-07-13 Thread Bruno Desthuilliers
Poor Yorick a écrit : > In the example below, the attribute "data" is added to a function > object. "me" can be used to get the function when it is invoked using > an identifier that matches the "co_name" attribute of function's code > object. Can anyone conjure an example of accessing fun2.da

Re: How to create new files?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > On Jul 13, 3:04 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: (snip) > Thanks for the variable naming tips. Is it normal for Python > programmers to create class members with a _ prefixed? This is the convention to denote implementation attributes. Th

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : (snip) > > Why? Why is OOP any better at explaining a state machine to a computer? I don't know if it's "better", but state machines are the historical starting point of OO with the Simula language. > I can write state machines all over the place in C, And even in ass

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : > Hi: > > From what I've read of OOP, I don't get it. I have also found some > articles profoundly critical of OOP. I tend to relate to these articles. > > However, those articles were no more objective than the descriptions of > OOP I've read in making a case. Ie., w

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : (snip) > > Excellent description. This understandable to me since I can envision > doing this with pointers. But I have no idea how Python actually > implements this. The code source is freely available, and it's in C !-) > It also appears that I am being guided away

Re: Pass by reference or by value?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > >>Hi, >> >>I noticed in Python all function parameters seem to be passed by >>reference. (snip) > > Correction: > > I ran a few more tests and python actually does a pass by value, (snip) Still wrong !-)

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : > Bruno Desthuilliers wrote: > >> Chris Carlen a écrit : > > >[edit] > >>> Must possibly learn a completely new way of thinking (OOP) >> >> >> Not necessarly. While Python is OO all the way down - meaning that >>

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Bruno Desthuilliers
Wayne Brehaut a écrit : > On Sat, 14 Jul 2007 06:01:56 +0200, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> Chris Carlen a écrit : >>> Hi: >>> >>> From what I've read of OOP, I don't get it. I have also found some >>&

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Bruno Desthuilliers
Wayne Brehaut a écrit : (snip) > after Bruno made the > claim: "OO is about machines - at least as conceveid by Alan Key, who > invented the term and most of the concept." Please reread more carefully the above. I do give credit to Smalltalk's author for the *term* "OOP", and *most* (not *all*)

Re: getting text inside the HTML tag

2007-07-16 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Jul 14, 12:47 pm, Nikola Skoric <[EMAIL PROTECTED]> wrote: >> I'm using sgmllib.SGMLParser to parse HTML. I have successfuly parsed start >> tags by implementing start_something method. But, now I have to fetch the >> string inside the start tag and end tag too. I h

Re: Trying to choose between python and java

2007-07-16 Thread Bruno Desthuilliers
Anthony Irwin a écrit : > Hi All, > (snip) > Also does anyone else have any useful comments about python vs java > without starting a flame war. I guess I'd better not answer, then !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: running a Delphi part from Python ?

2007-07-16 Thread Bruno Desthuilliers
Stef Mientki a écrit : > > I'm starting to get used to wxPython (coming from Delphi), > and it seems it can do almost everything I need. > > Now one thing I'm missing is a good RichEditor. Scintilla is for you, then. IIRC, there's a wxWidget widget embedding it, and quite a few editors using it

Re: questions about functions inside a function

2007-07-16 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I want to create a list of function. > > Here is my code: > In [9]: a = [] > > In [10]: for i in range(4): >: b = lambda : i**2 >: a.append(b) >: >: > > In [11]: for f in a: >: f() >: >: > 9 > 9 > 9

Re: Dynamic method

2007-07-16 Thread Bruno Desthuilliers
Lawrence Oluyede a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> > wrote: >>> I agree that in general the solution explained by Alex and you is better. >> They are not "better" - they are correct. > > Another way is to use the 'types'

[OT] Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Bruno Desthuilliers
Wayne Brehaut a écrit : > On Mon, 16 Jul 2007 10:10:05 +0200, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > >>Wayne Brehaut a écrit : >>(snip) >> >>>after Bruno made the >>>claim: "OO is about machines - at least as conceveid by

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Bruno Desthuilliers
Wayne Brehaut a écrit : > On Fri, 13 Jul 2007 20:37:04 -0400, Steve Holden <[EMAIL PROTECTED]> > wrote: > > >>Aahz wrote: >> >>>In article <[EMAIL PROTECTED]>, >>>Chris Carlen <[EMAIL PROTECTED]> wrote: From what I've read of OOP, I don't get it. >>> >>>For that matter, even using OOP a bi

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Bruno Desthuilliers
Wayne Brehaut a écrit : > On Sat, 14 Jul 2007 19:18:05 +0530, "Rustom Mody" > <[EMAIL PROTECTED]> wrote: > > >>On 7/14/07, Alex Martelli <[EMAIL PROTECTED]> wrote: >> >>>OOP can be abused (particularly with deep or intricate inheritance >>>structures). But the base concept is simple and clear: y

Re: Technology solutions for Ruby?

2007-07-16 Thread Bruno Desthuilliers
vasudevram a écrit : (snip) >>To me this means Ruby, Python, or, as mentioned above, Perl. If anyone > > can tell me of a way to meet the above requirements in either Python > or > Perl, I'm all ears (I just prefer Ruby). >>1. GUI - Native Look and Feel. According to wxRuby the bindings aren't

Re: Private functions and inheritance

2007-07-16 Thread Bruno Desthuilliers
Maciej Bliziński a écrit : (snip the rest - already answered by at least 3 persons). > I > don't want to expose the __bar() function outside, but on the other > hand i want to defer its implementation to a subclass. It seems like I > need to make it public, doesn't it? First, keep in mind that th

Re: questions about functions inside a function

2007-07-16 Thread Bruno Desthuilliers
Jeremy Sanders a écrit : > [EMAIL PROTECTED] wrote: > > >>What I want is, the value of i should be bounded to the anonymous >>function. And the output should like this: > > ... > >>How to achieve this? > > > This doesn't answer your question (others have), but another (perhaps > clearer) way

Re: Class decorators do not inherit properly

2007-07-16 Thread Bruno Desthuilliers
Lee Harr a écrit : >>>I think the term "class decorator" is going to eventually >>>mean something other than what you are doing here. I'd >>>avoid the term for now. >>> >>> >>>When you decorate a class method, >>>the function you use >>>needs to be defined before the method definition. >> >>FWIW, t

Re: How to organize control access to source code ?

2007-07-17 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hello, > How can we organize development team with code source control policy, > that limit access to some portion of code ? The question may be of interest, but I'm afraid I don't understand how it relates to Python ??? -- http://mail.python.org/mailman/listinfo/p

Re: Dynamic method

2007-07-17 Thread Bruno Desthuilliers
Daniel a écrit : > Bruno Desthuilliers wrote: >>> Another way is to use the 'types' module: >> True - and that's somewhat cleaner since it doesn't expose the internals >> of the descriptor protocol. OTHO, it can lead to strange results with >>

Re: a=0100; print a ; 64 how to reverse this?

2007-07-17 Thread Bruno Desthuilliers
mosi a écrit : > Problem: > how to get binary from integer and vice versa? > The simplest way I know is: > a = 0100 > a > 64 > > but: > a = 100 (I want binary number) > does not work that way. > > a.__hex__ exists > a.__oct__ exists > > but where is a.__bin__ ??? > > > What`s the simplest wa

Re: accessing javascript variables within psp code

2007-07-18 Thread Bruno Desthuilliers
BAnderton a écrit : > Hello all, > > Question: Is there any way to access a javascript variable from > within psp code? Short answer : no (or at least: not directly). And it has nothing to do with PSP. Long answer: this has to do with the http protocol. Things go like this: 1/ the client (us

Re: Design question regarding exceptions.

2007-07-18 Thread Bruno Desthuilliers
asincero a écrit : > I have a class called Users that provides a higher level of > abstraction to an underlying "users" table in a pgsql database. It > has methods like "addUser()" and "deleteUser()" which, obviously, wrap > the corresponding SQL statements. My question is would it better to > le

Re: a=0100; print a ; 64 how to reverse this?

2007-07-18 Thread Bruno Desthuilliers
Karthik Gurusamy a écrit : > On Jul 17, 5:35 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> mosi a écrit : >> >> >> >>> Problem: >>> how to get binary from integer and vice versa? >>> The simplest way I know is: >>> a = 0100

Re: class C: vs class C(object):

2007-07-19 Thread Bruno Desthuilliers
nvictor a écrit : > Hi, > > I'm not an experienced developer, and I came across this statement by > reading a code. I search for explanation, but can't find anything > meaningful. I read the entire document written by python's creator > about the features of version 2.2 The one named unifying type

Re: Itertools question: how to call a function n times?

2007-07-19 Thread Bruno Desthuilliers
Matthew Wilson a écrit : > I want to write a function that each time it gets called, it returns a > random choice of 1 to 5 words from a list of words. > > I can write this easily using for loops and random.choice(wordlist) and > random.randint(1, 5). > > But I want to know how to do this using i

Re: Converting between objects

2007-07-20 Thread Bruno Desthuilliers
Nathan Harmston a écrit : > Hi, > > I have being thinking about this and was wondering with built in types > you can do things like > > float(1) or str(200) > > is there way I can define conversion functions like this: > > say i have a class A and a class B > > bobj = B() > aobj = a(bobj) > >

Re: "The basics" difficulties

2007-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I'm trying to get this basic sample to work: > http://docs.python.org/ext/dnt-basics.html > > When I get to the last step: > $ python setup.py build > > I get this error: > error: Python was build with Visual Studio version 8.0 and > extensions need to be built with

Re: class C: vs class C(object):

2007-07-20 Thread Bruno Desthuilliers
Aahz a écrit : > In article <[EMAIL PROTECTED]>, > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> To make a long story short: Python 2.2 introduced a new object model >> which is more coherent and more powerful than the original one. The old >> one was k

Re: How to organize control access to source code ?

2007-07-20 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >>> How can we organize development team with code source control policy, >>> that limit access to some portion of code ? >> The question may be of interest, but I'm afraid I don&#x

Re: Pythonic way for missing dict keys

2007-07-21 Thread Bruno Desthuilliers
Alex Popescu a écrit : > Hi all! > > I am pretty sure this has been asked a couple of times, but I don't seem > to find it on the archives (Google seems to have a couple of problems > lately). > > I am wondering what is the most pythonic way of dealing with missing > keys and default values. >

Re: Pythonic way for missing dict keys

2007-07-21 Thread Bruno Desthuilliers
Alex Popescu a écrit : > Jakub Stolarski <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>Version 1 and 2 do different thing than version 3. The latter doesn't >>add value to dict. >> >>As it was mentioned before, use: >>1 - if you expect that there's no key in dict >>2 - if you expe

Re: Weird errors when trying to access a dictionary key

2007-07-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I have a data structure that looks like this: > (snip) > > I get the following error: (snip) > AttributeError: 'list' object has no attribute 'keys' Already answered. > Here is where it gets weird: > > type(song) (snip) > TypeError: 'str' object is not callable Y

Re: class C: vs class C(object):

2007-07-21 Thread Bruno Desthuilliers
George Sakkis a écrit : > On Jul 20, 5:40 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >>Aahz a écrit : >> >> >>>In article <[EMAIL PROTECTED]>, >>>Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >>> >>>>To

Re: comparison with None

2007-04-19 Thread Bruno Desthuilliers
Steven Howe a écrit : (snip) > I've read and found that 'None' comparisons is not always a good idea. > Better to: > from types import NoneType > > x = None > if type( x ) == NoneType: ># true >< code > > else: ># false; do something else. >< more code > Actually, None is garantee

Re: Python Feature Request: Explicit variable declarations

2007-04-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hello. Please tell me whether this feature request is sane (and not > done before) for python so it can be posted to the python-dev mailing > list. I should say first that I am not a professional programmer with > too much technical knowledge. > > I would like to have

Re: Shebang or Hashbang for modules or not?

2007-04-21 Thread Bruno Desthuilliers
Jorgen Grahn a écrit : > On Fri, 13 Apr 2007 22:46:03 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> > wrote: > >>Jorgen Grahn a écrit : > (snip) > >>More seriously, and as far as I'm concerned, when I want to make a >>python script (by oppositi

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > >>One inessential but very useful thing about tuples when you have a lot >>of them is that they are allocated the minimum possible amount of >>memory. OTOH lists are created with some slack so that appending

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Please help me think of an example where immutable tuples are > essential. Well, I don't know if they are "essential" - much of Python can be seen as 'unessential' syntactic sugar (my, even the class statement is not "essential" if you go that way). > It seems that

Re: Newbie question regarding string.split()

2007-04-21 Thread Bruno Desthuilliers
kevinliu23 a écrit : > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') The parens around the call to input.replace are useless: pr

Re: class __getitem__ when item is not a sequence ???

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Sorry for the vague subject. Not sure what the right terminology is. > > How can I use an instance's data by reference to the instance name, > not the instance attribute? OK the question is probably really poor > but hopefully an example will make it clear. > > >>x=

Re: Better dict of dicts

2007-04-21 Thread Bruno Desthuilliers
Bill Jackson a écrit : > I have a dictionary of dictionaries where the keys are typically very > long tuples and repeated in each inner dictionary. The dictionary > representation is nice because it handles sparseness well...and it is > nice to be able to look up values based on a string rather

Re: Nested dictionaries trouble

2007-04-21 Thread Bruno Desthuilliers
IamIan a écrit : > I am using the suggested approach to make a years list: > > years = ["199%s" % x for x in range(0,10)] > years += ["200%s" % x for x in range(0,10)] > > I haven't had any luck doing this in one line though. Is it possible? # Q, D and pretty obvious years = ["199%s" % x for x i

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Bruno Desthuilliers
Kevin Walzer a écrit : (snip) > Thanks to all for an illuminating thread on the mathematical > implications of "learning curve" and other aspects. This thread has > wandered pretty far from my original question (above) Noticed this too ?-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Bruno Desthuilliers
Kevin Walzer a écrit : > From the introduction to PyObjC, the Python-Objective-C bridge on Mac > OS X: > > "As described in Objective-C for PyObjC users the creation of > Objective-C objects is a two-stage process. To initialize objects, first > call a class method to allocate the memory (typi

Re: Dictionaries and dot notation

2007-04-22 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > Martin Drautzburg a écrit : > >> This may be pretty obvious for most of you: >> >> When I have an object (an instance of a class "Foo") I can access >> attributes via dot notation: >> >> aFoo.bar >

Re: Dictionaries and dot notation

2007-04-22 Thread Bruno Desthuilliers
Martin Drautzburg a écrit : > This may be pretty obvious for most of you: > > When I have an object (an instance of a class "Foo") I can access > attributes via dot notation: > > aFoo.bar > > however when I have a dictionary > > aDict = {"bar":"something"} > > I have to write

Re: Dictionaries and dot notation

2007-04-23 Thread Bruno Desthuilliers
Martin Drautzburg a écrit : > Daniel Nogradi wrote: > > > What if I want to create a datastructure that can be used in dot notation without having to create a class, i.e. because those objects have no behavior at all? >>> >>>A class inheriting from dict and implementing __getattr__ a

Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > > Well, why do some things in the library have to be functions, and > other things have to be class methods? > Why aren't they all just either functions or class methods? like > perhaps ruby. > If I tell you that Python's functions are in fact static method

Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
Marc 'BlackJack' Rintsch a écrit : > In <[EMAIL PROTECTED]>, Steven Howe > wrote: > >> And before someone get's all technical, I know everything in Python is >> an 'object' even None, which implies class, or is it the other way around? > > Objects don't imply classes. There are object oriented

Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
7stud a écrit : > [EMAIL PROTECTED] wrote: >> Annoyances: >> > > Every language has annoyances. Python is no exception. Sure. But we may disagree on what are actually Python's annoyances !-) > Post away. > Anyone that is offended can go drink a Guinness. > >> 1. Underscores! What's the deal

Re: what python technology for my app?

2007-04-27 Thread Bruno Desthuilliers
Chris a écrit : > I have an database containing lots of numerical data. I want to write a > browser based interface that will allow selection of various key > parameters and yield tables, plots and/or printouts of the data > according to the selections. Ultimately I want this to run on an > int

Re: what python technology for my app?

2007-04-27 Thread Bruno Desthuilliers
Robert Rawlins - Think Blue a écrit : > Just thought I'd make a little suggestion about this, I don’t know how > strict you want to be with the web development side of things, but I'm a web > developer by trade and have recently started using python for my non-web > type applications. > > If you'r

Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
Antoon Pardon a écrit : > On 2007-04-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>7stud a écrit : >> >>>[EMAIL PROTECTED] wrote: >>> >>>>Annoyances: >>>> >>> >>>Every language has annoyances. Py

Re: Which are your favorite UML tools?

2007-04-27 Thread Bruno Desthuilliers
Anastasios Hatzis a écrit : > Hello, > > I'm working on the light-weight MDA tool pyswarm, > http://pyswarm.sourceforge.net/ (it is about a code-generator for > Python/PostgreSQL-based software. I plan to add support of UML CASE tools > other than the one supported currently. > > I would like

Re: creating an object from base class

2007-04-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > i wish to have some extended functionality added to sockets > > i can create my own socket class class mysocket(socket.socket): > > and all should be fine. Except, the sockets are created for me by the > accept method, listening on port. So how can i take the stand

Re: Is it possible to determine what a function needs for parameters -

2007-05-02 Thread Bruno Desthuilliers
rh0dium a écrit : > Hi all, > > Below is a basic threading program. The basic I idea is that I have a > function which needs to be run using a queue of data. Early on I > specified my function needed to only accept basic parameters ( no > postional *args or *kwargs ) but now I am re-writing it an

Re: My Python annoyances

2007-05-02 Thread Bruno Desthuilliers
James Stroud a écrit : (snip) > > I want to complain about the fact that I wrote 200 lines the other day > and it worked first time. Problem was, I spent 20 minutes before I > realized that the lack of errors was a result of the lack of bugs. +1 QOTW -- http://mail.python.org/mailman/listinfo/

Re: How to check if a string is empty in python?

2007-05-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > How to check if a string is empty in python? > if(s == "") ?? > if not s: print "s is empty" -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I use Python instead of Joomla?

2007-05-02 Thread Bruno Desthuilliers
walterbyrd a écrit : > If I wanted to build a website with forums, news feeds, galleries, > event calander, document managment, etc. I do so in Joomla easily. > > But, I would perfer to use django/python, if that would be at all > practical. > > I suppose I could put python scripts into django, i

Re: How to check if a string is empty in python?

2007-05-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On May 2, 3:49 pm, Basilisk96 <[EMAIL PROTECTED]> wrote: > >>A simple >> >>if s: >>print "not empty" >>else: >>print "empty" >> >>will do. > > > How do you know that s is a string? Why do you want to know if it's a string ? -- http://mail.python.org/mailm

Re: Can I use Python instead of Joomla?

2007-05-03 Thread Bruno Desthuilliers
walterbyrd a écrit : > On May 2, 5:38 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> You're mixing apples, fishes, and cars here. Joomla is a content >> management system, Django a framework and Python a language. > > Yes, I know, but they are all

Re: is there a module to work with pickled objects storage in database?

2007-05-04 Thread Bruno Desthuilliers
krishnakant Mane a écrit : > hello all, > I am trying a very complex kind of a task in a project. > I have a knowledge management system where I need to store a lot of > objects (pickled). I have to store mostly lists and dictionaries into > a rdbms. Which totally defeats the purpose of a rdbms.

Re: Newbie and Page Re-Loading

2007-05-04 Thread Bruno Desthuilliers
mosscliffe a écrit : > I am very new to this python world, but I do like the look of the > language / syntax, though I have had some problems with indenting > using a text editor. There's no shortage of smart code editor having a decent support for Python. > > I have managed to get my ISP to ex

Re: Newbie and Page Re-Loading

2007-05-04 Thread Bruno Desthuilliers
mosscliffe a écrit : > Bruno, > > Many thanks for your very helpful reply. > > I am trying WingIDE Personal as an editor, up to now it seems OK. > > My ISP is running Python 2.4.3 and does not know about mod_python. > Few ISPs want to deploy mod_python... > I do not want to run a framework ye

Re: Towards faster Python implementations - theory

2007-05-08 Thread Bruno Desthuilliers
John Nagle a écrit : >Some faster Python implementations are under development. > JPython has been around for a while, s/JP/J/ And FWIW, I'm not sure Jython is really faster than CPython... -- http://mail.python.org/mailman/listinfo/python-list

Re: changing a var by reference of a list

2007-05-08 Thread Bruno Desthuilliers
Jorgen Bodde a écrit : > Ok thanks, > > I will try this approach. The idea was that I could give a list to the > SQL execute command, so that the results coming back would > automatically be assigned to variables. > You may want to have a look at SQLAlchemy. -- http://mail.python.org/mailman/lis

Re: Parameter checking on an interfase

2007-05-09 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi all, > I am more or less new to Python, and currently am making my > first "serious" program. The application is a Clinical History manager > (for my wife) which stores its data on a sqlite database. After > googling on this newsgroup, I have read several th

Re: elegant python style for loops

2007-05-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > To step through a list, the python style is avoid an explicit index. > But what if the same hidden index is to be used for more than one list > > for example:- > for key,value in listKeys,listValues : > newdict[key]=value newdict = dict(zip(listKeys, listValues

Re: Newbie look at Python and OO

2007-05-10 Thread Bruno Desthuilliers
walterbyrd a écrit : > I learned to program with Pascal, way back when. Went into software > development for a while, then went into systems admin. Have programmed > in several languages, just learning Python. > > Some things I find odd: > > 1) 5/-2 == -3? integer division. > 2) list assignment

Re: Newbie look at Python and OO

2007-05-10 Thread Bruno Desthuilliers
walterbyrd a écrit : > Thanx for all the replies, I may be slowly getting it. But, can > anybody explain this? > > a = 'hello' b = 'hello' a is b > > True > a = 'hello there' b = 'hello there' a is b > > False > Python - well, CPython (the reference C implementation) a

Re: Newbie look at Python and OO

2007-05-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > After thought: > > I do run into problems testing boolean values on a regular basis. FWIW, booleans were a late add-on. Originally, Python didn't had a bool type, only rules about the boolean value of a given object, mostly: 0, 0.0, '', [], (,), {} and None

Re: Newbie question about string(passing by ref)

2007-05-10 Thread Bruno Desthuilliers
lazy a écrit : > Hi, > > I want to pass a string by reference. I understand that strings are > immutable, but Im not > going to change the string in the function, just to aviod the overhead > of copying(when pass-by-value) because the > strings are long and this function will be called over and ov

Re: Dynamic subclassing ?

2007-05-12 Thread Bruno Desthuilliers
manatlan a écrit : > I've got an instance of a class, ex : > > b=gtk.Button() > > I'd like to add methods and attributes to my instance "b". > I know it's possible by hacking "b" with setattr() methods. You don't even need setattr() here, you can set the attributes directly. > But i'd > like t

Re: __dict__ for instances?

2007-05-13 Thread Bruno Desthuilliers
Ivan Voras a écrit : > [EMAIL PROTECTED] wrote: > > >>I think you want "dir(instance)" __dict__ returns the instance > > > Part of the problem is that dir(instance) returns a list of strings, so > iterating the dir(instance) gets me strings, not methods. Alternatively, > is there a way to get

Re: __dict__ for instances?

2007-05-13 Thread Bruno Desthuilliers
Ivan Voras a écrit : > While using PyGTK, I want to try and define signal handlers > automagically, without explicitly writing the long dictionary (i.e. I > want to use signal_autoconnect()). > > To do this, I need something that will inspect the current "self" and > return a dictionary that looks

Re: Dynamic subclassing ?

2007-05-13 Thread Bruno Desthuilliers
manatlan a écrit : > On 12 mai, 17:00, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>manatlan a écrit : >> >> >>>I've got an instance of a class, ex : >> >>>b=gtk.Button() >> >>>I'd like to add methods and

Re: design question

2007-05-13 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On May 12, 9:34 pm, Bjoern Schliessmann [EMAIL PROTECTED]> wrote: > > >>In principle, this is legal. >> >>But OTOH, how could a ShoppingCart "buy" something? In my world, >>Buyers "buy" when using ShoppingCarts. > > > Yes, I don't know either. I got this assignme

Re: __dict__ for instances?

2007-05-13 Thread Bruno Desthuilliers
Ivan Voras a écrit : > Marc Christiansen wrote: > > >>Nope, at least for PyGTK 2 :) See below. > > > Aaah, but! > > >>[...] >> >>>This looks like it should be easy, but I can't find the solution :( >> >>Use the doc, Luke, oops, Ivan :) >>Citing the gtk.glade.XML.signal_autoconnect documen

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Bruno Desthuilliers
Martin v. Löwis a écrit : > PEP 1 specifies that PEP authors need to collect feedback from the > community. As the author of PEP 3131, I'd like to encourage comments > to the PEP included below, either here (comp.lang.python), or to > [EMAIL PROTECTED] > > In summary, this PEP proposes to allow no

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Bruno Desthuilliers
Stefan Behnel a écrit : > Anton Vredegoor wrote: > >>>In summary, this PEP proposes to allow non-ASCII letters as >>>identifiers in Python. If the PEP is accepted, the following >>>identifiers would also become valid as class, function, or >>>variable names: Löffelstiel, changé, ошибка, or 売り場 >>>

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Bruno Desthuilliers
Stefan Behnel a écrit : > Martin v. Löwis schrieb: > >>PEP 1 specifies that PEP authors need to collect feedback from the >>community. As the author of PEP 3131, I'd like to encourage comments >>to the PEP included below, either here (comp.lang.python), or to >>[EMAIL PROTECTED] >> >>In summary, t

Re: How to do basic CRUD apps with Python

2007-05-14 Thread Bruno Desthuilliers
walterbyrd a écrit : > With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax > and non-Ajax solutions abound. > > With Python, finding such library, or apps. seems to be much more > difficult to find. > > I thought django might be a good way, but I can not seem to get an > answer

Re: __dict__ for instances?

2007-05-14 Thread Bruno Desthuilliers
Ivan Voras a écrit : > Bruno Desthuilliers wrote: > >>> "WARNING: "on_button_clicked" not callable or a tuple" >> Please post the relevant code and the full traceback. > > The code: > > Class W: > def __init__(self): > self.xm

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-14 Thread Bruno Desthuilliers
Stefan Behnel a écrit : > Eric Brunel wrote: >> On Mon, 14 May 2007 11:00:29 +0200, Stefan Behnel >>> Any chance there are still kanji-enabled programmes around that were >>> not hit >>> by the bomb in this scenario? They might still be able to help you get >>> the >>> code "public". >> Contrarily

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-14 Thread Bruno Desthuilliers
Stefan Behnel a écrit : > Bruno Desthuilliers wrote: >> but CS is english-speaking, period. > > That's a wrong assumption. I've never met anyone *serious* about programming and yet unable to read and write CS-oriented technical English. > I understand that peo

Re: Distributing programs depending on third party modules.

2007-05-15 Thread Bruno Desthuilliers
Tina I a écrit : > Hi list, > > Is there a preferred way to distribute programs that depends on third > party modules like PyQt, Beautifulsoup etc? I have used setuptools and > just having the setup script check for the existence of the required > modules. If they're not found I have it exit wi

Re: Trying to choose between python and java

2007-05-15 Thread Bruno Desthuilliers
Anthony Irwin a écrit : > Hi All, > > I am currently trying to decide between using python or java and have a > few quick questions about python that you may be able to help with. > > #1 Does python have something like javas .jar packages. A jar file > contains all the program files and you can

Re: Trying to choose between python and java

2007-05-15 Thread Bruno Desthuilliers
Steven Howe a écrit : (snip) >> > Flame war? Here amongst all the reasonable adults programmers? It never > happens. > Lol ! +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Distributing programs depending on third party modules.

2007-05-15 Thread Bruno Desthuilliers
Kevin Walzer a écrit : > Tina I wrote: > >> Hi list, >> >> Is there a preferred way to distribute programs that depends on third >> party modules like PyQt, Beautifulsoup etc? I have used setuptools and >> just having the setup script check for the existence of the required >> modules. If they'

Re: Trying to choose between python and java

2007-05-15 Thread Bruno Desthuilliers
Beliavsky a écrit : > On May 15, 1:30 am, Anthony Irwin <[EMAIL PROTECTED]> wrote: > > > >>#5 someone said that they used to use python but stopped because the >>language changed or made stuff depreciated (I can fully remember >>which) and old code stopped working. Is code written today likely t

<    6   7   8   9   10   11   12   13   14   15   >