On 6/09/12 19:59:05, tinn...@isbd.co.uk wrote:
I want to print a series of list elements some of which may not exist,
e.g. I have a line:-
print day, fld[1], balance, fld[2]
fld[2] doesn't always exist (fld is the result of a split) so the
print fails when it isn't set.
How about:
On 5/09/12 15:19:47, Franck Ditter wrote:
Thanks to all, but :
- I should have said that I work with Python 3. Does that matter ?
- May I reformulate the queston : a is b and id(a) == id(b)
both mean : a et b share the same physical address. Is that True ?
Yes.
Keep in mind, though, that
On 5/09/12 17:09:30, Dave Angel wrote:
But by claiming that id() really means address, and that those addresses
might move during the lifetime of an object, then the fact that the id()
functions are not called simultaneously implies that one object might
move to where the other one used to be
On 30/08/12 14:34:51, Marco Nawijn wrote:
Note that if you change 'd' it will change for all instances!
That depends on how you change it.
bobj = A()
bobj.d
'my attribute'
A.d = 'oops...attribute changed'
Here you change the attribute on the class.
That will affect all instances:
On 30/08/12 16:48:24, Marco Nawijn wrote:
On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote:
On 08/30/2012 10:11 AM, Marco Nawijn wrote:
On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
snip
Learned my lesson today. Don't assume you know something. Test
On 30/08/12 14:49:54, Ulrich Eckhardt wrote:
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
s = os.stat(.)
print s
posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L,
st_nlink=2, st_u
id=1000, st_gid=100, st_size=4096L, st_atime=1346327745,
st_mtime=1346327754, st
On 26/08/12 20:47:34, Nicholas Cole wrote:
Dear List,
In all previous versions of python, I've been able to install packages
into the path:
~/Library/Python/$py_version_short/site-packages
but in the rc builds of python 3.3 this is no longer part of sys.path.
It has been changed to
On 24/08/12 06:35:27, Marco wrote:
Please, can anyone explain me the meaning of the
buffering 1 in the built-in open()?
The doc says: ...and an integer 1 to indicate the size
of a fixed-size chunk buffer.
So I thought this size was the number of bytes or chars, but
it is not
The algorithm
On 24/08/12 21:59:12, Prasad, Ramit wrote:
Also, print doesn't work inside a class.
It works for me:
python3
Python 3.3.0a1 (v3.3.0a1:f1a9a6505731, Mar 4 2012, 12:26:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type help, copyright, credits or license for more information.
On 26/08/12 04:42:59, Steven W. Orr wrote:
On 8/25/2012 10:20 PM, Christopher McComas wrote:
Greetings,
I have code that I run via Django that grabs the results from various
sports from formatted text files. The script iterates over every line
in the formatted text files, finds the team in
On 26/08/12 21:21:15, Ned Deily wrote:
In article
caau18hc7katbonp7a+-a1pye8byysgfac4fhhksd8peeqjl...@mail.gmail.com,
Nicholas Cole nicholas.c...@gmail.com wrote:
In all previous versions of python, I've been able to install packages
into the path:
On 22/08/12 08:21:47, Santosh Kumar wrote:
Here is the script I am using:
from os import linesep
from string import punctuation
from sys import argv
script, givenfile = argv
with open(givenfile) as file:
# List to store the capitalised lines.
lines = []
for line in file:
On 22/08/12 09:29:37, Guillaume Comte wrote:
Le mercredi 22 août 2012 04:10:43 UTC+2, Dennis Lee Bieber a écrit :
On Tue, 21 Aug 2012 10:00:28 -0700 (PDT), Guillaume Comte
guillaume.comt...@gmail.com declaimed the following in
gmane.comp.python.general:
A later follow-up
On 19/08/12 19:48:06, Paul Rubin wrote:
Terry Reedy tjre...@udel.edu writes:
py s = chr(0x + 1)
py a, b = s
That looks like a 3.2- narrow build. Such which treat unicode strings
as sequences of code units rather than sequences of codepoints. Not an
implementation bug, but
On 20/08/12 14:36:58, Guillaume Comte wrote:
In fact, socket.create_connection is for TCP only so I cannot use it for a
ping implementation.
Why are you trying to reimplement ping?
All OS'es I am aware of come with a working ping implementation.
Does anyone have an idea about how to be
On 20/08/12 15:50:43, Gilles wrote:
On Mon, 20 Aug 2012 07:59:39 -0400, Rod Person
rodper...@rodperson.com wrote:
Check the Apache error log, there should be more information there.
It's a shared account, so I only have access to what's in cPanel,
which didn't display anything.
Most such
On 16/08/12 23:34:25, Walter Hurry wrote:
On Thu, 16 Aug 2012 17:20:29 -0400, Terry Reedy wrote:
On 8/16/2012 11:40 AM, Ramchandra Apte wrote:
Look you are the only person complaining about top-posting.
No he is not. Recheck all the the responses.
GMail uses top-posting by default.
It
On 16/08/12 01:26:09, Ethan Furman wrote:
Indexes have a new method (rebirth of an old one, really):
.index_search(
match,
start=None,
stop=None,
nearest=False,
partial=False )
The defaults are to search the entire index for exact matches and raise
On 8/08/12 04:14:01, Steven D'Aprano wrote:
NoneType raises an error if you try to create a second instance. bool
just returns one of the two singletons (doubletons?) again.
py type(None)()
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: cannot create
On 16/08/12 14:52:30, Thomas Bach wrote:
On Thu, Aug 16, 2012 at 12:16:03AM +, Steven D'Aprano wrote:
Some comments:
1) What you show are not use cases, but examples. A use-case is a
description of an actual real-world problem that needs to be solved. A
couple of asserts is not a
On 15/08/12 15:30:26, nepaul wrote:
The code:
import MySQLDB
strCmd = user = 'root', passwd = '123456', db = 'test', host = 'localhost'
_mysql_exceptions.OperationalError: (2005, Unknown MySQL server host 'user =
'root',
passwd = '123456', db = 'test', host = 'localhost'' (11004))
On 12/08/12 22:13:20, Alister wrote:
On Sun, 12 Aug 2012 19:20:26 +0100, Mark Lawrence wrote:
On 12/08/2012 17:59, Paul Rubin wrote:
which can be simplified to:
for x in range(len(L)//2 + len(L)%2):
for x in range(sum(divmod(len(L), 2))): ...
So who's going to be first in with and thou
On 11/08/12 00:48:38, Dennis Lee Bieber wrote:
On Fri, 10 Aug 2012 12:35:06 -0700, Smaran Harihar
smaran.hari...@gmail.com declaimed the following in
gmane.comp.python.general:
Hi Tim,
this is the output for the ls -lsF filename
8 -rwxr-xr-x 1 root root 5227 Jul 30 13:54
On 11/08/12 09:07:51, pozz wrote:
Il 11/08/2012 01:12, Dennis Lee Bieber ha scritto:
What you apparently missed is that serial.read() BLOCKs until data
is available (unless the port was opened with a read timeout set).
[...]
serial.read() may, there for, be using select() behind the
On 9/08/12 23:33:58, Terry Reedy wrote:
On 8/9/2012 4:06 PM, giuseppe.amatu...@gmail.com wrote:
[...]
unique=dict()
for row in array2D :
row = tuple(row)
if row in unique:
unique[row] += 1
else:
unique[row] = 1
I believe the 4 lines above are equivalent
On 10/08/12 10:20:00, Giacomo Alzetta wrote:
I'm trying to implement a c-extension which defines a new class(ModPolynomial
on the python side, ModPoly on the C-side).
At the moment I'm writing the in-place addition, but I get a *really* strange
behaviour.
Here's the code for the in-place
On 10/08/12 11:25:36, Giacomo Alzetta wrote:
Il giorno venerdì 10 agosto 2012 11:22:13 UTC+2, Hans Mulder ha scritto:
[...]
Yes, you're right. I didn't thought the combined operator would do a Py_DECREF
if the iadd operation was implemented, but it obviosuly makes sense.
The += operator cannot
On 19/07/12 23:10:04, Dennis Lee Bieber wrote:
On Thu, 19 Jul 2012 13:01:37 -0500, Tim Chase
python.l...@tim.thechases.com declaimed the following in
gmane.comp.python.general:
It just seems unfortunate that the sniffer would ever consider
[a-zA-Z0-9] as a valid delimiter.
+1
I'd
On 20/07/12 11:05:09, Virgil Stokes wrote:
On 20-Jul-2012 10:27, Steven D'Aprano wrote:
On Fri, 20 Jul 2012 08:20:57 +1000, Chris Angelico wrote:
Since the current evidence indicates the universe will just
keep
expanding, it's more of a deep freeze death...
Heat death means *lack* of
On 19/07/12 13:21:58, Tim Chase wrote:
tim@laptop:~/tmp$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
import csv
from cStringIO import StringIO
s =
On 17/07/12 15:47:05, Naser Nikandish wrote:
Hi,
I am trying to install Python 2.6 on Mac OS Lion. Here is what I did:
1- Download Mac Installer disk image (2.6) (sig) from
http://www.python.org/getit/releases/2.6/
2- Install it
3- Run Python Luncher, go to Python Luncher
On 15/07/12 10:44:09, Chris Angelico wrote:
On Sun, Jul 15, 2012 at 6:32 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
At compile time, Python parses the source code and turns it into byte-
code. Class and function definitions are executed at run time, the same
as any other
On 14/07/12 20:49:11, Chris Angelico wrote:
On Sun, Jul 15, 2012 at 3:54 AM, Dieter Maurer die...@handshake.de wrote:
I, too, would find it useful -- for me (although I do not hate myself).
Surely, you know an alarm clock. Usually, it gives an audible signal
when it is time to do something. A
On 13/07/12 04:16:53, Steven D'Aprano wrote:
On Thu, 12 Jul 2012 16:37:42 +0100, andrea crotti wrote:
2012/7/12 John Gordon gor...@panix.com:
In mailman.2043.1342102625.4697.python-l...@python.org andrea crotti
andrea.crott...@gmail.com writes:
Well that's what I thought, but I can't find
On 13/07/12 18:12:40, Prasad, Ramit wrote:
VERBOSE = True
def function(arg):
if VERBOSE:
print(calling function with arg %r % arg)
process(arg)
def caller():
VERBOSE = False
function(1)
-
Python semantics: function
On 13/07/12 19:59:59, Prasad, Ramit wrote:
I lean slightly towards the POSIX handling with the addition that
any additional write should throw an error. You are now saving to
a file that will not exist the moment you close it and that is
probably not expected.
I'd say: it depends.
If the
On 13/07/12 20:54:02, Ian Kelly wrote:
I've also seen the distinction described as early vs. late binding
on this list, but I'm not sure how precise that is -- I believe that
terminology more accurately describes whether method and attribute
names are looked up at compile-time or at run-time,
On 12/07/12 14:30:41, Laszlo Nagy wrote:
You are contradicting yourself. Either the OS is providing a fully
atomic rename or it doesn't. All POSIX compatible OS provide an atomic
rename functionality that renames the file atomically or fails without
loosing the target side. On POSIX OS it
On 11/07/12 20:38:18, woooee wrote:
You should not be using lambda in this case
.for x in [2, 3]:
.funcs = [x**ctr for ctr in range( 5 )]
.for p in range(5):
.print x, funcs[p]
.print
The list is called funcs because it is meant to contain functions.
Your code does not
On 7/07/12 07:47:56, Stephen Webb wrote:
I installed py27-numpy / scipy / matplotlib using macports, and it ran
without failing.
When I run Python I get the following error:
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
That's a python from python.org,
On 7/07/12 14:09:56, Ousmane Wilane wrote:
H == Hans Mulder han...@xs4all.nl writes:
H Or you can explicitly type the full path of the python you want.
H Or you can define aliases, for example:
H alias apple_python=/usr/bin/python alias
H macport_python=/opt/local/bin
On 6/07/12 00:55:48, Damjan wrote:
On 05.07.2012 16:10, Damjan wrote:
I've been struggling with an app that uses
Postgresql/Psycopg2/SQLAlchemy and I've come to this confusing
behaviour of datetime.datetime.
Also this:
#! /usr/bin/python2
# retardations in python's datetime
import
On 5/07/12 07:32:48, Steven D'Aprano wrote:
On Wed, 04 Jul 2012 23:38:17 -0400, Terry Reedy wrote:
If I run the script in 3.3 Idle, I get the same output you got. If I
then enter '5-2' interactively, I still get 3. Maybe the constant folder
is always on now.
Yes, I believe constant
On 5/07/12 12:47:52, Chris Angelico wrote:
On Thu, Jul 5, 2012 at 8:29 PM, Olive di...@bigfoot.com wrote:
I am creating a new class: package (to analyse the packages database in
some linux distros). I have created a class package such that
package(string) give me an instance of package if
On 5/07/12 19:03:57, Alexander Blinne wrote:
On 05.07.2012 16:34, Laszlo Nagy wrote:
five.contents[five.contents[:].index(5)] = 4
5
4
5 is 4
True
That's surprising, because even after changing 5 to 4 both objects still
have different id()s (tested on Py2.7), so 5 is 4 /should/ still be
On 28/06/12 13:09:14, Sergi Pasoev wrote:
Do you mean to implement the cd command ? To what extent do you want to
implement it ? if what you want is just to have a script to change the
current working directory, it is as easy as this:
import sys
import os
os.chdir(sys.argv[1])
plus
On 27/06/12 19:05:44, David Thomas wrote:
Is this why I keep getting an error using launcher?
No.
Yesterday your problem was that you tried this:
input(\n\nPress the enter key to exit)
That works fine in Pyhton3, but you are using python2
and in python2, the you must do this instead:
On 27/06/12 22:45:47, David Thomas wrote:
Thank you ever so much raw_input works fine.
Do you think I should stick with Python 2 before I go to 3?
I think so. The differences are not that big, but big
enough to confuse a beginner. Once you know pyhton2,
read
On 26/06/12 18:30:15, J wrote:
This is driving me batty... more enjoyment with the Python3
Everything must be bytes thing... sigh...
I have a file that contains a class used by other scripts. The class
is fed either a file, or a stream of output from another command, then
interprets that
On 26/06/12 20:11:51, David Thomas wrote:
On Monday, June 25, 2012 7:19:54 PM UTC+1, David Thomas wrote:
Hello,
This is my first post so go easy on me. I am just beginning to program
using Python on Mac. When I try to execute a file using Python Launcher my
code seems to cause an error in
On 26/06/12 21:51:41, Dennis Lee Bieber wrote:
On Tue, 26 Jun 2012 10:19:45 -0700 (PDT), David Thomas
dthoma...@me.com declaimed the following in gmane.comp.python.general:
http://www.freeimagehosting.net/ilbqt
That's an interesting configuration...
pythonw.exe is a
On 26/06/12 22:41:59, Dave Angel wrote:
On 06/26/2012 03:16 PM, Hans Mulder wrote:
SNIP
Python is an executable, and is
typically located in a bin directory. To find out where
it is, type
type python
at the shell prompt (that's the first prompt you get if you
open a Terminal
On 21/06/12 02:26:41, Steven D'Aprano wrote:
There used to be a page describing the differences between Jython and
CPython here:
http://www.jython.org/docs/differences.html
but it appears to have been eaten by the 404 Monster.
It has been moved to:
On 20/05/12 17:55:52, Steven D'Aprano wrote:
Is this a bug in the doctest documentation, or is my browser broken?
On this page:
http://docs.python.org/library/doctest.html#option-flags-and-directives
scroll down to the examples showing the doctest directives, e.g:
[quote]
For
On 19/05/12 13:20:24, Nobody wrote:
On Sat, 19 May 2012 11:30:46 +0200, Johannes Bauer wrote:
import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))
In 3.x, a string will be passed as a wchar_t*, not a char*. IOW, the
memory pointed to by
Hans Werner May nc-may...@netcologne.de added the comment:
Out of curiosity: where did you get a file that was last modified in 1956?
No idea, this was a jpeg file, probably downloaded from internet. Btw, on Linux
you can manipulate the creation date with the touch command, so it is possible
New submission from Hans Werner May nc-may...@netcologne.de:
Bug in tarfile:
In extractall, when a file exists in tarball with changetime older than (I
don't know, in my case it was year 1956) tarfile raises an Overflow exception:
File /usr/lib64/python2.7/tarfile.py, line 2298, in utime
On 1/05/12 17:34:57, ru...@yahoo.com wrote:
from __future__ import print_function #1
#1: Not sure whether you're using Python 2 or 3. I ran
this on Python 2.7 and think it will run on Python 3 if
you remove this line.
You
On 18/04/12 03:08:08, Kiuhnm wrote:
print(1)
print(2)
print(3)
with open('test') as f:
data = f.read()
with open('test') as f:
data = f.read()
I get the same result with Pythin 3.3.0a0 on MacOS X 10.6:
93 ./python.exe -m pdb /tmp/script.py
/tmp/script.py(1)module()
- print(1)
On 1/02/12 07:04:31, Jason Friedman wrote:
My system's default python is 2.6.5. I have also installed python3.2
at /opt/python.
I installed a pypi package for 2.6.5 with:
$ tar xzf package.tar.gz
$ cd package
$ python setup.py build
$ sudo python setup.py install
How can I also install this
On 21/12/11 21:11:03, Andrew Berg wrote:
On 12/21/2011 1:29 PM, Ethan Furman wrote:
Anything that runs at import time should be protected by the `if
__name__ == '__main__'` idiom as the children will import the __main__
module.
So the child imports the parent and runs the spawn code again?
On 22/12/11 14:12:57, Steven D'Aprano wrote:
On Thu, 22 Dec 2011 06:49:16 -0500, Neal Becker wrote:
I agree with the OP that the current syntax is confusing. The issue is,
the meaning of * is context-dependent.
Here you are complaining about an operator being confusing because it
is
On 21/12/11 01:03:26, Ian Kelly wrote:
As type conversion functions, bool(x) and
int(x) should *always* return bools and ints respectively
(or raise an exception), no matter what you pass in for x.
That doesn't always happen in 2.x:
type(int(1e42))
type 'long'
This was fixed in 3.0.
--
On 10/12/11 02:44:48, Tim Chase wrote:
Currently I can get the currently-logged-in-userid via getpass.getuser()
which would yield something like tchase.
Is there a cross-platform way to get the full username (such as from the
GECOS field of /etc/passed or via something like NetUserGetInfo on
On 6/12/11 09:48:39, Steven D'Aprano wrote:
On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote:
Hi.
I wonder if it is realistic to get a single key press in Python without
ncurses or
any similar library. In single key press I mean something like j and k
in Gnu less
program, you press the
On 2/12/11 10:09:17, janedenone wrote:
I had tried
sys.stdin = open('/dev/tty', 'r')
That seems to work for me. This code:
import sys
if sys.version_info.major == 2:
input = raw_input
for tp in enumerate(sys.stdin):
print(%d: %s % tp)
sys.stdin = open('/dev/tty', 'r')
answer =
On 2/12/11 03:46:10, Dan Stromberg wrote:
You can read piped data from sys.stdin normally. Then if you want
something from the user, at least on most *ix's, you would open
/dev/tty and get user input from there. 'Not sure about OS/X.
Reading from /dev/tty works fine on OS/X.
-- HansM
--
On 18/11/11 03:58:46, alex23 wrote:
On Nov 18, 11:36 am, Roy Smithr...@panix.com wrote:
What if the first import of a module is happening inside some code you
don't have access to?
No import will happen until you import something.
That would be the case if you use the '-S' command line
On 9/11/11 02:30:48, Chris Rebert wrote:
Burn him! Witch! Witch! Burn him!
His code turned me into a newt!
--
Sent nailed to a coconut carried by swallow.
Is that a European swallow or an African swallow?
-- HansM
--
http://mail.python.org/mailman/listinfo/python-list
On 27/10/11 10:57:55, faucheuse wrote:
I'm trying to launch my python program with another process name than
python.exe.
Which version of Python are you using?
Which version of which operating system?
In order to do that I'm trying to use the os.execvp function :
os.execvp(./Launch.py,
On 20/10/11 18:22:04, Westley Martínez wrote:
On Thu, Oct 20, 2011 at 06:19:40AM -0700, Yingjie Lan wrote:
Hi,
Is it possible to test if two range objects contain the same sequence of
integers by the following algorithm in Python 3.2?
1. standardize the ending bound by letting it be the
and check that the colour
channels are equal.
I'll be grateful for any pointers,
TIA
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On 3/10/11 08:10:57, Hegedüs, Ervin wrote:
hello,
On Mon, Oct 03, 2011 at 04:37:43AM +, Steven D'Aprano wrote:
I wanted to ensure that it would do the right thing when run without a tty,
such as from a cron job.
If you fork() your process, then it will also loose the tty...
Errhm, I
On 3/10/11 06:37:43, Steven D'Aprano wrote:
On Fri, 30 Sep 2011 21:09:54 +0100, Nobody wrote:
On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin wrote:
I have a Python script which I would like to test without a tty
attached to the process. I could run it as a cron job, but is there an
On 30/09/11 11:10:48, Ovidiu Deac wrote:
I have the following regexp which fails to compile. Can somebody explain why?
re.compile(r^(?: [^y]* )*, re.X)
[...]
sre_constants.error: nothing to repeat
Is this a bug or a feature?
A feature: the message explains why this pattern is not allowed.
On 30/09/11 20:34:37, RJB wrote:
You could try the old UNIX nohup ... technique for running a
process in the background (the) with no HangUP if you log out:
$ nohup python -c import sys,os; print
os.isatty(sys.stdout.fileno())
appending output to nohup.out
$ cat nohup.out
False
But that is
On 29/09/11 11:21:16, Steven D'Aprano wrote:
I have a Python script which I would like to test without a tty attached
to the process. I could run it as a cron job, but is there an easier way?
There is module on Pypi called python-daemon; it implements PEP-3143.
This module detaches the process
On 29/09/11 12:52:22, Steven D'Aprano wrote:
[steve@sylar ~]$ python -c import sys,os; print os.isatty(sys.stdout.fileno())
True
If I run the same Python command (without the setsid) as a cron job, I
get False emailed to me. That's the effect I'm looking for.
In that case, all you need to
On 9/09/11 11:07:24, Steven D'Aprano wrote:
Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of
script.py. While script.py is running, it receives the Ctrl-C, the calling
process does not.
You misinterpret what you are seeing: the calling process *does* receive
the ctrl-C,
On 6/09/11 01:18:37, Steven D'Aprano wrote:
Terry Reedy wrote:
The doc says -ccommand
Execute the Python code in command. command can be one or more
statements separated by newlines,
However, I have no idea how to put newlines into a command-line string.
I imagine that it depends on the
On 6/09/11 16:18:32, Laszlo Nagy wrote:
On 2011-09-06 15:42, Kayode Odeyemi wrote:
I was able to get this solved by calling class like this:
from core.fleet import Fleet
f = Fleet()
Thanks to a thread from the list titled TypeError: 'module' object is
not callable
Or you can also do this:
On 4/09/11 17:25:48, Alain Ketterlin wrote:
Erikerik.william...@gmail.com writes:
import os
from subprocess import Popen, PIPE
os.chroot(/tmp/my_chroot)
p = Popen(/bin/date, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout_val, stderr_val = p.communicate()
print stdout_val
but the Popen call is
On 30/08/11 06:13:41, Steven D'Aprano wrote:
On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote:
[...]
Yes, but if I am not mistaken, that will require me to put a line or
two after each os.system call. That's almost like whack-a-mole at the
code level rather than the Control-C level. OK, not
On 27/08/11 09:08:20, Arnaud Delobelle wrote:
I'm wondering what advice you have about formatting if statements with
long conditions (I always format my code to80 colums)
Here's an example taken from something I'm writing at the moment and
how I've formatted it:
if (isinstance(left,
On 27/08/11 11:05:25, Steven D'Aprano wrote:
Hans Mulder wrote:
[...]
It may look ugly, but it's very clear where the condition part ends
and the 'then' part begins.
Immediately after the colon, surely?
On the next line, actually :-)
The point is, that this layout makes it very clear
On 27/08/11 17:16:51, Colin J. Williams wrote:
What about:
cond= isinstance(left, PyCompare)
and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]
py_and= PyCompare(left.complist + right.complist[1:])if cond
else: py_and = PyBooleanAnd(left, right)
Colin
On 21/08/11 19:14:19, Irmen de Jong wrote:
What the precise difference (semantics and speed) is between the
BINARY_ADD and INPLACE_ADD opcodes, I dunno. Look in the Python source
code or maybe someone knows it from memory :-)
There is a clear difference in semantics: BINARY_ADD always
On 17/08/11 10:03:00, peter wrote:
Is there an equivalent to msvcrt for Linux users? I haven't found
one, and have resorted to some very clumsy code which turns off
keyboard excho then reads stdin. Seems such an obvious thing to want
to do I am surprised there is not a standard library module
New submission from Hans Bering hans.ber...@arcor.de:
The attached script will crash on a current Ubuntu with Python 3.2 + tcl/tk
when using a locale which uses a comma as a decimal separator (e.g., German).
It will not crash when using a locale which uses a dot as the decimal separator
(e.g
Hans Bering hans.ber...@arcor.de added the comment:
Sorry for the misclassification, and thanks for correcting that.
I agree, this issue is most likely related to issue 10647; but at some level I
think they must be different, because issue 10647 seems to be specific to
Python 3.1 under
Hans Bering hans.ber...@arcor.de added the comment:
Ok, _now_ I have run into the same problem. I have attached a small script
similar to the original entry (but shorter) which will reliably crash with
Python 3.1.4 on Windows 7 (64bit) when using a locale with a comma decimal
fraction marker
Changes by Hans Bering hans.ber...@arcor.de:
Removed file: http://bugs.python.org/file22535/tkinterCrash.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10647
Hans Bering hans.ber...@arcor.de added the comment:
I'm sorry, but it seems the issue described in my previous edit (msg139566) is
perhaps not related to the original Scrollbar problem. I had thought they were
because of the superficial resemblance (i.e., crashes due to locale-dependent
float
Hans Bering hans.ber...@arcor.de added the comment:
I have been able to reproduce this problem with a current Python 3.2 + tcl/tk
on Ubuntu. I have attached a script which should crash with the following
output stacktrace (you might have to find set a suitable locale depending
on your OS
On 23/06/11 18:11:32, Cathy James wrote:
I looked through this forum's archives, but I can't find a way to
search for a topic through the archive. Am I missing something?
One way to search the past contributions to this forum is to
go to http://groups.google.com/advanced_search and specify
On 20/06/11 08:14:14, Florencio Cano wrote:
This works:
infile=open('/foo/bar/prog/py_modules/this_is_a_test','r')
This doesn't:
infile=open('~/prog/py_modules/this_is_a_test','r')
Can't I work with files using Unix expressions?
You can use the glob module:
On 20/06/11 20:14:46, Tim Johnson wrote:
Currently using python 2.6, but am serving some systems that have
older versions of python (no earlier than.
Question 1:
With what version of python was str.format() first implemented?
That was 2.6, according to the online docs.
Take a look at the
On 17/06/11 19:47:50, Timo Lindemann wrote:
On Fri, 17 Jun 2011 00:57:25 +, Jason Friedman said:
but for various reasons I want a single script. Any alternatives?
you can use a here document like this:
#! /bin/bash
/usr/bin/python2 EOPYTHON
def hello():
print(Hello,
On 17/06/11 21:58:53, Nige Danton wrote:
Mac OSX python 2.6.1: I'm trying to install the natural language toolkit
and following the instructions here www.NLTK.org/download I've downloaded
the PyYAML package and in a terminal window tried to install it. However
terminal asks for my password -
On 17/06/11 22:57:41, Nige Danton wrote:
Hans Mulderhan...@xs4all.nl wrote:
On 17/06/11 21:58:53, Nige Danton wrote:
Mac OSX python 2.6.1: I'm trying to install the natural language toolkit
and following the instructions here www.NLTK.org/download I've downloaded
the PyYAML package
201 - 300 of 646 matches
Mail list logo