Steven D'Aprano wrote:
And how does Python know whether some arbitrary default object is mutable
or not?
It doesn't, that's the whole point.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rudin wrote:
Gregory Ewing writes:
You can clean up dir() by defining __all__ as a list of
names that you want to officially export.
I'm not sure that's necessarily a good idea... when you're trying to figure
out why something behaves in a certain way you want to check for the
presence
On Sat, 30 Oct 2010 15:05:37 +1300, Lawrence D'Oliveiro wrote:
> In message , geremy
> condra wrote:
>
>> ... dividing strings by a number doesn't make sense.
>
> The logical meaning would be the opposite of multiplying strings by a
> number:
>
> >>> "abc" * 3
> 'abcabcabc'
> >>> "ab
Thank you Robert for the clarification. Since I'm an amateur programmer,
could you please give me a sample of how I would do it. I'll take some time
to study arrays as well, and how to write them, I know of lists, and tuples,
and dictionaries; from "Dive into Python". but I am very green around t
In message <8idvgaf21...@mid.individual.net>, Peter Pearson wrote:
> Yes, module w imports x, and therefore w.x exists. Is that bad?
No-one seems to have come out and said this yet (unless it was in one of
those messages that no longer seem to be accessible on my ISP’s news
server): Python has
In message , Tim Harig wrote:
> Python could easily process the escape codes for any given terminal; but,
> in general, you would want something that works for more then a single
> terminal type.
Does anyone still bother with anything other than VT1xx-type terminals?
--
http://mail.python.org/ma
In message , Ed Keith wrote:
> I need to generate PDF files and I'm exploring what tools to use. I was
> planing on using ReportLab, but recently found some references to pango
> (http://www.pango.org/) and ciaro (http://cairographics.org/) being able
> to generate PDF files. But am having difficu
In message , Nikola Skoric wrote:
> I have a file full of lines which I parse into Line objects. I also
> have two subclasses of Line, namely Individual and Family. Constructor
> of both subclasses needs all Line objects in the file to be
> constructed, so I cannot construct subclass objects in th
On Oct 29, 11:59 am, Tracubik wrote:
> i've to convert integer x to string, but if x < 10,
> the string have to be '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
Everyone else seems to prefer the format-based solutions, which is
fine. I will give zfill a little exposure,
On 29 out, 19:06, Alessio Stalla wrote:
> On 28 Ott, 10:42, p...@informatimago.com (Pascal J. Bourguignon)
> wrote:
>
> > sthueb...@googlemail.com (Stefan Hübner) writes:
> > >> Would it be right to say that the only Lisp still in common use is the
> > >> Elisp
> > >> built into Emacs?
>
> > > Cl
In message <4cc5d9e9$0$1661$742ec...@news.sonic.net>, John Nagle wrote:
> Look at sock_close in "socketmodule.c". Note that it ignores the
> return status on close, always returns None, and never raises an
> exception. As the Linux manual page for "close" says:
> "Not checking the return val
In message <4cc3fad1.5080...@sschwarzer.net>, Stefan Schwarzer wrote:
> I'm looking for a tool which can read Python files and write
> a corresponding XMI file for import into UML tools.
UML ... isn’t that something more in vogue among the Java/DotNet corporate-
code-cutter-drone crowd?
Specific
In message , geremy
condra wrote:
> ... dividing strings by a number doesn't make sense.
The logical meaning would be the opposite of multiplying strings by a
number:
>>> "abc" * 3
'abcabcabc'
>>> "abcabcabc" // 3
'abc'
>>> "abcabcabc" // "abc"
3
>>> "abcabcabd" //
In message , kj wrote:
> matplotlib, even in its underlying so-called "OO mode", follows
> MATLAB's graphics model, which, in my very subjective opinion, is
> vastly inferior to Mathematica's.
Speaking as someone who once had to do GUI programming in MATLAB, I think
it’s really only good for one
In message , Dave Angel
wrote:
> Gee, maybe when "you're trying to track down problems", you might try
> starting the application in a console?
On a rationally-designed OS, I have a choice. I can do that, but that’s not
really my first resort: the first thing I can do is check in ~/.xsession-
e
In message <8ivfa3fif...@mid.individual.net>, Gregory Ewing wrote:
> Lawrence D'Oliveiro wrote:
>
>> You mean “GUI console”. So non-GUI apps get a GUI element whether they
>> want it or not, while GUI ones don’t. That’s completely backwards.
>
> The "G" in GUI stands for "Graphical". I wouldn't
On Oct 29, 3:26 am, Sebastian wrote:
> Hi all,
>
> I am new to python and I don't know how to fix this error. I only try to
> execute python (or a cgi script) and I get an ouptu like
>
> [...]
> 'import site' failed; traceback:
> Traceback (most recent call last):
> File "/usr/lib/python2.6/site.p
I personally would take only one bite at a time. Meaning only do one then do
the other later.
But to each it own :)
> Date: Fri, 29 Oct 2010 17:48:11 -0500
> To: python-list@python.org
> From: jbiq...@icsmx.com
> Subject: Re: Python 2.7 or 3.1
>
> Hello all
>
> Would you consider a "not so in
On Thu, 28 Oct 2010 18:26:49 +0200, Sebastian wrote:
> Hi all,
>
> I am new to python and I don't know how to fix this error. I only try to
> execute python (or a cgi script) and I get an ouptu like
>
> [...]
> 'import site' failed; traceback:
> Traceback (most recent call last):
> File "/usr/lib
Antoine Pitrou wrote:
> On Fri, 29 Oct 2010 08:12:19 -0400
> Neal Becker wrote:
>> Seems multiprocessing doesn't behave well with signals:
>> [...]
>
> By the way, could you post an issue on the tracker with instructions on
> how to reproduce (including OS)?
>
> Thanks
>
> Antoine.
http://bug
Chris Rebert wrote:
On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing
wrote:
I think what's disturbing about this is that the two halves of
the extended traceback are printed in the wrong order. We're
True, but swapping the order would only worsen Steve's problem.
Yes, I can see that what S
Hello all
Would you consider a "not so intelligent move" for a newsbie to
Python to have maybe version 2.7 and 3.x (if that's possible to be
running together on the same machine) to have them run and be
learning mainly in 2.7 and see differences in 3.x? In my case I am
interested mainly in we
On Wed, Oct 27, 2010 at 7:18 PM, Braden Faulkner wrote:
> Would it be safe to say that 2.6 would be even better for beginners than?
Let me just come out with a contrary point of view before you go down
that path. If you're seriously considering using sqlite, then you may
be just as well off using
Am 29.10.2010 23:16, schrieb Lawrence D'Oliveiro:
> In message , Jorge
> Biquez wrote:
>
>> I was wondering if you can comment more about what alternatives to
>> use instead to MySql. My web solutions do not need "all the power" of
>> a true database,
>
> Is more than one process likely to acces
In message , Jorge
Biquez wrote:
> I was wondering if you can comment more about what alternatives to
> use instead to MySql. My web solutions do not need "all the power" of
> a true database,
Is more than one process likely to access the data at the same time? If so,
use MySQL.
--
http://mail
On Fri, 29 Oct 2010 08:12:19 -0400
Neal Becker wrote:
> Seems multiprocessing doesn't behave well with signals:
> [...]
By the way, could you post an issue on the tracker with instructions on
how to reproduce (including OS)?
Thanks
Antoine.
--
http://mail.python.org/mailman/listinfo/python-l
In message <4cc701e7$0$1606$742ec...@news.sonic.net>, John Nagle wrote:
> The weird "functional if" syntax additions were a cave-in to the
> functional crowd, and may have been a mistake.
The only mistake was not putting functional-if into the language in the
first place, and having to use that
On Thursday 28 October 2010, 21:23:03 Craig McRoberts wrote:
> Oh, I like to browse brick-and-mortar enough. But it's been forever
> since I've bought something there.
If you can get your hands on a copy of Mark Summerfield's Programming in
Python3, check it out. He really raised the accustomed q
Are Tkinter StringVar (IntVar, FloatVar, etc) thread safe, eg.
can a background thread read or write to these objects? Or must I
use a Queue to pass information between my background thread and
my main Tkinter GUI thread and have my main Tkinter thread pop
the Queue and update the application's Str
In message , Andre
Alexander Bell wrote:
>>>> i = 5
>>>> l = [i**2 for i in range(3)]
>>>> i
>2
The last line comes out as 5 in Python 3.1.
--
http://mail.python.org/mailman/listinfo/python-list
On 28 Ott, 10:42, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> sthueb...@googlemail.com (Stefan Hübner) writes:
> >> Would it be right to say that the only Lisp still in common use is the
> >> Elisp
> >> built into Emacs?
>
> > Clojure (http://clojure.org) is a Lisp on the JVM. It's gai
In message
,
jos...@corporate-world.lisp.de wrote:
> On 29 Okt., 01:34, Lawrence D'Oliveiro
> wrote:
>
>> In message
>> ,
>> kodifik wrote:
>>
>>> On Oct 28, 1:55 am, Lawrence D'Oliveiro
>>> wrote:
>>
Would it be right to say that the only Lisp still in common use is the
Elisp built i
Dun Peal, 28.10.2010 09:10:
I find myself surprised at the relatively little use that Cython is seeing.
I don't think it's being used that little. It just doesn't show that
easily. We get a lot of feedback on the mailing list that suggests that
it's actually used by all sorts of people in all
On Thu, Oct 21, 2010 at 7:53 PM, John Nagle wrote:
> On 10/21/2010 2:51 PM, Chris Rebert wrote:
>
>> On Thu, Oct 21, 2010 at 2:36 PM, Sean Choi wrote:
>>
>>> I found two similar questions in the mailing list, but I didn't
>>> understand
>>>
>>> the explanations.
>>> I ran this code on Ubuntu 10.
On 2:59 PM, Chris Rebert wrote:
On Thu, Oct 28, 2010 at 8:33 PM, Baskaran Sankaran wrote:
Sorry for the confusion; fooz(), track() and barz() are all members of their
respective classes. I must have missed the self argument while creating the
synthetic example.
Yeah, I realize the mutual impor
MRAB wrote:
On 29/10/2010 11:24, Chris Rebert wrote:
On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing
wrote:
Chris Rebert wrote:
Your Traceback is merely being made slightly longer/more
complicated than you'd prefer; however, conversely, what if a bug was
to be introduced into your exception
On Fri, Oct 29, 2010 at 10:35 AM, Tim Harig wrote:
> On 2010-10-29, mix wrote:
> > Hi,
> >
> > I'm wondering if there is a way in python to process a string
> > containing terminal escape characters. Example: Please consider the
> > following string:
>
> Python could easily process the escape co
MRAB wrote:
On 24/10/2010 13:28, Steve Holden wrote:
On 10/24/2010 4:48 AM, Martin v. Loewis wrote:
Am 24.10.2010 07:01, schrieb Steve Holden:
I was somewhat surprised to discover that Python 3 no longer allows an
exception to be raised in an except clause (or rather that it
reports it
as a s
On 24/10/2010 13:28, Steve Holden wrote:
On 10/24/2010 4:48 AM, Martin v. Loewis wrote:
Am 24.10.2010 07:01, schrieb Steve Holden:
I was somewhat surprised to discover that Python 3 no longer allows an
exception to be raised in an except clause (or rather that it reports it
as a separate except
On 2010-10-29, mix wrote:
> Hi,
>
> I'm wondering if there is a way in python to process a string
> containing terminal escape characters. Example: Please consider the
> following string:
Python could easily process the escape codes for any given terminal; but,
in general, you would want somethin
On 29/10/2010 17:18, "none <"@mail.python.org wrote:
On 29/10/10 16:59, Tracubik wrote:
Hi all,
i've to convert integer x to string, but if x< 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can
On 29/10/2010 11:24, Chris Rebert wrote:
On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing
wrote:
Chris Rebert wrote:
Your Traceback is merely being made slightly longer/more
complicated than you'd prefer; however, conversely, what if a bug was
to be introduced into your exception handler? Then
Le 29/10/2010 13:41, Adam Tauno Williams a écrit :
So what kind of object is ?
In this case it is clearly mx.DateTime.DateTime.
__repr__ and __str__ may produce different representations;
Thanks a lot, in fact it is DateTime from xmlrpclib but your post really
helped me to find it.
--
htt
On Oct 29, 2:43 am, Steven D'Aprano wrote:
> On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote:
> > It's clear but tedious to write:
>
> > if 'monday" in days_off or "tuesday" in days_off:
> > doSomething
>
> > I currently am tending to write:
>
> > if any([d for d in ['monday
> Hi all,
> i've to convert integer x to string, but if x < 10, the string have to
> be
> '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
>
> x = 32
> str(x) --> '32'
>
> x represent hour/minute/second.
>
> I can easily add '0' with a if then block, but is there a built
On 29/10/10 16:59, Tracubik wrote:
Hi all,
i've to convert integer x to string, but if x< 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can easily add '0' with a if then block, but is there
On 2010-10-29, Tracubik wrote:
> Hi all,
> i've to convert integer x to string, but if x < 10, the string have to be
> '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
>
> x = 32
> str(x) --> '32'
>
> x represent hour/minute/second.
>
> I can easily add '0' with a if then b
Hi all,
i've to convert integer x to string, but if x < 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can easily add '0' with a if then block, but is there a built-in way to
add the '0' automat
On Oct 24, 7:36 am, Steve Holden wrote:
> I don't want people to think this is a big deal, however.
Nonsense, this IS a big deal. (and Steve grow a spine already!) I was
not even aware of this issue until you brought it up -- although i
will admit your choice of title is completely misleading!
On Oct 28, 2:16 pm, Teenan wrote:
> hmmm bookstore.. those are the things they had before Amazon right? ;)
hmm Amazon... Is that the place where you buy tutorials when you could
instead get the same info for free with a little Google fu? ;-)
--
http://mail.python.org/mailman/listinfo/python-li
Hi,
I'm wondering if there is a way in python to process a string
containing terminal escape characters. Example: Please consider the
following string:
str = ''\x1B[K\x1B[D\x1B[D\x1B[D\x1B[D\x1B[C\x1B[C\x1B[C\x1B[C
\x1b[d\x1b[d\x...@q\x1b[@q\x...@q''
as a result of printing it (print str), t
On 10/29/10 12:02 AM, Chris Rebert wrote:
On Thu, Oct 28, 2010 at 9:41 PM, Bj Raz wrote:
I am working with differential equations of the higher roots of negative
one. (dividing enormous numbers into other enormous numbers to come out with
very reasonable numbers).
I am mixing this in to a scrip
On Fri, 2010-10-29 at 07:31 -0700, Jean-Paul Calderone wrote:
> On Oct 29, 10:08 am, Adam Tauno Williams
> wrote:
> > signal handler to do something smart in the case of a "-15" [for which
> > there isn't really a thread equivalent - can you sent a SystemV style
> > signal to an individual thread
> It is not easily discoverable, but it is possible to suppress
> __context__ by using a bare re-raise afterwards:
I see. I'd wrap this like this:
def raise_no_context(e):
try:
raise e
except:
e.__context__=None
raise
d = {}
try:
val = d['nosuch']
except KeyEr
On Oct 29, 10:08 am, Adam Tauno Williams
wrote:
> signal handler to do something smart in the case of a "-15" [for which
> there isn't really a thread equivalent - can you sent a SystemV style
> signal to an individual thread in a process? I don't think so.]
Yes. pthread_kill(P)
Jean-Paul
--
On Fri, 29 Oct 2010 10:08:01 -0400
Adam Tauno Williams wrote:
>
> No, I don't think so. You're asking the module to over generalize
> behavior. Reaping of the child is important, and that the child needs
> to be reaped may matter to the master child (why? did something go
> wrong?). Silently r
On Fri, 2010-10-29 at 08:39 -0400, Neal Becker wrote:
> Adam Tauno Williams wrote:
>
> > On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote:
> >> Seems multiprocessing doesn't behave well with signals:
> >> -
> >> from multiprocessing import Pool
> >> import time
> >> def sleep (dummy):
Adam Tauno Williams wrote:
> On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote:
>> Seems multiprocessing doesn't behave well with signals:
>> -
>> from multiprocessing import Pool
>> import time
>> def sleep (dummy):
>> time.sleep (10)
>> if __name__ == '__main__':
>> pool = Poo
On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote:
> Seems multiprocessing doesn't behave well with signals:
> -
> from multiprocessing import Pool
> import time
> def sleep (dummy):
> time.sleep (10)
> if __name__ == '__main__':
> pool = Pool (processes=2)
> result = po
Seems multiprocessing doesn't behave well with signals:
---
from multiprocessing import Pool
import time
def sleep (dummy):
time.sleep (10)
if __name__ == '__main__':
pool = Pool (processes=2)
result = pool.map (sleep, range (4))
-
start it up
$ python t
On Fri, 29 Oct 2010 04:07:15 -0700
Chris Rebert wrote:
> On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou wrote:
> > On Sun, 24 Oct 2010 10:48:23 +0200
> > "Martin v. Loewis" wrote:
> >>
> >> You may now wonder whether it is possible to set __context__ to None
> >> somehow. See PEP 3134:
> >>
>
On Fri, 2010-10-29 at 13:15 +0200, jf wrote:
> Hi,
> I've a bug in my code and I'm trying de reproduce it.
> To trace the bug I print arguments, and it produces this:
> {'date': }
> My question is: what is: ?
> I use mx.DateTime put if I print it I get:
>
> So what kind of object is ?
In this c
Take a look here:
http://pypi.python.org/pypi/DateTime/
I always use this package only with Zope (it's an application server)
If you are simply working in python maybe it's better to use datetime object.
Hi.
On Fri, Oct 29, 2010 at 1:15 PM, jf wrote:
> Hi,
>
> I've a bug in my code and I'm tr
Hi,
I've a bug in my code and I'm trying de reproduce it.
To trace the bug I print arguments, and it produces this:
{'date': }
My question is: what is: ?
I use mx.DateTime put if I print it I get:
So what kind of object is ?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou wrote:
> On Sun, 24 Oct 2010 10:48:23 +0200
> "Martin v. Loewis" wrote:
>>
>> You may now wonder whether it is possible to set __context__ to None
>> somehow. See PEP 3134:
>>
>> Open Issue: Suppressing Context
>>
>> As written, this PEP makes i
On Sun, 24 Oct 2010 10:48:23 +0200
"Martin v. Loewis" wrote:
>
> You may now wonder whether it is possible to set __context__ to None
> somehow. See PEP 3134:
>
> Open Issue: Suppressing Context
>
> As written, this PEP makes it impossible to suppress '__context__',
> since setting exc.
On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing
wrote:
> Chris Rebert wrote:
>>
>> Your Traceback is merely being made slightly longer/more
>> complicated than you'd prefer; however, conversely, what if a bug was
>> to be introduced into your exception handler? Then you'd likely very
>> much apprec
Daniel Fetchinson wrote:
Any reason your project is not easy_installable?
Mainly because I'm not a setuptools user and haven't been
motivated to learn how to do this so far.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Daniel Fetchinson wrote:
The problem is that some part of the application gets installed to
/home/fetchinson/.local/lib/python2.6/site-packages/GUI
and some other parts get installed to
/home/fetchinson/.local/lib/python/site-packages/GUI
Which parts get installed in which places, exactly?
cbr...@cbrownsystems.com wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
>doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
>doSomething
>
> Is there a better pythonic idiom
On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
> doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
> doSomething
Chris Rebert wrote:
Your Traceback is merely being made slightly longer/more
complicated than you'd prefer; however, conversely, what if a bug was
to be introduced into your exception handler? Then you'd likely very
much appreciate the "superfluous" Traceback info.
I think what's disturbing abo
On Thu, 28 Oct 2010 10:13:15 -0400, Dave Angel wrote:
> Inverting the bits of a floating point number wouldn't make much sense,
> so fortunately it gives an error.
>>> from struct import pack, unpack
>>>
>>> def float_as_int(x):
... bits = pack("d", x)
... return unpack("q", bits)[0]
...
Steve Holden wrote:
Yeah, that's a given. Ruby would probably let you do that, but Python
insists that you don't dick around with the built-in types. And roghtly
so, IMHO.
Some restrictions on this are necessary -- it obviously
wouldn't be safe to allow replacing the class of an
object with on
On Thu, 28 Oct 2010 20:16:45 +0100, Teenan wrote:
> On Thu, 2010-10-28 at 15:03 -0400, Craig McRoberts wrote:
>> Thanks for the prompt replies. Sounds like it's time to hit a
>> bookstore.
>>
>> Craig McRoberts
>
> You could do a lot worse than getting 'Dive into Python' (There's even a
> nice n
Mark Wooding wrote:
Would the world be a better place if we had a name for 2 pi rather than
pi itself?
I don't think so. The women working in the factory in India
that makes most of the worlds 2s would be out of a job.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 28 Oct 2010 14:14:43 -0400, Craig McRoberts wrote:
> First off, greetings from a newbie!
>
> Here's the deal. I gained a passable knowledge of Python nearly ten
> years ago. Then I decided a career in the computer sciences wasn't for
> me, and I let it go. Now I find myself back in the de
gb345 wrote:
I see how clicking directly on these files would obviate the need
to specify the path of the interpreter, but it's still not clear
to me how the interpreter would know where to look for the myscript.py
module that both the GUI scripts require.
If it's in the same directory as the
On Fri, 29 Oct 2010 21:24:23 +1300, Gregory Ewing wrote:
> John Nagle wrote:
>> On 10/21/2010 2:51 PM, Chris Rebert wrote:
>
>>> This is a common newbie stumbling-block: Don't use lists (or anything
>>> mutable) as default argument values
>
>> That really should be an error.
>
> No, it shou
Lawrence D'Oliveiro wrote:
You mean “GUI console”. So non-GUI apps get a GUI element whether they want
it or not, while GUI ones don’t. That’s completely backwards.
The "G" in GUI stands for "Graphical". I wouldn't call a window that
displays nothing but text "graphical".
--
Greg
--
http://ma
Not sure why you use the for-else syntax without a break or continue. And
I'm also not sure on the readability.
-Xav on his Froyo
On 29/10/2010 6:21 PM, "HEK" wrote:
> On Oct 28, 6:16 pm, "cbr...@cbrownsystems.com"
> wrote:
>> It's clear but tedious to write:
>>
>> if 'monday" in days_off or "tu
Gregory Ewing writes:
> Brendan wrote:
>> I use
>> Python sporadically, and frequently use the dir command to learn or
>> remind myself of class methods.
>
> You can clean up dir() by defining __all__ as a list of
> names that you want to officially export. Other names will
> still be there, but
John Nagle wrote:
On 10/21/2010 2:51 PM, Chris Rebert wrote:
This is a common newbie stumbling-block: Don't use lists (or anything
mutable) as default argument values
That really should be an error.
No, it shouldn't. The criterion isn't whether the object is
mutable, but whether you a
Brendan wrote:
I use
Python sporadically, and frequently use the dir command to learn or
remind myself of class methods.
You can clean up dir() by defining __all__ as a list of
names that you want to officially export. Other names will
still be there, but they won't show up in the dir() listing
On Oct 28, 6:16 pm, "cbr...@cbrownsystems.com"
wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
> doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
> doSomething
>
> Is there a be
On Oct 28, 10:50 pm, Paul Rubin wrote:
> John Nagle writes:
> > d1 = set('monday','tuesday')
> > days_off = set('saturday','sunday')
> > if not d1.isdisjoint(days_off) :...
> > This is cheaper than intersection, since it doesn't have to
> > allocate and construct a set. It just tests
On Oct 28, 11:56 am, Arnaud Delobelle wrote:
> "cbr...@cbrownsystems.com" writes:
> > It's clear but tedious to write:
>
> > if 'monday" in days_off or "tuesday" in days_off:
> > doSomething
>
> > I currently am tending to write:
>
> > if any([d for d in ['monday', 'tuesday'] if d in days_off
87 matches
Mail list logo