> From: st...@pearwood.info
> To: tutor@python.org
> Date: Fri, 24 Sep 2010 13:00:40 +1000
> Subject: Re: [Tutor] pure function problem
>
> Roelof, please learn to delete unnecessarily quoted text. There's no
> need to quoted the entire discussion every t
Roelof, please learn to delete unnecessarily quoted text. There's no
need to quoted the entire discussion every time you answer.
On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote:
> time = tijd()
[...]
> print time(uitkomst)
Why are you calling time as a function, when it is a tijd instance?
Hello tutors. Probably the wrong mailing list, but someone might know.
I want to use matplotlib (or similar) to plot an equation in
slope-intercept (y=mx+b) or standard form (Ax + By = C). As far as I've
read and tested, you can only plot with a series of points. I could make
two points out of
On Fri, 24 Sep 2010 01:45:29 am you wrote:
> > Oh, and (4)... in Python circles, it's traditional but not
> > compulsory to use metasyntactic variables named after Monty Python
> > sketches rather than foo and bar. So spam, ham, eggs, parrot (dead
> > or otherwise), names of cheeses, aardvark..., a
On Fri, 24 Sep 2010 05:32:55 am Alex Hall wrote:
> Hi all,
> A general coding question: is it better to use return(False) (or 0,
> or -1, or whatever) or to raise whateverError("oops")? Are there
> cases for each?
Yes.
There is absolutely no point whatsoever raising an exception, or
returning a
On Fri, 24 Sep 2010 05:47:21 am Wayne Werner wrote:
> OTOH, a lot of people feel that using exceptions as control flow is
> bad practice - they're exceptional so they should only arise in
> exceptional case.
That's not the Python philosophy. Python uses exceptions for flow
control: iteration cat
On 9/23/2010 8:26 AM Pete said...
Hiya,
still working on my plugin architecture. I figured out how to import modules of
which I don't know the name yet at compile time,
by using __import__() instead of import.
So that works fine when I want to have the equivalent of
import spam
... by using
On Fri, 24 Sep 2010 06:06:25 am Luke Paireepinart wrote:
> You should do both. Raise an exception in the exceptional case.
>
> My general pattern is to return None if no results exist, return the
> results if they do exist, and raise an exception if I couldn't
> perform the function.
I hate that!
Thanks for the responses. Up to now, despite using some Java and a lot
of Python, I have not even tried raising exceptions. I can see
situations where they would be useful, but was not sure if I should
use them as much as possible or just keep relying on the return codes
that I am used to. Sounds l
> The lines between doc tests, blackbox testing, whitebox testing, and
> regression testing is blurry. People may legitimately disagree on
> whether a specific test is documentation, testing the interface,
> testing the implementation, or all three.
>
Wow!!! Ok that clears up a lot. Thank you
> From: rwob...@hotmail.com
> To: tutor@python.org
> Subject: RE: [Tutor] pure function problem
> Date: Thu, 23 Sep 2010 10:15:07 +
>
>
>
>> Date: Thu, 23 Sep 2010 05:36:58 -0400
>> Subject: Re: [Tutor] pure function problem
>> From: jemejo...@gmail.com
>> To
You should do both. Raise an exception in the exceptional case.
My general pattern is to return None if no results exist, return the results if
they do exist, and raise an exception if I couldn't perform the function.
Eg. If I have a function that creates a list of users with a first name of bob
On Thu, Sep 23, 2010 at 2:32 PM, Alex Hall wrote:
> Hi all,
> A general coding question: is it better to use return(False) (or 0, or
> -1, or whatever) or to raise whateverError("oops")? Are there cases
> for each?
It depends on your prevailing philosophy - if you like the EAFP that
prevails in
Hi all,
A general coding question: is it better to use return(False) (or 0, or
-1, or whatever) or to raise whateverError("oops")? Are there cases
for each?
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
_
On 23/09/2010 7:18 PM, Rance Hall wrote:
Again I'm referencing Tim Golden from
http://timgolden.me.uk/python/win32_how_do_i/print.html
This code block is relevant:
import os, sys
import win32print
printer_name = win32print.GetDefaultPrinter ()
#
# raw_data could equally be raw PCL/PS read f
Again I'm referencing Tim Golden from
http://timgolden.me.uk/python/win32_how_do_i/print.html
This code block is relevant:
import os, sys
import win32print
printer_name = win32print.GetDefaultPrinter ()
#
# raw_data could equally be raw PCL/PS read from
# some print-to-file operation
#
if sy
> Oh, and (4)... in Python circles, it's traditional but not compulsory
> to use metasyntactic variables named after Monty Python sketches
> rather than foo and bar. So spam, ham, eggs, parrot (dead or
> otherwise), names of cheeses, aardvark..., although there is no
> standard order.
Hm, some
Hiya,
still working on my plugin architecture. I figured out how to import modules of
which I don't know the name yet at compile time,
by using __import__() instead of import.
So that works fine when I want to have the equivalent of
import spam
... by using
__import__('spam')
Question:
wha
On 23/09/2010 14:05, Rance Hall wrote:
For the first roll-out and testing I figured plaintext was good enough.
Future revisions will probably use the PDF library you also referred
to on your page.
Either way that is as printer ready as I expect I will be able to get it.
One option you might w
On Thu, Sep 23, 2010 at 3:40 AM, Tim Golden wrote:
> On 23/09/2010 07:30, Rance Hall wrote:
>>
>>
>> Tim's how-to is likely not for my version of python (mine is 3.1)
>> since some of his command fail on my system because mine wants options
>> or parameters that Tim doesn't mention.
>
> I've fixe
> Date: Thu, 23 Sep 2010 05:36:58 -0400
> Subject: Re: [Tutor] pure function problem
> From: jemejo...@gmail.com
> To: tutor@python.org
> CC: rwob...@hotmail.com
>
> The problem is that your class definition doesn't do anything to
> explicitly set those attributes.
>
> On Thu, Sep 23, 2010 at
The problem is that your class definition doesn't do anything to
explicitly set those attributes.
On Thu, Sep 23, 2010 at 4:58 AM, Roelof Wobben wrote:
> class tijd :
> pass
You're not doing any explicit setting of attributes at the class level.
> time = tijd()
> time.hour = 20
> time.minu
Hello,
I have to rewrite a function to a pure function.
So i have this :
class tijd :
pass
def increment(time, seconds):
sum = tijd()
sum.seconds = time.seconds + seconds
if sum.seconds> 60 :
minutes, seconds = divmod(sum.seconds, 60)
sum.seconds = seco
On 23/09/2010 07:30, Rance Hall wrote:
I'm using this page as a reference:
http://timgolden.me.uk/python/win32_how_do_i/print.html
I'm able to print to the default printer ok, but I can't seem to find
out how to get to pick the printer I want to use.
This is from a CLI app, so there is no gui.
On Thu, 23 Sep 2010 03:17:39 pm ranjan das wrote:
> What I want to do is write my code completely in Python (as gainst
> iron python),
Iron Python *is* Python. It's just a different implementation, with
built-in support for Dot-Net.
> copy it to the visual studio editor and create a web
> ba
25 matches
Mail list logo