On Sat, Aug 19, 2017 at 11:34:10AM -0600, Mats Wichmann wrote:
> It makes some sense though; computational code just goes ahead and
> computes. In the graphical UI world, interesting things happen when an
> event you can't exactly plan for takes place. From the point of view of
> a computer prog
On Sat, Aug 19, 2017 at 11:00:51AM -0500, boB Stepp wrote:
> I try to keep this in mind. Another thing I'm currently struggling
> with is when to use inheritance vs. separate, independent classes.
Raymond Hettinger has a good video presentation about the use of classes
and inheritance for deleg
On Sat, Aug 19, 2017 at 10:52:45AM -0500, boB Stepp wrote:
> This thought had occurred to me. Sometimes I wish there was a
> mechanism in Python to create a binding to data where both were
> unchangeable/immutable. Yes, I could use an immutable data type, but
> if I bind an identifier to it that
On 19Aug2017 11:00, boB Stepp wrote:
On Sat, Aug 19, 2017 at 4:04 AM, Peter Otten <__pete...@web.de> wrote:
[...]
The lesson is that Python already provides some powerful ready-to-use
classes that take you a long way without having to write your own custom
classes.
In my beginning experiment
On 19Aug2017 06:13, kay Cee wrote:
update_log = open('update_log.txt', 'r+')
Normally one would use 'a' (append) for a log open. I don't see what 'r+'
accomplishes for you. In particular I expect it would always write at the start
of the log file, overwriting whatever was there. W
On 19/08/17 11:13, kay Cee wrote:
> import subprocess
> import time
> import datetime
>
> class UpdateError(Exception):
> pass
In defining your own type of Exception you implicitly
say that you will be raising it somewhere. But you
never raise this exception in your code...
> def update():
On 08/19/2017 04:13 AM, kay Cee wrote:
> I made a python script that will update a Ubuntu Server every second and
> writes asuccess message and date to a log file, but for some reason the
> file is not being written to.
>
> Here is the Script:
>
> #!/usr/bin/python3
>
> import subprocess
> impo
On 19/08/17 17:00, boB Stepp wrote:
> I try to keep this in mind. Another thing I'm currently struggling
> with is when to use inheritance vs. separate, independent classes.
The golden rule is if the child is not a kind-of the parent then
it should be delegation not inheritance. Never use inheri
kay Cee wrote:
> I made a python script that will update a Ubuntu Server every second and
> writes asuccess message and date to a log file, but for some reason the
> file is not being written to.
>
> Here is the Script:
>
>
> #!/usr/bin/python3
>
>
>
> import subprocess
>
> import time
>
On 19/08/17 10:04, Peter Otten wrote:
> nicer interface. Nobody would want to write
>
> a + b * c
>
> as
>
> add(a, mul(b, c))
Unless they program in Lisp perhaps :-)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my
I made a python script that will update a Ubuntu Server every second and
writes asuccess message and date to a log file, but for some reason the
file is not being written to.
Here is the Script:
#!/usr/bin/python3
import subprocess
import time
import datetime
class UpdateError(Exception)
On 08/19/2017 10:00 AM, boB Stepp wrote:
>> (That was easy; but I wonder what tkinter would look like without
>> callbacks...)
>
> I wish I knew more so that I could fully wonder about this myself.
> You might even be making a clever joke and I am clueless.
All graphics frameworks depend heavily
On Sat, Aug 19, 2017 at 4:04 AM, Peter Otten <__pete...@web.de> wrote:
> Steven D'Aprano wrote:
>
>> Mostly for Bob, but also for anyone else interested:
>>
>> When To Use Classes
>>
>> http://kentsjohnson.com/stories/00014.html
>
> Just a minor nit, but you don't even need a custom function for th
On Sat, Aug 19, 2017 at 3:07 AM, Alan Gauld via Tutor wrote:
> On 19/08/17 08:52, Alan Gauld via Tutor wrote:
>
> Following up my own post - a sure sign of failure to communicate :-(
>
>> On 19/08/17 05:26, boB Stepp wrote:
>>
>>> related methods needs to share the same values and a class would ti
Steven D'Aprano wrote:
> Mostly for Bob, but also for anyone else interested:
>
> When To Use Classes
>
> http://kentsjohnson.com/stories/00014.html
Just a minor nit, but you don't even need a custom function for the callback
result = []
db.query(sql, result.append)
The lesson is that Python
On 19/08/17 08:52, Alan Gauld via Tutor wrote:
Following up my own post - a sure sign of failure to communicate :-(
> On 19/08/17 05:26, boB Stepp wrote:
>
>> related methods needs to share the same values and a class would tidy
>> this up nicely without the need for any globals
> Indeed, but
On 19/08/17 05:26, boB Stepp wrote:
> related methods needs to share the same values and a class would tidy
> this up nicely without the need for any globals or needless passing of
> the exact same values around as parameters/arguments.
Indeed, but its important to remember that class attributes
17 matches
Mail list logo