he
obviousness test. It also fails the introspection test:
neither dir(list) nor help(list) make it easy to
discover how to empty a list. In my opinion, the
primary advantage for a clear() method would be that it
is self-documenting.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Gwozdziewycz wrote:
> I've been looking recently for date processing modules that can parse
> dates in forms such as "next week" or "6 days from next sunday".
This is, in fact, a fairly difficult problem in general. See the TERN_
competition that's currently held yearly on this task. Th
Ben Sizer wrote:
>> Likewise, the del keyword is fundamental -- if you
>> can't get, set, and del, then you need to go back to collections
>> school.
>
> I have hardly used the del keyword in several years of coding in
> Python. Why should it magically spring to mind in this occasion?
> Similarly
th rage that dicts have a
clear method too", then I'll just back away slooowly now.
But if there are good, solid reasons for rejecting *this particular*
(hypothetical) convenience method, then I'd like to hear about them, sans
questions about my ability to program in Python.
Thank you,
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
hould not execute
module.__call__()? I would have thought that by the duck typing principle,
it shouldn't matter whether the object was a class, a module or an int, if
it has a __call__ method it should be callable.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
Kent Johnson wrote:
> Are there any best practice guidelines for when to use
> super(Class, self).__init__()
> vs
> Base.__init__(self)
> to call a base class __init__()?
>
[snip]
>
> 3. A third fix might be to change both Base and threading.Thread() to
> call super(...).__init__(). This mig
Jan Niklas Fingerle wrote:
> Steven Bethard <[EMAIL PROTECTED]> wrote:
>> Personally, I'd call the lack of the super calls in threading.Thread and
>> Base bugs.
>
> It can't be a bug since it wasn't a bug before super was introduced and
> you
when you add a module to a class
instance, it will do whatever the class __add__ method says.
Frankly I can't think of anything useful adding two modules would do, but
maybe that's my failure of imagination.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
e done wrong. You just have to pay
attention.
Fourth step: if you still can't determine the error, don't expect others
to debug a 1000+ line script. Spend some time cutting the script back to
the smallest possible version that still gives you the same error. This
may even help you understan
tements, the second by adding another array, but both came up with
> the same system error at the command prompt level shown here:
>
> SystemError: com_backpatch: offset too large
Is this a Python error or a shell error?
If it is a Python error, perhaps you would like to post the entire
trace
("but Your Honour, I converted the TTF file into a bitmap"). Adding
decorations and such merely means you have created a derivative work of
the font, which the licence may not permit.
I suggest that you use a font which comes under a clearly free to
distribute licence, or you design your own.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
urce code to the module? Have you tried
googling? Have you tried using Python's extensive introspection
capabilities on the module?
Failing that, do you have a specific question you would like to ask?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
silently overflow, raise an
exception, or become a 201-digit integer?
[snip]
> The zeros function always gives me an error message.
Oh, don't tell me, I love playing guessing games!
Is it a SyntaxError?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ine, not just
newline, this is better still because you don't have to do any tests:
s = line.rstrip()
There is also a lstrip to strip leading whitespace, and strip() to strip
both leading and trailing whitespace.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 10 Feb 2006 20:24:34 -0800, Ross Ridge wrote:
> Steven D'Aprano wrote:
>> It is highly unlikely that any judge will be fooled by a mere change in
>> format ("but Your Honour, I converted the TTF file into a bitmap").
>
> If that were true, almost t
tension to solve that specific problem, while
still having all the other advantages of Python.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
n language is
"very slow" on modern hardware in any meaningful sense. There are plenty
of *specific tasks* which are too slow when written in one language or
another, but that's not the same thing.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
s=None):
if goodchars is None:
goodchars = string.printable
for c in s:
if c not in goodchars:
return False
return True
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print
> chr(0x1b)+chr(0x5b)+chr(0x48)+chr(0x1b)+chr(0x5b)+chr(0x32)+chr(0x4a),
Or even easier:
print "\x1b[H\x1b[2J"
which may or may not work, depending on the terminal you are using.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
d you like us to guess? Because it works for me, both as a
stand-alone script:
$ cat clear.py
magic = "\x1b[H\x1b[2J"
def clear():
print magic
if __name__ == "__main__":
clear()
$ python clear.py
and also from inside Python as a module:
>>> import clea
On Sun, 12 Feb 2006 03:03:20 -0800, bearophileHUGS wrote:
> Steven D'Aprano>Very slow to do what, compared to what? The decay time
> of the tau meson?<
>
> Probably every answer I can give you is wrong for you, so answering is
> almost useless...
We do actually agre
ore practical
solution to the task even though a F-11 would be faster.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ction), and it
will be much easier for you to write and debug when you can isolate
individual pieces of the task in individual functions.
Re-factoring will have another advantage: you might just find the problem
on your own.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 12 Feb 2006 06:20:10 -0800, bonono wrote:
>
> Steven D'Aprano wrote:
>> But, in general, more often than not, Python is fast enough. The extra
>> value of using something like Lua or Ocaml or even C is just not enough to
>> make up for the disadvant
# but both a and c include the same nested list
True
What if you want c to include a copy of the nested list? That's where you
use deepcopy:
py> d = copy.deepcopy(a)
py> d[2] is a[2]
False
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 12 Feb 2006 17:44:50 +0100, PA wrote:
> On Feb 12, 2006, at 16:11, Steven D'Aprano wrote:
>
>> availability of skilled programmers is absolutely critical for the use
>> of a language.
>
> By that measure, we should all be using Java, no?
I said nothing ab
On Sun, 12 Feb 2006 17:08:02 +, Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> .
> .
> .
>>on the web for each language. By comparis
de you're describing?
It isn't written in C, but get your hands on wget. It
is probably already on your Linux distro, but if not,
check it out here:
http://www.gnu.org/software/wget/wget.html
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
on: programmers may look at it and say "No classes?
Prototyping? WTF is that? I don't have time to learn
something so different, better stick to languages which
have a smaller learning curve."
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ves too much.
The thing to remember is that methods are attributes too, so it is a
little hard to expect Python to magically know which attributes you want
to see and which you don't. Although, I don't think it is too much to
expect Python to distinguish methods from non-method attributes.
this? I've
tried searching, but can't find anything useful.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 14 Feb 2006 22:43:50 +1100, Steven D'Aprano wrote:
> On Tue, 14 Feb 2006 14:29:44 +0300, Sergey wrote:
>
>> Hello.
>>
>> I try to open file with pathname length 282 bytes:
>> E:\files\..\something.dat
>>
>> On MSDN
>&g
files...something.dat" which doesn't exist.
You should escape the backslashes:
f = file("E:\\files\\...\\something.dat", "r")
or use raw strings:
f = file(r"E:\files\...\something.dat", "r")
or just use forward slashes and let Windows deal with i
On Tue, 14 Feb 2006 04:11:52 -0800, Raymond Hettinger wrote:
> Steven D'Aprano wrote:
>> I came across this unexpected behaviour of getattr for new style classes.
>> Example:
>>
>> >>> class Parrot(object):
>> ... thing = [1,2,3]
>> ...
&g
On Tue, 14 Feb 2006 13:03:17 +0100, bruno at modulix wrote:
> Steven D'Aprano wrote:
>> I came across this unexpected behaviour of getattr for new style classes.
>> Example:
>>
>>
>>>>>class Parrot(object):
>>
>> ... thing = [1,2,
in about two
seconds:
>>> factor(12345678987654)
[2, 3, 2057613164609L]
and this in less than a second:
>>> factor(12345678987654321)
[3, 3, 3, 3, 37, 37, 333667, 333667]
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
bers. A number with 1,000 factors would be enormous,
and yet the memory needed for a list of 1,000 ints could be as small as
8K -- trivial on modern computers.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
t) C code. So even though count
may do more work, it may do it faster.
The only way to tell for sure is to actually time the code, not try to
guess.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
r.__lt__, 50), (operator.__mul__, 2))
for i in loop:
do_something(i)
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
Georg Brandl wrote:
> Steven D'Aprano wrote:
>
>>On Wed, 15 Feb 2006 08:44:10 +0100, Marc 'BlackJack' Rintsch wrote:
>>
>>
>>>In <[EMAIL PROTECTED]>, Farel wrote:
>>>
>>>
>>>>Which is Faster in Python and Why?
&
Graham wrote:
> The way i'm controlling functionality is with some games and exec, so
> if 'code' was the text code you wanted to execute i run:
>
> exec code in {'__builtins__':None"}
>
> obviously this doesn't give you much to play with, but it does remove
> file access and importing as far as
# make a local reference for speed
while condition:
flag = iso(t1, t2)
... code ...
If your code is still too slow, you might speed it up with Psycho, or you
may need to write a C extension. Either way, you won't know if the code is
fast enough until you actually run it.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
n just a day or two ago
where a function which was taking hours to complete was re-written with a
better algorithm which took only seconds. And still in Python.
If it is still too slow after using better algorithms, or if there are no
better algorithms, then and only then re-write those bottlenecks in C for
speed.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
e x in list comprehensions are exported to the rest of the
local scope, but that (mis)feature is officially going to be removed in
future versions of Python.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 16 Feb 2006 12:30:47 -0800, SMB wrote:
> I know I could do this with two for loops, but am looking for a better
> solution maybe involving list comprehension.
What's wrong with for loops? Why do you think they are unPythonic?
--
Steven.
--
http://mail.python.org/mailm
am, by any chance?
The spammers already know how to look for open relays. Unlike the original
poster, they know how to use Google. *wink*
Besides, not just spammers want to detect open relays. Many people like to
block mail from open relays.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
> But still my question is why is the:
> f = open('myfile,'r')
> a = f.read(5000)
> working in linux??
Why shouldn't it work in Linux? The question should be, why is it not
working in Windows? (When did "my code is broken" become the excepted
state of af
occasional newbie who somehow has missed out on
learning about true division, but that's no reason to not implement
features in the language. The cost of confusing a newbie once in a month
of Sundays is far less than the benefit of introducing true division.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
xtra):
"""Return a new list consisting of extra appended to the items of L."""
return L + [extra]
Now call it like this:
f(functional_append(a, 4))
But in fact you can now optimize the functional_append away by just doing
this:
f(*a+[4])
and it will work.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ally will thank us.
http://www.catb.org/~esr/faqs/smart-questions.html
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
as default - because it will just PISS too many (long time python)
> people OFF. ;-)
Do you realise that the reason true division was introduced into Python
was because many long-time Python programmers requested it? So far from
annoying them, it is a feature that most Python programmers are waiting
for.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
do the same thing.
try:
print baz[3]
except KeyError:
print "No third value. Initializing it now."
baz[3] = 0.0
# A third way.
print baz.get(3, 0) # Prints 0 if no third value exists.
# A fourth way: print baz[3] with a default value of 0,
# and set the value if it doesn
whether you wanted to copy selected text or paste over it
according to some subtle clue in the text itself. Wouldn't that be fun?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
oncede that perhaps my post was a little hasty.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
arison than it would for the
CPU to blast bits around?
I have no idea whether your shortcuts are optimizations or pessimizations.
I'm just asking whether you know, or if you are making assumptions.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ge.
For those tasks that language speed is a limiting factor (say, writing
devise drivers, operating systems, and similar), Python may not be fast
enough. But they are the exception rather than the rule, and there are no
shortage of ways around that: Psycho, C extensions, or even "choose
another language".
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
but help would be much appreciated!
> Thanks in advance!
"input" takes the user-entered string and evaluates it as a Python
expression. You want raw_input().
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
avascript or ruby or perl,
>>
>>
>> It's not a "scripting" language, and it's not interpreted.
>
> Of course it is. What do you think happens to the bytecode?
By that logic, all languages are interpreted. What do you think happens to
the machinecode?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
't mind one bit if others, less informed than them, come
away with that impression.
Let's be frank: "interpreted language" has negative connotations which may
have been valid in the 1960s and perhaps even the 1970s, but are no longer
automatically valid. Nevertheless, those connotations stick around,
generally amongst the less knowledgeable. That hurts Python's commercial
success, and Python's commercial success is vital for anyone who wishes to
get paid to program in Python.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
notation. It is too easy to make
typos, what with , and . next to each other, and the
typos often will not raise an exception but will simply
give incorrect but puzzling behaviour. This isn't
unique to the proposed syntax (e.g. under Python today
it isn't obvious whethe
tionality
already exist? Is there a reason why it can't exist?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
rs for each of the two teams, which comes
> out to be quite large.
750 objects is not very many, not unless they are carrying around large
chunks of data. And even then, using __slots__ saves only a small
amount of memory per object.
Write your code the slot-less way, see how it performs, and if it is slow,
change your class definition.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I think this is what you want:
>
> file = open(r'c:/test.txt','r')
>
> c = file.read(3)
> while c:
> print c
> c = file.read(3)
>
> file.close();
Or:
def read3():
return file.read(3)
for chars in iter(read3, ''):
... do something
features that would have increased
Python's speed at the cost of productivity, rather than deliberately
choose to emphasis productivity at the expense of some speed.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
(At least not yet.)
But it is also absolutely true that Python is compiled. Why emphasise the
interpreter, and therefore Python's similarity to bash, rather than the
compiler and Python's similarity to (say) Java or Lisp?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
mainder split between everything else.
If anyone cares to look at my quick and dirty source code, it is attached
following my signature.
--
Steven.
* * *
"""Rough and ready script to analyse the Python standard library
and count function definitions that use None
oks perfectly Pythonic to me.
You know, just because Python has for loops and
multi-line blocks of code doesn't mean we shouldn't use
them *wink*
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ce
Using a proper database will give you 2 and 3, but at
the cost of a lot of overhead, and typically a
relational database is not a single file.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
Donn Cave wrote:
> Quoth Steven D'Aprano <[EMAIL PROTECTED]>:
> ...
> | Nobody denies that Python code running with no optimization tricks is
> | (currently) slower than compiled C code. That's a matter of objective
> | fact. Nobody denies that Python can be
off if such people run
> away to Ruby, with its (expletive deleted) a..b AND a...b syntaxes just
> to ensure maximum confusion;-).
Ruby uses both .. and ...? Now I'm frightened.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
y google skills are
lacking or nobody has ever thought of doing import
"C:\directory\module" before.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 21 Feb 2006 09:46:27 -0800, Donn Cave wrote:
> In article <[EMAIL PROTECTED]>,
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> ...
>> Hey Donn, here is a compiled program for the PowerPC,
>> or an ARM processor, or one of IBM's Big Iron
>>
us of Python's development. If you tell them that Python is
slow because it is interpreted, they will believe that Python will always
be slow. If you tell them that Python is slow because speed has not been
the priority, they will believe that some day it will become the priority,
and then Python will get faster. And they will be right. That is the aim
of PyPy after all.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
the server and then emails it...
>
> assuming that the web server can read files on your local disk is perhaps
> a bit too optimistic.
Come on, Gaz is running Windows. Chances are *everyone* can read files on
his local disk.
*wink*
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
(ValueError, IndexError):
... print "Error!"
...
Error!
And here I was thinking that commas make tuples, not
brackets. What is happening here?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
ax
How about posting your actual code?
You could try this:
while 1:
var = raw_input("Give me some data! ")
if var == "some data":
print "Success!"
break
else:
print "No good, try again."
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
(I imagine) should
be about the same as timer1. Possibly even less as it isn't timing the
setup of the for loop.
Any ideas what is causing the difference? I'm running Python 2.3 under
Linux.
Thanks,
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
> do I need to slice off the "u", or anything? I know it has something to
> do with unicode but I don't know how to treat it.
No. The u is part of the display of the string, just like the quote marks.
Ordinary strings are printed with ' ' delimiters.
Unicod
read a
file containing "d:\thedir", and print the string you have just read, the
print statement uses repr() and you will see that the string is just
what you expect:
d:\thedir
You can also check for yourself that the string is correct by looking at
its length: nine characters.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
on:
def isascii(s):
for c in some_string:
if c not in string.ascii_letters:
return False
return True
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
for _ in itr:
func()
t1 = timer()
return t1 - t0
And the results:
>>> timer.timer3()
0.64760088920593262
>>> timer.timer4()
5.2274949550628662
It looks like the time function under Linux at least is very slow.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
f calling the try..except block in every
branch directly, pull it out into a function:
def test(s,what):
try:
i = s.index(what)
print "It's here: ", i
except ValueError:
print "No 3's here"
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
break
>> else:
>> print "No good, try again."
> That works fine with strings and when "some_data" is hardcoded. I run
> into trouble when "some data" is replaced with a number, unquoted. It
> simply says "No good, etc"
Try this, at a command line:
5 == '5'
and see what you get.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
g spaces? I don't see why Windows' lack is
Mac users' problem.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Feb 2006 00:24:25 +, Jeffrey Schwab wrote:
> Steven D'Aprano wrote:
>> On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote:
>>
>> My comments inserted inline.
>>
>>
>>
>>>#!/usr/bin/python
>>>#simple guessing game,
On Thu, 23 Feb 2006 17:49:31 -0600, Larry Bates wrote:
> Steven D'Aprano wrote:
>> On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote:
>>
>>> How about not naming files with leading and trailing spaces on
>>> the Mac? Seems like a bad habit that need
On Thu, 23 Feb 2006 20:41:52 -0600, Terry Hancock wrote:
> On Fri, 24 Feb 2006 09:14:53 +1100
> "Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
>> There are *reasons* why Python discourages functions with
>> side-effects. Side-effects make your code hard to t
On Thu, 23 Feb 2006 16:49:09 -0800, bonono wrote:
>
> Steven D'Aprano wrote:
>> On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote:
>>
>> >> try:
>> >>i = a.find("3")
>> >>print "It's here: ", i
>&
#x27;\n').replace('\r', '\n')
elif linesep == '\r': # classic Macintosh
s = s.replace('\r\n', '\r').replace('\n', '\r')
elif linesep == '\r\n': # Windows
s = s.replace('\r\n', '\r').replace('\n', '\r')
s = s.replace('\r', '\r\n')
else: # weird platforms?
print "Unknown line separator, skipping."
return s
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Feb 2006 10:11:18 +0100, Magnus Lycka wrote:
> Steven D'Aprano wrote:
>> It looks like the time function under Linux at least is very slow.
>
> Perhaps you should try doing the same thing in C.
> Then you can see whether the problem is in the
> wrapper or
On Fri, 24 Feb 2006 01:50:40 -0800, bonono wrote:
> Steven D'Aprano wrote:
>> Just out of curiosity, when do you think is the right time to begin
>> teaching programmers good practice from bad? Before or after they've
>> learnt bad habits?
>
> When you hav
ndex(substr) not only returned the index as
promised, but also (say) appended substr to a list somewhere.
Side-effects aren't always bad (import, for example, does all its work by
side-effect). But they are generally frowned upon, and in functional
languages they are verboten.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Feb 2006 10:51:09 +, Roel Schroeven wrote:
[snip]
> I think it looks like the problem is in the system call.
Thank you Roel for going the extra mile. I appreciate the unexpected bonus.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Feb 2006 06:45:41 -0500, Kent Johnson wrote:
> Steven D'Aprano wrote:
>> Now that's a Python wart: using >>> for the prompt for interactive
>> sessions. It makes it ambiguous when posting code in email or newsgroups,
>> especially once the code
On Fri, 24 Feb 2006 08:03:49 -0500, Roy Smith wrote:
> In article <[EMAIL PROTECTED]>,
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>
>> Side-effects aren't always bad (import, for example, does all its work by
>> side-effect). But they are generally f
you have to assume some of them will be malicious, and they will be a lot
more inventive searching for security holes than you.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
er the motto "Nothing sucks like an Electrolux."
Which is a wonderful, deliberately ironic advertising line. I love it!!!
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
on is True.
>>
> What would be the occasion that AssertionError be the right exception
> to raise then ?
Surely that would be when an assert statement fails?
I don't think AssertionError should be called by hand. At least, I
wouldn't do so.
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
invest in picking up a Zen language. Hard-core hackers
> might presumably lean towards the Zen languages.
Regardless of whether Python is a Zen or tool language, or both, or
something else, it is incredibly easy to pick up. Just remember, and this
goes for *any* new language you are trying to learn, Pyth
#x27;t modify locals() so it doesn't help me.
No, you can't modify locals. Locals returns a copy of the local
environment as a dict, but changing that dict doesn't change the local
variables.
There is an exception to that rule: if you run locals from the
interpreter, outside of a fu
10001 - 10100 of 15568 matches
Mail list logo