Hi,
I'm looking to create a prog that will store disparate bits of info
all linked together, i.e. address details for a person, transaction
records, specific themes, and the ability to search by certain
criteria, so I'm pretty sure I want a database.
Can anyone recommend a useful database librar
Smith, Jeff wrote:
But in my mind nothing beats the Perl statement:
newstr = "$s $n $r";
for clarity, ease of use, and maintainability.
Only a little ease of use is lost with the following in Python, clarity
and maintainability are kept, and it even will let you format the output
(as in # of deci
On Feb 10, 2005, at 19:50, Bill Mill wrote:
so "#{} .
Here, [symbol] refers to the scope(?) of the variable. See the
discussion between me and Alan on this topic a while ago -- the use of
these symbols being his main criticism of Ruby.
foo is a local variable
$foo is a global variable
@foo is a
Kent,
On Thu, 10 Feb 2005 13:43:21 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Python 2.4 includes a string.Template class which does much the same thing as
> Itpl.itpl():
>
> >>> from string import Template
> >>> s, n, r = '0', 12, 3.4
> >>> x = Template("$s $n $r")
> >>> x.substit
On Thu, 10 Feb 2005 19:28:26 -, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > Although it's worse with:
> > newstr = s + ' ' + str(n) + ' ' + str(r)
>
> You could try:
>
> newstr = s + ' ' + `n` + ' ' + `r`
>
> if you think thats better.
> But `` is different to str() for some types.
>
> Person
> Although it's worse with:
> newstr = s + ' ' + str(n) + ' ' + str(r)
You could try:
newstr = s + ' ' + `n` + ' ' + `r`
if you think thats better.
But `` is different to str() for some types.
Personally I prefer the formatting approach.
> But in my mind nothing beats the Perl statement:
> new
Bill Mill wrote:
Kent,
On Thu, 10 Feb 2005 13:43:21 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
Python 2.4 includes a string.Template class which does much the same thing as Itpl.itpl():
I just didn't want to give an answer that only works in python 2.4,
and one furthermore which I have not test
Abel,
No, you don't have to escape them all. Perl treats single and double
quotes differently. Single-quoted strings don't do interpolation and
double-quoted strings do.
Jeff
-Original Message-
From: Abel Daniel [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 10, 2005 12:23 PM
To
Python 2.4 includes a string.Template class which does much the same thing as
Itpl.itpl():
>>> from string import Template
>>> s, n, r = '0', 12, 3.4
>>> x = Template("$s $n $r")
>>> x.substitute(locals())
'0 12 3.4'
If you want to bundle this up in a pp() function you have to do some magic to
On Thu, 10 Feb 2005 18:22:30 +0100, Abel Daniel <[EMAIL PROTECTED]> wrote:
> Bill Mill writes:
>
> > I get the impression that many pythonistas don't like string
> > interpolation. I've never seen a clear definition of why.
> >From "import this":
>
> Explicit is better than implicit.
>
> An
I regret my original answer since it led to frustration. I missed the point
that the local variable is pointed to the once-created default object, and
that reassigning to that name does NOT affect the once-created default object.
I am glad for a community in which we can cover each other's blind
Bill Mill writes:
> I get the impression that many pythonistas don't like string
> interpolation. I've never seen a clear definition of why.
>From "import this":
Explicit is better than implicit.
And doesn't perl's method mean that you have to escape _every_
_single_ '$' in strings? I think
Sorry for the double post; I forgot one thing:
On Thu, 10 Feb 2005 10:43:28 -0500, Bill Mill <[EMAIL PROTECTED]> wrote:
> Jeff,
>
> I get the impression that many pythonistas don't like string
> interpolation. I've never seen a clear definition of why. Anyway, it's
> easy enough to add with the I
Jeff,
I get the impression that many pythonistas don't like string
interpolation. I've never seen a clear definition of why. Anyway, it's
easy enough to add with the Itpl [1] module:
>>> import Itpl, sys
>>> sys.stdout = Itpl.filter()
>>> s, n, r = 0, 0, 0
>>> print "$s $n $r"
0 0 0
>>> x = Itpl.
To all those who talked about hating the symbology in Perl and the
suggestion that it should be removed from a later version. I just
remembered what you get for that symbology that I really do like about
Perl: variable interpolation in strings:
C:
sprintf(newstr,"%s %d %f",s,n,r);
Becomes a litt
> I am not so clued up on the 'base 2' and 'base 8' stuff.
> Care to explain that a little?
Easy. Imagine the numerals 2,3,4,5,6,7,8,9 were never invented.
You'd start counting at 0.
Next would come 1.
Now you've maxed out your first column so you have to carry to the
next column, so next would c
Alan Gauld wrote:
The main change in refactoring is moving it to OOP. I have a method
that serves as the entry point for parsing the files.
Not an object? If you are thinking terms of what the methods
do its probably not OOP...
I would expect to see an object for the File, another for the Header,
Alan Gauld said unto the world upon 2005-02-10 02:58:
The main change in refactoring is moving it to OOP. I have a method
that serves as the entry point for parsing the files.
Not an object? If you are thinking terms of what the methods
do its probably not OOP...
Hi Alan,
That may well be :-) What
Johan Geldenhuys said unto the world upon 2005-02-10 00:43:
I am not so clued up on the 'base 2' and 'base 8' stuff.
Care to explain that a little?
Johan
On Tue, 2005-02-08 at 12:12, Pierre Barbier de Reuille wrote:
Hi Johan,
here's a go:
We have 10 fingers. Not coincidentally, we have a base 10 n
On Feb 10, 2005, at 05:43, Johan Geldenhuys wrote:
I am not so clued up on the 'base 2' and 'base 8' stuff.
Care to explain that a little?
Usually, we use base 10 numbers, that is, numbers that can be
represented with 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
Binary, or base 2, represents all
> I am not so clued up on the 'base 2' and 'base 8' stuff.
> Care to explain that a little?
base 2 is binary, base 8 is octal.
We normally use base 10 decimal.
The base refers to the biggest number that can be represented
by a single digit. (Actually one less than the base because we
start with
> >def f(a,L=[]):
> >if L==[5]:
> >print 'L==[5] caught'
> >print L
> >print 'resetting L...'
> >L=[]
> >L.append(a)
> >return L
> >
> >
> >###
> >
> Now I'm dizzy... I can't understand why there are two "L"!
> L is a local variable of the function, right
> The main change in refactoring is moving it to OOP. I have a method
> that serves as the entry point for parsing the files.
Not an object? If you are thinking terms of what the methods
do its probably not OOP...
I would expect to see an object for the File, another for the Header,
a third for t
23 matches
Mail list logo