On 09/11/2012 07:20, Graham Fielding wrote:
Hey, folks, me again! I've been puzzling over this for a while now: I'm trying
to write data to a file to save the state of my game using the following
function: def save_game():
#open a new empty shelve (possibly overwriting an old one) to writ
On 09/11/2012 06:37, Steven D'Aprano wrote:
On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote:
On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence
wrote:
On 07/11/2012 01:55, Steven D'Aprano wrote:
Who knows? Who cares? Nobody does:
n -= n
But I've seen this scattered through code:
Hey, folks, me again! I've been puzzling over this for a while now: I'm trying
to write data to a file to save the state of my game using the following
function: def save_game():
#open a new empty shelve (possibly overwriting an old one) to write the
game data
file_object = open('sav
On Fri, Nov 9, 2012 at 5:37 PM, Steven D'Aprano
wrote:
> On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote:
>> Can you enlighten us as to how this is better than either:
>> x := -x
>> or
>> x := 0 - x
>> ? I'm not seeing it.
>
> I'm hoping that Mark intended it as an example of crappy cod
On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote:
> On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence
> wrote:
>> On 07/11/2012 01:55, Steven D'Aprano wrote:
>>>
>>>
>>> Who knows? Who cares? Nobody does:
>>>
>>> n -= n
>>>
>>>
>> But I've seen this scattered through code:
>>
>> x := x - x -
On Thu, 08 Nov 2012 23:44:54 -0500, Terry Reedy wrote:
> On 11/8/2012 6:40 PM, Steven D'Aprano wrote:
[...]
>> IFoo.bar # returns a computed property
>
> Assuming IFoo is a class and bar is a property attribute of the class,
> IFoo.bar is the property object itself, not the computed property of
On Fri, Nov 9, 2012 at 12:00 PM, Ian Kelly wrote:
> looks(Foo).like(IFoo), on the other hand, is crystal clear about which
> argument is which.
I'm not so sure that it is, tbh. If you read it like an English
sentence, it's clearly testing whether Foo matches the template in
IFoo, but which are yo
On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence wrote:
> On 07/11/2012 01:55, Steven D'Aprano wrote:
>>
>>
>> Who knows? Who cares? Nobody does:
>>
>> n -= n
>>
>
> But I've seen this scattered through code:
>
> x := x - x - x
Can you enlighten us as to how this is better than either:
x := -x
or
On 11/8/2012 6:40 PM, Steven D'Aprano wrote:
On Thu, 08 Nov 2012 15:39:24 -0500, Terry Reedy wrote:
[...]
test.py:21: UserWarning: 'bar': is not property.
assert looks(Foo).like(IFoo)
Traceback (most recent call last):
File "test.py", line 21, in
assert looks(Foo).like(IFoo)
Asser
On 2012.11.08 08:06, Oscar Benjamin wrote:
> It would be a lot better though if it just worked straight away
> without me needing to set the code page (like the terminal in every
> other OS I use).
The crude equivalent of .bashrc/.zshrc/whatever shell startup script for
cmd is setting a string valu
On Nov 9, 4:12 am, Peng Yu wrote:
> Hi,
>
> In bash, set -v will print the command executed. For example, the
> following screen output shows that the "echo" command is printed
> automatically. Is there a similar thing in python?
>
> ~/linux/test/bash/man/builtin/set/-v$ cat main.sh
> #!/usr/bin/e
On 07/11/2012 01:55, Steven D'Aprano wrote:
Who knows? Who cares? Nobody does:
n -= n
But I've seen this scattered through code:
x := x - x - x
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
On 8/11/12 19:05:11, jkn wrote:
> Hi All
> i am trying to build up a set of subprocess.Ponen calls to
> replicate the effect of a horribly long shell command. I'm not clear
> how I can do one part of this and wonder if anyone can advise. I'm on
> Linux, fairly obviously.
>
> I have a command w
On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano
wrote:
> On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote:
>
>> People who come from strongly typed languages that offer interfaces
>> often are confused by lack of one in Python. Python, being dynamic
>> typing programming language, follo
On Thu, 08 Nov 2012 15:39:24 -0500, Terry Reedy wrote:
[...]
> test.py:21: UserWarning: 'bar': is not property.
>assert looks(Foo).like(IFoo)
> Traceback (most recent call last):
>File "test.py", line 21, in
> assert looks(Foo).like(IFoo)
> AssertionError
> '''
>
> I view this check
On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote:
> People who come from strongly typed languages that offer interfaces
> often are confused by lack of one in Python. Python, being dynamic
> typing programming language, follows duck typing principal. It can as
> simple as this:
>
> as
On Monday, November 5, 2012 3:07:12 PM UTC+8, Chris Rebert wrote:
> On Sun, Nov 4, 2012 at 10:27 PM, Demian Brecht wrote:
>
> > So, here I was thinking "oh, this is a nice, easy way to initialize a 4D
> > matrix" (running 2.7.3, non-core libs not allowed):
>
> >
>
> > m = [[None] * 4] * 4
This
Hi,
In bash, set -v will print the command executed. For example, the
following screen output shows that the "echo" command is printed
automatically. Is there a similar thing in python?
~/linux/test/bash/man/builtin/set/-v$ cat main.sh
#!/usr/bin/env bash
set -v
echo "Hello World!"
~/linux/test/
On 8 November 2012 19:54, wrote:
> Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
>> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
>>
>> wrote:
>>
>> > If I want the other characters to work I need to change the code page:
>>
>> >
>>
>> > O:\>chcp 65001
>>
>> > Active code page: 65001
On Thu, Nov 8, 2012 at 1:54 PM, Prasad, Ramit wrote:
> Why would font not matter? Unicode is the abstract definition
> of all characters right? From that we map the abstract
> character to a code page/set, which gives real values for an
> abstract character. From that code page we then visually di
wxjmfa...@gmail.com wrote:
>
> Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
> > On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
> >
> > wrote:
> >
> > > If I want the other characters to work I need to change the code page:
> > >
> > > O:\>chcp 65001
> > > Active code page: 65001
> > >
On Thu, Nov 8, 2012 at 12:54 PM, wrote:
> Font has nothing to do here.
> You are "simply" wrongly encoding your "unicode".
>
'\u2013'
> '–'
'\u2013'.encode('utf-8')
> b'\xe2\x80\x93'
'\u2013'.encode('utf-8').decode('cp1252')
> '–'
No, it seriously is the font. This is what I ge
On 11/8/2012 12:34 PM, Andriy Kornatskyy wrote:
People who come from strongly typed languages that offer interfaces
often are confused by lack of one in Python. Python, being dynamic
typing programming language, follows duck typing principal. It can as
simple as this:
assert looks(Foo).like(IFo
On 11/8/2012 12:13 PM, Ian Kelly wrote:
On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
wrote:
Preparing for an upgrade from 2.7 to 3, I stumbled across an incompatibility
between 2.7 and 3.2 on one hand and 3.3 on the other:
class X(int):
def __init__(self, value):
super(X, se
Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
>
> wrote:
>
> > If I want the other characters to work I need to change the code page:
>
> >
>
> > O:\>chcp 65001
>
> > Active code page: 65001
>
> >
>
> > O:\>Q:\tools\Python33\python
Le jeudi 8 novembre 2012 19:32:14 UTC+1, Oscar Benjamin a écrit :
> On 8 November 2012 15:05, wrote:
>
> > Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
>
> >> On 8 November 2012 00:44, Oscar Benjamin
> >> wrote:
>
> >> > On 7 November 2012 23:51, Andrew Berg wrote:
>
>
Ian,
Thank you for the comments.
There is definitely a room for improvement, however there are limits. One of
them is related to decorator that replaces decorated method arguments with
something like *args, **kwargs. Here is an example.
def x():
def decorate(m):
def x(*args, **kwa
On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
wrote:
> If I want the other characters to work I need to change the code page:
>
> O:\>chcp 65001
> Active code page: 65001
>
> O:\>Q:\tools\Python33\python -c "import sys;
> sys.stdout.buffer.write('\u03b1\n'.encode('utf-8'))"
> α
>
> O:\>Q:\tools\
On Thu, Nov 8, 2012 at 10:30 AM, Andriy Kornatskyy
wrote:
>
> People who come from strongly typed languages that offer interfaces often are
> confused by lack of one in Python. Python, being dynamic typing programming
> language, follows duck typing principal. It can as simple as this:
>
> asser
On 8 November 2012 15:05, wrote:
> Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
>> On 8 November 2012 00:44, Oscar Benjamin wrote:
>> > On 7 November 2012 23:51, Andrew Berg wrote:
>> >> On 2012.11.07 17:27, Oscar Benjamin wrote:
>>
>> >>> Are you using cmd.exe (standard Wi
On 2012-11-08, Chris Angelico wrote:
> On Fri, Nov 9, 2012 at 4:05 AM, Debashish Saha wrote:
>> (15+1.00067968)-(15+1.00067961)
>> Out[102]: 2.384185791015625e-07
>>
>> 1.00067968-(1.00067961)
>> Out[103]: 7.1866624e-08
>>
>> above i am showing the two different results,t
Hi All
i am trying to build up a set of subprocess.Ponen calls to
replicate the effect of a horribly long shell command. I'm not clear
how I can do one part of this and wonder if anyone can advise. I'm on
Linux, fairly obviously.
I have a command which (simplified) is a tar -c command piped th
On 11/08/2012 12:05 PM, Debashish Saha wrote:
> (15+1.00067968)-(15+1.00067961)
> Out[102]: 2.384185791015625e-07
>
> 1.00067968-(1.00067961)
> Out[103]: 7.1866624e-08
>
> above i am showing the two different results,though the two outputs
> should be same if we do it in cop
People who come from strongly typed languages that offer interfaces often are
confused by lack of one in Python. Python, being dynamic typing programming
language, follows duck typing principal. It can as simple as this:
assert looks(Foo).like(IFoo)
The post below shows how programmer can as
People who come from strongly typed languages that offer interfaces often are
confused by lack of one in Python. Python, being dynamic typing programming
language, follows duck typing principal. It can as simple as this:
assert looks(Foo).like(IFoo)
The post below shows how programmer can asse
On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
wrote:
> Hi!
>
> Preparing for an upgrade from 2.7 to 3, I stumbled across an incompatibility
> between 2.7 and 3.2 on one hand and 3.3 on the other:
>
> class X(int):
> def __init__(self, value):
> super(X, self).__init__(value)
> X(42)
On Fri, Nov 9, 2012 at 4:05 AM, Debashish Saha wrote:
> (15+1.00067968)-(15+1.00067961)
> Out[102]: 2.384185791015625e-07
>
> 1.00067968-(1.00067961)
> Out[103]: 7.1866624e-08
>
> above i am showing the two different results,though the two outputs
> should be same if we do
On Thu, Nov 8, 2012 at 11:32 AM, Chris Rebert wrote:
> On Thursday, November 8, 2012, Kevin Holleran wrote:
>
>> On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran wrote:
>>
>>> My goodness psexec.
>>>
>>> thanks can't believe that didn't come to me...
>>>
>>>
>>>
>>>
>>> On Thu, Nov 8, 2012
On 11/08/2012 08:47 AM, inshu chauhan wrote:
> Actually data is neither a zanzibar nor a class nor a list.. its a yml
> image. with pixels
> I am trying to access pixels of a 3D image through this programme..
>
You want us to keep guessing? And without supplying any new
information? There's no
On Thursday, November 8, 2012, Kevin Holleran wrote:
> On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran
>
> > wrote:
>
>> My goodness psexec.
>>
>> thanks can't believe that didn't come to me...
>>
>>
>>
>>
>> On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden
>>
>> > wrote:
>>
>>> On 08/11/2012
On 08/11/2012 15:37, Kevin Holleran wrote:
> [code]
> try:
> print("Attempting to restart Splunk...")
> subprocess.call(["psexec", "" + host, "'c:\\Program
> Files\\Splunk\\bin\\splunk.exe'", "restart"])
> [/code]
>
> & am getting:
>
> [output]
> Attempting to restart
Hi!
Preparing for an upgrade from 2.7 to 3, I stumbled across an
incompatibility between 2.7 and 3.2 on one hand and 3.3 on the other:
class X(int):
def __init__(self, value):
super(X, self).__init__(value)
X(42)
On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeErr
On Thu, Nov 8, 2012 at 1:26 AM, Andrew Robinson
wrote:
> OK: Then copy by reference using map:
>
> values = zip( map( lambda:times, xrange(num_groups) ) )
> if len(values) < len(times) * num_groups ...
>
> Done. It's clearer than a list comprehension and you still really don't
> need a li
On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran wrote:
> My goodness psexec.
>
> thanks can't believe that didn't come to me...
>
>
>
>
> On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden wrote:
>
>> On 08/11/2012 14:25, Kevin Holleran wrote:
>> > Good morning,
>> >
>> > I wrote a python script
Duncan Booth, 08.11.2012 14:58:
> Ulrich Eckhardt wrote:
>> If possible, I'm looking for a solution that works for Pythons 2 and 3,
>> since I'm not fully through the conversion yet and have clients that
>> might use the older snake for some time before shedding their skin.
>>
>> Suggestions?
>
Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
> On 8 November 2012 00:44, Oscar Benjamin wrote:
>
> > On 7 November 2012 23:51, Andrew Berg wrote:
>
> >> On 2012.11.07 17:27, Oscar Benjamin wrote:
>
> >>> Are you using cmd.exe (standard Windows terminal)? If so, it does not
My goodness psexec.
thanks can't believe that didn't come to me...
--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP
My Paleo & Fitness Blo
On 08/11/2012 14:25, Kevin Holleran wrote:
> Good morning,
>
> I wrote a python script to connect out to a bunch of my remote machines
> that are running some software. It modifies a bunch of the config files
> for me. After making the changes, I need to restart the software. The
> way to do th
On Nov 7, 2012, at 11:51 PM, Andrew Robinson wrote:
> On 11/07/2012 04:00 PM, Steven D'Aprano wrote:
>> Andrew, it appears that your posts are being eaten or rejected by my
>> ISP's news server, because they aren't showing up for me. Possibly a side-
>> effect of your dates being in the distant p
Good morning,
I wrote a python script to connect out to a bunch of my remote machines
that are running some software. It modifies a bunch of the config files
for me. After making the changes, I need to restart the software. The way
to do this is to call an .exe passing in a argument 'restart'
On 08/11/2012 8:09 AM, Anssi Saari wrote:
farrellpolym...@gmail.com writes:
[snip]
Does Numpy 1.6.2 not run with Python 3.2.3?
It does on the Raspberry Pi, which uses a variant of Debian.
Colin W.
--
http://mail.python.org/mailman/listinfo/python-list
On 8 November 2012 00:44, Oscar Benjamin wrote:
> On 7 November 2012 23:51, Andrew Berg wrote:
>> On 2012.11.07 17:27, Oscar Benjamin wrote:
>>> Are you using cmd.exe (standard Windows terminal)? If so, it does not
>>> support unicode
>> Actually, it does. Code page 65001 is UTF-8. I know that do
Thanks, Oscar and Ramit! This is exactly what I was looking for.
Anders
> -Original Message-
> From: Oscar Benjamin [mailto:oscar.j.benja...@gmail.com]
> Sent: Wednesday, November 07, 2012 6:27 PM
> To: Anders Schneiderman
> Cc: python-list@python.org
> Subject: Re: Right solution to un
Ulrich Eckhardt wrote:
> If possible, I'm looking for a solution that works for Pythons 2 and 3,
> since I'm not fully through the conversion yet and have clients that
> might use the older snake for some time before shedding their skin.
>
> Suggestions?
Why bother checking types at all?
def
Actually data is neither a zanzibar nor a class nor a list.. its a yml
image. with pixels
I am trying to access pixels of a 3D image through this programme..
On Tue, Nov 6, 2012 at 8:59 PM, woooee wrote:
> From this line, "data" appears to be a class
> if 0 < ix < data.width and 0 < iy <
farrellpolym...@gmail.com writes:
> Hello to the group!
>
> I've learned a lot about Ubuntu just trying to install numpy for Python
> 3.2.3. I've finally managed to put it in the Python3.2 directory but when I
> try to import it, I still get there's "no module named numpy." There are
> other mo
On Thu, 08 Nov 2012 13:05:22 +0100, Ulrich Eckhardt wrote:
> Firstly, I have code that allows either a file or a string representing
> its content as parameter. If the parameter is a file, the content is
> read from the file. In Python 2, I used "isinstance(p, file)" to
> determine whether the par
Ulrich Eckhardt wrote:
> Hi!
>
> I have two problems that are related and that I'd like to solve together.
>
> Firstly, I have code that allows either a file or a string representing
> its content as parameter. If the parameter is a file, the content is
> read from the file. In Python 2, I used
On Thu, Nov 8, 2012 at 11:05 PM, Ulrich Eckhardt
wrote:
> Firstly, I have code that allows either a file or a string representing its
> content as parameter. If the parameter is a file, the content is read from
> the file. In Python 2, I used "isinstance(p, file)" to determine whether the
> parame
On 2012-11-08 08:04, Nikhil Verma wrote:
Hi
My Problem
I have a list :-
L = ['Sunday November 11 2012 9:00pm ', 'Thursday November 15 2012
7:00pm ',\
'Friday November 16 2012 7:00pm ', 'Monday November
19 2012 7:30pm ', \
'Friday November 23 2012 7:30
On 2012-11-08 12:05, Ulrich Eckhardt wrote:
Hi!
I have two problems that are related and that I'd like to solve together.
Firstly, I have code that allows either a file or a string representing
its content as parameter. If the parameter is a file, the content is
read from the file. In Python 2,
Hi!
I have two problems that are related and that I'd like to solve together.
Firstly, I have code that allows either a file or a string representing
its content as parameter. If the parameter is a file, the content is
read from the file. In Python 2, I used "isinstance(p, file)" to
determine
On 8/11/12 00:53:49, Steven D'Aprano wrote:
> This error confuses me. Is that an exact copy and paste of the error, or
> have you edited it or reconstructed it? Because it seems to me that if
> task.subject is a unicode string, as it appears to be, calling print on
> it should succeed:
>
> py>
Le mercredi 7 novembre 2012 23:17:42 UTC+1, Anders a écrit :
> I've run into a Unicode error, and despite doing some googling, I
>
> can't figure out the right way to fix it. I have a Python 2.6 script
>
> that reads my Outlook 2010 task list. I'm able to read the tasks from
>
> Outlook and stor
2012/11/8 andrea crotti :
>
>
>
> Yes yes I saw the answer, but now I was thinking that what I need is
> simply this:
> tar czpvf - /path/to/archive | split -d -b 100M - tardisk
>
> since it should run only on Linux it's probably way easier, my script
> will then only need to create the list of fil
2012/11/7 Oscar Benjamin :
>
> Correct. But if you read the rest of Alexander's post you'll find a
> suggestion that would work in this case and that can guarantee to give
> files of the desired size.
>
> You just need to define your own class that implements a write()
> method and then distributes
Nikhil Verma wrote:
> I have a list :-
> L = ['Sunday November 11 2012 9:00pm ', 'Thursday November 15 2012
> 7:00pm ',\
[...]
> 2012 7:00pm ']
> final_event_time = [datetime.strptime(iterable, '%A %B %d %Y %I:%M%p') for
> iterable in L]
>
> and having this error Unconverted data remains .
Smaran Harihar wrote:
> I am able to read through a CSV File and fetch the data inside the CSV
> file but I have a really big list of CSV files and I wish to do the same
> particular code in all the CSV files.
>
> Is there some way that I can loops through all these files, which are in a
> single
On 11/07/2012 11:09 PM, Ian Kelly wrote:
On Wed, Nov 7, 2012 at 8:13 PM, Andrew Robinson
wrote:
OK, and is this a main use case? (I'm not saying it isn't I'm asking.)
I have no idea what is a "main" use case.
Well, then we can't evaluate if it's worth keeping a list multiplier
around at all
Hi
My Problem
I have a list :-
L = ['Sunday November 11 2012 9:00pm ', 'Thursday November 15 2012
7:00pm ',\
'Friday November 16 2012 7:00pm ', 'Monday November 19
2012 7:30pm ', \
'Friday November 23 2012 7:30pm ', 'Sunday November 25
2012 8:00pm ',\
70 matches
Mail list logo