> "John" == John Bokma <[EMAIL PROTECTED]> writes:
John> Who told you Perl can't do exceptions?
Back when I learned (heh, I never 'really' learned, but knew enough to
write programs in it) perl, almost every function call was followed by
or die("blah");
i.e. the user had to check the er
Steven Bethard wrote:
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp inste
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expr
I have no time for a long discussion, but the code should
speak for itself:
class Container(object):
def __init__(self, content):
self.content = content
def __str__(self):
return "" % self.content
class Wrapped(object):
def __init__(self, obj):
self._obj = obj
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expression if I'm going
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expression if I'm going to require 2.4 a
"David Isaac" <[EMAIL PROTECTED]> writes:
>> Alan Isaac wrote:
> I meant something that application users on different platforms can print
> with, not something
> that they could coerce a platform into supporting given enough energy (e.g.,
> via Cygwin).
> The closest to an option so far seems to
John Bokma <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> John Bokma <[EMAIL PROTECTED]> writes:
>>> Mike Meyer wrote:
John Bokma <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> Depends on the problem. If it's one of the things for which Python
>> has an obvious solution (so
I thought I'd share a piece of the discussion a friend of mine is having
with a mathematician/programmer on this issue of variables:
int foo = 5;
Is foo not a variable? Within the scope of that statement, foo can be
no other value but 5. Is foo not a constant? Are constants and
variables not mu
Hi,
I'm happy to announce the release of Wing IDE version 2.0.3, an
advanced development environment for the Python programming
language.
This is a free upgrade for Wing IDE 2.0 users. The release can
be downloaded from:
http://wingware.com/downloads
Wing IDE provides powerful debugging, editi
I'm a Computational Linguist just starting with Python. I personally
would be very interested in a UT Python group.
Jim
lugal wrote:
Is anyone aware if there's a Utah-based Python User Group? If not, does
any else from Utah have any interest in forming a Utah-based Python
User Group?
--
http://ma
"Harlin Seritt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Does anyone know of any decent documenation on Mark Hammond's win32all
> modules? I have tried looking at the documentation .chm file that comes
> with it, Python Programming On Win32 (OReilly book) and ActiveState's
> d
On 2005-04-25, Robert Kern <[EMAIL PROTECTED]> wrote:
>> I certainly don't see how. Strings are immutable. The old
>> object can't be modified in-place, so the "in-place" behavior
>> is moot.
>
> It's the left-hand-side, in this case a list, that gets modified
> in-place. Whether the right-hand
Grant Edwards wrote:
On 2005-04-25, Terry Reedy <[EMAIL PROTECTED]> wrote:
According to the language reference,
An augmented assignment expression like x += 1 can be
rewritten as x = x + 1 to achieve a similar, but not
exactly equal effect. In the augmented version, x is only
eval
Harlin Seritt wrote:
I have three tuples of the same size: tup1, tup2, tup3
I'd like to do something like this:
for a,b,c in tup1, tup2, tup3:
print a
print b
print c
Of course, you get an error when you try to run the pseudocode above.
What is the correct way to get this done?
For somethi
Thank you Mr. Stroud.
--
http://mail.python.org/mailman/listinfo/python-list
Harlin Seritt wrote:
I have three tuples of the same size: tup1, tup2, tup3
I'd like to do something like this:
for a,b,c in tup1, tup2, tup3:
print a
print b
print c
Presuming that you want a,b,c to be corresponding entries from the three tuples, then zip() is your
friend:
for a,b,c in z
Harlin Seritt wrote:
I have three tuples of the same size: tup1, tup2, tup3
I'd like to do something like this:
for a,b,c in tup1, tup2, tup3:
print a
print b
print c
Of course, you get an error when you try to run the pseudocode above.
What is the correct way to get this done?
for a, b, c
for a,b,c in zip(tup1, tup2, tup3):
print a
print b
print c
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
I've found the solution I must destroy the first window using
self.master.destroy(), but thanks anyway ^_^
--
http://mail.python.org/mailman/listinfo/python-list
I have three tuples of the same size: tup1, tup2, tup3
I'd like to do something like this:
for a,b,c in tup1, tup2, tup3:
print a
print b
print c
Of course, you get an error when you try to run the pseudocode above.
What is the correct way to get this done?
Thanks,
Harlin
--
http://
James Stroud wrote:
On Saturday 23 April 2005 10:25 pm, so sayeth Richard Blackwood:
Unfortunately that's not much of an option for me. We are working on a
project together so I am forced to either prove his notion incorrect or
I give in to his conception. *throws hands in air*
This is a co
> Alan Isaac wrote:
> > What is the current best practice for cross platform printing of
PostScript
> > files from Python?
"Warren Postma" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Well since printing postscript files on most Unix systems (probably
> including Mac OSX although
On 2005-04-25, Terry Reedy <[EMAIL PROTECTED]> wrote:
>>According to the language reference,
>>
>> An augmented assignment expression like x += 1 can be
>> rewritten as x = x + 1 to achieve a similar, but not
>> exactly equal effect. In the augmented version, x is only
>> ev
On Monday 25 April 2005 01:24, Harlin Seritt wrote:
> dat = urllib.urlopen(url, 'r').read()
Drop the 'r' - urlopen is posting the 'r' to the server, instead of doing what
you mean, opening the file read-only.
pgpmZ2zcMs1bO.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listi
I think it depends on the server
On 24 Apr 2005 17:24:18 -0700, Harlin Seritt <[EMAIL PROTECTED]> wrote:
> I am trying to do the following:
>
>
>
> import urllib
>
> url = 'http://www.website.com/file.shtml'
> dat = urllib.urlopen(url, 'r').read()
> print dat
>
> When I do so, I get the follo
Daniel Cer wrote:
Robert wrote:
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to
>According to the language reference,
>
> An augmented assignment expression like x += 1 can be
> rewritten as x = x + 1 to achieve a similar, but not
> exactly equal effect. In the augmented version, x is only
> evaluated once.
>
>I don't consider the two results you po
Robert wrote:
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out
Probably you're looking for Beautiful Soup:
http://www.crummy.com/software/BeautifulSoup/
George
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to do the following:
import urllib
url = 'http://www.website.com/file.shtml'
dat = urllib.urlopen(url, 'r').read()
print dat
When I do so, I get the following data:
405 Method Not Allowed
Method Not Allowed
The requested method POST is not allowed for the URL
Apache/1.3.27 Se
Hi,
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out put
and f
Kartic,
Thanks for the help. It's good to get a different perspective on
something (i.e. MSDN, dir() etc).
--
http://mail.python.org/mailman/listinfo/python-list
Alexander Schmolck wrote:
[1] Best practice would be something like this (don't worry to much about it
-- it just ensures the file is properly closed, even if something goes
wrong):
confFile = None
try:
confFile = open(networkConf, 'w')
confFile.wr
Is there a HTML clean/tidy library or module written in pure python? I
found mxTidy, but it's a interface to command-line tool.
What I'm searching is something that will accept a list of allowed tags
and/or attributes and strip the rest from HTML string.
--
http://mail.python.org/mailman/listin
Thomas Köllmann wrote:
Hi, everybody!
I'm teaching myself Python, and I have no experience in programming
apart from some years of shell scripting. So, please bear with me.
These two funktions are part of an administrative script I've set
myself as a first lesson, and, as you will see, they're prac
Reports to [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED]
And do not feed the troll!
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Köllmann <[EMAIL PROTECTED]> writes:
> confFile.close
You want ``confFile.close()`` -- the above won't do anything [1].
'as
Footnotes:
[1] Best practice would be something like this (don't worry to much about it
-- it just ensures the file is properly closed, even if somethin
On Sun, 24 Apr 2005 23:40:22 +0200,
Thomas KÃllmann <[EMAIL PROTECTED]> wrote:
> Hi, everybody!
> I'm teaching myself Python, and I have no experience in programming
> apart from some years of shell scripting. So, please bear with me.
> These two funktions are part of an administrative script I'v
Miguel Manso wrote:
Mike Meyer wrote:
Miguel Manso <[EMAIL PROTECTED]> writes:
I've tryed to use python some times but I get frustrated very quick. I
get myself many times needing to figure out how to loop through a
list, declare an associative array, checking how to pass named
parameters to fun
John Bokma <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> John Bokma <[EMAIL PROTECTED]> writes:
>>> Mike Meyer wrote:
Depends on the problem. If it's one of the things for which Python
has an obvious solution (sort a list; split a string on whitespace;
pull select list elements
Leif Biberg Kristensen wrote:
Leif K-Brooks skrev:
But Python's DB-API (the standard way to connect to an SQL database
from Python) makes escaping SQL strings automatic. You can do this:
cursor.execute('UPDATE foo SET bar=%s WHERE id=%s', ["foo'bar", 123])
So. I've been writing SQL queries in Pyt
Mage wrote:
foo = dict()
or:
foo = {}
--
http://mail.python.org/mailman/listinfo/python-list
> "John" == John Bokma <[EMAIL PROTECTED]> writes:
>> Nah, they aren't slow. They just have to worry about more things than
>> the Python developers.
John> Do you have references to this? I would love to see if
John> indeed 100 Python programmers do implement, say 5 CS tasks
I've kicked off wikalong documentation for Python by adding an example
program to the documentation for the HTMLParser module. See
http://python.org/doc/current/lib/module-HTMLParser.html
(Generally, I think most wikalong annotations won't take the form of
complete example programs, but this was a
Richard Blackwood wrote:
Robert Kern wrote:
His problem is that he doesn't respect that technical terms can have
different meanings in different fields and contexts. No authoritative
reference can solve his problem for him. He's being overly pedantic
about a field in which *he* is clearly not an
> "Ilpo" == Ilpo NyyssÃnen writes:
Ilpo> Pickle doesn't have validation. I am not comfortable for
Ilpo> using it as storage format that should be reliable over
Ilpo> years when the program evolves. It also doesn't tell me if
That's why you should implement xml import/export mecha
[EMAIL PROTECTED]:
> hi Bearphile! That really gives me an idea.Thanks much for that. Yes
as
> you said the algorithm reaches a maximium recursion depth for larger
> sets i tried.
You can improve the little flood filling function, avoiding the "bad"
Python recursivity.
> Do you see where I am he
Roman Neuhauser wrote:
# [EMAIL PROTECTED] / 2005-04-23 15:53:17 +0200:
Lad wrote:
Is anyone capable of providing Python advantages over PHP if there are
any?
The irreverant would point you to
http://www.python.org/doc/Humor.html#vowels
*I* wouldn't consider doing anything like that, though.
ch
On 24 Apr 2005 09:44:49 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>Richter,yes what I am looking for is for cluster with rectangular
>bounding boxes as you explained in the first figure.
>
Sorry, not your fault, but I'm still not clear on diagonal
connection/separation.
E.g., (removin
Mike Meyer wrote:
Miguel Manso <[EMAIL PROTECTED]> writes:
I've tryed to use python some times but I get frustrated very quick. I
get myself many times needing to figure out how to loop through a
list, declare an associative array, checking how to pass named
parameters to function
Hi !
You can to generate SWF (flash) files, with swfobjs.dll
See :
http://bukoo.sourceforge.net
and
http://www.angelfire.com/nt/teklord/swfexport.htm
I succeeded, therefore, it is easy...
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 23 Apr 2005 22:45:14 -0400, Richard Blackwood wrote:
> Indeed, this language is math. My friend says that foo is a constant and
> necessarily not a variable. If I had written foo = raw_input(), he would
> say that foo is a variable. Which is perfectly fine except that he insists
> that sinc
Miguel Manso <[EMAIL PROTECTED]> writes:
> I've tryed to use python some times but I get frustrated very quick. I
> get myself many times needing to figure out how to loop through a
> list, declare an associative array, checking how to pass named
> parameters to functions, and simple things like t
Lad a trollé :
Is anyone capable of providing Python advantages over PHP if there are
any?
Why don't you check by yourself ?
--
http://mail.python.org/mailman/listinfo/python-list
Mage a écrit :
I can tell:
- python is more *pythonic* than php
Keyboard !-)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> when you use a = a + 'world' python sees it as an error because of
> different type.
>
> But when you use a += 'world'
> python will change the right into list (because a is a list). So when
> you're code become:
> a += 'world' # a += list('world')
>
> It really helpf
since the file where i call the first window and the second window is
different,.If I put app.master.withdraw() there,...won't I get error
message that says; app is not defined as global or something like that?
--
http://mail.python.org/mailman/listinfo/python-list
"Clara" wrote:
> Well, but where do I call withdraw?
when you want the new window to appear, and the old one to
go away, of course. something like this, perhaps?
from mainmenu import FileManager
app2 = FileManager(self.username.get())
app2.master.title("File Manager")
app2.master.maxsiz
Forgive my ignorance, but where do I call withdraw?
--
http://mail.python.org/mailman/listinfo/python-list
Well, but where do I call withdraw?
--
http://mail.python.org/mailman/listinfo/python-list
"Nemesis" <[EMAIL PROTECTED]> wrote:
> So the real filename may be different from the argument passed to
> "open". I have this problem, I want to delete (in some circustances) the
> file created by shelve.open, how can I know which is the name of this
> file (or files) ?
if you put the shelve in
"Mage" <[EMAIL PROTECTED]> wrote:
> The question is above: when will these file be closed?
>
> for s in file('/etc/passwd'):
> print s
>
> file('/home/mage/test.txt','w').write('foo')
when the interpreter gets around to it.
if you want to make sure that a file is closed at a given point in
y
"Clara" wrote:
> I meant to write an application where there is a button in a window and
> when you click on the button, it will open a new window, but I want the
> first window to close, replaced by the second window.
> I open a login window and start the mainloop, when the user click on
> the lo
Miguel Manso wrote:
> I've tryed to use python some times but I get frustrated very quick. I
> get myself many times needing to figure out how to loop through a list,
http://docs.python.org/tut/node6.html#SECTION00620
> declare an associative array,
http://docs.python.org/tut/n
Hello,
The question is above: when will these file be closed?
for s in file('/etc/passwd'):
print s
file('/home/mage/test.txt','w').write('foo')
Mage
--
http://mail.python.org/mailman/listinfo/python-list
Miguel Manso wrote:
>
>
> I've tryed to use python some times but I get frustrated very quick. I
> get myself many times needing to figure out how to loop through a
> list, declare an associative array, checking how to pass named
> parameters to functions, and simple things like that.
list = [3,5
In the python docs about shelve module I read:
-
open( filename[,flag='c'[,protocol=None[,writeback=False[,binary=None)
Open a persistent dictionary. The filename specified is the base filename
for the underl
Richard Blackwood <[EMAIL PROTECTED]> writes:
> Bengt Richter wrote:
>
> >Tell him in Python foo is a member of one set and 5 is a member of another,
> >and foo = 5 expresses the step of putting them into correspondence
> >to define a mapping, not declaring them equal.
> >
> Could I honestly argu
Hi,...
I meant to write an application where there is a button in a window and
when you click on the button, it will open a new window, but I want the
first window to close, replaced by the second window.
I open a login window and start the mainloop, when the user click on
the login button, the __c
On 4/24/05, Miguel Manso <[EMAIL PROTECTED]> wrote:
> I'm a programmer with 5 year of experience into Perl. I'm on that point
> where you resolve problems without thinking on HOW you'll do it with
> that language but only on the problem itself.
I code in perl and C all day. Python is a very nice e
Richard Blackwood <[EMAIL PROTECTED]> writes:
> Unfortunately that's not much of an option for me. We are working on a
> project together so I am forced to either prove his notion incorrect
> or I give in to his conception. *throws hands in air*
Well, one option is to give in to his conception an
Hi, list.
I'm into a psicological doubt that I would like to share with you
(you'll know why later on this mail).
I'm a programmer with 5 year of experience into Perl. I'm on that point
where you resolve problems without thinking on HOW you'll do it with
that language but only on the problem it
Hi All--
James Stroud wrote:
>
> On Sunday 24 April 2005 06:59 am, so sayeth François Pinard:
> > As seen from here, the Python mailing list quality has been degrading
> > significantly for the last half-year or so.
>
> That's funny. That's exactly as long as I've been on this list. I wonder if
Richard Blackwood <[EMAIL PROTECTED]> writes:
> Fantastic, wikipedia deals precisely with the difference between
> variables in mathematics versus programming. However, he would never
> trust a definition from such an "unreputable" source. If you have any
> other sources I might direct him to...he
On Saturday 23 April 2005 10:25 pm, so sayeth Richard Blackwood:
> Unfortunately that's not much of an option for me. We are working on a
> project together so I am forced to either prove his notion incorrect or
> I give in to his conception. *throws hands in air*
This is a communcication issue. Y
Quoth Mike Meyer <[EMAIL PROTECTED]>:
...
| He's right - programming is an offshoot of mathematics. It adds
| *dynamics* to the structures of mathematics. In mathematics, a
| construct (graph, function, mapping, set, whatever) is immutable. You
| can talk about things that change with time, but you
Richard Blackwood <[EMAIL PROTECTED]> writes:
> Kent Johnson wrote:
> That is exactly how I feel about it. Foo is what it is. Variable, name
> bound to immutable value, etc., what we call it doesn't really change
> how I program, only how I communicate with other programmers (and
> mathematicians)
On Sunday 24 April 2005 06:59 am, so sayeth François Pinard:
> As seen from here, the Python mailing list quality has been degrading
> significantly for the last half-year or so.
That's funny. That's exactly as long as I've been on this list. I wonder if
the correlation is causal?
--
James Stro
Ilias Lazaridis wrote:
[EVALUATION] - E02 - Support for MinGW Open Source Compiler
http://groups-beta.google.com/group/comp.lang.python/msg/f5cd74aa26617f17
-
In comparison to the E02 thread, now a more practical one.
-
Here is a simple evaluation template (first part) which can be applied
to the
Hello there,
Try visiting this well listed Directory on Computers and Internet! ...
Here is the link http://hi-fiweb.com/comp
Hoping to learn a lot from other group members.
Take care,
Kathy
--
http://mail.python.org/mailman/listinfo/python-list
Uzytkownik "Steven Bethard" <[EMAIL PROTECTED]> napisal w
wiadomosci news:[EMAIL PROTECTED]
> Any reason you can't define it like:
>
> class actor(object):
> def __init__(self):
> self.roles = []
> def act(self):
> for role_func in self.roles:
> role_func(self)
hi Bearphile! That really gives me an idea.Thanks much for that. Yes as
you said the algorithm reaches a maximium recursion depth for larger
sets i tried.I still have a question. if
m = [[0,0,0,0],[0,1,1,0,0],[0,0,1,0,0],[0,0,0,0]]
all it does is count the number of 1's and return us the number in
I never managed to link my python extensions (mingw .a) with python and
broke down and bought Visual/C++ as it is the compiler used by Python.
Yet some people seem to have managed:
http://uucode.com/texts/python-mingw/python-mingw.html
Regards,
Philippe
Jack Diederich wrote:
> On Sat, Apr 23
This issue was discussed in another recent python-list thread, called
"Writing to stdout and a log file".
My second post includes a patch to Python's "fileobject.c" that made the
code that started that thread work, but for reasons I mentioned in that
post I didn't want to push for inclusion of my
Does that mean you are using C++/C# and not Python ?
I also guess you do not wish MFC and wxWindows to coexist in the same .exe
as the reasons for conflict are many (GDI port, main event loop .)
Then do you simply wish to "map" your wxindows calls to equivalent MFC calls
with some kind of stu
Callbacks are functions called when an optparse.OptionParser() object
has a callback option defined (don't know how to say this less obvious
sounding...) (they are documented in
http://docs.python.org/lib/optparse-option-callbacks.html)
Example (based on an example in the documentation):
this scr
Richter,yes what I am looking for is for cluster with rectangular
bounding boxes as you explained in the first figure.
--
http://mail.python.org/mailman/listinfo/python-list
I have built a wxPython prototype of an app, that lets me place rectangles
o a wxPanel, move them and change their size. How the rects are added
and placed has to follow certain rules.
The final goal is to merge this "graphical editor" into a MFC app.
Converting a standalone wxPython app into a wx
Diez B. Roggisch wrote:
> Reinhold Birkenfeld wrote:
>
>> Diez B. Roggisch wrote:
class Foo(type):
def __new__(cls, name, bases, dict):
for k,v in [(k, v) for k,v in dict.items() if callable(v)]:
cls.wrap(k,v,cls.get_directives(v), dict)
Reinhold Birkenfeld wrote:
>
>Have you tried psycopg?
>
>
Thank you. It did the fetchall() in 11 secs and 13 secs with dictionary
creating. It's the fastest so far.
Mage
--
http://mail.python.org/mailman/listinfo/python-list
Ivan Voras wrote:
> Sorry, that was just steam venting from my ears - I often get bitten by
> the "ordinal not in range(128)" error. :)
I think I'm glad to hear that. Errors should never pass silently, unless
explicitly silenced. When you get that error, it means there is a bug in
your code (just
Irmen de Jong wrote:
[EMAIL PROTECTED] wrote:
How can we make only one thread at a time be able to access and
increment i ?
Use a synchronization primitive such as a lock
(threading.Lock, threading.RLock)
But for simply incrementing a number (i+=1) this is not needed
because that operation cannot b
That helps.Thanks much.
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> It's consistent with using a.extend("world") which is what the += is
> sugar for.
>
> In [1]:a = ['hello']
>
> In [2]:a.extend("world")
>
> In [3]:a
> Out[3]:['hello', 'w', 'o', 'r', 'l', 'd']
>
> It's a *good* thing that .extend() takes any iterable without explicit
> convers
"[EMAIL PROTECTED]" wrote:
> when you use a = a + 'world' python sees it as an error because of
> different type.
>
> But when you use a += 'world'
> python will change the right into list (because a is a list).
"changing into a list" is a bit misleadning; to bit a bit more precise,
you may want
check this site:
http://mail.python.org/pipermail/python-bugs-list/2003-November/021201.html
pujo
--
http://mail.python.org/mailman/listinfo/python-list
Richard Blackwood wrote:
To All:
Folks, I need your help. I have a friend who claims that if I write:
foo = 5
then foo is NOT a variable, necessarily. If you guys can define for me
what a variable is and what qualifications you have to back you, I can
pass this along to, hopefully, convince hi
On 2005-04-24, Michael Sparks <[EMAIL PROTECTED]> wrote:
a=["hello"]
a = a + "world"
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: can only concatenate list (not "str") to list
> However if we do this just slightly differently:
>
a = ["hello"]
a +
when you use a = a + 'world' python sees it as an error because of
different type.
But when you use a += 'world'
python will change the right into list (because a is a list). So when
you're code become:
a += 'world' # a += list('world')
It really helpfull if you stick to use append instead of +=
1 - 100 of 153 matches
Mail list logo