On 10/16/17 7:39 PM, מיקי מונין wrote:
Hello, I am working on an article on python string formatting. As a part of
the article I am researching the different forms of python string
formatting.
While researching string interpolation(i.e. the % operator) I noticed
something weird with string lengt
On Thu, Jan 14, 2016 at 3:03 PM, Michal Nalevanko
wrote:
> I've just installed Python 3.5.1 on my computer and came across somewhat
> strange behavior.
>
> This is a snapshot of a short code that I wrote: https://goo.gl/izYbD0
>
> Quite simple, you might say. Obviously, the program should create a
On Tue, 03 Jun 2014 10:01:26 +0200, Peter Otten wrote:
> Steven D'Aprano wrote:
>
>> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
>>
>>> I invoked the wrong bug.py :/ , works fine now (this happens to me
>>> when im a bit tired sometimes...).
>>
>> Clarity in naming is an excellent thin
Steven D'Aprano wrote:
> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
>
>> I invoked the wrong bug.py :/ , works fine now (this happens to me when
>> im a bit tired sometimes...).
>
> Clarity in naming is an excellent thing. If you have two files called
> "bug.py", that's two too many.
On Mon, Jun 2, 2014 at 5:30 PM, Chris Angelico wrote:
> On Tue, Jun 3, 2014 at 10:22 AM, Steven D'Aprano
> wrote:
>> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
>>
>>> I invoked the wrong bug.py :/ , works fine now (this happens to me when
>>> im a bit tired sometimes...).
>>
>> Clarity
On Tue, Jun 3, 2014 at 10:22 AM, Steven D'Aprano
wrote:
> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
>
>> I invoked the wrong bug.py :/ , works fine now (this happens to me when
>> im a bit tired sometimes...).
>
> Clarity in naming is an excellent thing. If you have two files called
> "
On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
> I invoked the wrong bug.py :/ , works fine now (this happens to me when
> im a bit tired sometimes...).
Clarity in naming is an excellent thing. If you have two files called
"bug.py", that's two too many.
Imagine having fifty files called "
I invoked the wrong bug.py :/ , works fine now (this happens to me when im
a bit tired sometimes...).
Im unsure about the "real" bugreport, will investigate if I find some time
and motivation.
--
https://mail.python.org/mailman/listinfo/python-list
robert...@googlemail.com wrote:
> Hello folks,
>
> I am not sure if it is only on my system the case that the code in
> http://pastebin.com/WETvqMJN misbehaves in the stated way.
> Can anybody reproduce it?
>
> I thought it could be that the tabs/spaces do influence it, but it doesn't
> care.
>
On 02/06/2014 17:35, robert...@googlemail.com wrote:
Hello folks,
I am not sure if it is only on my system the case that the code in
http://pastebin.com/WETvqMJN misbehaves in the stated way.
Can anybody reproduce it?
I thought it could be that the tabs/spaces do influence it, but it
doesn't ca
On 02/26/2014 10:24 PM, ast wrote:
Hello
box is a list of 3 integer items
If I write:
box.sort()
if box == [1, 2, 3]:
the program works as expected. But if I write:
if box.sort() == [1, 2, 3]:
it doesn't work, the test always fails. Why ?
Thx
sort() sorts the sequence in pla
On 02/26/2014 10:24 PM, ast wrote:
Hello
box is a list of 3 integer items
If I write:
box.sort()
if box == [1, 2, 3]:
the program works as expected. But if I write:
if box.sort() == [1, 2, 3]:
Most such questions can be answered by printing out the values in
question and observi
Thanks for the very clear explanation
--
https://mail.python.org/mailman/listinfo/python-list
"ast" :
> if I write:
>
>if box.sort() == [1, 2, 3]:
>
> it doesn't work, the test always fails. Why ?
The list.sort() method returns None.
The builtin sorted() function returns a list:
if sorted(box) == [1, 2, 3]:
would work.
Note that the list.sort() method is often preferred because
"ast" writes:
> If I write:
>
>box.sort()
>if box == [1, 2, 3]:
>
> the program works as expected. But if I write:
>
>if box.sort() == [1, 2, 3]:
>
> it doesn't work, the test always fails. Why ?
Because very often methods **dont't** return the object they are applied
(self that is).
On Thu, Feb 27, 2014 at 07:24:24AM +0100, ast wrote:
> Hello
>
> box is a list of 3 integer items
>
> If I write:
>
>box.sort()
>if box == [1, 2, 3]:
>
>
> the program works as expected. But if I write:
>
>if box.sort() == [1, 2, 3]:
>
> it doesn't work, the test always fails. Wh
"ast" wrote in message
news:530eda1d$0$2061$426a7...@news.free.fr...
> Hello
>
> box is a list of 3 integer items
>
> If I write:
>
>box.sort()
>if box == [1, 2, 3]:
>
>
> the program works as expected. But if I write:
>
>if box.sort() == [1, 2, 3]:
>
> it doesn't work, the test alwa
Thank you all for your replies.
I had the matrix concept in mind such as
explained in the numpy example.
Rob
On Thu, Apr 18, 2013 at 3:19 PM, Wolfgang Maier <
wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> Robrecht W. Uyttenhove gmail.com> writes:
>
> >
> > Hello,
> > I tried out the follo
Robrecht W. Uyttenhove gmail.com> writes:
>
> Hello,
> I tried out the following
code:y=[range(0,7),range(7,14),range(14,21),range(21,28),range(28,35)]
> >>> y[[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13],
> [14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28, >
In "Robrecht W.
Uyttenhove" writes:
> I tried out the following code:
> y=[range(0,7),range(7,14),range(14,21),range(21,28),range(28,35)]
> >>> y
> [[0, 1, 2, 3, 4, 5, 6],
> [7, 8, 9, 10, 11, 12, 13],
> [14, 15, 16, 17, 18, 19, 20],
> [21, 22, 23, 24, 25, 26, 27],
> [28, 29, 30, 31, 32, 33,
Robrecht W. Uyttenhove wrote:
> Hello,
>
> I tried out the following code:
> y=[range(0,7),range(7,14),range(14,21),range(21,28),range(28,35)]
y
> [[0, 1, 2, 3, 4, 5, 6],
> [7, 8, 9, 10, 11, 12, 13],
> [14, 15, 16, 17, 18, 19, 20],
> [21, 22, 23, 24, 25, 26, 27],
> [28, 29, 30, 31, 32, 3
On 16-Aug-2012 19:40, Steven D'Aprano wrote:
On Thu, 16 Aug 2012 13:18:59 +0200, Virgil Stokes wrote:
On 15-Aug-2012 02:19, Steven D'Aprano wrote:
On Tue, 14 Aug 2012 21:40:10 +0200, Virgil Stokes wrote:
You might find the following useful:
def testFunc(startingList):
xOnlyList = [];
On Thu, 16 Aug 2012 13:18:59 +0200, Virgil Stokes wrote:
> On 15-Aug-2012 02:19, Steven D'Aprano wrote:
>> On Tue, 14 Aug 2012 21:40:10 +0200, Virgil Stokes wrote:
>>
>>> You might find the following useful:
>>>
>>> def testFunc(startingList):
>>> xOnlyList = []; j = -1
>>> for xl in s
x27;''
Purpose: Time four different algorithms for the same task
Author: V. Stokes (v...@it.uu.se, 2012-08-16 (15:46), 2012-08-16)
Refs:
python-list@python.org list
* Strange behavior, 14-Aug-2012 17:38, light1qu...@gmail.com
* Re: Strange behavior, 14-Aug-2012 21:40, Stok
Virgil Stokes wrote:
>>> def testFunc(startingList):
>>>xOnlyList = []; j = -1
>>>for xl in startingList:
>>>if (xl[0] == 'x'):
>> That's going to fail in the starting list contains an empty string. Use
>> xl.startswith('x') instead.
> Yes, but this was by design (tacitly assumed that startingList
code is actually irrelevant for the original
"Strange behavior" post.
Have a good day!
'''
Purpose: Time three different algorithms for the same task
Author: V. Stokes (v...@it.uu.se, 2012-08-16)
Refs:
python-list@python.org list
* Strange behavior, 14-Aug-2
light1qu...@gmail.com writes:
> I got my answer by reading your posts and referring to:
> http://docs.python.org/reference/compound_stmts.html#the-for-statement
> (particularly the shaded grey box)
Not that the problem is not specific to python (if you erase the current
element when traversing a
Chris Angelico writes:
> Other people have explained the problem with your code. I'll take this
> example as a way of introducing you to one of Python's handy features
> - it's an idea borrowed from functional languages, and is extremely
> handy. It's called the "list comprehension", and can be l
On Tue, 14 Aug 2012 21:40:10 +0200, Virgil Stokes wrote:
> You might find the following useful:
>
> def testFunc(startingList):
> xOnlyList = []; j = -1
> for xl in startingList:
> if (xl[0] == 'x'):
That's going to fail in the starting list contains an empty string. Use
xl.s
On Wed, Aug 15, 2012 at 1:38 AM, wrote:
> def testFunc(startingList):
> xOnlyList = [];
> for str in startingList:
> if (str[0] == 'x'):
> print str;
> xOnlyList.append(str)
> startingList.remo
Original Message
Subject:Re: Strange behavior
Date: Tue, 14 Aug 2012 21:32:16 +0200
From: Virgil Stokes
To: light1qu...@gmail.com
On 2012-08-14 17:38, light1qu...@gmail.com wrote:
Hi, I am migrating from PHP to Python and I am slightly confused.
I am
On 2012-08-14 17:38, light1qu...@gmail.com wrote:
Hi, I am migrating from PHP to Python and I am slightly confused.
I am making a function that takes a startingList, finds all the strings in the
list that begin with 'x', removes those strings and puts them into a xOnlyList.
However if you run
On 8/14/2012 11:59 AM, Alain Ketterlin wrote:
light1qu...@gmail.com writes:
However if you run the code you will notice only one of the strings
beginning with 'x' is removed from the startingList.
def testFunc(startingList):
xOnlyList = [];
for str in startingList:
light1qu...@gmail.com writes:
> However if you run the code you will notice only one of the strings
> beginning with 'x' is removed from the startingList.
>
> def testFunc(startingList):
> xOnlyList = [];
> for str in startingList:
> if (str[0] == 'x'):
>
On Mon, Feb 13, 2012 at 3:16 PM, Arnaud Delobelle wrote:
>> Strangely it was working fine the other day. Then while debugging a
>> script it suddenly started do this and now does this for every script
>
> How were you debugging?
I think I may have been attempting to use pipes to redirect stdin
an
On 13 February 2012 19:50, waylan wrote:
> When I try running any Python Script on the command line with Python
> 3.2 I get this weird behavior. The cursor dances around the command
> line window and nothing ever happens. Pressing Ctr+C does nothing.
> When I close the window (mouse click on X in
I don't know how many times I stared at that code without seeing the error.
Thanks so much!
Phillip
On Fri, Sep 23, 2011 at 1:26 PM, Arnaud Delobelle wrote:
> On 23 September 2011 21:09, Dr. Phillip M. Feldman
> wrote:
> >
> > A few weeks ago, I wrote a class that creates an iterator for solv
On 23 September 2011 21:09, Dr. Phillip M. Feldman
wrote:
>
> A few weeks ago, I wrote a class that creates an iterator for solving the
> general unlabeled-balls-in-labeled boxes occupancy problem. Chris Rebert
> converted my code to a generator, which made the code cleaner, and I
> subsequently s
In article <626f24e5-4d8e-416c-b3ed-dc56a88dc...@s21g2000prm.googlegroups.com>,
Lambda wrote:
>
>def matrix_power(m, n):
> result = m[:]
> print result is m
Use copy.deepcopy()
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
"You could make Eskimos emigrate t
Mark Dickinson wrote:
On Oct 28, 8:24 am, Lambda wrote:
Thank you!
Following is my final code:
Looks good, but are you sure about that word 'final'? ;-)
def matrix_power(m, n):
"""
Raise 2x2 matrix m to nth power.
"""
if n =0: return [[1, 0], [0, 1]]
x =atrix_power(m,
Lambda wrote:
> I defined a function to raise a 2x2 matrix to nth power:
> BTW, numpy has such a function, but it doesn't support really large
> number.
> Does numpy has some functions that support arbitrarily large number?
You can tell it to use Python instead of C integers:
>>> import numpy
>
On Oct 28, 8:24 am, Lambda wrote:
> Thank you!
> Following is my final code:
Looks good, but are you sure about that word 'final'? ;-)
>
> def matrix_power(m, n):
> """
> Raise 2x2 matrix m to nth power.
> """
> if n == 0: return [[1, 0], [0, 1]]
>
> x = matrix_power(m, n / 2)
I sugg
On Oct 28, 10:40 am, Chris Rebert wrote:
> On Tue, Oct 27, 2009 at 7:15 PM, Lambda wrote:
> > I defined a function to raise a 2x2 matrix to nth power:
>
> > def matrix_power(m, n):
> > result = m[:]
>
> Note that this only copies the *outer* list. It does NOT copy any of
> the inner, nested list
Lambda wrote:
I defined a function to raise a 2x2 matrix to nth power:
There is a much faster way to raise x to a count power n than the
definitional but naive method of multipling 1 by x n times. It is based
on the binary representation of n.
Example: x**29 = x**(16+8+4+1) = x**16 * x**8 *
On Tue, Oct 27, 2009 at 7:15 PM, Lambda wrote:
> I defined a function to raise a 2x2 matrix to nth power:
>
> def matrix_power(m, n):
> result = m[:]
Note that this only copies the *outer* list. It does NOT copy any of
the inner, nested lists, it just makes fresh *references* to them,
which is w
That's it. I am calling my own program and not coreutils' sort, what
explains the unrequested output. Many thanks.
Cheers,
Kay
On 16 Jun., 22:16, Piet van Oostrum wrote:
> > kmw (k) wrote:
> >k> Hi,
> >k> I wanted to write a simple script (in 5 minutes or so) which replaces
> >k> the option
> kmw (k) wrote:
>k> Hi,
>k> I wanted to write a simple script (in 5 minutes or so) which replaces
>k> the option '+1' given to the command 'sort' by '-k 2' and than runs
>k> 'sort' with the modified argument list. After two hours I am giving up
>k> and ask you for help. This is what I tried
kmw wrote:
Hi,
I wanted to write a simple script (in 5 minutes or so) which replaces
the option '+1' given to the command 'sort' by '-k 2' and than runs
'sort' with the modified argument list. After two hours I am giving up
and ask you for help. This is what I tried (please excuse the verbose
co
Tim Roberts wrote:
Scott David Daniels wrote:
I avoid using single-letter variables except where I know the types
from the name (so I use i, j, k, l, m, n as integers, s as string,
and w, x, y, and z I am a little looser with (but usually float or
complex).
It's amazing to me that Fortran con
Tim Roberts wrote:
> Scott David Daniels wrote:
>> I avoid using single-letter variables except where I know the types
>>from the name (so I use i, j, k, l, m, n as integers, s as string,
>> and w, x, y, and z I am a little looser with (but usually float or
>> complex).
>
> It's amazing to me tha
Scott David Daniels wrote:
>
>I avoid using single-letter variables except where I know the types
>from the name (so I use i, j, k, l, m, n as integers, s as string,
>and w, x, y, and z I am a little looser with (but usually float or
>complex).
It's amazing to me that Fortran continues to live on
On Dec 27, 8:52 am, David Lemper wrote:
> I'm a newbee trying 3.0 Please help with math.sqrt()
math.sqrt() is not the problem.
> At the command line this function works correctly
> >>> import math
> n = input("enter a number > ")
> s = math.sqrt(n)
> An e
En Fri, 26 Dec 2008 19:52:24 -0200, escribió:
I'm a newbee trying 3.0 Please help with math.sqrt()
At the command line this function works correctly
>>> import math
n = input("enter a number > ")
s = math.sqrt(n)
An entry of 9 or 9.0 will yield 3.0
Y
On Fri, Dec 26, 2008 at 1:52 PM, wrote:
> I'm a newbee trying 3.0 Please help with math.sqrt()
>
> At the command line this function works correctly
> >>> import math
> n = input("enter a number > ")
raw_input() was renamed input() in Python 3.0, and it returns a
*string*, n
David Lemper wrote:
I'm a newbee trying 3.0 Please help with math.sqrt()
At the command line this function works correctly
>>> import math
n = input("enter a number > ")
s = math.sqrt(n)
An entry of 9 or 9.0 will yield 3.0
Yet the same code in a sc
On Mar 20, 9:09 am, hellt <[EMAIL PROTECTED]> wrote:
> "The eclipse console is not an exact copy of a shell... one of the
> changes is that when you press in a shell, it may give you a
> \r, \n or \r\n as an end-line char, depending on your platform. Python
> does not expect this -- from the docs
On 20 мар, 14:31, hellt <[EMAIL PROTECTED]> wrote:
> i've faced with some strangeness while executing this sample:
>
> choice = raw_input("your choice: ")
> print len(choice)
>
> when i run this sample in my eclipse console with CPython and print
> Yes, i have this output
> 4 #trailing \t is the fo
On Dec 28, 9:43 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Dec 29, 1:12 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
>
> > I've noticed an oddity when running a program, using the csv module,
> > within IDLE. I'm new to Python so am confused by what is happening.
> > Here is what I'm doing:
>
On Dec 29, 1:12 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> I've noticed an oddity when running a program, using the csv module,
> within IDLE. I'm new to Python so am confused by what is happening.
> Here is what I'm doing:
>
> 1) Open the IDLE Shell.
> 2) Select File | Open...
> 3) Choose my f
On Fri, 28 Dec 2007 18:12:58 -0800, t_rectenwald wrote:
> Within the program, the snippet where I use the csv module is below:
>
> ==
> csvfile = open('foo.csv', 'w')
> writer = csv.writer(csvfile)
>
> for row in rows:
> writer.writerow(row[0:3])
>
> csvfile.clos
Jakub Hegenbart wrote:
> Hi,
>
> I'm studying the descriptor protocol and its usage from the following
> document:
>
> http://users.rcn.com/python/download/Descriptor.htm
>
> There is some sample code:
>
> http://users.rcn.com/python/download/Descriptor.htm#descriptor-example
>
> that behaves
Jakub Hegenbart wrote:
> Hi,
>
> I'm studying the descriptor protocol and its usage from the following
> document:
>
> http://users.rcn.com/python/download/Descriptor.htm
>
> There is some sample code:
>
> http://users.rcn.com/python/download/Descriptor.htm#descriptor-example
>
> that behaves
On Mon, 4 Jun 2007 21:34:36, David Stockwell wxp <[EMAIL PROTECTED]>
wrote
>
>in DOS you can try this to see what your path is:
>
>echo "My path is %PATH%"
or more simply:
,
| C:> path
`
--
Doug Woodrow
--
http://mail.python.org/mailman/listinfo/python-list
my guess its your path. I'm not familiar with IDLE but if you try getting
the properties of IDLE, chances are its got the patch set up correctly.
in DOS you can try this to see what your path is:
echo "My path is %PATH%"
- Original Message -
From: "Jakob Svavar Bjarnason" <[EMAIL PROT
En Sat, 02 Jun 2007 15:31:40 -0300, Jakob Svavar Bjarnason
<[EMAIL PROTECTED]> escribió:
> I have been trying to switch to Python from other languages such as Perl
> and now I have a newbie question.
>
> I have been trying to run a setup script to install a python library. To
> do that I nee
En Thu, 12 Apr 2007 01:23:08 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> On Thu, 12 Apr 2007 00:32:32 -0300, Gabriel Genellina wrote:
>
>> First I want to say that __getitem__ should raise IndexError, not
>> KeyError, to indicate "not found"
>
> How do you know the Original Poster's c
Steven D'Aprano wrote:
> On Wed, 11 Apr 2007 16:37:35 -0700, rconradharris wrote:
> ...
> Here are the results under Python 2.5:
>
tester(10)
> Checking index 0...
> Checking index 0...
> Checking index 0...
> Checking index 0...
> Checking index 0...
> [False, 'KeyError', False, 'KeyError',
On Thu, 12 Apr 2007 00:32:32 -0300, Gabriel Genellina wrote:
> First I want to say that __getitem__ should raise IndexError, not
> KeyError, to indicate "not found"
How do you know the Original Poster's class was meant to be a sequence
rather than a mapping?
--
Steven.
--
http://mail.python
On Wed, 11 Apr 2007 16:37:35 -0700, rconradharris wrote:
> A co-worker of mine came across some interesting behavior in the
> Python interpreter today and I'm hoping someone more knowledgeable in
> Python internals can explain this to me.
>
> First, we create an instance of an Old-Style class wit
En Wed, 11 Apr 2007 20:37:35 -0300, <[EMAIL PROTECTED]> escribió:
> First, we create an instance of an Old-Style class without defining a
> __contains__ but instead define a __getitem__ method in which we raise
> KeyError. Next we repeatedly use the 'in' operator to test to see
> whether something
On Sun, 25 Mar 2007 03:59:52 -0700, dartsch wrote:
> I get an output like
>
>
>
>
> So according to print I get the same function object returned at both
> calls.
Not the same function object. The first object is printed, then deleted
by the garbage collector because it goes out of scope. Th
On Mar 25, 1:04 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On 25 Mar 2007 03:59:52 -0700, [EMAIL PROTECTED] wrote:
>
>
>
> >Hello,
>
> >when I execute the following code (python 2.5)
>
> >def f(x):
> >def g():
> >return x
> >return g
>
> >print f(1)
> >print f(2)
>
> >I ge
On 25 Mar 2007 03:59:52 -0700, [EMAIL PROTECTED] wrote:
>Hello,
>
>when I execute the following code (python 2.5)
>
>def f(x):
>def g():
>return x
>return g
>
>print f(1)
>print f(2)
>
>I get an output like
>
>
>
>
>So according to print I get the same function object returned at
Carsten Haese wrote:
> I think this statement needs to be clarified. The binding of "data" to
> the empty list *does* happen at runtime, not at compile time. However,
> the binding happens only once, when the "def" statement is executed, as
> opposed to every time the __init__ function is called.
On Mon, 2006-10-16 at 10:51, Steven D'Aprano wrote:
> On Mon, 16 Oct 2006 07:26:05 -0700, abcd wrote:
>
> > class Foo:
> > def __init__(self, name, data=[]):
>
> The binding of the name "data" to the empty list happens at compile time,
> not runtime.
I think this statement needs to be clarif
abcd wrote:
> Rob Williscroft wrote:
>> http://docs.python.org/ref/function.html#l2h-619
>
>
> thanks. weird that it works that way since they even state "This is
> generally not what was intended."
The "not intended" refers to the programmer making the mistake of creating a
shared instance -
Steven D'Aprano wrote:
> It isn't a bug in Python. At worst, it is a "gotcha", but it is a
> deliberate design decision, and quite useful. For example, this is good
> for caching complicated calculations:
it's also used to pass in *objects* instead of names into an inner scope.
--
http://mail
On 2006-10-16, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> Well, it's a bug in your code :)
>
> It isn't a bug in Python. At worst, it is a "gotcha", but it is
> a deliberate design decision, and quite useful. For example,
> this is good for caching complicated calculations:
I'd say the feature i
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> It isn't a bug in Python. At worst, it is a "gotcha", but it is a
> deliberate design decision, and quite useful. For example, this is good
> for caching complicated calculations:
>
> def function(x, _cache={}):
> # _cache is initialised to an empt
On Mon, 16 Oct 2006 07:26:05 -0700, abcd wrote:
> class Foo:
> def __init__(self, name, data=[]):
The binding of the name "data" to the empty list happens at compile time,
not runtime.
> self.name = name
> self.data = data
>
> def addData(self, val):
> self.data.
Rob Williscroft wrote:
> http://docs.python.org/ref/function.html#l2h-619
thanks. weird that it works that way since they even state "This is
generally not what was intended."
oh well.
--
http://mail.python.org/mailman/listinfo/python-list
abcd wrote in news:[EMAIL PROTECTED] in
comp.lang.python:
> class Foo:
> def __init__(self, name, data=[]):
http://docs.python.org/ref/function.html#l2h-619
Rob.
--
http://www.victim-prime.dsl.pipex.com/
--
http://mail.python.org/mailman/listinfo/python-list
My original concern and reason for goint the iterator/generator route
was exactly for large large lists :) Unnecessary in this example, but
exactly what I was exploring. I wouldn't be using list comprehension
for generating the permutiations. Where all this came from was
creating a generator/ite
[EMAIL PROTECTED] wrote:
>Gary Herron wrote:
>
>
>>List comprehension is a great shortcut, but when the shortcut starts
>>causing trouble, better to go with the old ways. You need to reopen each
>>file each time you want to iterate through it. You should be able to
>>understand the difference be
Gary Herron wrote:
> List comprehension is a great shortcut, but when the shortcut starts
> causing trouble, better to go with the old ways. You need to reopen each
> file each time you want to iterate through it. You should be able to
> understand the difference between these two bits of code.
>
DOH!!
thanks a lot. had to be something stupid on my part.
Now I get it :)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
>Ok, I am confused about this one. I'm not sure if it's a bug or a
>feature.. but
>
>
List comprehension is a great shortcut, but when the shortcut starts
causing trouble, better to go with the old ways. You need to reopen each
file each time you want to iterate throu
On Tue, May 30, 2006 at 01:11:26PM -0700, [EMAIL PROTECTED] wrote:
[...]
> >>> RESTART
> >>> f1 = open('word1.txt')
> >>> f2 = open('word2.txt')
> >>> f3 = open('word3.txt')
> >>> print [(i1.strip(),i2.strip(),i3.strip(),) for i1 in f1 for i2 in f2 for
> >>> i3 in
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok, I am confused about this one. I'm not sure if it's a bug or a
> feature.. but
>
RESTART
f1 = open('word1.txt')
f2 = open('word2.txt')
f3 = open('word3.txt')
print [(i1.stri
Vinay Sajip:
>Rene Pijlman:
>> It struck me as somewhat complicated as well.
>You should look at later versions of Python - your points above about
>easier configuration have already been addressed: here's a link from
>the current (2.4) docs:
>
>http://docs.python.org/lib/minimal-example.html
Yes
Rene Pijlman wrote:
> It struck me as somewhat complicated as well.
>
> Looking at the basic example:
> http://www.python.org/doc/2.3.5/lib/node304.html
>
> ... the things that first-time users shouldn't be bothered with IMO are:
>
> 1. Getting a logger by name from a hierarchical namespace. There
> But I do think that adding logging to a cgi script is a sensible thing to
> do for a beginner.
Let me second that. I happen to write a lot of CGI, and ISTM that
while you can do it without logging, you are condemming yourself to a
lot of staring at the screen, head-scratching, and saying ``Now w
Rene Pijlman wrote:
> But I do think that adding logging to a cgi script is a sensible thing to
> do for a beginner. Getting that to run in a debugger is probably way more
> complicated.
on the other hand, adding
if 1: # set to 0 when deploying
print ""
print cgi.escape(repr(
Steve Holden:
>Rene Pijlman:
>> Add logging to your program:
>> http://www.python.org/doc/2.3.5/lib/module-logging.html
>>
>Probably oiverkill, particularly for a beginner (is it only me that
>thinks the logging module is either way over-complicated or way
>under-documented?).
It struck me as s
Steve Holden wrote:
>> Add logging to your program:
>> http://www.python.org/doc/2.3.5/lib/module-logging.html
>>
> Probably oiverkill, particularly for a beginner (is it only me that
> thinks the logging module is either way over-complicated or way
> under-documented?).
No, I would agree with
Rene Pijlman wrote:
> sophie_newbie:
>
>>OK, interesting, but just how dow I print he environment in the
>>program??
>
>
> Add logging to your program:
> http://www.python.org/doc/2.3.5/lib/module-logging.html
>
Probably oiverkill, particularly for a beginner (is it only me that
thinks the log
sophie_newbie:
>OK, interesting, but just how dow I print he environment in the
>program??
Add logging to your program:
http://www.python.org/doc/2.3.5/lib/module-logging.html
And log the environment:
http://www.python.org/dev/doc/newstyle/lib/os-procinfo.html
--
René Pijlman
--
http://mail.py
OK, interesting, but just how dow I print he environment in the
program??
--
http://mail.python.org/mailman/listinfo/python-list
sophie_newbie schrieb:
> I have written a cgi script that seems to run perfectly from the
> command line when I simulate some cgi input using
> os.environ['QUERY_STRING'].
>
> The thing is that when I run it from the browser, one of my os.system
> calls, which gets excecuted fine when running the
Brian wrote:
> Hello,
>
> Can someone tell me what I am doing wrong in this code.
>
> If I create a file change.py with the following contents:
>
> def intTest(M, c):
> r = M
> for k in c:
> print 'int(r/k) = ', int(r/k), 'r =', r, 'k =', k, 'r/k
> =', r/k
>
1 - 100 of 102 matches
Mail list logo