Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
I know the Python syntax pretty well. I know a lot of the libraries and tools. When I see professional Python programmer's code, I am often blown away with the code. I realized that even though I know the language, I know nothing about using it effectively. I would like to start using Python more

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 8:44 am, Chris Angelico wrote: > On Fri, Aug 26, 2011 at 10:33 PM, Travis Parks wrote: > > I know the Python syntax pretty well. I know a lot of the libraries > > and tools. When I see professional Python programmer's code, I am > > often blown away with the

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 9:28 am, Chris Angelico wrote: > On Fri, Aug 26, 2011 at 10:58 PM, Travis Parks wrote: > > I haven't gotten to the point where I can truly use the language > > features to my full advantage. I haven't seen enough "tricks" to be > > effec

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 11:12 am, Roy Smith wrote: > In article > <2309ec4b-e9a3-4330-9983-1c621ac16...@ea4g2000vbb.googlegroups.com>, >  Travis Parks wrote: > > > I know the Python syntax pretty well. I know a lot of the libraries > > and tools. When I see professional

Checking Signature of Function Parameter

2011-08-28 Thread Travis Parks
I am trying to write an algorithms library in Python. Most of the functions will accept functions as parameters. For instance, there is a function called any: def any(source, predicate): for item in source: if predicate(item): return true; return false; There are some

Re: Checking Signature of Function Parameter

2011-08-28 Thread Travis Parks
On Aug 28, 5:31 pm, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 7:20 AM, Travis Parks wrote: > > > if source is None: raise ValueError("") > > if not isinstanceof(source, collections.iterable): raise TypeError("") > > if not callable(predicate):

Re: Checking Signature of Function Parameter

2011-08-29 Thread Travis Parks
On Aug 29, 2:30 am, Nobody wrote: > On Sun, 28 Aug 2011 14:20:11 -0700, Travis Parks wrote: > > More importantly, I want to make sure that > > predicate is callable, accepting a thing, returning a bool. > > The "callable" part is do-able, the rest isn't. >

Re: Checking Signature of Function Parameter

2011-08-29 Thread Travis Parks
On Aug 29, 1:42 pm, Ian Kelly wrote: > On Mon, Aug 29, 2011 at 10:45 AM, Travis Parks wrote: > > I wanted to allow for calls like this: > > > extend(range(0, 1000)).map(lambda x: x * x).where(lambda x: x % 2 == > > 0).first(lambda x: x % 7 == 0) > > > It

Handling 2.7 and 3.0 Versions of Dict

2011-08-30 Thread Travis Parks
I am writing a simple algorithms library that I want to work for both Python 2.7 and 3.x. I am writing some functions like distinct, which work with dictionaries under the hood. The problem I ran into is that I am calling itervalues or values depending on which version of the language I am working

Closures and Partial Function Application

2011-08-31 Thread Travis Parks
I was a little disappointed the other day when I realized that closures were read-only. I like to use closures quite a bit. Can someone explain why this limitation exists? Secondly, since I can cheat by wrapping the thing being closure-ified, how can I write a simple wrapper that has all the same

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 1:18 pm, Chris Rebert wrote: > On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks wrote: > > I was a little disappointed the other day when I realized that > > closures were read-only. I like to use closures quite a bit. > > Assuming I'm intuiting your quest

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 1:51 pm, Travis Parks wrote: > On Aug 31, 1:18 pm, Chris Rebert wrote: > > > On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks > > wrote: > > > I was a little disappointed the other day when I realized that > > > closures were read-only

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 2:18 pm, Ian Kelly wrote: > On Wed, Aug 31, 2011 at 12:02 PM, Travis Parks wrote: > > Am I doing something wrong, here? nonlocal isn't registering. Which > > version did this get incorporated? > > 3.0 Ah, okay. It would be really useful for unit testing. Unf

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 2:03 pm, "bruno.desthuilli...@gmail.com" wrote: > On 31 août, 18:45, Travis Parks wrote: > > > I was a little disappointed the other day when I realized that > > closures were read-only. I like to use closures quite a bit. > > They are not _strictly_

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Travis Parks
On Aug 31, 7:37 pm, Gregory Ewing wrote: > Ian Kelly wrote: > > if sys.version_info < (3,): > >     getDictValues = dict.itervalues > > else: > >     getDictValues = dict.values > > > (which is basically what the OP was doing in the first place). > > And which he seemed to think didn't work for so

Algorithms Library - Asking for Pointers

2011-09-02 Thread Travis Parks
some feedback. I want to know if I am following conventions (overall style and quality of code). Thanks, Travis Parks -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling 2.7 and 3.0 Versions of Dict

2011-09-02 Thread Travis Parks
On Sep 2, 12:36 pm, "Gabriel Genellina" wrote: > En Wed, 31 Aug 2011 22:28:09 -0300, Travis Parks   > escribi : > > > On Aug 31, 7:37 pm, Gregory Ewing wrote: > >> Ian Kelly wrote: > >> > if sys.version_info < (3,): >

Re: Algorithms Library - Asking for Pointers

2011-09-02 Thread Travis Parks
On Sep 2, 4:09 pm, Ian Kelly wrote: > On Fri, Sep 2, 2011 at 10:59 AM, Travis Parks wrote: > > Hello: > > > I am working on an algorithms library. It provides LINQ like > > functionality to Python iterators. Eventually, I plan on having > > feaures that work

