Re: [Tutor] Mailing list archive oddity?

2011-09-29 Thread Devin Jeanpierre
> So I wanted to reference a post I had already deleted and I looked at the > archive (http://mail.python.org/pipermail/tutor/). > > My question...how do I get a future capable email client like the archive? :) What mail client do you use? Does it offer a way to move posts out of the inbox, witho

Re: [Tutor] Mailing list archive oddity?

2011-09-29 Thread Devin Jeanpierre
On Thu, Sep 29, 2011 at 4:25 PM, Prasad, Ramit wrote: > -Original Message----- > From: Devin Jeanpierre [mailto:jeanpierr...@gmail.com] > Sent: Thursday, September 29, 2011 3:11 PM > To: Prasad, Ramit > Cc: tutor@python.org > Subject: Re: [Tutor] Mailing list archive oddity? >

Re: [Tutor] how to unique the string

2011-10-22 Thread Devin Jeanpierre
You should be able to do this yourself, with the help of the following link: http://docs.python.org/library/stdtypes.html#set Is this a homework question? Devin On Sat, Oct 22, 2011 at 12:09 PM, lina wrote: > Hi, > > I googled for a while, but failed to find the perfect answer, > > for a strin

Re: [Tutor] Which should it be, lists, tuples, dictionary or files?

2012-01-02 Thread Devin Jeanpierre
> Another option for you would be a shelve.(See the shelve module > in the standard library) A file that acts like a dictionary. > You can store a list of values against a single key. It's probably worth mentioning that shelve is not secure; loading a saved shelf can involve executing arbitrary py

Re: [Tutor] Your thoughts on designing python code for unit testing?

2012-01-04 Thread Devin Jeanpierre
I've found that bottom-up development favors testable code. That is, rather than thinking of the problem to be solved, thinking in terms of the tools (functions) one would use to solve the problem. These tools can be written to be testable, and then it all builds up in this tower of easily-testable

Re: [Tutor] Subclassing Exceptions

2012-01-06 Thread Devin Jeanpierre
> Inheriting from SyntaxError doesn't work! When I create a new exception, I > generally subclass from the built-in exception it most resembles, in case > there was some reason to also catch it via an ancestor. But I'm not sure if > that is really all that useful an idea in practice. How do you

Re: [Tutor] making a custom file parser?

2012-01-08 Thread Devin Jeanpierre
> Parsing XML with regular expressions is generally very bad idea. In > the general case, it's actually impossible. XML is not what is called > a regular language, and therefore cannot be parsed with regular > expressions. You can use regular expressions to grab a limited amount > of data from a li

Re: [Tutor] making a custom file parser?

2012-01-09 Thread Devin Jeanpierre
e thinking LEPL or PyMeta or something. -- Devin On Sun, Jan 8, 2012 at 9:06 PM, Hugo Arts wrote: > On Mon, Jan 9, 2012 at 2:19 AM, Devin Jeanpierre > wrote: >>> Parsing XML with regular expressions is generally very bad idea. In >>> the general case, it's actually im

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 10:36 PM, Michael Lewis wrote: > Is it generally better to use try/except/else statements or if/elif/else? > Or, is there a time and place for each? There's a time and place for each. Most errors are indicated in the form of an exception being raised, though. > For a simp

Re: [Tutor] Rounding Error

2012-01-27 Thread Devin Jeanpierre
On Sat, Jan 28, 2012 at 1:20 AM, Steven D'Aprano wrote: > And finally, we come all the way back to the beginning again and say That's > not the right way to do it! Don't round the number *outside* of the string > formatting, get the string formatting to do it for you: Reason being because repr(ro

Re: [Tutor] Importing libraries

2012-02-04 Thread Devin Jeanpierre
On Sat, Feb 4, 2012 at 6:35 AM, Steven D'Aprano wrote: > Michael Lewis wrote: >> >> Why don't I have to import str or list to access their attributes like I >> do >> with the math or random or any other library? > > > > Because they are built-in. That means they live inside the Python > compiler/i

Re: [Tutor] how to print a string in desired colour

2012-02-12 Thread Devin Jeanpierre
On Sun, Feb 12, 2012 at 8:02 AM, Scott Nelson wrote: > On Sun, Feb 12, 2012 at 6:47 AM, Debashish Saha wrote: >> >> suppose i want to print 'hello world' in color blue.so what to do? >> > > There was a similar thread awhile ago.  Unfortunately the answer isn't an > easy one.  It depends on what o

Re: [Tutor] syntax error

2012-05-12 Thread Devin Jeanpierre
On Sat, May 12, 2012 at 10:29 PM, bob gailer wrote: > oh - and always provide a specific meaningful subject My client has no idea what thread this post came from. Is it supposed to? -- Devin ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

Re: [Tutor] Auto-response for your message to the "Tutor" mailing list

2012-05-12 Thread Devin Jeanpierre
This is the third time I've received a message "for those of you new to the Tutor list". When does it stop? -- Devin On Sat, May 12, 2012 at 11:19 PM, wrote: > Your message for tutor@python.org, the Python programming tutor list, > has been received and is being delivered.  This automated respo

Re: [Tutor] syntax error

2012-05-13 Thread Devin Jeanpierre
On Sun, May 13, 2012 at 5:44 AM, Steven D'Aprano wrote: > Devin Jeanpierre wrote: >> >> On Sat, May 12, 2012 at 10:29 PM, bob gailer wrote: >>> >>> oh - and always provide a specific meaningful subject >> >> >> My client has no idea

Re: [Tutor] threading mind set

2012-05-13 Thread Devin Jeanpierre
On Sun, May 13, 2012 at 8:31 PM, Steven D'Aprano wrote: >> Using processes and message passing, using dataflow, actors or CSP, >> parallelism and concurrency is far more straightforward. Not easy, >> agreed, but then programming isn't easy. > > My argument is that once you move beyond the one-oper

Re: [Tutor] Teaching an 8-year-old programming.

2012-05-20 Thread Devin Jeanpierre
I've heard remarkable things about http://www.programbydesign.org/ , but it's aimed at students a little older. Its design might help you; although, it also probably depends on motivation / what you want to teach. Anyway, that's the best I can offer. Good luck! It sounds like you're in for a fun t

Re: [Tutor] Issue with classes

2012-06-12 Thread Devin Jeanpierre
On Tue, Jun 12, 2012 at 4:07 AM, Bod Soutar wrote: > I confess I don't know anything about classes really so I'm probably doing > something stupid, but can anyone point me in the right direction? A smaller example: def foo(): mydict = {} bar() print mydict def bar(): mydict[3] =

Re: [Tutor] str object is not callable

2012-07-10 Thread Devin Jeanpierre
On Tue, Jul 10, 2012 at 10:56 AM, Chris Hare wrote: > The input to the function in the larger program is the same as the first test > in the small script that works -- "admin". > > As a side note -- the rstrip call is also broken, although the string module > is imported. I just can't figure ou

Re: [Tutor] writing function changeColor

2012-07-18 Thread Devin Jeanpierre
On Wed, Jul 18, 2012 at 3:20 PM, Aditi Pai wrote: > I am trying my best to learn and your attitude was not welcome. If you don't > want to answer my question, I understand. I'm doing research elsewhere too > and because I am new at this, my familiarity with key terms and search words > is also imp

Re: [Tutor] floating point rounding inconsistency

2012-09-28 Thread Devin Jeanpierre
On Fri, Sep 28, 2012 at 8:37 AM, Steven D'Aprano wrote: > On 28/09/12 22:15, Mark Lawrence wrote: > >> The Python round function is itself problematic. The idea of deprecating >> it is currently being discussed on Python ideas. This quote from Calvin >> Spealman is typical "Also, I'd be completely

Re: [Tutor] Project help

2012-10-12 Thread Devin Jeanpierre
Do your own homework. -- Devin On Sat, Oct 13, 2012 at 12:55 AM, Brett Dailey wrote: > I'm working on a few projects and need some help. Here's what the first one > needs to do: > > "Credits" > 1. Create a list of strings. Make sure your program will work with any > number of strings. > 2. Make

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Devin Jeanpierre
On Mon, Oct 22, 2012 at 7:45 AM, Matthew Ngaha wrote: > the 2nd one usually includes a lot more code then i showed. can you please > tell me why different methods are used to access the main code? is it just > preference or is one way actually better coding practice? The second one is used if you

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Devin Jeanpierre
On Mon, Oct 22, 2012 at 6:15 PM, Steven D'Aprano wrote: > Not that. That unconditionally executes main the first time you access > the module, *regardless* of whether it is being run as a script or > being imported. That is nearly always the wrong thing to do. Recently I've become a fan of execut

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Devin Jeanpierre
On Mon, Oct 22, 2012 at 9:23 AM, Walter Prins wrote: > Devin, > > On 22 October 2012 12:54, Devin Jeanpierre wrote: >> On Mon, Oct 22, 2012 at 7:45 AM, Matthew Ngaha wrote: >>> the 2nd one usually includes a lot more code then i showed. can you please >>> tell

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Devin Jeanpierre
On Mon, Oct 22, 2012 at 8:42 PM, Steven D'Aprano wrote: > If you do that, and the module directly or indirectly imports itself > while it is running as a script, you may run into trouble. But writing > a dual-purpose module that is usable as an importable module or as a > stand-alone script is not

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Devin Jeanpierre
On Mon, Oct 22, 2012 at 8:54 PM, Steven D'Aprano wrote: >> Recently I've become a fan of executable packages. In __main__.py, >> it's always the right thing to do. > > > I would disagree there too. I think that unconditionally running main > is the wrong thing to do, except perhaps in the most tri

Re: [Tutor] Which is better Practice and why

2012-10-23 Thread Devin Jeanpierre
On Tue, Oct 23, 2012 at 5:59 AM, Steven D'Aprano wrote: > I think you'll find that you're wrong there :) Oops. >> If I want to test something, I put it in another file. > Yes. And how do you import the __main__.py module to test it, without > it executing? How do you test the body of code in th

Re: [Tutor] Python and xml *creation*

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 6:49 PM, Sander Sweers wrote: > Op vrijdag 26 oktober 2012 17:00:16 schreef Prasad, Ramit: >> Based on the most recent comment (May 2010) I would probably >> stick with online tutorials. > > I generally do not trust "reviews" on the publisher's website as they have > been p

Re: [Tutor] running multiple concurrent processes

2012-11-03 Thread Devin Jeanpierre
On Sat, Nov 3, 2012 at 9:05 PM, richard kappler wrote: > I notice no one has mentioned asyncore. Is that something I should stay away > from? I just started digging through the doc file. Regardless of ones' feelings on it, there is no builtin support for multiprocessing using asyncore. -- Devin

Re: [Tutor] Value of tracebacks to malicious attackers?

2016-01-24 Thread Devin Jeanpierre
Forgetting to hide tracebacks on a client-side app is not a huge deal (other than being confusing and looking too serious), and definitely doesn't matter for security. So I guess we're assuming that the Python code is not on the user's machine. On Sat, Jan 23, 2016 at 10:43 PM, Danny Yoo wrote: >

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-04 Thread Devin Jeanpierre
On Mon, Mar 4, 2013 at 8:22 PM, Charles Leviton wrote: > I have some confusion regarding when findall returns a list of strings and > when it returns a list of tuples. > Would appreciate an explanation. If there are no groups, it returns a list of strings, where the strings are the whole match.

Re: [Tutor] Pygraphics crashed

2013-05-16 Thread Devin Jeanpierre
On Thu, May 16, 2013 at 2:06 AM, Jim Mooney wrote: > How do I uninstall modules? I installed Pygraphics, which worked fine, > along with some other mods, like numpy, but when I installed 64 bit py > 2.7 > I get the message "The _imaging C module is not installed" when > running a prog that worked

Re: [Tutor] Parentheses and tuples [was Re: Fwd: Difference between types]

2013-05-24 Thread Devin Jeanpierre
On Fri, May 24, 2013 at 10:35 PM, Steven D'Aprano wrote: > So single-item tuples are not special. They just follow the rules for > multiple-item tuples, except that you only have item. And except that the trailing comma is not optional. So, they are special after all. -- Devin __

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Devin Jeanpierre
On Mon, May 27, 2013 at 7:20 PM, Alan Gauld wrote: > Can you give a use case of how you think you could use them? > There may be another way to do what you want. I can't speak for Jim, but I have used the dis module in the past to quickly check how python parsed an expression (e.g. not x is y).

Re: [Tutor] Opinion - help could use more examples

2013-06-19 Thread Devin Jeanpierre
On Wed, Jun 19, 2013 at 1:43 PM, Jim Mooney wrote: > Here's a peeve of mine about Python help - it often has zero examples. > I printed help(zip) to see what it does and got this: > --snip-- > > Not understandable right off, IMHO, unless you're already hardcore. help() is outright harmful to peop

Re: [Tutor] Hash map and dictionaries

2013-12-01 Thread Devin Jeanpierre
On Sun, Dec 1, 2013 at 7:40 AM, Reuben wrote: > Hi > > Question 1: > - > I would like to know the concept of hash map. Additionally, I got to know > that hash maps are equivalent to dictionaries in python. > > I would like to understand the relationship between dictionaries and ha

Re: [Tutor] more html/css question than python

2013-12-21 Thread Devin Jeanpierre
On Sat, Dec 21, 2013 at 11:10 AM, Matthew Ngaha wrote: > so xhtml even over html5? isn't html5 the new thing these days? I know > basic javascript, so it's definately better to also learn jquery? > I've always pushed it to the side :( HTML5 has an XML representation (called XHTML5) which works e

Re: [Tutor] python, speed, game programming

2014-01-03 Thread Devin Jeanpierre
On Fri, Jan 3, 2014 at 1:53 PM, Keith Winston wrote: > I am gearing up for the next project (yeah, an eventual end to Chutes & > Ladders!). It is a typing tutor, I am inclined to use it to learn Dvorak but > I would expect it easily adapted to QWERTY or anything else. > [snip] > > I hope Python is

Re: [Tutor] python problems on android

2014-01-03 Thread Devin Jeanpierre
On Fri, Jan 3, 2014 at 4:26 PM, wrote: > Thanks Dave. Your email doesn't appear to be in response to anything. I think your email client is broken, and you should switch to a different one. -- Devin ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] iter class

2014-01-22 Thread Devin Jeanpierre
On Wed, Jan 22, 2014 at 8:57 PM, Keith Winston wrote: > I'm working my way through some of the examples in > > http://ivory.idyll.org/articles/advanced-swc/#list-comprehensions > > And tried this one: > class MyTrickyIter: > ... def __init__(self, thelist): > ... self.thelist = thelist

Re: [Tutor] iter class

2014-01-23 Thread Devin Jeanpierre
On Thu, Jan 23, 2014 at 7:50 AM, Keith Winston wrote: > Yes, the exercise was about implementing an iter incorrectly, to see > the difference. But I don't really understand your second point: when > I changed the method name, it worked...? Again, nothing was incorrect about the example. Every ite

Re: [Tutor] Which computer operating system is best for Python

2014-02-05 Thread Devin Jeanpierre
On Wed, Feb 5, 2014 at 4:35 PM, David Abbott wrote: > Linux runs great on older Laptops that were the top of the line in > their day, two nice examples with great keyboards are dell e6400 and > ibm T61's. Linux is easy to install and set up now a days :) FWIW linux does, but firefox and chrome do

Re: [Tutor] learning recursion

2014-02-06 Thread Devin Jeanpierre
On Thu, Feb 6, 2014 at 11:28 AM, Denis Heidtmann wrote: for i in range(4): > ... print fib2(i) > ... > > The above results in an error: Because fib2(0) recurses infinitely, and i's first value is 0. -- Devin ___ Tutor maillist - Tutor@python

Re: [Tutor] Question about O(N**2)

2014-05-04 Thread Devin Jeanpierre
On Sat, May 3, 2014 at 9:13 PM, Steven D'Aprano wrote: > > On Sat, May 03, 2014 at 03:59:40PM -0700, Danny Yoo wrote: > > Following up on this. Let's make sure that we're talking about the same > > thing. > > > > > > The assertion is that the following: > > > > fullPath += [...] > > > > wher

Re: [Tutor] How does this work? Is there anyway to receive live Python help?

2014-05-26 Thread Devin Jeanpierre
If you want python help "live", try the #python IRC channel at irc.freenode.net You'll need to register a nick though, see https://freenode.net/faq.shtml#nicksetup -- Devin On Mon, May 26, 2014 at 8:40 AM, Emma Soules wrote: > > > ___ > Tutor maillist

Re: [Tutor] How does this work? Is there anyway to receive live Python help?

2014-05-26 Thread Devin Jeanpierre
FWIW I am an operator on the channel, so, obviously biased. (ssbr) On Mon, May 26, 2014 at 5:15 PM, Steven D'Aprano wrote: > On Mon, May 26, 2014 at 01:04:55PM -0700, Devin Jeanpierre wrote: >> If you want python help "live", try the #python IRC channel at >> irc.

Re: [Tutor] What are *appropriate* uses for exec() and eval() ?

2015-02-16 Thread Devin Jeanpierre
On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano wrote: > Here is a fork of that recipe. It uses an inner class for the new > namedtuple class. The only thing which needs exec is the __new__ method. > > http://code.activestate.com/recipes/578918-yet-another-namedtuple/ > > This demonstrates a powe

Re: [Tutor] What are *appropriate* uses for exec() and eval() ?

2015-02-16 Thread Devin Jeanpierre
On Mon, Feb 16, 2015 at 7:20 PM, Cameron Simpson wrote: > One might use exec() to use code that is valid in one python version but not > another, when you need your program to run in both i.e. to get code that is > syntacticly invalid in one version, but to use it (conditionally) in another > vers

Re: [Tutor] What are *appropriate* uses for exec() and eval() ?

2015-02-17 Thread Devin Jeanpierre
On Tue, Feb 17, 2015 at 7:31 AM, Steven D'Aprano wrote: > On Mon, Feb 16, 2015 at 07:10:21PM -0800, Devin Jeanpierre wrote: >> On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano wrote: >> > Here is a fork of that recipe. It uses an inner class for the new >>