Hi !
Sorry, but :
The statement exec does not have impact on the style.
Like with exefile or import (and other), the style is determined by the
contents. Rather judge "exec" (or import, or execfile) than the contents,
it is an error of causality.
@-salutations
--
Michel Claveau
--
ht
Charles Hartman wrote:
> Does anyone know of a cross-platform (OSX and Windows at least) library
> for text-to-speech? I know there's an OSX API, and probably also for
> Windows. I know PyTTS exists, but it seems to talk only to the Windows
> engine. I'd like to write a single Python module to han
*pling* !
I'm sometimes a bit slow :)
Regards Kay
--
http://mail.python.org/mailman/listinfo/python-list
"Michael Spencer" <[EMAIL PROTECTED]> wrote:
> I could imagine a class: accumulator(mapping, default, incremetor) such that:
> >>> my_tally = accumulator({}, 0, operator.add)
> or
> >>> my_dict_of_lists = accumulator({}, [], list.append)
> or
> >>> my_dict_of_sets = accumulator({}, set(),
sam <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I got the the following syntax error in comparison:
> File "/usr/local/work/myparser.py", line 85
> if ( (m=self.macro_parser.match (d)) != None ):
>^
>SyntaxError: invalid syntax
>
>How can I get around wtih this? I don't want to break down
On Sat, 19 Mar 2005 01:24:57 GMT, "Raymond Hettinger"
<[EMAIL PROTECTED]> wrote:
>def count(self, value, qty=1):
>try:
>self[key] += qty
>except KeyError:
>self[key] = qty
>
>def appendlist(self, key, *values):
>tr
> > +1 on this. The new suggested operations are meaningful for a subset
> of all
> > valid dicts, so they
> > should not be part of the base dict API. If any version of this is
> approved, > it will clearly be an
> > application of the "practicality beats purity" zen rule, and the
> > justificatio
John Machin wrote:
> More meaningful names wouldn't go astray either :-)
I heartily concur!
Instead of starting with:
fields = line.strip().split(',')
you could use something like:
(f_name, f_date, f_time, ...) = line.strip().split(',')
Of course then you won't be able to use ', '.join(fiel
2
--
http://mail.python.org/mailman/listinfo/python-list
I am surprised nobody suggested we put those two methods into a
separate module (say dictutils or even UserDict) as functions:
from dictutils import tally, listappend
tally(mydict, key)
listappend(mydict, key, value)
I am -1 about a specific subclass of dict in the standard library, I
would not
Charles Hartman wrote:
Does anyone know of a cross-platform (OSX and Windows at least) library
for text-to-speech? I know there's an OSX API, and probably also for
Windows. I know PyTTS exists, but it seems to talk only to the Windows
engine. I'd like to write a single Python module to handle t
Kay Schluehr wrote:
Maybe also the subclassing idea I introduced falls for short for the
same reasons. Adding an accumulator to a dict should be implemented as
a *decorator* pattern in the GoF meaning of the word i.e. adding an
interface to some object at runtime that provides special facilities.
U
On 19 Mar 2005 19:01:05 -0800, "MCD" <[EMAIL PROTECTED]> wrote:
>Hello, I'm new to python and this group and am trying to build some
>bins and was wondering if any of you could kindly help me out. I'm a
>bit lost on how to begin.
Are you (extremely) new to computer programming? Is this school
hom
George Sakkis wrote:
> > -1 form me.
> >
> > I'm not very glad with both of them ( not a naming issue ) because
i
> > think that the dict type should offer only methods that apply to
each
> > dict whatever it contains. count() specializes to dict values that
are
> > addable and appendlist to those
"John Machin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> George Sakkis wrote:
> > +1 on this. The new suggested operations are meaningful for a subset
> of all valid dicts, so they
> > should not be part of the base dict API. If any version of this is
> approved, it will clearl
Alexander Schmolck wrote:
"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
The rationale is to replace the awkward and slow existing idioms for dictionary
based accumulation:
d[key] = d.get(key, 0) + qty
d.setdefault(key, []).extend(values)
Indeed not too readable. The try..except version is
MCD wrote:
Hello, I'm new to python and this group and am trying to build some
bins and was wondering if any of you could kindly help me out. I'm a
bit lost on how to begin.
I have some text files that have a time filed along with 2 other fields
formatted like this >>
1231 23 56
1232 25 79
1234 26
Does anyone know of a cross-platform (OSX and Windows at least) library
for text-to-speech? I know there's an OSX API, and probably also for
Windows. I know PyTTS exists, but it seems to talk only to the Windows
engine. I'd like to write a single Python module to handle this on both
platforms,
sam wrote:
I got the the following syntax error in comparison:
File "/usr/local/work/myparser.py", line 85
if ( (m=self.macro_parser.match (d)) != None ):
^
SyntaxError: invalid syntax
How can I get around wtih this?
Break the comparison into two steps.
> I don't want to break dow
Maxwell Hammer wrote:
An application I am developing executes many threads and then has a
"monitor" part that waits for certain events. One of these events causes
the application to have to shutdown. On shutdown the monitor part
notifies the threads of a shutdown, and the threads must cleanup and e
Do Re Mi chel La Si Do wrote:
Also :
classname = "Dog"
exec("b="+classname+"()")
b.bark()
or
classname = "Dog"
exec("cl="+classname)
b=cl()
b.bark()
Ugh.
The statement exec (note: it's a statement, not a
function call as you imply with the above) is rarely
either require
I have a SplitterWindow and two panels p1 and p2 in it.
I can put GenericDirCtrl into the left panel (p1),
however it (DirCtrl) stays small. I'd like to stretch it in the whole
of p1. The following code doesn't work, please help.
dir3 = wx.GenericDirCtrl(p1, -1, size=(-1,-1), style=... etc
Hi,
I got the the following syntax error in comparison:
File "/usr/local/work/myparser.py", line 85
if ( (m=self.macro_parser.match (d)) != None ):
^
SyntaxError: invalid syntax
How can I get around wtih this? I don't want to break down this
comparison in two steps.
Thanks
Sam
--
[EMAIL PROTECTED] wrote:
> Lorn Davies wrote:
>
> > if (fields[8] == 'N' or 'P') and (fields[6] == '0' or '1'):
> > ## This line above doesn't work, can't figure out how to struct?
>
> In Python you would need to phrase that as follows:
> if (fields[8] == 'N' or fields[8] == 'P') and (fields[6
Hello, I'm new to python and this group and am trying to build some
bins and was wondering if any of you could kindly help me out. I'm a
bit lost on how to begin.
I have some text files that have a time filed along with 2 other fields
formatted like this >>
1231 23 56
1232 25 79
1234 26 88
1235 2
Lorn Davies wrote:
> if (fields[8] == 'N' or 'P') and (fields[6] == '0' or '1'):
> ## This line above doesn't work, can't figure out how to struct?
In Python you would need to phrase that as follows:
if (fields[8] == 'N' or fields[8] == 'P') and (fields[6] == '0'
or fields[6] == '1'):
or al
I am python beginner, I have a question about the interdependence of
modules.
For example, when I have two modules:
module1.py
-
def plus(x):
return add(x,1)
module2.py
-
def add(x,y):
return x+y
def plus2(x):
return plus(x)+1
How should I write "import" in both
Hi guys. First time poster long time reader.
Just wanted to say "Hi" ;)
On a side note my Hubby is REAL excited about
this new IPO stock GRDX. They just started trading
this one like 2 days ago. It's already almost
doubled in just 2 days! My Husband is really
excited about this stock. Say's it co
George Sakkis wrote:
> +1 on this. The new suggested operations are meaningful for a subset
of all valid dicts, so they
> should not be part of the base dict API. If any version of this is
approved, it will clearly be an
> application of the "practicality beats purity" zen rule, and the
justificat
"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
> The rationale is to replace the awkward and slow existing idioms for
> dictionary
> based accumulation:
>
> d[key] = d.get(key, 0) + qty
> d.setdefault(key, []).extend(values)
>
> In simplest form, those two statements would now be coded m
Michael Spencer wrote:
> Raymond Hettinger wrote:
> > I would like to get everyone's thoughts on two new dictionary
methods:
> >
> > def count(self, value, qty=1):
> > try:
> > self[key] += qty
> > except KeyError:
> > self[key] = qty
An application I am developing executes many threads and then has a
"monitor" part that waits for certain events. One of these events causes
the application to have to shutdown. On shutdown the monitor part
notifies the threads of a shutdown, and the threads must cleanup and exit.
When all threads
Hello,
To be honest, I also posted this on the wxPython mailing list. But I
thought maybe some of you on the python list can help me...
I am trying to refresh a pane of a notebook that contains a grid that
contains data from a MySQL database. Here is the code (sorry, it's
quite long):
#!/usr/bin/
H. Well, the way I did it, if I remember correctly (the files are at
work), was to run the line "python setup.py py2exe --force --excludes gtk,
gobject,pango" and then copied the entire GTK directory into the
distribution directory. Just copying the DLLs doesn't suffice since there
are other f
Raymond Hettinger wrote:
I would like to get everyone's thoughts on two new dictionary methods:
def count(self, value, qty=1):
try:
self[key] += qty
except KeyError:
self[key] = qty
def appendlist(self, key, *values):
> -1 form me.
>
> I'm not very glad with both of them ( not a naming issue ) because i
> think that the dict type should offer only methods that apply to each
> dict whatever it contains. count() specializes to dict values that are
> addable and appendlist to those that are extendable. Why not
> su
Thanks Lutz!
I should have looked into Amara's binderytools module earlier. This is
just the type of tool I was looking for. When I tried testing its
compatibility with py2exe, I was _almost_ able to compile... Does
anyone know where the following libraries exist? I thought Amara would
have th
Tim Jarman wrote:
> But if your foo is under your control, why not do everyone a favour
and call
> it something else?
His case is a canonical example of a patch. Often you'd like to choose
the "patch" approach because:
(1) the third-party may eventually incorporate the changes themselves,
hence y
I'm happy to say that Snakelets 1.38 is available.
Snakelets is a very simple-to-use Python web application server.
This project provides a built-in threaded web server (so you don't
need to set up Apache or another web server), Ypages (HTML+Python
language, similar to Java's JSPs) and Snakelets:
On 19 Mar 2005 11:33:20 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
>Raymond Hettinger wrote:
>> I would like to get everyone's thoughts on two new dictionary
>methods:
>>
>> def count(self, value, qty=1):
>> try:
>> self[key] += qty
>> except K
so you run data pool as like a sruct that contains all your global
objects? That sounds like an iteresting way of doing things. i try to
stay away from gloabs as much as possible but this might be a good time
to queue up that particular tool
thanks for your reply
--
http://mail.python.org/mailma
On 19 Mar 2005 14:16:42 -0800, Tian <[EMAIL PROTECTED]> wrote:
> How can I create an instance of an object from a string?
>
> For example, I have a class Dog:
> class Dog:
> def bark(self):
> print "Arf!!!"
>
> I have a string:
> classname = "Dog"
>
> How can I create a instance of Dog fro
Hi !
Also :
classname = "Dog"
exec("b="+classname+"()")
b.bark()
or
classname = "Dog"
exec("cl="+classname)
b=cl()
b.bark()
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> Also, in all of my code base, I've not run across a single opportunity to use
> something like unionset().
In my code, this would be roughly tied with appendlist for frequency of
use.
--
David Eppstein
Computer
Tian wrote:
I have a string:
classname = "Dog"
It's easier without strings:
>>> classname = Dog
>>> classname().bark()
Arf!!!
>>>
--
http://mail.python.org/mailman/listinfo/python-list
Francisco Borges wrote:
> There are 2 "foo" named modules, 'std foo' and 'my foo'. I want to be
> able to import 'my foo' and then from within my foo, import 'std
> foo'. Anyone can help??
In other words, you would like to make a "patch" on third-party code.
There are many ways to do it. Here is j
This is very useful, thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Dave> This release contains a number of small bugfixes and patches
Dave> received from users.
...
I don't see this change:
*** /Users/skip/src/sybase-0.36/Sybase.py Sun Apr 27 05:54:35 2003
--- /Users/skip/tmp/Sybase.py Sat Mar 19 16:46:17 2005
***
*** 436,441 **
In article <[EMAIL PROTECTED]>,
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> The rationale is to replace the awkward and slow existing idioms for
> dictionary
> based accumulation:
>
> d[key] = d.get(key, 0) + qty
> d.setdefault(key, []).extend(values)
>
> In simplest form, those t
[Bengt Richter]
> IMO Raymond's Zen concerns
> are the ones to think about first, and then efficiency, which was one of the
motivators
> in the first place ;-)
Well said.
I find the disassembly (presented in the first post) to be telling. The
compiler has done a great job and there is no fluff -
Tian wrote:
How can I create an instance of an object from a string?
For example, I have a class Dog:
class Dog:
def bark(self):
print "Arf!!!"
I have a string:
classname = "Dog"
How can I create a instance of Dog from classname?
Is there any such methods like those in Java?
You generally get
Reinhold Birkenfeld wrote:
> John Machin wrote:
> Are you kidding? If you know what "set" and "default" means, you will
be
> able to guess what "setdefault" means. Same goes for updateBy.
>
No I'm not kidding -- people from some cultures have no difficulty at
all in mentally splitting up "words"
On 19 Mar 2005 12:05:18 -0800, "MackS" <[EMAIL PROTECTED]>
wrote:
>Hi
>
>I'm new to Python, I've read the FAQ but still can't get the following
>simple example working:
>
># file main_mod.py:
>global_string = 'abc'
>def main():
>import auxiliary_mod
>instance = auxiliary_mod.ClassA()
>
"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
> I find the disassembly (presented in the first post) to be telling.
> The compiler has done a great job and there is no fluff -- all of
> those steps have been specified by the programmer and he/she must at
> some level be aware of every one of them
How can I create an instance of an object from a string?
For example, I have a class Dog:
class Dog:
def bark(self):
print "Arf!!!"
I have a string:
classname = "Dog"
How can I create a instance of Dog from classname?
Is there any such methods like those in Java?
--
http://mail.python.o
John Machin wrote:
> Raymond Hettinger wrote:
>> I would like to get everyone's thoughts on two new dictionary
> methods:
>
> +1 for each.
>
>> PROBLEMS BEING SOLVED
>> -
>>
>> The readability issues with the existing constructs are:
>>
>> * They are awkward to teach, create,
Raymond Hettinger wrote:
> I would like to get everyone's thoughts on two new dictionary
methods:
+1 for each.
> PROBLEMS BEING SOLVED
> -
>
> The readability issues with the existing constructs are:
>
> * They are awkward to teach, create, read, and review.
> * Their wording
On Sat, 19 Mar 2005 07:13:15 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On Sat, 19 Mar 2005 01:24:57 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]>
>> wrote:
>>
>>>I would like to get everyone's thoughts on two new dictionary methods:
>>>
>>> def count(self, valu
Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] ]
>>> OK, so I need to be more precise.
>>> Given a list of sets, output the largest list of sets (from this list,
>>> order does not matter) such that:
>>> 1) there is no set that is a PROPER subset of another set in this list
>>> 2
"El Pitonero" <[EMAIL PROTECTED]> writes:
> What about no name at all for the scalar case:
>
> a['hello'] += 1
> a['bye'] -= 2
I like this despite the minor surprise that it works even when
a['hello'] is uninitialized.
--
http://mail.python.org/mailman/listinfo/python-list
Francisco Borges wrote:
> Hello,
>
> This is not stricly necessary but it would be nice if I could get it
> done. Here is what I want to do:
>
> There are 2 "foo" named modules, 'std foo' and 'my foo'. I want to be
> able to import 'my foo' and then from within my foo, import 'std
> foo'. Anyone
fraca7 a écrit :
Michael Hoffman wrote:
Enjoy ;)
That's not the exact word that first came to my mind :)
--
http://mail.python.org/mailman/listinfo/python-list
MackS wrote:
> Hi
>
> I'm new to Python, I've read the FAQ but still can't get the following
> simple example working:
>
> # file main_mod.py:
>
> global_string = 'abc'
>
> def main():
>
> import auxiliary_mod
> instance = auxiliary_mod.ClassA()
> instance.fun()
> return
>
> m
Hi
I'm new to Python, I've read the FAQ but still can't get the following
simple example working:
# file main_mod.py:
global_string = 'abc'
def main():
import auxiliary_mod
instance = auxiliary_mod.ClassA()
instance.fun()
return
main()
# file auxiliary_mod.py:
class ClassA:
Tanteauguri a écrit :
Hi List, is there in python a variable variable like in PHP ($$var)?
Hopefully, no.
See other answers in that thread for pythonic idioms.
--
http://mail.python.org/mailman/listinfo/python-list
Raymond Hettinger wrote:
> I would like to get everyone's thoughts on two new dictionary
methods:
>
> def count(self, value, qty=1):
> try:
> self[key] += qty
> except KeyError:
> self[key] = qty
>
> def appendlist(self, key, *
On Sat, 19 Mar 2005 15:17:59 GMT,
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> [Dan Sommers]
>> Curious that in this lengthy discussion, a method name of
>> "accumulate" never came up. I'm not sure how to separate the two
>> cases (accumulating scalars vs. accumulating a list), though.
> Se
Francisco Borges <[EMAIL PROTECTED]> writes:
> I could simply copy optparse's code and hack it or I could simply import
> it and overload some methods, which is what I think would be a cleaner
> solution.
So why aren't you willing to give your optparse module a different name?
George Sakkis wrote:
> "Aahz" <[EMAIL PROTECTED]> wrote:
> > In article <[EMAIL PROTECTED]>,
> > Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> > >
> > >The proposed names could possibly be improved (perhaps tally() is
more active
> > >and clear than count()).
> >
> > +1 tally()
>
> -1 for count():
Hello,
This is not stricly necessary but it would be nice if I could get it
done. Here is what I want to do:
There are 2 "foo" named modules, 'std foo' and 'my foo'. I want to be
able to import 'my foo' and then from within my foo, import 'std
foo'. Anyone can help??
-
Before you start
Exactly what I was looking for. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
On Sat, 19 Mar 2005 14:36:02 +0100, Ivan Voras <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
Hey, IIRC, old Turbo Assembler (tasm, by Borland) had those. Much of it
was still manual, by it supported semi-automatic vtables and such :)
I'd suspect throu
"Aahz" <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> >
> >The proposed names could possibly be improved (perhaps tally() is more active
> >and clear than count()).
>
> +1 tally()
-1 for count(): Implies an accessor, not a mutator.
-1
Raymond Hettinger wrote:
>
> As written out above, the += syntax works fine but does not work with
append().
> ...
> BTW, there is no need to make the same post three times.
The append() syntax works, if you use the other definition of safedict
(*). There are more than one way of defining safedict
Hi
if key not in d:
d[key] = {subkey:value}
else:
d[key][subkey] = value
and
d[(key,subkey)] = value
?
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Ah OK, I stand corrected. Whoops. I just read the web page and thought the
wrong thing, that makes sense.
> Think about it. A key= function is quite a different thing. It provides
a
> *temporary* comparison key while retaining the original value. IOW, your
> re-write is incorrect:
>
> >>> L =
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> [Jeff Epler]
> > Maybe something for sets like 'appendlist' ('unionset'?)
>
> While this could work and potentially be useful, I think it is better to keep
> the proposal focused on the two common use cases. Adding a third would reduce
> the chance
Kent Johnson said unto the world upon 2005-03-19 07:19:
Brian van den Broek wrote:
Raymond Hettinger said unto the world upon 2005-03-18 20:24:
I would like to get everyone's thoughts on two new dictionary methods:
def appendlist(self, key, *values):
try:
self[ke
Thank you all very much for your suggestions and input... they've been
very helpful. I found the easiest apporach, as a beginner to this, was
working with Chirag's code. Thanks Chirag, I was actually able to read
and make some edit's to the code and then use it... woohooo!
My changes are annotated
You can use PROC.poll() to find out whether the process has exited yet
or not (for instance, in a 'while' loop along with a delay). I don't know
what facilities exist to forcibly terminate programs on Windows, though.
On Unix, os.kill() can be used to kill a process given its pid. Perhaps
some of
Rob Cranfill wrote:
Ah, now *there's* an intriguing approach! I am too much a Python noob to
know - can I subclass RFH and then invoke that new class from a config
file (the crux of my original question) ? I may play around with it
today
There's at least one way that will work, though it ma
Alex Polite wrote:
On lör, mar 19, 2005 at 10:12:10 -0500, Peter Hansen wrote:
Alex Polite wrote:
You could, for example, bind to a port of "0" and that will
auto-assign an available port for you. Does that work
in your case? If not, please describe what you are really
trying to accomplish.
I'm l
Bryan wrote:
> is there a way to determine the operating system's language? i can't seem
> to find a method that returns the value.
Try the module locale.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
[El Pitonero]
> Is it even necessary to use a method name?
>
> import copy
> class safedict(dict):
> def __init__(self, default=None):
> self.default = default
> def __getitem__(self, key):
> try:
> return dict.__getitem__(self, key)
> except KeyError:
>
[EMAIL PROTECTED] wrote:
> I've narrowed down my toolkit selection for my project to wxPython and
> pyQt, and now i'd like to hear any opinions, war stories, peeves, etc,
> about them, particularly from anyone who's used _both_toolkits_. I'm
> only mildly interested in the IDEs and UI designers fo
On 2005-03-19, Alex Polite <[EMAIL PROTECTED]> wrote:
>
> If I try to bind a socket to a port that's already in use I get this
> error
>
> "error socket.error: (98, 'Address already in use')"
>
> Is there anyway to check in advance if a port i already taken?
Yes. Try to bind to the port. If you
news.sydney.pipenetworks.com wrote:
Yeah...sorry about that. I misunderstood what node333.html was used for.
Looks like your best bet may be to extend the RotatingFileHandler
directly in the handlers module and call doRollover() in __init__.
Ah, now *there's* an intriguing approach! I am too much
I calling a Windows executable with PROC = subprocess.Popen('...'), and
blocking further python execution until the process terminates with
PROC.wait(). Occasionally, something unusual happens with the
subprocess, and it fails without terminating the process. When this
happens, my Python program
Bengt Richter wrote:
The first hit is
http://docs.python.org/lib/node332.html
HTH
NID (No, It Doesn't) ;-) but thanks anyway. To reiterate, the question
is how to make RotatingFileHandler do a doRotate() on startup from a
*config file*. No mention of that in what you point to.
- ro
In article <[EMAIL PROTECTED]>,
Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>
>How about countkey() or tabulate()?
Those rank roughly equal to tally() for me, with a slight edge to these
two for clarity and a slight edge to tally() for conciseness.
--
Aahz ([EMAIL PROTECTED]) <*>
Raymond Hettinger wrote:
> Separating the two cases is essential. Also, the wording should
contain strong
> cues that remind you of addition and of building a list.
>
> For the first, how about addup():
>
> d = {}
> for word in text.split():
> d.addup(word)
import copy
class safe
In article <[EMAIL PROTECTED]>,
Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>
>The proposed names could possibly be improved (perhaps tally() is more active
>and clear than count()).
+1 tally()
--
Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/
"The joy of coding Pyth
-1 on set increment.
I think this makes your intent much clearer:
.d={}
.for word in text.split():
.d.tally(word)
.if word.lower() in ["a","an","the"]:
.d.tally(word,-1)
or perhaps simplest:
.d={}
.for word in text.split():
.if word.lower() not in ["a","an","the"]:
.d
[Ivan Van Laningham]
> What about adding another method, "setincrement()"?
. . .
> Not that there's any real utility in that.
That was a short lived suggestion ;-)
Also, it would entail storing an extra value in the dictionary header. That
alone would be a killer.
Raymond
--
http://mail.
One reason I chose not to use ConfigParser module is that I also have a
similar config file for a MATLAB compiled program to run along with my
Python script. XML would eliminate the need to use two different style
configuration files.
Another reason is that the programmer who is writing the GUI t
How about this?
try:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
s.bind((HOST, PORT))
except socket.error, e:
if e
print "address already in use"
--
http://mail.python.org/mailman/listinfo/python-list
Dan Sommers wrote:
> On Sat, 19 Mar 2005 01:24:57 GMT,
> "Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
>
> > The proposed names could possibly be improved (perhaps tally() is
more
> > active and clear than count()).
>
> Curious that in this lengthy discussion, a method name of
"accumulate"
> never
On lör, mar 19, 2005 at 10:12:10 -0500, Peter Hansen wrote:
> Alex Polite wrote:
>
> You could, for example, bind to a port of "0" and that will
> auto-assign an available port for you. Does that work
> in your case? If not, please describe what you are really
> trying to accomplish.
I'm launch
Hi All--
Raymond Hettinger wrote:
>
> Separating the two cases is essential. Also, the wording should contain
> strong
> cues that remind you of addition and of building a list.
>
> For the first, how about addup():
>
> d = {}
> for word in text.split():
> d.addup(word)
>
I
1 - 100 of 159 matches
Mail list logo