Re: Ideal way to separate GUI and logic?

2013-07-15 Thread Owen Marshall
On 2013-07-16, fronag...@gmail.com  wrote:
> On Tuesday, July 16, 2013 1:06:30 AM UTC+8, asim...@gmail.com wrote:
>> fron...@gmail.com wrote:
>>
>> > So as a general idea, I should at the very least separate the GUI
>> > from the program logic by defining the logic as a function,
>> > correct? And the next level of separation is to define the logic as
>> > a class in one or more separate files, and then import it to the
>> > file with the GUI, correct?
>>
>> >
>>
>> > My next question is, to what degree should I 'slice' my logic into
>> > functions? How small or how large should one function be, as a rule
>> > of thumb?
>>
>>
>>
>> The way I do this is to write unit tests against the class and the
>> functions (take a look at the unittest module). The functions methods
>> (take a look at the unittest module). Each function should contain
>> the smallest bit of testable logic.
>>
>>
>>
>> Another way to think about this is that each function should contain
>> the smallest piece of logic that you can describe as one action.
>>
>>
>>
>> -
>>
>> Asim Jalis
>
> Again, thanks for all the responses. I'm curious, though, what exactly
> is the rationale for making functions so small? (I've heard that the
> function calling of Python has relatively high overhead?)

Small functions are _always_ encouraged for every language. This is best
practice for everything, not just Python. Has nothing to do with
overhead.

--
-owen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UTF-EBCDIC encoding?

2013-07-15 Thread Owen Marshall
On 2013-07-12, Joel Goldstick  wrote:
> --047d7bdc8be492d67804e154c580 Content-Type: text/plain; charset=UTF-8
>
> On Fri, Jul 12, 2013 at 2:11 PM, Wayne Werner 
> wrote:
>
>> Is anyone aware of a UTF-EBCDIC[1] decoder?
>>
>> While Python does have a few EBCDIC dialects in the codecs, it does
>> not have the (relatively new?) UTF-EBCDIC one.
>>
>> Additionally, if anyone is aware of a Python tool that can unpack a
>> mainframe PDS file, that would also be worthwhile.
>>
>>
>> Thanks, Wayne
>>
>> [1]:
>> https://en.wikipedia.org/wiki/**UTF-EBCDIC
>> --
>> http://mail.python.org/**mailman/listinfo/python-list
>>
>
>
> I can't help you.  I'm astonished.  Trying to imagine the work
> environment where this technology would be necessary
>

Ask any poor shmuck who has ever had to consume files created by the
government -- especially stuff from the Social Security Administration
-- and they'll tell horror stories about EBCDIC.

Typically I've seen ``iconv'' used for this task, so I'd love to see a
native solution...

--
-owen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Owen Marshall
On 2013-07-18, Grant Edwards  wrote:
> On 2013-07-18, Serhiy Storchaka  wrote:
>> 18.07.13 20:04, Terry Reedy ??():
>>> On 7/18/2013 3:29 AM, Aseem Bansal wrote:
 About reading comp.lang.python can you suggest how to read it and
 reply?
>>>
>>> To read this list as a newsgroup use news.gmane.org. The difference
>>> between the mailing list interface and newsgroup interface is that the
>>> latter automatically segregates messages by group and only downloads the
>>> messages you want to read. Gmane is also a better way to search the
>>> archive.
>>
>> Also newsgroup interface allow you reply to messages that have already
>> been posted before your subscription.
>
> Indeed.  I read about 20 mailing lists by pointing a newsreader (I use
> slrn) at gmane.org.  I find it to take far less effort than actualling
> having all of those messages actually sent to me.  For _some_ of the
> gmane groups/lists you will actually have to subscribe to the mailing
> list in question if you want to be allowed to post messages -- but in
> your account settings for that mailing list server you can turn off
> delivery, so that it doesn't actually send you any of the postings.
>
> I really can't recommend gmane.org highly enough.
>
> [I don't actually read the python list using gmane.org, since I've
> read it from a Usenet news server via the group comp.lang.python since
> long before I discovered gmane.org.]
>

Huh - I (foolishly) didn't realize gmane actually had NNTP, I've always
used it to search mailing lists. If the list dumped to usenet (much like
c.l.python) I'd post through sunsite.dk, which is a very nice usenet
provider. But that still meant several annoying mailing list
subscriptions.

... man, I'm really glad I read your post :-)

--
  -owen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Owen Marshall
On 2013-07-18, Michael Torrie  wrote:
> On 07/18/2013 12:19 PM, Owen Marshall wrote:
>> Huh - I (foolishly) didn't realize gmane actually had NNTP, I've always
>> used it to search mailing lists. If the list dumped to usenet (much like
>> c.l.python) I'd post through sunsite.dk, which is a very nice usenet
>> provider. But that still meant several annoying mailing list
>> subscriptions.
>>
>> ... man, I'm really glad I read your post :-)
>
> I'm a bit confused.  This list *is* c.l.python (I happen to read via
> e-mail through the mailing list).  So you can reach it from sunsite.dk
> can you not?

Doesn't surprise me, I was confusing ;-)

What I was saying was that my workflow used to be this:

For maliing lists that dump to a newsgroup (c.l.python) I'd post to the
group via usenet (sunsite.dk)

For mailing lists that _do not_ have a direct newsgroup gateway (flask,
etc.) I'd have to subscribe and read them in my mail client.


So I used to think gmane was just a way of reading a bunch of mailing
lists. *But now* I know it is much more - it's an NNTP <==> mail gateway
that also has a web viewer.

Now I can point my slrn to news.gmane.net and see the flask mailing
list, ruby-talk, ... -- which I much prefer to using email.


Again, perfectly obvious stuff had I actually _read_ the gmane FAQ. But
who has time for that ;-)

--
  -owen
-- 
http://mail.python.org/mailman/listinfo/python-list