t Timer
>>> t1 = Timer("457 in data1", setup)
>>> t2 = Timer("457 in data2", setup)
>>> t3 = Timer("bin_search(data1, 457)", setup)
>>> t4 = Timer("bin_search(data2, 457)", setup)
>>>
>>> for t in (t1, t2
s actually counterproductive, making a rod
for your own back, by introducing bugs into code that wasn't buggy in
the first place. Learning to code is hard enough when you can trust the
library to be (mostly) bug free, don't make it any harder!
--
Steven D'Aprano
spend your time as a programmer. Hence the
usual advice that premature optimization is the root of all evil. First
make it work, and then only if it's not fast enough, make it work
faster.
Of course, none of this is meant to say you shouldn't plan ahead and
choose the best data structure for the job!
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Sat, 24 Apr 2010 10:37:15 am Steven D'Aprano wrote:
> For the record, here's some timing benchmarks to see how badly it
> turned out:
[...]
> 0.0346097946167
> 0.461233854294
> 3.04955101013
> 5.70547604561
>
> For comparison, here's the timing on a pla
lf.filename, 'a') as f:
f.write("...")
and the file will be automatically closed safely even if an error
occurs!
(In Python 2.5, you can also do this if you run
from __future__ import with_statement
at the very top of your program.)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
;>> x.append('something') # Modify that list in place.
>>> x is y # Still identical.
True
>>> y
['something']
If this is the behaviour you want, then you don't need to do anything.
Otherwise you need to move the creation of the empty list inside t
SAME empty list.
>>> a.append(1)
>>> print a, b
[1] [1]
When you have a default value like magasins=[], it is like the second,
not the first.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
er doesn't have one, it creates it. It uses Tkinter's
Frame object as the base class (not a metaclass, metaclasses are an
advanced technique which are very different). That way the
ScrolledCanvas class inherits behaviour from Frame.
--
Steven D'Aprano
__
gt;
> I am now officiciously pissed.
Perhaps you should drink less alcohol before posting then.
*wink*
(For those in the US, in British and Australian English, to be "pissed"
is to be drunk. Being angry is "pissed off".)
--
Steven D'Aprano
__
"tables"? Is that the same as _table?
Generally you shouldn't use the "from module import *" form. You should
consider it advanced usage, or at least discouraged.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To
This is true, as far as it goes, but what they say is that if
the behaviour of dict.__init__ changes, and you *do* call it, your
class may still break. (This is why dict is unlikely to change any time
soon.)
--
Steven D'Aprano
___
Tutor
On Wed, 28 Apr 2010 08:08:12 am Steven D'Aprano wrote:
> Some people argue that you must call dict.__init__ even though it
> doesn't do anything. Their reasoning is, some day its behaviour might
> change, and if you don't call it in your subclass, then your class
> may
On Wed, 28 Apr 2010 04:53:06 pm Walter Wefft wrote:
> Steven D'Aprano wrote:
> > And for guru-level mastery, replace to call to dict.__init__ with
> > ...
>
> nothing at all, because dict.__init__ doesn't do anything.
[...]
> Behaviour is different depending
yield c
else:
# There are a *lot* of unicode characters, but I don't know
# how many. Take the coward's way out.
raise NotImplementedError('left as an exercise for the reader')
> It's too ambiguous and if you say to foll
t;yellow", "green"]
Characters are single letters, digits or punctuation marks:
a e i o u 2 4 6 8 . ? $ %
In Python, characters are just strings, and you can put them in a list:
["a", "e", "i", "o", "u", "2", &q
d (may it rest in peace!).
And Dabo is based on Visual FoxPro.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
rds, something will happen -- usually the dealer will start a
new, shuffled, deck. Does your code have a deck?
> 2. I am not sure if I can let the winner get all of the cards and
> print out what cards the winner has when the game finished.
That's a question about blackjack, not Python.
ure walk(alist: ptr):
begin
while alist <> nil:
begin
writeln(alist^.data);
alist := alist^.next
end;
end;
Everything else, I leave as an exercise :)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ut is
* enough to give linear-time amortized behavior over a long
* sequence of appends() in the presence of a poorly-performing
* system realloc().
* The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...
*/
which doesn't look anything like the numbers above. I don't understand
w
change your program to use float instead of int. Also, you have a
lot of unnecessary brackets that don't do anything except make it hard
to read. This should do it:
a = 9e9*float(Q1)*float(Q2)/float(d)**2
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
towards the beginning), so
that the changes only happen in the part of the list you've already
seen.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
rovide a stable sort method. Failure to be stable
would count as a bug, and not a quality of implementation issue.
Python the language promises that files will be automatically closed at
some point after you have finished with them. That is a language
feature. Exactly when this happens is
ing. Similarly if your class has a __setstate__
method which does something stupid. Python is a "consenting adults"
language: if you want to shoot yourself in the foot by writing broken
code, Python doesn't try to stop you.
But for built-ins, with the possible exception of floats de
TestFLAC(TestMP3):
filename = 'data/lossless/01 - Christmas Waltz.flac'
filetype = FLACFile
def test_lossless(self):
raw = open('raw sounds.wav', 'r').read()
data = self.file.convert_to_wav()
self.assertEquals(raw, data)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
uld double check your results, e.g.
sometimes I will add a test I know will fail, just to make sure that
the framework will see it.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
reuse its memory. This is why
destructors (__del__ methods) don't necessarily run when you expect
them to.
>>> class Example:
... def __del__(self):
... print "Goodbye!"
...
>>> x = Example()
>>> mylist = [x]
>>> del x
>>> mylist[0] = None
Goodbye!
Hope this helps,
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
/learnpythonthehardway.com/index
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
(sys.argv[1]) as source:
You're opening the file in text mode. On Linux, there's no difference,
but on Windows, it will do strange things to the end of lines. You need
to open the file in binary mode:
open(sys.argv[1], 'rb')
--
Steven D'Aprano
_
work took 0.015870 seconds
See the documentation for the time module:
http://docs.python.org/library/time.html
That's a bit technical and newbie-unfriendly, so you might also like to
read this:
http://effbot.org/librarybook/time.htm
although it's very old and parts of it are
read.
> but that's just MHO.
The trick is not to top post, or bottom post, but in-line posting after
trimming the quotes to remove extraneous and unnecessary text, while
still leaving sufficient text to give context.
--
Steven D'Aprano
__
list2, value):
elements = [list1[i] for (i,x) in enumerate(list2) if x in list3]
return sum(elements)
And now call it in a loop:
sums = []
for value in list3:
sums.append(extract_and_sum(list1, list2, value))
And you are done.
--
Steven D'Aprano
_
text = open('test.fa', 'r').read() # includes newlines
text = text.replace('\n', '') # remove newlines
To get the characters 7 to 11 inclusive "TTCAC", you have to remember
that Python starts counting at 0, not 1, an
; "block lettering" created by dashes and vertical lines. If I could
> show a picture of it I would.
Why don't you copy and paste it?
> I do not get the same result as the book.
What result do you get?
What result do you expect?
--
Steven D'Aprano
But with that proviso, there's nothing wrong with importing
your own modulo to access the metadata.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
again
3
3 again
>>>
>>>
>>> for x in (1,2,3):
... print(x)
... continue
... print(x, "again")
...
1
2
3
>>>
>>>
>>> for x in (1,2,3):
... print(x)
... break
... print(x, "again")
...
1
>>&
you've written makes no
sense to the Python compiler. It also tells you that the error has
nothing to do with either of the print lines.
Unfortunately Python isn't smart enough to recognise that the problem is
with "the" rather than &q
or:
get second field
put it before third field
go to last card of next background
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
you seem to assume a 5 always rounds up...
That's how I was taught to do rounding in school too.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
;> d * 3 == 1
False
If you care about representing fractions exactly, use the fraction
module, not decimal.
>>> from fractions import Fraction
>>> f = Fraction(1, 3)
>>> f * 3 == 1
True
--
Steven D'Aprano
___
Tuto
On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
wrote:
> > Why do people keep recommending Decimal? Decimals suffer from the
> > exact same issues as floats,
>
> This is exactly incorrect! The Decimal operator offe
On Mon, 24 May 2010 03:06:28 am Wayne Werner wrote:
> On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano
wrote:
> > On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> > > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
> >
> > wrote:
> > > &g
can't trust it to do *anything*. (If d.keys() and d.values() are buggy,
how do you know that zip() or d.items() aren't buggy too?)
The exception to this is if you are handling non-dict mappings that
don't make promises about keeping d.keys() and d.values() aligned in
te that instead, just in case."
Yes, I suppose that there are buggy Python implementations where x+2
doesn't work correctly but 1+x+1 does, and there might be stupid data
types that are the same, but do you really need to support such
badly-
oughly.
You might want to wrap the call to rmtree in a try...except block in
case path_to_new_files doesn't exist.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
awfully
harsh, but perhaps he was having a bad day. I've come to understand the
semantics of the global statement better, and can see that unnecessary
global declarations goes against the purpose and meaning of the
statement. I was, in short, cargo-cult programming, using global
r):
return True
instead of None.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
an instance C().method(x).
You might also be interested in what I call "dualmethod", which passes
the class as first argument if you call it from the class, and the
instance if you call it from the instance:
http://code.activestate.com/recipes/577030-dualmethod-descriptor/
--
d.title:
print "Title: %s" % record.title
if record.author:
print "Author: %s" % record.author
If you want to distinguish between unknown and no author, the obvious
solution is to pass "?" as unknown and "" for no author.
--
Steve
ose a random number between 1 and 365,
then find out which date of the year (month and day) that is.
You can't do that because you have to use lists. So what would you do
instead?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python
not supplied. In the body of the function, this
function or class is called, to produce a value which is then
named "win". Judging by the default value and the name of the inner
variable, I would say it is expected to produce a window object, so any
function or class that returns a win
file in text mode. I'm pretty sure that is not
going to work well. Try passing 'rb' as the mode instead.
> try:
> all_data = input_file.read()
> print str(len(all_data))
You don't need to call str() before calling print. print is
z2', 'w') # create a temporary file
>>> x.write("some data")
>>> x.close()
>>> input_file = bz2.BZ2File('test.bz2', 'r') # open it
>>> print len(input_file)
Traceback (most recent call last):
File "",
sful test of the hypothesis.
Assuming this is the problem you are having, you have a number of
possible solutions:
(1) Re-create the bz2 file from a single stream.
(2) Use another application to expand the bz2 file and then read
directly from
ince the very earliest days, which is *at least* 1991, while list
comprehensions are a newcomer.
But if you insist on a list comprehension, you can re-write the above
for-loop as:
L = [o.someOtherAttribute for o in a if o.someAttribute > someConstant]
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ng a simple assignment,
nearly as bad as writing this:
if len(mystring) == 0:
n = 0
else:
n = len(mystring)
instead of just
n = len(mystring)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
o look
exactly like random binary characters, in other words, gibberish, so
what makes you think this is not working perfectly?
What do you get if you print the binary blob, and what do you expect to
get?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
. The database could be
doing *anything* to it -- it could be compressing it, or encoding it in
some way, who knows? You have to convert the data back into RTF before
writing it. This almost certainly isn't a Python problem, but a
database problem. Consult your database documentation, and g
rge regexes:
>>> re.sub('(one)', 'only \\1', s)
'only one'
or better, use the raw string syntax so Python doesn't interpret
backslashes specially:
>>> re.sub('(one)', r'only \1', s)
'only one'
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ss you directly or
indirectly inherit from object. If you inherit from nothing, it is an
old-style class regardless of whether you say
class Name: pass
or
class Name(): pass
In Python 3.x, there are no old-style classes.
> Going forward into the 2.7/3.x world, is there a preferred style?
exist any
longer.
> In other words, it seems that the following are now equivalent:
>
> class Name:
>
> -AND-
>
> class Name( object ):
Only in Python 3.x.
> My impression was the "class Name:" style created an old style class.
Only in Python 2.x (and 1.x, bu
'b': [1, 2, 4], 'd': <__main__.C instance at 0xb7f6008c>, 'gc':
, '__builtins__': , 'C': , '__name__': '__main__', '__doc__': None}]
So gc says two objects *directly* refer to the list: the tuple, and
glo
her widgets, which are called slaves. You can
think of a geometry manager as taking control of the master widget, and
deciding what will be displayed within.
I suppose you could say that master and slave widgets could be named
parent and child widgets instead.
--
Steven D'Aprano
__
oelonsoftware.com/articles/fog000319.html
> Seems to work...
You say that now, but one day you will use it on a list of 100,000
items, and you'll wonder why it takes 45 minutes to finish, and curse
Python for being slow.
--
Steven D'Aprano
_
On Sat, 12 Jun 2010 02:18:52 am Hugo Arts wrote:
> On 11 jun 2010, at 17:49, Steven D'Aprano wrote:
> > On Sat, 12 Jun 2010 12:58:19 am Alan Gauld wrote:
> >> Have you looked at the count method of lists?
> >>
> >> Something like:
> >>
> &g
b[3], b[4]?
b = a doesn't create a duplicated list, it gives the same list a second
name. Watch this:
>>> a = [1, 2, 3]
>>> b = a
>>> b.append("Surprise!")
>>> a
[1, 2, 3, 'Surprise!']
b and a both refer to the same obj
nts if t[1] > 1]
It's still has the awful O(N**2) performance, but it is nearly 25%
faster (for N=18) by my tests, and is easier to read. And by some happy
accident, it keeps the order of the original sorted list:
>>> mylist =
ery desirable at the
best of times!) is virtually impossible. Good luck!
However, there is one little ray of sunshine. If you install Pygame,
gasp should successfully import it and therefore not try to raise a
string exception, and the second error will disappear all on its own.
(But who knows how many more little landmines are waiting...)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ketrans(a, b):
try:
return string.translate(a, b)
except TypeError:
return str.translate(a, b)
> 2. write a fixer for doing this which I could use. I could`nt find
> any good tutorials out there on writing fixers, i`d be grateful if
> you could point me to any.
Fo
"no"]
return response.lower() in ["", "y", "yes"]
And then put them together in your main program like this:
def main():
if ask_id('Would you like an ID?'):
x = getid()
do_something_with_id(x)
print "Continue wor
want to call?
suffix = suffixes[n]
outfile.write(line + suffix(line) + '\n')
n = 1 - n # n -> 1, 0, 1, 0, 1, 0, ...
outfile.close()
infile.close()
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
is
simple enough, you can just write your data to the file manually. But
honestly, you can't get much simpler than ConfigParser or plistlib.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Thu, 17 Jun 2010 03:44:58 am Jeff Johnson wrote:
> I will send you my python script that reads and writes to a windows
> style .ini file if you want me to.
How is your script different from the standard ConfigParser module?
--
Steven D&
stem('echo $myenvvar')
value
0
but if I turn to another shell (not a subshell) it doesn't exist:
[st...@sylar ~]$ echo $myenvvar
[st...@sylar ~]$
See also this:
http://code.activestate.com/recipes/159462-how-to-set-environment-variables/
So unless I've missed something exceed
ing of Favo(u)rite, but why have
you dropped the E off the end of "favorite"? I'd almost think your
keyboard was broken, but no, you have E in Movies and object.
Deliberate misspellings in class and variable names will cost you *far*
more in debugging time when you
thing"
count = 1
for char in string:
count *= 10
import math
print "The string has", math.log10(count), "characters."
There's probably a shorter way too.
--
Steven D'Aprano
___
Tutor maillist - Tutor
we look forward to you coming back with a better
question!
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
an a
tuple, don't print the tuple:
names = c.execute('select names from students')
for t in names:
name = t[0] # Extract the first item from each tuple.
print name
Of course you can combine the two lines inside the loop:
print t[0]
> It seems a shame to have to
= alpha.something_else(3)
and so forth.
By the way, __init__.py doesn't have to contain anything, although it
can contain code. It just needs to exist.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
27;ve got the aptitude to be a programmer", it doesn't
really fill me with confidence. Perhaps that's something you should
keep more to yourself until *after* you've proven you do have the
chops?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
oneous data? Receiving
data from random places on the Internet? You control both machines,
right next to each other in the same locked server room guarded by
crocodiles, and you have the only key?
Depending on how serious your threat model is, the righ
#x27;, 'spam & chips\n', 'spam & spam']
> >
> > but if I do it again I get:
> >>>> print inp.readlines()
> >
> > []
> >
> > I'm baffled, why is inp now empty?
>
> I suspect you have hit the end of the file.
""]:
print("Done")
else:
indexes = [int(k) for k in indexes]
print(indexes)
for i in indexes:
print(lst[i])
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ambiguity, e.g. around the `is` operator, or when using dot method
access on a literal int or float.
I'm sure this wasn't added to Python specifically to allow calling
methods on numeric literals. You can use parentheses for that:
>>> (1).__str__()
'1'
This w
some big chunk of work took, that's perfectly
fine, e.g. if you expect to print something like this:
"Processed 1734 records in 8.2 seconds."
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
%s' % host).read()
alive = output.find('Reply from')
print alive
if alive is -1:
print '%s \t\t DOWN ' % host
else:
print '%s \t\t OK' % host
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Thu, 24 Jun 2010 04:09:38 am Alan Gauld wrote:
> "Steven D'Aprano" wrote
>
> > The easiest way is to just run forever, and stop when the user
> > interrupts it with ctrl-D (or ctrl-Z on Windows):
>
> I think that would be Ctrl-C on both.
> Ctrl-D/Z
your code will
exit when it reaches the end of the file, or on an un-caught exception.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
the loop is to hit it with a hammer (kill it from
outside Python), in which case the finally block never gets to run.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
*not* wrong to use it (especially if
you have to support versions of Python prior to 2.5) but the with
statement is the preferred way to do it now.
See more information about it here:
http://effbot.org/zone/python-with-statement.htm
--
Steven D'Aprano
__
ia.org/wiki/Comparison_of_file_systems
These days, if you're a developer on a non-Linux PC who doesn't need to
worry about legacy file systems, most file systems you come across will
be Unicode and not bytes. It's mostly Linux developers who have
to the popen*
functions, for times where popen* are too much and system is too
little. If all you want is the output (stdout + stderr) of an external
command:
import commands
output = commands.getoutput('ls -l foo*')
will do the trick.
--
Steven D'Aprano
__
r more than $40 will cover?
Cynical? Who, me?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
some are added dynamically when
the instance is initialised, and some are added dynamically later. But
they're all added dynamically. Python doesn't track when attributes are
added because, in general, it's an unimportant difference.
--
Steven D'Aprano
ou know.
I have no idea. That's why I asked:
> > Cynical? Who, me?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
th.sqrt(x) + math.asin(x**2)
Then when you catch an error:
try:
print func(y)
except DomainError:
# only catches my own error
except ValueError:
# catches any other ValueError
But both solutions are equally good. Normally you don't want fifty
di
laden
toolbars and try terrifying the user with "your computer is
unprotected" warnings -- no wonder the average user can't tell the
difference between legitimate anti-malware and trojan horses).
On the other hand, it is quite pretty.
(Yes, I am speaking from experience. Eve
On Sun, 27 Jun 2010 03:05:16 am Payal wrote:
> Thanks a lot for the quick answer. Still some doubts below.
>
> On Sat, Jun 26, 2010 at 11:07:17PM +1000, Steven D'Aprano wrote:
> > The old MRO (Method Resolution Order) is broken for classes using
> > multiple inheri
On Mon, 28 Jun 2010 03:07:47 am Richard D. Moores wrote:
> A "feature" very important to me
> is that with Gmail, my mail is just always THERE, with no need to
> download it
You see your email without downloading it? You don't understand how the
Internet works, do you?
t's own after the example looks silly.
Re-writing the question to avoid the problem is often awkward, but can
be done:
[rewritten example]
Hello, which of these two are better?
(1) lambda x: x+1
(2) def f(x):
return x+1
[end rewritten example]
Since there is no One Right Answer
If you provide three:
cmd = "UPDATE testtable SET jpeg = %s WHERE testtable_n = %s"
cursor.execute(cmd, data1, data2)
then Python fills in self and gives an error message that execute takes
only three arguments, not four.
So you need to read the documentation for execute to find ou
101 - 200 of 3304 matches
Mail list logo