Brian van den Broek wrote:
Sean Perry said unto the world upon 2005-01-27 02:13:
SNIP
And now, for the pedant in me. I would recommend against naming
functions with initial capital letters. In many languages, this implies
a new type (like your Water class). so CombineWater should be
combineWater.
Wolfram Kraus said unto the world upon 2005-01-27 03:24:
Brian van den Broek wrote:
SNIP
Thanks Wolfram,
I knew someone would improve what I posted. (It can always be done ;-)
for i in a_list:
if i in items_dict:
items_dict[i] = items_dict[i] + 1
else:
Does anyone happen to know how to turn of the syntax checking in
python? I've been working on a module driven preprocessor but I'd
like
to not have to use comment strings.
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection
This is something I've been trying to figure out for some time. Is
there a way in Python to take a string [say something from a
raw_input] and make that string a variable name? I want to to this
so
that I can create class instances on-the-fly, using a user-entered
string as the instance
Greetings all, I'm new to python and thought I'd pop in here for
advice.
Good decisions both :-)
I've done object oriented design and programmed in perl, java, c++,
basic, etc.
...
I'm curious about good tutorial websites and books to buy.
With your background the standard Python tutorial
I hear that Alan Gauld's tutorial is also very good, but geared more
towards people new to programming.
Yes, I try to take folks to the point where they can understand the
official tutor (well maybe a wee bit further than that, but that
was the original target...)
(which itself should be in
for i in range(len(a)):
for k in range(len(a)):
for k in range(i,len(a)):
is faster, and if you calculate len before starting the
loops that will speed it up too. (You calculate len for
each iteration of each loop!)
if i != k:
if a[i] == a[k]:
print a[i]
break
HTH
Alan G.
functions with initial capital letters. In many languages, this
implies
a new type (like your Water class). so CombineWater should be
combineWater.
Do you mean implies by the dominant coding conventions, or by
language
syntax? (Indulging the curious pedant in me.)
Coding convention. Its
Does anyone happen to know how to turn of the syntax checking in
python? I've been working on a module driven preprocessor but I'd
like to not have to use comment strings.
So don't use them! They aren't mandatory.
I'm not sure I understand youir problem? Why would turning
off syntax
Brian van den Broek wrote:
Wolfram Kraus said unto the world upon 2005-01-27 03:24:
Brian van den Broek wrote:
for key in items_dict.copy(): # Try it without the .copy()
if items_dict[key] == 1:# and see what happens.
del items_dict[key]
dict_keys =
Google is your friend: Googling 'python clustering algorithm' gives many hits that seem to have what
you are looking for.
Kent
kumar s wrote:
Hi:
I am still trying to learn the OOPs side of python.
however, things/circumstances dont seems to stop until
I finish my practise and attaing higher
Chad Crabtree wrote:
Does anyone happen to know how to turn of the syntax checking in
python? I've been working on a module driven preprocessor but I'd
like to not have to use comment strings.
I don't think that's possible. What would the compiler do with code
with an invalid syntax?
-Original message-
From: Alan Gauld [EMAIL PROTECTED]
Date: Thu, 27 Jan 2005 05:08:07 -0500
To: Chad Crabtree [EMAIL PROTECTED]
Subject: Re: [Tutor] Syntax Check
Does anyone happen to know how to turn of the syntax checking in
python? I've been working on a module driven
Kumar,
On Wed, 26 Jan 2005 22:35:59 -0800 (PST), kumar s [EMAIL PROTECTED] wrote:
Hi:
I am still trying to learn the OOPs side of python.
however, things/circumstances dont seems to stop until
I finish my practise and attaing higher understanding.
may be, i am being pushed by circumstances
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Are there any example programs depicting Clustering
algorithms such as agglomerative, complete link,
partional , squared error clustering, k-means or
clustering algos based on Neural networks or genetic
algorithm. although I just learned python, (to
Dear Danny, thank you for ur help. But a basic
question ?
In a table, more specifically a matrix 3X3,
AppleFruitDenmark
F-16 Fighter USA
Taj Wonder India
MummyAntique Egypt
IF I have to sort on country, it should be
AppleFruitDenmark
MummyAntique Egypt
Srinivas,
You can't sort a string, since it's immutable. You can, however, sort
a list. To sort your table by the third element, you can do something
like this:
table = ((apple, fruit, denmark),
... (mummy, antique, egypt),
... (taj, wonder, india),
... (f-16, fighter, usa))
sorter = [(elt[2],
Newbie question.
I'm trying to practice safe coding techniques. I just want to make sure that a
user can't supply a massive argument to my script and cause trouble. I'm just
trying only accept about 256 bytes:
buffer(sys.argv[1], 0, 256)
searchpath = sys.argv[1]
The script runs successfully,
On Thu, 27 Jan 2005, Miles Stevenson wrote:
I'm trying to practice safe coding techniques. I just want to make sure
that a user can't supply a massive argument to my script and cause
trouble. I'm just trying only accept about 256 bytes:
buffer(sys.argv[1], 0, 256)
^^
Hi Miles,
Well I don't think that it would really require that. I could just
define macro's in a module and just do it like so
import macro
import defined_macros as m
macro.expand(m.with(),m.assert())
I just thought it would be best to have definitions at the head of a
script, or at least to have the
Check out COG (http://www.nedbatchelder.com/code/cog/), a macro system for any
language created by Ned Batchelder
(http://www.nedbatchelder.com/).
I'm not sure if that's what you're looking for, but allows some good macro
capabilities.
Thanks,
Ryan
-Original Message-
From: [EMAIL
I've used something along the lines for Pythoncard, but the names are
generated within strict rules and expectations.
i.e.
first off
#Some code that uses regExs, finds all headings, and
# a asterisk to indicate a date value, returns a iterable object
reHead using finditer()
#which
22 matches
Mail list logo