Does anyone know how I would go about conditionally raising an
exception in a decorator (or any returned function for that matter)?
For example:
def decorator(arg):
def raise_exception(fn):
raise Exception
return raise_exception
class some_class(object):
@raise_exception
d
whoops! The code should be:
def decorator(arg):
def raise_exception(fn):
raise Exception
return raise_exception
class some_class(object):
@decorator('meaningless string')
def some_method(self):
print "An exception should be raised when I'm called, but not
when I'm
I'm sorry about the typos, but that doesn't seem to be what the issue
is (I typed it into the textbox rather carelessly, I apologize :-( ).
It seems to be an issue with passing the decorator an argument:
Given:
def decorator(arg):
def raise_exception(fn):
raise Exception
return ra
Hello ,
I have written a code to get the page source of the google search
page .. this is working for other urls. I have this problem with
import re
from urllib2 import urlopen
string='http://www.google.com/search?num=20&hl=en&q=ipod&btnG=Search'
file_source=file("google_source.txt",'w'
Hello ,
I have written a code to get the page source of the google search
page .. this is working for other urls. I have this problem with
import re
from urllib2 import urlopen
string='http://www.google.com/search?num=20&hl=en&q=ipod&btnG=Search'
file_source=file("google_source.txt",'w'
b2.urlopen(req).read()
its still giving the error mentioned above .. Iam accessing the yahoo search
engine .. link is "http://search.yahoo.com/search?n=20&p=ipod";
I'm attaching the python file i have written just have a look and suggest me
something that works for this query
oves that have been shown to be be superior (this
speeds up the computer's response).
Carl G.
--
http://mail.python.org/mailman/listinfo/python-list
to be sure. I will need to solder together my own devices, as even
though the patents have expired, the old devices are still encumbered
by trademarks. I'll get back to you in 20 years after I have removed
the last traces of evil intellectual property from my life.
So long commrad,
Dean G.
--
Hi all,
I am new to python and don't yet know the libraries well. What would
be the best way to approach this problem: I have a html file parsing
script - the file sits on my harddrive. I want to extract the date
modified from the meta-data. Should I read through lines of the file
doing a string.f
e the html file
> parsing script you say you have already, or how the date is 'modified
> from' the meta-data.
>
> On Wed, Dec 2, 2009 at 10:24 PM, Mark G wrote:
> > Hi all,
>
> > I am new to python and don't yet know the libraries well. What would
> >
A while back I was working for a company and set up a little python script to
send out maintenance emails for some equipment we had set up in the field. The
script collected information about the equipment composed an email and sent it
out to interested persons. Then I left the company and they
if you prefix number with zero, it will turn into octal number... I
too wasn't aware of it... at least in python :/
http://en.wikipedia.org/wiki/Octal
It seems like bad practice to put zeroes before any decimal number in
any language :)
Juraj
--
http://mail.python.org/mailman/listinfo/python-list
Hi Team,
I am very new to this python world.
Below is my problem.
I have a "Machine A" where i want to execute some commands(dos commands from
command prompt), delete/create some files, delete/create some directories.
All this i need to do from my local host.
Is there a way which i can do? Can
Am 20.11.21 um 20:15 schrieb Ulli Horlacher:
Stefan Ram wrote:
r...@zedat.fu-berlin.de (Stefan Ram) writes:
except Exception as inst:
print( traceback.format_exc() )
More to the point of getting the line number:
As I wrote in my initial posting:
I already have the line number. I am
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for square_list in start_list:
x = pow(start_list, 2)
square_list.append(x)
square_list.sort()
print square_list
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
Please provide me the solution for the
Am 08.08.19 um 01:18 schrieb MRAB:
On 2019-08-07 21:36, Kuyateh Yankz wrote:
#trying to write a function that takes a list value as an argument and
returns a string with all the items separated by a comma and a space,
with and inserted before the last item. For example, passing the
previous sp
On Tue, Mar 24, 2020, 4:45 PM wrote:
I have the following scenario:
I have created lots of python files that I use to calculate a Cashflow
model, when I run these files I get a beautiful pandas DataFrame that
contains my final model. My mission is to show this table to the rest of
the compan
Am 25.03.20 um 15:21 schrieb farayao...@gmail.com:
Hello Paolo,
Thanks for your reply, indeed now I'm thinking on building a web app, do you
have any suggestions for this? I am thinking of using Tkinter, the method that
you describe using HTML is also using Javascript?
Kind Regards
Felipe
42)
66
>>>
--
// Today's Oblique Strategy (© Brian Eno/Peter Schmidt):
// Repetition is a form of change
// Brett g Porter * [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hello all.
i am trying to make some win32 binaries of M2Crypto 0.15
What I use is:
Python 2.3.3
openssl-0.9.7i
swigwin 1.3.27
I have build the openssl binaries and have installed the Swig binary
python dir is C:\Program Files\Plone 2\Python
openssl dir is c:\openssl
Swig dir is c:\swig
so I ha
or macros.
building '__m2crypto' extension
C:\SWIG\swig.exe -python -ISWIG -I"c:\openssl\include" -o SWIG/_m2crypto.c
SWIG/_m2crypto.i
SWIG\_lib.i(527): Error: Syntax error in input(1).
error: command 'swig.exe' failed with exit status 1
any help would be n
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas G. Apostolou wrote:
>
> >> C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128:
> > UserWarning:
> >> Unknown Extension options: 'swig_opts'
&g
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas G. Apostolou wrote:
>
> > I still get the error:
> > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file:
> > 'Python.h': No such file or di
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas G. Apostolou wrote:
>
> > So what you say is that the Python installed with Plone doesn't have
> > Python.h in ./include but Python installers from Python.org do have
access private attribute "%s"' % i
)
else:
obj = getattr(obj,i)
return obj
def list_public_methods(obj):
"""Returns a list of attribute strings, found in the specified
object, which represent callable attributes"""
Its ok now,
it seems the problem was that i had saved the file in UTF-8 format ???
I got it again and saved it in Greek(ISO) format and it now goes fine
"Thomas G. Apostolou" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all,
> I use Python
2\Zope\bin"
Do i HAVE to reinstall Plone and set it not to run as service?
Thank you in advance...
Thomas G. Apostolou
--
http://mail.python.org/mailman/listinfo/python-list
erwise".
If you're trying to return multiple values from a function, Python lets
you do that
>>> def multiFoo(x, y, z):
... return x*2, y*2, z*2
...
>>> x = 1
>>> y = 2
>>> z = 3
>>> x, y, z = multiFoo(x, y, z)
>>> x
2
>>> y
4
>>> z
6
>>>
--
// Today's Oblique Strategy (© Brian Eno/Peter Schmidt):
// Repetition is a form of change
// Brett g Porter * [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Roedy Green said something like:
> On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted
> or indirectly quoted someone who said :
>
>> recently i got a project that involves the use of php. In 2 days, i
>> read almost the entirety of the php doc. Finding it a breeze because it
Greetings!!!
I ran the following simple string commands in Linux + Python and the results
are:
[EMAIL PROTECTED] root]# python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>
e
> different( eventhough without '\n' are the same)
>
> Thanks for help.
> LAd.
>
Have you looked at the difflib module that comes with Python?
http://docs.python.org/lib/module-difflib.html
--
// Today's Oblique Strategy (© Brian Eno/Peter Schmidt):
// Change
he "It's" man) in _The First 20 Years
of Monty Python_ by Kim "Howard" Johnson (St. Martin's Press, 1989), p.20
--
// Today's Oblique Strategy (© Brian Eno/Peter Schmidt):
// Change instrument roles
// Brett g Porter * [EMAIL PROTECTED]
// http://bgporter.inknoise.com/JerseyPorkStore
--
http://mail.python.org/mailman/listinfo/python-list
. And at the end of the last
> loops do I somehow have to set my mySet to NULL? Any ideas here?
>
> --
> edward hotchkiss
>
>
>
>
>
> # Script to Evaluate every possible IP Address Combo, then write it to a
> text file
> # 9/15/05
>
Hi Stewart,
what about the other way, string -> var and not var -> string?
My suggestion:
mylist = ["a", "b", "c"]
for my in mylist:
if locals()[my] == None:
print "you have a problem with %s" % my
Paolo
Stewart Midwinter wrote:
I'd like to do something like the following:
a = 1; b = 2; c
[Rahul].
> I want to compute dot product of two vectors stored as lists a and b.a
> and b are of the same length
from scipy import dot
ans=dot(a,b)
This times faster than the alternatives I have seen mentioned so far,
given scipy.
Cheers,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/
"Alan G Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This times faster than the alternatives I have seen mentioned so far,
> given scipy.
Actually, since I am new to 'timeit', I probably should check that
I am not overlooking something. Es
I need a clarification of the argument.
Are the opponents saying that I should not be able to:
def compose(list_of_functions): return reduce(lambda f, g: lambda x:
f(g(x)), list_of_functions)
In a nutshell: why?
And may I see the proposed "better" replacement for function compositio
So as I understand it, so far the "best" proposal for a
replacement of my function-composition function
uses a (compatibility reducing) Python 2.4 feature
that Nick suggests will end up on "Gotcha" lists.
Hmmm: lambda is looking pretty good, I'd say.
The readability issue is valid, of course. Bu
Good Morning.
I am new to Tkinter. I have been testing the installation of Tkinter
through the python web site. The first two test steps give no errors,
'import _tkinter' and 'import Tkinter'. However, the third step,
'Tkinter._test', gives the error:
An
Eric Brunel wrote:
On Tue, 19 Apr 2005 09:35:03 -0400, Peter G Carswell <[EMAIL PROTECTED]>
wrote:
Good Morning.
I am new to Tkinter. I have been testing the installation of Tkinter
through the python web site. The first two test steps give no errors,
'import _tkinter' and
.py", line 3118, in _test
label = Label(root, text=text)
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 2285, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1780, in __init__
self.tk.cal
Hi list,
I'm happy to join to this nice mail list. At my company we use
python to handle system administration tasks.
I found the next problem during my work:
test.py:
# cat test.py
#!/usr/bin/python
import os
os.statvfs('/')
r
Hi,
not yet, I will check it today, thanks for the idea !
We may have some deeper problem...
Br,
Peter.
On 10/15/2011 05:46 PM, ext Kev Dwyer wrote:
Peter G. Marczis wrote:
Hello Peter,
Welcome to the list.
Have you tried calling statvfs from a C program? What happens if you do?
Best
After reading and searching for a while i found that all about running
ZService as service start from C:\Program Files\Plone
2\Data\bin\zopeservice.py
But still i cannot fully understand where the server is called so that i
replace it with z2s.py or what ever needed...
Any ideas?
"Tho
BartlebyScrivener wrote:
> Even without the marker, can't you do:
>
> sentence = "the fabric is red"
> colors = ["red", "white", "blue"]
>
> for color in colors:
> if (sentence.find(color) > 0):
> print color, sentence.find(color)
>
That depends on whether you're only looking for who
Lars Rune Nøstdal said something like:
> hi,
> everyone thinks youreoay faggot and that youreh stupid .. now go
> fugkght yourselfes
>
> peasse out .. yo!
Idiot.
--
http://mail.python.org/mailman/listinfo/python-list
'/~connolly/'.
unquote_plus(string)
Like unquote(), but also replaces plus signs by spaces, as required
for unquoting HTML form values.
--
// Today's Oblique Strategy (© Brian Eno/Peter Schmidt):
// Accretion
// Brett g Porter * [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Justin Azoff wrote:
> Tom Plunket wrote:
>> boilerplate = \
>> """
> [big string]
>> """
>>
>> return boilerplate % ((module,) * 3)
>>
[deletia...]
> Of course..
>
stuff = {'lang': 'python', 'page': 'typesseq-strings.html'}
print """I should read the %(lang)s documentation at
Many thanks to those of you who responded to my question about
anonymous functions with local variables, filling me in on
e) do something else clever and Pythonic that I don't know about yet?
by pointing out that I can use (among other good things) lambda with
default arguments. That should sui
From: "danielx" <[EMAIL PROTECTED]>
Date: 22 Jul 2006 01:43:30 -0700
Boris Borcic wrote:
> does
>
> x.sort(cmp = lambda x,y : cmp(random.random(),0.5))
>
> pick a random shuffle of x with uniform distribution ?
...
Let e be the element which was in the first position t
Subject: Re: random shuffles
To: python-list@python.org
Ross Ridge wrote:
> David G. Wonnacott wrote:
> > Couldn't we easily get an n*log(n) shuffle...
>
> Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle
> algorithim is well known
In response to my question, ``What is the idiomatically appropriate
Python way to pass, as a "function-type parameter", code that is most
clearly written with a local variable?'', a number of you made very
helpful suggestions, including the use of a default argument; if one
wanted to give a name to
but in cases like this where you don't know in
advance what the class will need to handle, it lets your code hide the
magic in a way that lets the users of your code forget that there's
anything magic going on at all. It just looks like code.
--
// Brett g Porter * [EMAIL PROTECTED]
// http://www.bgporter.net/blog
--
http://mail.python.org/mailman/listinfo/python-list
being consistent).
Pushing the scutwork down onto tools is not as good a solution as
eliminating the scutwork, especially when it shouldn't be necessary at
all...
--
// Brett g Porter * [EMAIL PROTECTED]
// http://www.bgporter.net/blog
--
http://mail.python.org/mailman/listinfo/python-list
My class MyClass reuses many default parameters
with a small number of changes in each instance.
For various reasons I decided to put all the
parameters in a separate Params class, instances
of which reset the default values based on keyword
arguments, like this:
class Params:
def __init__(se
On Sun, 12 Nov 2006 02:14:32 -0500, Doug <[EMAIL PROTECTED]> wrote:
> I was going to link to
> a definition of FUD to show I really meant to use that term.
Oooh.
If you had just mentioned your dyslogia,
it would have saved us all some time.
Thanks!
Alan
--
http://mail.python.org/mailman/listinfo/
I've been searching google and this group for a while now for a good
tutorial on making a Tetris-style game in Python. I hear Tetris is a
good starting point, and although I am fairly new to programming I
think I would learn best if I had some code to experiment with because
without a tutorial I ha
I read a file into a buffer and subject it to re.sub()
I can replace every occurrence of a pattern with a fixed string but when
I try to replace each occurrence with a string that changes (by having
an incrementing number in it, (ie 'repTxt[1]','repTxt[2]'etc), I note
that the incrementing number g
I V wrote:
> Frank Potter wrote:
>> Does google supply some webservice to programmers? I did see
>
> Googling for "google api" gets you to:
>
> http://www.google.com/apis/
>
> It appears to be a SOAP API, which you can access with python, but I
> think you'll need a third-party library. Googling
get the message that patterns apply a lot differently in python as compared to the {...;} languages.
Details here.http://mindview.net/Books/Python/ThinkingInPython.html-- Thomas G. Willis---
http://i-see-sound.comhttp://tomwillis.sonicdiscord.comAmerica, still more rights than North Korea
--
http://mail.python.org/mailman/listinfo/python-list
people answering
> questions without any problem and it goes very well
>
> Thanks
Don't forget that there's also the Tutor list (see
http://www.python.org/mailman/listinfo/tutor ), targeted to people
looking to learn the language...
--
// Today's Oblique Strategy
On Sun, 22 May 2005 10:29:50 +0300, "gralex" <[EMAIL PROTECTED]> wrote:
>Hi,all!
>
>How i can manually start CellEditor in wxGrid for spicified Cell in grid in
>my programm:
>
>mygrid.SetGridCursor(2,3)
>mygrid.MakeCellVisible(2,3)
># starting editing... ??
>mygrid.ShowCellEdi
Paul McGuire coughed up:
> Is this supposed to be some sort of wake-up call or call-to-arms to
> all the CS lemmings who have been hoodwinked by Sun into the realm of
> jargon over substance?
...[rip]...
> You certainly seem to have a lot of energy and enthusiasm for these
> topics. It would be
John W. Kennedy coughed up:
> alex goldman wrote:
>> John W. Kennedy wrote:
>>
>>
>>> Strong
>>> typing has been a feature of mainstream programming languages since
>>> the late 1950's.
>>
>>
>> Is Fortran a strongly typed language? I don't think so. Strong
>> typing has been invented in the 70's,
[EMAIL PROTECTED] coughed up:
> Thomas G. Marshall wrote:
>
*Missattributed* --Thomas G. Marshall (I) did /not/ write the following:
>>> I am not familiar with modern Fortran. Surely it at least has
>>> argument prototyping by now?
>
> Since the 1990 standa
Xah Lee coughed up:
> The Rise of "Static" versus "Instance" variables
You are clearly unable to form a proper argument, *AND* you have irritated
nearly everyone frequently.
Ahthe blessed silence
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> The last I have seen is
> http://mail.python.org/pipermail/python-3000/2007-January/005284.html
OK. Thanks.
> Do you care to explain what is broken?
I suppose one either finds coercion of arithmetic operations to int
to be odd/broken or does not. But that's all I meant
>>> None >= 0
False
>>> None <= 0
True
Explanation appreciated.
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
what is the simplest way to upload a file (or a long string) to a
server using cgi/python?
Since I want to upload the data programmatically, a form based
solution is not good. I am not experienced with SOAP/WSDL and I
believe that would be more difficult than necessary. The client
program
Thanks for your replies, however I think urlllib can not help me here.
I have control over the server side (I can write a cgi-script in
python), but I have very little control on the client side (I have to
use VBA).
Kind regards,
Karsten.
--
http://mail.python.org/mailman/listinfo/python-list
On 30 Apr., 15:51, "Dave Borne" <[EMAIL PROTECTED]> wrote:
> > Since I want to upload the data programmatically, a form based
> > solution is not good.
>
> Karsten,
> Could you explain this statement? When I want to move data to a
> server in a CGI environment, a form post is the easiest way I can
OK, I think I have a simple solution now. I am going to use FTP in my
VBA-Client (it's possible) and don't need to do any server-side
programming.
Kind regards,
Karsten.
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
> Not really, but that depends on what you know about the concept of sets and
> maps as collections of course.
>
> The contract for sets and dicts doesn't imply any order whatsoever. Which is
> essentially the reason why
>
> set(xrange(10))[0]
>
> doesn't exist, and quite
Robert Kern wrote:
> http://docs.python.org/lib/typesmapping.html
> """
> Keys and values are listed in an arbitrary order which is non-random, varies
> across Python implementations, and depends on the dictionary's history of
> insertions and deletions.
> """
Even this does not tell me that if I
I've been studying python for 2 weeks now and got stucked in the
following problem:
for j in range(10):
print j
if(True):
j=j+2
print 'interno',j
What happens is that "j=j+2" inside IF does not change the loop
counter ("j") as it would in C or Java, for example.
Am I missing so
On May 12, 2:45 pm, Basilisk96 <[EMAIL PROTECTED]> wrote:
> On May 12, 12:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote:
>
>
>
> > I've been studying python for 2 weeks now and got stucked in the
> > following problem:
>
> > for j
On May 12, 3:09 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote:
> Cesar G. Miguel wrote:
> > -
> > L = []
> > file = ['5,1378,1,9', '2,1,4,5']
> > str=''
> > for item in file:
> >
On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote:
> > Actually I'm trying to convert a string to a list of float numbers:
> > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0]
>
> str="53,20,4,2"
> map(lambda s: float(s), str.split(','))
>
> Last expression returns: [53.0, 20.0, 4.0, 2.0]
>
On May 12, 8:13 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> Cesar G. Miguel <[EMAIL PROTECTED]> wrote:
>
> > On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote:
> > > > Actually I'm trying to convert a string to a list of float numbers:
> >
l Message-
> From: Dan Fabrizio [mailto:[EMAIL PROTECTED]
> Sent: Saturday, May 26, 2007 3:46 PM
> To: python-list@python.org; George, Harry G
> Subject: Using python for a CAD program
>
> Hello,
>
> I saw your post from last year about using python for a EE
> CAD pr
Robert Dailey wrote:
> Hi,
>
> I have the following code:
>
> str = "C:/somepath/folder/file.txt"
>
> for char in str:
> if char == "\\":
> char = "/"
>
> The above doesn't modify the variable 'str' directly. I'm still pretty
> new to Python so if someone could explain to me why th
Steven D'Aprano wrote:
> I'd be interested in hearing people's stories of Eureka moments in Python,
> moments where you suddenly realise that some task which seemed like it
> would be hard work was easy with Python.
Mine was definitely when I was first working with the xmlrpc module, and
I was pu
Dustan wrote:
> On Mar 13, 10:05 am, Brett g Porter <[EMAIL PROTECTED]> wrote:
>> Steven D'Aprano wrote:
>>> I'd be interested in hearing people's stories of Eureka moments in Python,
>>> moments where you suddenly realise that some task which see
I'm getting the following trace in python 2.5:
Traceback (most recent call last):
File "./template_unittest.py", line 36, in
zencc.start_browser(machines.zones[0].devices.get_primary_servers()[0])
File "/home/bean/code/automation/nrm-qa/trunk/brimstone/lib/zcc.py", line
221, in start_browse
Pardon the vocab question;
I'm not a computer science type.
According to the Reference Manual,
a class defintion has the structure::
classdef ::= "class" classname [inheritance] ":" suite
What is the entire part before the suite called?
(Just pointing to a reference is fine & helpful,
Steven Bethard wrote:
> As far as I
> know, there's no official term for the first four elements of a class
> statement. I'd probably call it the class statement header.
That will have to do for now.
Thanks!
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 14, 12:54 pm, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> Hello there,
>
> I'm exploring possibilities of using python as an alternative to Matlab.
> The obvious way to go seems to be matplotlib for plotting, but I do like
> GLE http://glx.sourceforge.net/> a lot. One reason is that w
other, using strictly Open Source Software, and enjoying
the process. .NET/Mono and C# don't pass either the "lots" or the
"enjoy" tests.
> -Original Message-
> From: egbert [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 24, 2007 10:05 AM
> To: Ge
Hendrik Maryns <[EMAIL PROTECTED]> writes:
> ___
> /| /| | |
> ||__|| | Please do |
> / O O\__ NOT |
> /
Diez B. Roggisch wrote:
> [EMAIL PROTECTED] wrote:
>
> Maybe the built-in string interpolation is sufficient?
>
> print "Hello %(name)s" % dict(name="Peter Pan")
Or in recent pythons, the built-in string templating system (see
http://docs.python.org/lib/node109.html)
>>> from string import
Steven D'Aprano wrote:
> In fact, "fastest" isn't even a meaningful attribute. Does it mean:
>
> * the worst-case is fastest
> * the best-case is fastest
> * the average-case is fastest
> * fastest on typical data
> * all of the above
I confess that it did not occur to me that there
might be an
SMALLp wrote:
> Hy. How to use printer in python.
http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html
--
http://mail.python.org/mailman/listinfo/python-list
http://www.scipy.org/Cookbook/InputOutput>
hth,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Is the behavior below expected? Documented?
(The error msg is misleading.)
Thanks,
Alan Isaac
>>> x = range(20)
>>> s = slice(None,None,2)
>>> x[s]
Traceback (most recent call last):
File "", line 1, in
TypeError: sequence index must be integer, not 'slice'
--
http://mail.python.org/mailman/li
On 1/16/2009 1:15 PM Paul Rubin apparently wrote:
range is an iterator now. Try itertools.islice.
Well yes, it behaves like xrange did.
But (also like xrange) it supports indexing. (!)
So why not slicing?
I expected this (to keep it functionally
more similar to the old range).
Alan Isaac
--
h
It is documented:
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range
--
http://mail.python.org/mailman/listinfo/python-list
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range
I see no mention of the tuple methods?
Right after the paragraph
"Most sequence types support the following operations."
it seems appropriate to have one stating
"Most sequence types support the
Alan G Isaac wrote:
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range
I see no mention of the tuple methods?
Right after the paragraph
"Most sequence types support the following operations."
it seems appropriate to have one sta
On 1/16/2009 6:44 PM Terry Reedy apparently wrote:
http://bugs.python.org/issue4966
Is this another lacuna or am I overlooking it?
I cannot find the 3.0 documentation of string
formatting with the ``%`` operator.
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
In Python 3, you can no longer ``exec(open(filename))``.
I guess the reason is that in 3.0 ``open`` returns a stream,
instead of open file, and exec wants
"a string, bytes, or code object" and not a "TextIOWrapper".
So it returns an error.
Is it intentional that ``exec`` cannot handle a TextIOWr
101 - 200 of 389 matches
Mail list logo