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"
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
;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"
-
k us questions :)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
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
> 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).
-
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
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
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
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
.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': })
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
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
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
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
--
--
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
'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
see the input and resulting output
files.
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
r it! Do you understand why ?
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
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
mean by "command" ?
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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 = "[
ch you valuable lessons.
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
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
--
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
nt.
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
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
>> 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
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
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
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
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
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
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"
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
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
in.readlines()[:5]]
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
stdin), 0, 5)]
?
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
tter (using islice).
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
bose ... But I like your simplification :)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
501 - 550 of 550 matches
Mail list logo