Re: 79 chars or more?

2010-08-16 Thread James Mills
ircumstances I would agree with you and have a different opinion. However being vision impaired restricts the available width (irregardless of the width of the monitor) of text I'm able to view at once. :) cheers James -- -- James Mills -- -- "Problems are solved by method"

Re: 79 chars or more?

2010-08-16 Thread James Mills
use the same standards (stick to project standards as Steven says). The other side is this... I'm of the opinion that if you're writing a line of code that's excessively long (>80char or say >100chars), then you might want to reconsider what you're doing :) (It might be wr

Re: 79 chars or more?

2010-08-16 Thread James Mills
;okay" to teach. However: Bare in mind other considerations for smaller width conventions and the reasons for them. Make your students aware of standards and get them into the habit of following standards early on. cheers James -- -- James Mills -- -- "Problems are solved by method" -

Re: What is a class method?

2010-08-22 Thread James Mills
k us questions :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a class method?

2010-08-22 Thread James Mills
thods myself personally in any of my work (yet). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about Python + CouchDB

2010-09-13 Thread James Mills
hen it "crashes". Use an appropriate try/except block to "catch" the exception(s). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Default python compile options

2010-09-14 Thread James Mills
> someone please shed some light? You can easily find this out for yourself. Ubuntu is a Debian-based system. Use dpkg-source to get the source package of python-2.6 and have a look at how it builds. cheers James PS: There's nothing wrong with a plain old ./configure (no options). -

Re: python27.exe vs python2.7.exe ...

2010-09-14 Thread James Mills
On Wed, Sep 15, 2010 at 7:25 AM, Sridhar Ratnakumar wrote: > Thoughts? I've never been a Windows developer (probably never will be), but I have one thought: Why has ActivePython not been doing this all along ? cheers James -- -- James Mills -- -- "Problems are solved by met

Re: python27.exe vs python2.7.exe ...

2010-09-14 Thread James Mills
x27;t* many of the typical (now) Linux > "pythonX.Y" installed executables. Good point :) My comment was just a comment, nothing negative intended! cheers james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Default python compile options

2010-09-14 Thread James Mills
o ask) You might need to installed some other packages from Ubuntu/Debian eg: zlib-dev Building python requires certain "development libraries" that Ubuntu/Debian systems do not install by default (they are separate packages). cheers James -- -- James Mills -- -- "Problem

Re: compiling python 3.1.2 with local readline fails to get readline - help!

2010-09-15 Thread James Mills
pile readline correctly and that you've set the appropriate environment variables and paths for C/C++ compilers (eg: GCC) to pick it up ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: classes and dictionaries

2010-09-15 Thread James Mills
.def __init__(self, data=None): ... self.data = {"params": data} ... >>> a = b = object() >>> id(a), id(b) (3075279112L, 3075279112L) >>> foo = Foo(a) >>> bar = Foo(b) >>> foo.data, bar.data ({'params': }, {'params': })

Re: program organization question for web development with python

2010-09-15 Thread James Mills
encourage you to use a web framework as opposed to plain old CGI. cheers james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] problem with python 3.1

2010-09-15 Thread James Mills
clearly overlooked that you must convert the values of x and y to int's using either: x = int(input(...)) or x = int(x) You cannot perform (most) mathematical operators where the operands are of different types (in Python) eg: str and int cheers James PS: Please post questions

Re: compiling python 3.1.2 with local readline fails to get readline - help!

2010-09-15 Thread James Mills
compiled and installed to your home directory actually working and can you actually compile any C programs that use this custom readline ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: select() call and filedescriptor out of range in select error

2010-09-15 Thread James Mills
t contain dirty data ? Your code has likely removed the socket object from the list before, why is it attempting to remove it again ? I would consider you re-look at your code's logic rather than patch up the code with a "band-aid-solution". cheers James -- -- James Mills -- --

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
ere's why. What do you mean by "dynamic attributes " ? Can you show a simple code example ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
's more > Pythonic, IMHO. I agree with 2) and 3) and in general this is probably a "good approach". cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
see the input and resulting output files. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 10:06 AM, MRAB wrote: > You're not closing f_in. That line should be: Although this _could_ be the problem (buffers not being flushed and the file being properly closed, etc) it could be something else... --James -- -- James Mills -- -- "Problems are sol

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
r it! Do you understand why ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
ailing list. Check your subscription status with the link below. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Error installing cx_Oracle

2010-09-22 Thread James Mills
t; lib/python2.6/pycc' failed with exit status 1 > r...@access1:/$ > > I have searched for a solution everywhere and tried many things but > didn't work. Can somebody help me in this? Install the python development libraries. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of bash "set -x" in Python

2010-09-26 Thread James Mills
mean by "command" ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into a list

