Donn Cave wrote:
> Actually I'd make it a little less compact -- put the "break"
> on its own line -- but in any case this is fine. It's a natural
> and ordinary way to express this in Python.
>
> ...
> | But I get a syntax error.
> |
> | while c = f.read(1):
> |^
> | SyntaxError:
I've always accepted the None vs. 0 as a cavaet of the added
convenience but I think it's ultimately worth it.
Sorry, I didn't want to start a
"nothing values evaluate to false" argument.
I'll go read python-dev archives a bit and see if there's anything
useful for me to know.
Thanks
--
http:/
quot;while ", is NOT restricted to being in
> (True, False). See section 5.10 of the Python Reference Manual:
I'm sorry! I realise that now and I'm sorry to have caused the traffic
I did. Thank you for pointing it out to me though - it's pretty
fundamental Python!
*Greg th
That is both clever and useful! I never would have thought of doing
that.
This seems to me like a general way to "workaround" the Python
statement/expression separation woes I've been having, in cases where I
really really want it.
Now, where can I copy this out to so I will be able to find it wh
> On the other hand, if you've already
planned another pass over the code, that might be the time to look
into this.
Exactly. And when I do that pass I will definitely try buffering the
data 10 or 100 meg at a time before entring the 1 char-at-a-time loop,
or using mmap to similar ends.
--
http:
John Machin wrote:
> Sigh indeed. If you need to read it a character at a time to parse it,
> the design is f***ed.
There is always the potential to do 2k buffered reads and once in
memory pick the contents apart character-wise.
I assume something similar would happen for tokenising XML and HTML
Robert Kern wrote:
> > Robert> Please quote the message you are replying to. We have no
> > Robert> idea what "the 2nd option" is.
> >
> > I think he means the second option you presented
> >
> > If you must read one character at a time,
> >
> > def reader(fileobj, blocksize=1):
> >
OnOpen, id=ID_OPEN)
^^
etc.
-greg
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
i am looking for an idea on how to handle un-nesting tags.
i know i can use something build on top of a htmltidy, but i'm rather
wondering if this could be done using only python standard library. my
input tags can not be crossed (i mean " w1 w2 w3 " is
impossible from my input)
actuall
Currently I am launching adobe reader using the following call:
os.system("path.file.pdf")
this works fine for opening the pdf doc at the beginning. We would like
to enhance this and open the document to either a page or a nameddest
in the doc. The syntax for that in the DOS command prompt world i
Diez B. Roggisch wrote:
> I tried to find out if subway and
> rails can do the same - that is, generate the sql. For subway the lack
> of documentation prevented that, and I didn't find it in rails , too.
In Rails you can do that with the command:
$ rake db_structure_dump
However I think it's n
0_en.pdf"')
I'm going to give your method a try to see if it launches any quicker.
Thanks again.
Greg Miller
--
http://mail.python.org/mailman/listinfo/python-list
Thank you for the information, when I launched the Reader on the actual
hardware it launched quickly. I think I just have too much running on
my application PC. I will consider starting an AcroReader app however.
Greg
--
http://mail.python.org/mailman/listinfo/python-list
== '__main__':
import astandardmodule
astandardmodule.appendRelativeIncludePath('..', '..')
import mymodule
Which, as you can see, is much shorter. ;)
--
Greg McIntyre
--
http://mail.python.org/mailman/listinfo/python-list
ntly isn't:
>>> def f():
... return 2+3
...
>>> import dis
>>> dis.dis(f)
2 0 LOAD_CONST 1 (2)
3 LOAD_CONST 2 (3)
6 BINARY_ADD
7 RETURN_VALUE
8 LOAD_CONST
Giovanni Bajo has put together a Pyrex release incorporating
patches to address the Python 2.4 distutils compatibility
problem and the GCC 4 lvalue cast problem.
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
Thanks to Giovanni for filling a gap until I can get back
to working on Pyrex
use os.path.walk, although it's not quite as
newb friendly.
-greg
--
http://mail.python.org/mailman/listinfo/python-list
ode (except the mp3 filename, of course) on my
machine and it worked fine. ActivePython 2.3.4 and Pygame 1.6. Could it
be a hardware problem?
-greg
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Epler wrote:
Unlike Perl, Python implements only a *finite turning machine*
That's interesting -- I didn't know Python could be
used as a lathe. You learn something new every day!
I suppose an "infinite turning machine" would
be a really *big* lathe...
--
Greg Ewing, C
ursive function), both of which require
statements.
Lambdas can give you one-line functions, local variable
binding, if-then-else capabilities, and recursion. Everything
else should be possible from there.
As a fellow named Church once pointed out, lambdas are really
*all* you need in a language..
disallowing it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
Sion Arrowsmith wrote:
Greg Ewing <[EMAIL PROTECTED]> wrote:
As a fellow named Church once pointed out, lambdas are really
*all* you need in a language...
... where as others argue that it is impractical not to have
some form of runtime data storage, thereby giving rise to the
separat
I'm on a Linux box running python 2.3 and would like to connect to a
postgres database via SSL, but have not been able to find a module to do
this (or haven't figured out the syntax). Can anyone help me out?
Thanks,
--greg
--
Greg Lindstrom 501 975.4859
Computer
lback threads execute. (This call is made
automatically if you are creating new threads using Python's thread
module, but if the new threads are created by some C code, you need to
call it yourself.)
---
Greg Chapman
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Greg Chapman wrote:
>
> > Your callback function needs to hold the Python GIL (and have a
> > vaild threadstate) before it calls any Python C-API functions.
> > Change the last part of it to:
> >
> >PyGILState_STATE state;
> >
PIL application?
Thanks again!
--greg
--
Greg Lindstrom 501 975.4859
Computer Programmer [EMAIL PROTECTED]
NovaSys Health
Little Rock, Arkansas
"We are the music makers, and we are the dreamers of dreams." W.W.
--
http://mail.python.org/mailman/listinfo/python-list
I actually tried this last summer on linux and I think in order to
make it work right I had to use the hotplug features AND udev. I had
to use udev because I needed a specific mount path, otherwise it just
picked the next in the list if there was more than one drive.
I ended up skipping that proj
more common/accepted way to perform this task? I'm using Python
2.3 on Linux.
Thanks for your help,
--greg
--
Greg Lindstrom 501 975.4859
Computer Programmer [EMAIL PROTECTED]
NovaSys Health
Little Rock, Arkansas
"We are the music makers, and we are the dreamers
any other nonsense parameters.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
irection. How can I perform the above task while keeping my sanity?
Thanks!
--greg
--
Greg Lindstrom 501 975.4859
Computer Programmer [EMAIL PROTECTED]
NovaSys Health
Little Rock, Arkansas
"We are the music makers, and we are the dreamers of dreams." W.W.
--
n got the "Python installed correctly" screen). Reboot. When I
open a dos window and type "python" I am told it doesn't know that that
is! The file association with seems to work. Do I need to map the PATH
myself? Everything's in the default directory (C:\Pytho
don't have the
working directory set, launches the app directly, etc.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
changed. Anyone know what I'm doing
wrong? (Note: minidom loads it just fine...)
Thanks,
Greg Wilson
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
in CPython the way it currently works. Guido seems
to be against this sort of thing, though, as he
seems to regard it as a useful feature that the
for-loop control variable is not local to the
loop.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Ze
er.foo()
This allows you to rename A and only have to change one super call to
reflect the new name.
---
Greg Chapman
--
http://mail.python.org/mailman/listinfo/python-list
Greg Chapman wrote:
> Steven Bethard wrote:
>
> > When would you call super with only one argument? The only examples
> > I can find of doing this are in the test suite for super.
> >
>
> I think it's to allow something like this:
>
> class A(B, C
Jeremy Bowers wrote:
The only punctuation you *need* is whitespace. See Forth
You don't even need that... see FORTRAN. :-)
DOI=1TO10-ly,
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.pytho
no guaranteed relationship between the
chunks of data written to one end of a pipe or socket
and those returned by reading the other end. So you'd
still need to be prepared to buffer and re-chunk the
data. You'd end up doing all of what I outlined above,
with the extra complication of
If so, it would seem that
reading a non-blocking disk file would *never* return
any data...
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
Donn Cave wrote:
Yes, this looks right to me, but I think we're talking
about os.read(), not fileobject.read().
Indeed, you shouldn't be mixing select() with buffered
io, or all kinds of bad things can happen.
Everything I said applies to OS-level reads and
writes, not stdio-level one
st you
keep the __init__ and setConfig operations separate,
and live with having to call setConfig after creating
an object. Factory functions could be provided if
you were doing this a lot.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, N
) algorithm
instead of an O(n**2) one.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
ster.__init__ to fire, which it didn't.
What does 'klass=Tester'
actually do on line 05?
Line 10 - Seems that the syntax 'Tester()' actually causes
the __init__ method to
fire. Is this the only case?
Line 12 - At this point, I was thinking of Tester.stuff as a
sta
then pass it a tuple with the
values for that record. Just a thought.
So, gurus, what are your suggestions to tame this record? Are there
easier ways that I'm just not seeing?
Thanks,
--greg
--
http://mail.python.org/mailman/listinfo/python-list
LutherRevisited wrote:
I know in .NET text boxes have a focus method which will do
this, but I can't find anything similar in the places I've looked so far.
wxPython does, in fact have such a method. It's called SetFocus. It's
actually a wx.Window method, so all control
work for me, but if you have win32all installed, you can get it
from Python:
>>> import win32api
>>> print "Uptime:", win32api.GetTickCount(), "Milliseconds"
Uptime: 148699875 Milliseconds
hth
greg
--
http://mail.python.org/mailman/listinfo/python-list
s.python.org/lib/built-in-funcs.html
Otherwise, you'll have to explain a bit more--that's my best guess as to
what your issue is.
Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
You might also try deleting any *.pyc files, Python will just recompile
them next time around.
greg
--
http
The directory structure is then
yourpackage/
__init__.py
python23/
cppmymodule.pyd (2.3 version)
python24/
cppmymodule.pyd (2.4 version)
but at run time it will appear as though one version or
the other of cppmymodule is a direct submodule of
yourpackage.
--
Greg Ewing, Co
Leif K-Brooks wrote:
Noah wrote:
The problem is that my users want to see .sit files.
I know it's sort of silly. Zip files are foreign and frightening to
them.
Would Stuffit open zip files renamed to .sit?
Yes! I just tried it, and it works.
--
Greg Ewing, Computer Science Dept,
Universi
str()
and repr() on floats:
Python 2.3.4 (#1, Jun 30 2004, 16:47:37)
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str(3.2)
'3.2'
>>> repr(3.
--
you should be passing the same dictionary for both scopes:
g = {}
exec stuff_to_define in g, g
# definitions are now in g
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
, defaultfactory())
return defdict
That looks really nice!
I'd prefer a more elegant name than 'defaultdict', though.
How about 'table'?
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
confusion would result.
Can you think of any situation in which surprising
behaviour would occur through someone thinking the
parallel was closer than it is?
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http
George Sakkis wrote:
As for naming, I would suggest reset() instead of set(), to emphasize that the
key must be there.
make() is ok; other candidates could be add() or put().
How about 'new' and 'old'?
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
a cell in this case, just passing the
value of x as an implicit parameter to the generator.
How do I disassemble the generator?
You'd have to get hold of the code object for it
and disassemble that. There should be a reference to
it in one of the co_consts slots, I think.
--
Greg Ewing, C
cond statement is going
to overwrite the first one. If you want to append
data to an existing file, you need to open it in
'a' mode.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
, and give us a computing environment
that's truly elegant from the ground up! :-)
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
If she's interested in creating web sites, maybe you could
introduce her to some simple CGI programming?
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
Sean McIlroy wrote:
I did try it, and it didn't work either. It appears there must be
something wrong with my computer, hopefully something benign.
Just a thought: Is your computer's clock set correctly?
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christc
a single file
object for independent reading and writing at the same
time. C stdio implementations tend to get confused if
you try to do that.
You may have other problems as well, but you'll at least
need to open two separate file objects.
--
Greg Ewing, Computer Science Dept,
University of C
globals at all, including other
functions and classes defined in the same module --
which you may find rather inconvenient!
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listi
n be used as a truth value. Non-empty
lists count as true; empty lists and None count as false.
* The 'and' and 'or' operators short-circuit: if the first
operand determines the result, the second operand is not
evaluated.
* Negative list indices are counted from the e
Steven Bethard wrote:
py> def defaultdict(*args, **kwargs):
... defaultfactory, args = args[0], args[1:]
which can be written more succinctly as
def defaultdict(defaultfactory, *args, **kwargs):
...
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch,
e
parallel's a little weaker here because calling iter doesn't always
produce objects of type iter:
Indeed, I see iter() as being more like len(), which
is clearly a function, not a constructor. Making iter()
a type and giving it class methods would be strange.
--
Greg Ewing, Computer Sc
Ville Vainio wrote:
The issue that really bothers me here is bloating the builtin
space. We already have an uncomfortable amount of builtin
functions.
Maybe what we're really after here is the notion of a
builtin module that's pre-imported into the builtin
namespace.
--
Greg Ewing
Paul McGuire wrote:
The code was filled with two key variables: t_1 and t_l. Printing out
the source in a Courier font made these two vars completely
indistinguishable,
Are you sure it was Courier? I'm looking at it now
in Courier, and they are different, although very
similar.
--
Greg
ing that you need to
add 1.
3) You have a starting point and an ending
point: lst[s:e+1].
Again, you don't really have an ending point.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.py
it easy on me if you please...I just don't see it and
have a deadline rushing towards me. How do I read the data from a file
in a zip archive?
Thanks!
--greg
--
Greg Lindstrom 501 975.4859 (office)
Senior Programmer501 219-4455 (fax)
NovaSys Health [
[EMAIL PROTECTED] wrote:
I'd love to do the whole thing in Python, but I don't know how to make
a DLL purely from Python.
I don't think you can do it *purely* in Python. You'll at
least need a C or Pyrex wrapper which dispatches to Python
code.
--
Greg Ewing, Computer Science
etter_name = intern('set_' + name)
return property(
lambda self: getattr(self, getter_name)(),
lambda self, value: getattr(self, setter_name)(value),
None,
doc)
Usage example:
class MyClass(object):
...
spam = overridable_property('spam
joined can be unicode, though:
>>> str.join(" ", [u"a", u"b"])
u'a b'
So it's probably not a serious problem, since in most
cases you'll know whether the joining string is unicode
or not when you write the code. If not, you'll just
have to do it the "new" way.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
mal output of a program,
to be seen by the user.
* repr() is for debugging output, and should indicate
reasonably unambiguously the *type* of the object.
When debugging, it's often at least as important to
know what type of object you have as what value it
has.
--
Greg Ewing, C
if
you want.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
Joey C. wrote:
the issue with the
temporary file is that when I write something new to it, if the old
contents of the file was larger, not all of it will be overwritten.
Not if you open it with
f = open(filename, "w")
which will delete any previous contents the file
may have had.
--
this purpose, as
?print "foo =", foo
has a nice hint of "WT?%$%$ is going on at this point?"
to it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
nce between unsurprising and boring.
The coffee I drank this afternoon, for instance, did
not surprise me, but I still enjoyed it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
atomicity of the cake-ingestion
operation will become apparent.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
.)
Maybe there is some good documentation available, but I cannot find it.
I found most of this out by reading the source, I think.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
gf gf wrote:
Really! That's a pity... Instead of trying to
recreate a repository the size of CPAN, a Python
interface to Perl modules is really called for.
When Parrot comes on line, this presumably will
become trivial...
--
Greg Ewing, Computer Science Dept,
University of Cante
By the way, is the Parrot project still alive,
or has it been given up on?
Not that I actually want it, but the idea is
kind of morbidly fascinating.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http
made the weak ref point to the Foo, not the
RealFoo.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
t like this:
EVT_MENU(self, wxID_FIREFOX, curry(self.OnLaunch, path='D:\Program
Files\Mozilla Firefox\Firefox.exe'))
Then change your OnLaunch handler back to the way you originally wanted it:
def OnLaunch (self, event, path):
print event.GetString()
os.startfile(path)
f.__dict__,
self.__class__, self.__class__.__dict__, or some other magic
properties.
such as
def unpickle(self):
new_self = pickle.load(open(self.getFilePath('pickle')))
self.__class__ = new_self.__class__
self.__dict__.update(new_self.__dict__)
--
Greg Ewing, Computer S
If I remove the import sys and sys.exit(0) then type ./myotherfile.py at
the command line it runs as expected. Both files have the same
permission settings (744) and owner (me). I'm been looking at this for
a couple of days and am at a loss. Have any of you seen anything like
this and what
inally say something that gets into Quote of the
Week, and it's attributed to someone else! :-) :-) :-)
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
database copying.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
Peter Maas wrote:
This is only true for trivial bash scripts. I have seen bash scripts
which were quite hard to read especially for beginners.
I've seen shell scripts which are quite hard to read
even for experts!
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christc
Mike Meyer wrote:
Gee, it's changed from eight to eighty. Probably because eight is a
small app by todays standards. Then again, it's not like 80 is large
these days.
Yeah, it's probably time to upgrade it to 800. :-)
--
Greg Ewing, Computer Science Dept,
Universit
> He says,
> Do you know how I can get "base12 pi"?
> Because the chromatic scale is base12.
> c c# d d# e f f# g g# a a# b
>
> Dick
It might feel more "natural" to do this with 'e' (2.718...)
--greg
--
http://mail.python.org/mailman/listinfo/python-list
I just discovered that a few minutes ago, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
emented?) string.
It spans multiple lines.
"""
print type(foo)
print foo
The output is:
This is a dedented (or perhaps demented?) string.
It spans multiple lines.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.c
aps I
missed a section of the documentation; if I did, I apologize. Can
anyone show me how to use this package?
Thanks,
--greg
--
Greg Lindstrom 501 975.4859 (office)
Senior Programmer501 219-4455 (fax)
NovaSys Health [EMAIL PROTECTED]
Little Rock, Arkansas
&q
is invisible at compile time, so the compiler misses it,
and the run-time evaluation fails.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
od syntax for
this that isn't skewed towards one kind of use case.
That's probably a large part of the reason why nothing
like it has so far been seriously considered for
adoption.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.
'', '', '']
>>> "*".split("*")
['', '']
>>> "".split("*")
['']
The split() method is really doing two somewhat different things
depending on whether it is given an argument, and the end-cases
come out differently.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
And
there are probably some cases where this code still wouldn't work...
Note that in general it's impossible to tell exactly
which function object was involved, since there could
be more than one function object sharing the same code
object, and the frame only references the code object
, there wasn't any established
convention.
Hopefully the stdlib naming will gradually get ironed
out as the oldest bits get deprecated. The tutorial
could probably do with being updated, too.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
rned by using it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list
arguments to be
in the form of a tuple, and if you give it something else,
it wraps it up in a 1-element tuple and uses that instead.
This seems to happen even with a custom subclass of tuple,
so it must be doing an exact type check.
So it looks like you'll have to parse the format string.
--
Peter Otten wrote:
Greg Ewing wrote:
This seems to happen even with a custom subclass of tuple,
so it must be doing an exact type check.
No, it doesn't do an exact type check, but always calls the tuple method:
I guess you mean len(). On further investigation,
this seems to be right, except
701 - 800 of 1198 matches
Mail list logo