Re: Algorithms Library - Asking for Pointers

2011-09-02 Thread Travis Parks
On Sep 2, 6:49 pm, Travis Parks wrote: > On Sep 2, 4:09 pm, Ian Kelly wrote: > > > > > > > On Fri, Sep 2, 2011 at 10:59 AM, Travis Parks > > wrote: > > > Hello: > > > > I am working on an algorithms library. It provides LINQ like > > &

Re: Algorithms Library - Asking for Pointers

2011-09-03 Thread Travis Parks
On Sep 3, 12:35 am, Chris Torek wrote: > In article <18fe4afd-569b-4580-a629-50f6c7482...@c29g2000yqd.googlegroups.com> > Travis Parks   wrote: > > >[Someone] commented that the itertools algorithms will perform > >faster than the hand-written ones. Are these algorit

Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Travis Parks
bout it. My guess is that there would be a severe penalty for crossing process boundaries... but any insights would be appreciated. Thanks, Travis Parks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-05 Thread Travis Parks
On Nov 5, 4:11 pm, Travis Parks wrote: > Hello: > > A new guy showed up at work a few weeks ago and has started talking > about replacing a 6 month old project, written in ASP.NET MVC, with an > open source solution that can handle massive scaling. I think his > primary concern

Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-07 Thread Travis Parks
On Nov 7, 12:44 pm, John Gordon wrote: > In John Gordon writes: > > > In <415d875d-bc6d-4e69-bcf8-39754b450...@n18g2000vbv.googlegroups.com> > > Travis Parks writes: > > > Which web frameworks have people here used and which have they found > > > t

xmlrpclib date times and a trailing Z

2011-11-11 Thread Travis Parks
e doesn't look like it handles time zones at all. I guess, is there a way to tell xmlrpclib to include time zones when parsing date times? Thanks, Travis Parks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python ORMs Supporting POPOs and Substituting Layers in Django

2011-11-12 Thread Travis Parks
On Nov 8, 12:09 am, Lie Ryan wrote: > On 11/08/2011 01:21 PM, Travis Parks wrote: > > > > > > > On Nov 7, 12:44 pm, John Gordon  wrote: > >> In  John Gordon  writes: > > >>> In<415d875d-bc6d-4e69-bcf8-39754b450...@n18g2000vbv.googlegroups.

Re: xmlrpclib date times and a trailing Z

2011-11-13 Thread Travis Parks
On Nov 11, 7:20 pm, Travis Parks wrote: > I am trying to connect to Marchex's a call tracking software using > xmlrpclib. I was able to get some code working, but I ran into a > problem dealing with transfering datetimes. > > When I construct a xmlrpclib.ServerPro

Using the Python Interpreter as a Reference

2011-11-20 Thread Travis Parks
generated because I see state transition tables, which I doubt someone built by hand. Any help would be greatly appreciated. It will be cool to see how the interpreter works internally. I am still wonder whether designing the language (going on 4 months now) will be harder than implementing it. Than

Re: Using the Python Interpreter as a Reference

2011-11-21 Thread Travis Parks
On Nov 21, 12:44 am, Steven D'Aprano wrote: > On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: > > What's your language's "special feature"? I like to keep track of > > languages using a "slug" - a simple one-sentence (or less) statement of > > when it's right to use this language above o

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread Travis Parks
On Nov 22, 1:37 pm, Alan Meyer wrote: > On 11/20/2011 7:46 PM, Travis Parks wrote: > > > Hello: > > > I am currently working on designing a new programming language. ... > > I have great respect for people who take on projects like this. > > Your chances of po

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Travis Parks
On Nov 26, 1:53 pm, Rick Johnson wrote: > On Nov 20, 6:46 pm, Travis Parks wrote: > > > Hello: > > > I am currently working on designing a new programming language. It is > > a compiled language, but I still want to use Python as a reference. > > Python has a l

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 27, 6:55 pm, Steven D'Aprano wrote: > On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: > > Personally, I find a lot of good things in Python. I thinking tabs are > > out-of-date. Even the MAKE community wishes that the need for tabs would > > go away and

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 2:32 pm, Ian Kelly wrote: > On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano > > wrote: > >> My language combines generators and collection initializers, instead of > >> creating a whole new syntax for comprehensions. > > >> [| for i in 0..10: for j in 0.10: yield return i * j |] > > >

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 3:40 pm, Gregory Ewing wrote: > Travis Parks wrote: > > I thinking tabs are > > out-of-date. Even the MAKE community wishes that the need for tabs > > would go away > > The situation with make is a bit different, because it > *requires* tabs in cer

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:24 pm, Steven D'Aprano wrote: > On Mon, 28 Nov 2011 12:32:59 -0700, Ian Kelly wrote: > > On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano > > wrote: > [...] > >>> Lambdas and functions are the same thing in my language, so no need > >>> for a special keyword. > > >> That does not fol

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 8:49 pm, Chris Angelico wrote: > On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer wrote: > > To me, I would think the interpreter finding the coder's intended > > indent wouldn't be that hard. And just make the need for consistant > > spaces or tabs irrevelent simply by reformatting the ind

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:57 pm, Steven D'Aprano wrote: > On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote: > > Exception handling is one of those subjects few understand and fewer can > > implement properly in modern code. Languages that don't support > > exceptions as