Hi everyone, I'm a beginning programming student in Python and have a
few questions regarding strings.
If s1 = spam
If s2 = ni!
1. Would string.ljust(string.upper(s2),4) * 3 start it at the left
margin and move it 12 spaces to the right because of the 4 *3? If so,
why is it in the
On Sat, 15 Sep 2007 15:56:40 +0200, Arnau Sanchez wrote:
js escribió:
On 9/15/07, Summercool [EMAIL PROTECTED] wrote:
in Python... is the method to use ,.join() ? but then it must take
a list of strings... not integers...
any fast method?
print ''.join([str(i) for i in [1,2,3]])
On Sat, 15 Sep 2007 19:52:47 -0400, Shawn Minisall wrote:
Hi everyone, I'm a beginning programming student in Python and have a
few questions regarding strings.
If s1 = spam
If s2 = ni!
1. Would string.ljust(string.upper(s2),4) * 3 start it at the left
margin and move it 12 spaces
On Sat, 15 Sep 2007 14:58:15 -0700, James Stroud wrote:
I was staring at a segment of code that looked like this today:
for something in stuff[x:y]:
whatever(something)
and was wondering if the compiler really made a copy of the slice from
stuff as the code seems to suggest,
On Sat, 15 Sep 2007 14:15:20 +, brus stoc at gmail dot com wrote:
[snip spam]
Hey, thanks for spamming our group.
You know, there are probably millions of people who never received the
original spam because their Usenet provider does a good job of filtering
out crud, and they wouldn't
On Behalf Of J. Cliff Dyer
On the other hand, this is just as bad:
[ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if
foo in ( x ) ]
I think that's allowed in order to recruit C/C++ programmers.
Regards,
Ryan Ginstrom
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch wrote:
But please don't use the functions in `string` that are also available as
methods on strings. Those functions are deprecated.
Meaning (for newbie clarification):
instead of string.upper(s2), just do s2.upper(). For more detail, see
the docs.
--
On Sat, 15 Sep 2007 16:07:07 +, Grant Edwards wrote:
It's nice people have invented so many ways to spell the builting map
;)
,.join(map(str,[1,2,3]))
'1,2,3'
The oldest solution, and if not the fastest, at least neck-and-neck with
the list comprehension.
timeit.Timer(',
On Sun, 16 Sep 2007 00:05:58 +, Marc 'BlackJack' Rintsch wrote:
On Sat, 15 Sep 2007 14:58:15 -0700, James Stroud wrote:
I was staring at a segment of code that looked like this today:
for something in stuff[x:y]:
whatever(something)
and was wondering if the compiler
On 9 16 , 2 51 , [EMAIL PROTECTED] wrote:
http://freesoftwareupgrades.blogspot.com/
what
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 16 Sep 2007 09:14:57 +0900, Ryan Ginstrom wrote:
On Behalf Of J. Cliff Dyer
On the other hand, this is just as bad:
[ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in
( x ) ]
I think that's allowed in order to recruit C/C++ programmers.
Heh :)
In all seriousness,
On Sat, 15 Sep 2007 02:45:10 -0700, James Stroud wrote:
Steven D'Aprano wrote:
On Fri, 14 Sep 2007 18:19:45 -0700, James Stroud wrote:
How do I subclass int and/or long so that my class also auto-converts
only when needed?
Use __new__.
The disadvantage of that is that your example code
John Machin wrote:
On 16/09/2007 8:11 AM, James Stroud wrote:
Steve Holden wrote:
I don't know why you have a bug up your ass about it, as the
Americans say.
I think most Americans say wild hare up your ass.
The essence of Steve's point appears to be that the OP has ridden into
town to
:)
--
http://mail.python.org/mailman/listinfo/python-list
Anybody introdcing something on the subject?
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 15 Sep 2007 03:25:27 +, mouseit wrote:
I'm trying to add an element to a list which is a property of an
object, stored in an array. When I append to one element, all of the
lists are appended!
Example Code:
class Test:
array = []
myTests = [Test() , Test() , Test()]
Grant Edwards wrote:
On 2007-09-15, Robert Kern [EMAIL PROTECTED] wrote:
Grant Edwards wrote:
On 2007-09-15, Erik Jones [EMAIL PROTECTED] wrote:
print ''.join([str(i) for i in [1,2,3]])
It's better to use generator comprehension instead of LC:
,.join(str(i) for i in [1, 2, 3])
Why is
Rob E wrote:
On Sat, 15 Sep 2007 03:25:27 +, mouseit wrote:
I'm trying to add an element to a list which is a property of an
object, stored in an array. When I append to one element, all of the
lists are appended!
Example Code:
class Test:
array = []
myTests = [Test() , Test()
Steven D'Aprano [EMAIL PROTECTED] writes:
In *general* the compiler can't tell, but in specific cases it
could. A (hypothetical) optimizing compiler would tell the
difference between:
for item in alist[1:5]:
print item # no possible side-effects
The 'print' statement converts the
On Sep 14, 10:30 am, Mark Morss [EMAIL PROTECTED] wrote:
I would like to construct a class that includes both the integers and
None. I desire that if x and y are elements of this class, and both
are integers, then arithmetic operations between them, such as x+y,
return the same result as
I'm trying to detect and intelligently deal with problems created when a
user of a Python CGI page uploads a file and then gets impatient and
clicks on some other button or the browser's cancel button (or even
closes the page). If the file is large enough, and the user is
impatient enough,
Armin Rigo added the comment:
We need to start from PyFile_WriteString() and PyFile_WriteObject()
and PyObject_Print(), which are what the PRINT_* opcodes use, and make
sure there is no single fprintf() or fputs() that occurs with the GIL
held. It is not enough to fix a few places that could
New submission from Eduardo Padoan:
Currently, itertools.count.__next__ checks wether the current value is
PY_SSIZE_T_MAX and raises OverflowError if so. Shouldn't the value be
stored as long, at least in Py3k? Not that I have any use case for it,
so it is minor.
--
components: Library
Eric S. R-e-mond added the comment:
Hi guys.
--
assignee: - esr
nosy: +esr
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Changes by Eric S. R-e-mond:
--
severity: minor - critical
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Eric S. R-e-mond:
--
keywords: +r-eyyy-mond
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Eric S. R-e-mond:
--
versions: +3rd party, Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1,
Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.6
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
Changes by Eric S. R-e-mond:
--
type: behavior - compile error
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Changes by Eric S. R-e-mond:
--
dependencies: +--install-base not honored on win32
type: compile error - behavior
versions: -3rd party, Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1,
Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.6
Changes by Eric S. R-e-mond:
--
dependencies: + Elemental Security contribution - pgen2 package
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
New submission from Eric S. R-e-mond:
I tried this code, and it blew up in my face.
foo = malloc(4096)
NameError: name 'malloc' is not defined
Why?
--
components: Library (Lib)
keywords: r-eyyy-mond
messages: 55929
nosy: esr
priority: high
severity: normal
status: open
title:
Guido van Rossum added the comment:
Plese do submit a patch.
FWIW I think it's solved in Py3k, the tp_print slot is dead (as is any
use of the C stdio library).
--
nosy: +gvanrossum
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1164
Changes by Brett Cannon:
--
versions: +Python 2.6
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1164
__
___
Python-bugs-list mailing list
Unsubscribe:
Brett Cannon added the comment:
Since I already did this once I just did a more thorough job; patch is
attached.
PyObject_WriteString() just calls PyFile_WriteObject() which ends up
using PyObject_Print(), so it is was simple to handle those cases. I
then released the GIL for strings, lists,
Changes by Brett Cannon:
--
keywords: +patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1164
__
___
Python-bugs-list mailing list
Unsubscribe:
Alexey Suda-Chen added the comment:
--- tokenizer.c (revision 58161)
+++ tokenizer.c (working copy)
@@ -402,6 +402,8 @@
if (allocated) {
Py_DECREF(bufobj);
}
+ Py_XDECREF(tok-decoding_buffer);
+ tok-decoding_buffer = 0;
return s;
--
nosy:
Changes by Martin v. Löwis:
--
assignee: esr -
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin v. Löwis:
--
keywords: +patch -r-eyyy-mond
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin v. Löwis:
--
dependencies: - Elemental Security contribution - pgen2 package,
--install-base not honored on win32
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
Changes by Martin v. Löwis:
--
keywords: +py3k -patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Martin v. Löwis added the comment:
I doubt you are esr, although I'm uncertain how you hijacked his account.
Please stop spamming this tracker.
--
nosy: +loewis
resolution: - invalid
status: open - closed
__
Tracker [EMAIL PROTECTED]
Brett Cannon added the comment:
Note the patch is inlined in a message.
--
keywords: +patch, py3k
nosy: +brett.cannon
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1134
__
Guido van Rossum added the comment:
Looks Good, except I think it's a bad idea to release/acquire the GIL
for each character when writing the repr() of a string. Given that the
string is immutable and its refcount kept alive by the caller I don't
see a reason why you can't just reference the
Changes by Paul F. Dubois:
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Paul F. Dubois:
--
nosy: -esr
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1165
__
___
Python-bugs-list mailing list
Unsubscribe:
Brett Cannon added the comment:
Good point. I changed it on my machine and it cut that whole section
down to a single release/acquire.
I will go ahead and do this for the other types and then upload another
patch to be reviewed when it's ready.
__
Tracker
Brett Cannon added the comment:
OK, every PyTypeObject in Objects and Modules has its tp_print release
the GIL. Once someone OKs the patch I will apply it.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1164
__
Changes by sligocki:
--
versions: +Python 2.5 -Python 2.4
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1727780
_
___
Python-bugs-list mailing list
sligocki added the comment:
I've had this same problem with 2.5.1
Pickling random.getstate() on 64bit and then loading it back with
random.setstate() on 32bit does not work (crashes because of trying cast
64bit ints to 32bit).
The other way around is even worse. It loads but is in a faulty
New submission from Ian Kelly:
The ndbm functions in gdbm 1.8.1+ require the gdbm_compat library in
addition to gdbm.
--
components: Build, Extension Modules
files: gdbm_ndbm.diff
messages: 55939
nosy: ikelly
severity: normal
status: open
title: gdbm/ndbm 1.8.1+ needs libgdbm_compat.so
101 - 150 of 150 matches
Mail list logo