2010-10-04 Thread James Mills
7;,..,'n']" (values are not sequential) > > What would be the best way to do this? I don't want to use eval, as the > string is coming from an untrusted source. If you trust the source of the data the following is probably the simplest: >>> s = "[

Re: help!!!

2010-10-05 Thread James Mills
ch you valuable lessons. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any module for automated testing in python?

2010-10-15 Thread James Mills
On Fri, Oct 15, 2010 at 8:19 PM, gopi krishna wrote: > Hi, > Is there any module for automated testing in python? > Pls help me frns.. py.test is quite nice and I use it for my own project(s). The company I work for also uses it to test their software. cheers James -- -- Ja

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread James Mills
On Tue, Oct 19, 2010 at 1:37 PM, alex23 wrote: > Given that there's little if anything gained from nesting classes > (other than possible scoping confusion) is there ever a need? 15+ years of programming and I've never used nested classes in any language :) cheers James --

Re: merge list of tuples with list

2010-10-19 Thread James Mills
gt; a = [(1,2,3,7), (4,5,6)] What happens with the 8 in the 2nd tuple b ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: merge list of tuples with list

2010-10-19 Thread James Mills
nt. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Filename for stdout

2010-10-20 Thread James Mills
When you do: $ ./foo > /tmp/foobar You're telling your shell to write the stdout output of foo to the file /tmp/foobar sys.stdout won't actually tell you anything useful. It's normally just a file descriptor. cheers James -- -- James Mills -- -- "Problems are solved by

Re: how to scrutch a dict()

2010-10-20 Thread James Mills
t if the Value is None". > > Are there any tighter or smarmier ways to do that? Python does so > often manage maps better than that... Rather than creating a new dict why don't you just do: def _scrunch(d): for k, v in d.items(): if v is None: del d[k] cheer

Re: How do I chain methods?

2010-10-24 Thread James Mills
>> x = Foo() >>> y = x.first() Chad >>> y.last() A <__main__.Foo object at 0x1011d7ad0> >>> NB: You must return "self" in this case so you can do chained calls. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:02 AM, Chris Rebert wrote: > Method chaining is usually* not idiomatic in Python. I don't agree but anyway... I've just not seen it commonly used amongst python programmers. cheers James -- -- James Mills -- -- "Problems are solved b

Re: How do I chain methods?

2010-10-24 Thread James Mills
d__(1).__sub__(3) 2 The implementation of many common operators return self (the object you're working with). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 12:49 PM, Steven D'Aprano wrote: > ...if you're writing x.__add__(1).__sub__(3) instead of x + 1 - 3 then > you're almost certainly doing it wrong. It was just an example :) ... And this isn't python-tutor --James -- -- James Mills -- -- &quo

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:39 AM, James Mills wrote: > Function/Method Chaining is probably used a lot in Python itself: > >>>> x = 4 >>>> x.__add__(1).__sub__(3) > 2 > > The implementation of many common operators return self (the object > you're wo

Re: [Beginer Question] I heard about python needing some sort of_VariableName_ boiler plate?

2010-10-31 Thread James Mills
To define variables, just assign a value to a name: >>> x = 1 >>> x 1 cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: with block for multiple files

2010-10-31 Thread James Mills
On Mon, Nov 1, 2010 at 3:03 PM, Yingjie Lan wrote: > with open('scores.csv'), open('grades.csv', wt) as f,g: >     g.write(f.read()) One could write their own ContextManager here... cheers James -- -- James Mills -- -- "Problems are solved by method"

Re: extracting variables accessed and written from function / rule-based function calls

2010-11-01 Thread James Mills
cheers James 1. http://pypi.python.org/pypi/Traits/3.5.0 -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation too difficult for beginners

2010-11-02 Thread James Mills
cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Curses Programming

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 12:42 AM, alexander wrote: > Could any give a hand? Assignment ? Homework ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
in.readlines()[:5]] cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Looping through files in a directory

2010-11-10 Thread James Mills
ousand times from a bash script. Any input or pointers to functions that'd > help would be very much appreciated. Thanks! os.walk or os.listdir cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
usr/bin/env python import sys print [v for v in list(line for line in sys.stdin)[:5]] This uses a generator expression to read from stdin, converts this to a list (only getting the first 5 items). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://ma

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 11:38 AM, MRAB wrote: > 'list' will exhaust the input, then the slicing will return at most 5 > lines. Hmm you're right :) -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 1:02 PM, Steve Holden wrote: > This suggests that you are mistaken about not exhausting the source. Yeah I was mistaken. Oh well :) I was thinking of a generator-based solution and got lost in the implementation! -- -- James Mills -- -- "Problems are solved b

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
stdin), 0, 5)] ? -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
tter (using islice). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-11 Thread James Mills
bose ... But I like your simplification :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6