e issues aside, I
> think it would be a good idea if built-in functions behaved exactly
> the same as normal functions.
As Steven D'Aprano showed they behave like normal functions. Even pure
Python functions can have arguments without names:
def spam(*args):
pass
Ciao,
Mar
to stuff them as static methods into classes or even
uglier you see code like ``Spam().spammify(eggs)`` instead of a plain
function call.
And functions are first class objects in Python. That sounds quite OO to
me. You can think of a module with functions as a singleton.
Ciao,
Marc
blocksize * number of blocks math to get
> the % of used space.
Just go ahead and do it:
In [185]: stat = os.statvfs('/')
In [186]: stat.f_bsize
Out[186]: 4096
In [187]: stat.f_blocks
Out[187]: 2622526L
In [188]: stat.f_bsize * stat.f_blocks
Out[188]: 10741866496L
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
misunderstand his intention. He wanted to give the
optional third argument of `getattr()` as keyword argument.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
().
>>
>> But consider rewriting the following:
>>
>> def table(func, seq):
>> return zip(seq, map(func,seq))
>>
>> table(len, ('', (), []))
>
> table(lambda x:x.__len__(), ('',[],()))
>
> What was the point again ?
Beauti
")
…this line will raise an exception. `file.write()` takes just one
argument, not three as in this call. If you don't get an exception maybe
you have other places with a bare ``except`` like in the snippet above.
Don't do that. Catch the specific exception you want to handle with an
``except`` and not simply *all*.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
te over `something` directly. That loop can be written as:
for pixval in data:
rgb = pixval2rgb(pixval)
rgbs.append(rgb)
Or even shorter in one line:
rgbs = map(pixval2rgb, data)
If the `numpy` array is what you want/need it might be more efficient to do
the RGB to "pixval" conversion with `numpy`. It should be faster to shift
and "or" a whole array instead of every pixel one by one in pure Python.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
>
> idiom, which is a bit of a pity I think.
And what should ``'string'.find('str')`` return? How do you distinguish
the not found at all case from the found at the very beginning case!?
The simple test you want can be written this way:
if 'something' in chec
t; return rows
>
> How would you modify this to exclude lines between "Begin VB.Form" and
> "End" as described above?
Introduce the flag and look up the docs for the `startswith()` method on
strings.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ee read only one record of the data at a time?
Have you tried `iterparse()`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
hat UTF-8 encoded 'Ä' and shows it. If you expected the output
'\xc3\x84' then remember that you ask the soup object for its
representation and not a string. The object itself decides what
`repr(obj)` returns. Soup objects represent themselves as UTF-8 encoded
strings.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
re(Word(alphas))`` part "eats" the 'end' and when it
can't get more, the parser moves to the ``Literal('end')`` part which
fails because the 'end' is already gone.
> Is there a way to get pyparsing to parse a grammar like this?
Negative lookahead
It's the first argument to `findvisitor()` which is invoked for every
directory level by `os.path.walk()`. `findvisitor()` adds all file names
that match `pattern` to the `matches` list.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
t; self.db = shelve.open('textmatch.db', flag=modeflag)
>> else:
>> self.db = shelve.open(dbName, flag=modeflag)
def open_db(self, db_name='textmatch.db', modeflag='c'):
self.db = shelve.open(db_name, flag=modeflag)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
> when the GC finds it?
Only when the GC destroys it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
:
>> "UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in
>> position 40:
>> ordinal not in range(128)"
>>
>
> Find out what encoding the files are in and modify the script to use it.
The problem is not the encoding of the files as you see they are decoded
to unicode strings by the XML reading part already.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
f`` statement.
>graphAddressOut = tag1 + logUrl + fileOut[1] + extention1 + tag2
>+
> "SWITCH: " + string.swapcase(fileOut2D[0]) + " & nbsp;PORT
> ID: " + fileOut2D[1] + "" + imgTitleTag + imgTag1 + logUrl +
> fileOut[1] + extention2
dynamic language; that's the price you have to pay for leaving the
> static typing world".
I don't thing that's a dynamic vs. static thing because in statically
typed languages it's not that easy to find out all possible exceptions
unless the language forces you to declare them.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ciency differences.
Python has a list type without the "s, it's a real list. Don't confuse
the *ADT list* with *linked lists* which are just one implementation of
the ADT list.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Lad wrote:
> What is a good way to read binary data from HUGE file and write it
> to another file?
What about `shutil.copy()`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, raghu wrote:
> what is standard streams in case of python?
Do you mean `sys.stdin`, `sys.stdout` ans `sys.stderr`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
> python always seems to amaze me how other languages make a mess of
> things that suppose to be simple
It gets even simpler: cursor objects are iterable after the `execute()`
call. So you don't need the number of rows::
gert.excecute('select * from person')
for row in gert
ng code from
> either a web page or an e-mail that TABs are messed up, which is not a
> problem with other languages, but is a problem with Python. Too bad.
Well then don't use code from people using TABs. If it's indented by four
spaces per level, like suggested by the style guide
In <[EMAIL PROTECTED]>, hg wrote:
> Is there a way to do that ?
Maybe this helps:
http://paste.pocoo.org/show/316/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
usually you don't expect a list or dictionary but some object
that *acts* like a list or dictionary. Or you even expect just some
aspects of the type's behavior. For example that it is something you can
iterate over.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
o
> have a problem with these strings.
What exactly are you doing? How does a (unicode?) string look like that
triggers this exception?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Fabrice DELENTE wrote:
> As support for 8-bit (and even unicode) is important for my script, is there
> any hope? Should I switch to slang instead of curses?
Take a look at urwid:
http://excess.org/urwid/
Ciao,
Marc 'BlackJack&
rs',
'nested_scopes']
In [4]: __future__.all_feature_names
Out[4]: ['nested_scopes', 'generators', 'division']
In [5]: __future__.division
Out[5]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
In [6]: help(__future__)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
= u'\u2022'
In [3]: a = a.decode('iso-8859-1')
---
exceptions.UnicodeEncodeError Traceback (most recent call last)
/home/marc/
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022'
gt;From 2.5 on we have `with_statement`::
>>> __future__.with_statement
_Feature((2, 5, 0, 'alpha', 1), (2, 6, 0, 'alpha', 0), 32768)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
lowed by a ".".
A space between the integer literal and the dot operator works too:
In [1]: 2 .__add__(1)
Out[1]: 3
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ne 1, in
> File "", line 0
>
> ^
> SyntaxError: unexpected EOF while parsing
It's `input()` that expects a valid Python expression. An empty one
doesn't work, it has to evaluate to something.
In [2]: input()
---
;]
> plot ( list[0], color[0])
> hold (True)
> for i in range ( 1, len(list) ):
> plot ( list[i], color[i] )
No need for the counter here.
for args in zip(list[1:], color[1:]):
plot(*args)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
s the OP trying to divide by 7 or 2?
I read it as divide by 7. And the `int.__div__()` Method limits this
somehow -- a more polymorphic approach would be::
import operator
operator.div(14, 7)
:-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Krypto wrote:
> The correct answer as told to me by a person is
>
> (N>>3) + ((N-7*(N>>3))>>3)
How could it be correct if it uses `-`? You ruled out `-` and `/` in your
first post.
Ciao,
Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> pygame is probily a good program to start with as long as you keep in
> mind that it is possible that up to 50% of the p.c. laptops may not be
> able to run it.
Huh? Care to explain this?
Ciao,
Marc 'BlackJa
ranges isn't that
hard without a regular expression.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Tony Houghton wrote:
> In Linux it's possible for filesystems to have a different encoding from
> the system's setting. Given a filename, is there a (preferably) portable
> way to determine its encoding?
No.
Ciao,
Marc
res or
objects then you have something like Python's list type.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> On Feb 3, 2:16 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> In <[EMAIL PROTECTED]>,
>>
>> [EMAIL PROTECTED] wrote:
>> > pygame is probily a good program to start with as lo
prints 'hello world'
> s=s.upper()
> print s.hello() # expected to print 'hello WORLD', but s is no longer
> myStr, it's a regular str!
>
> What can I do?
Return a `myStr` instance instead of a regular `str`:
def hello(self):
return myStr('hell
In <[EMAIL PROTECTED]>,
karoly.kiripolszky wrote:
> and the great thing is that the algorithm can be used with any
> language that structures the code with brackets, like PHP and many
> others.
But it fails if brackets appear in comments or literal strings.
Ciao,
m within the class scope as seen
> above in the init, but is there any way of printing it from within the
> main without creating an object of the MyClass type. I need to assign
> the name of the class within my script, to a variable in main.
Yes::
print MyClass.__name__
Ciao,
In <[EMAIL PROTECTED]>, Gosi wrote:
> I like to use J for many things and I think that combining Python and
> J is a hell of a good mixture.
I was able to follow this sentence up to and including the word "hell"… :-)
Ciao,
Marc 'BlackJack' Rintsch
--
tp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/415504
And a library called `poker-eval` with Python bindings:
http://pokersource.org/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
function to translate a glob pattern to a `re`
pattern:
In [8]: fnmatch.translate('.??[oOdDnNmM]*')
Out[8]: '\\...[oOdDnNmM].*$'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> With some number:
>
> In [2]: "% 3s" % 'a'
> Out[2]: ' a'
The space still doesn't have any effect here:
In [66]: "%3s" % 'a'
Out[66]: ' a'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
; be more specific.
In pure Python it's not possible and even in C it might be difficult to
get an absolute *physical* memory address unless you run DOS. Modern
operating systems tend to use some virtualisation of memory. :-)
What's your goal? What do you expect at the memory address y
']].
Not by directly referencing them, but with a list comprehension::
result = [the_dict[key] for key in ('row1', 'row2', 'row3')]
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ple should demonstrate that assigning to the loop variable
has no effect on the "loop test". Which IMHO is a good thing.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
python.org/doc/faq/installed/
http://effbot.org/pyfaq/installed-why-is-python-installed-on-my-machine.htm
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
preinstalled by the vendor of that
machine.
A good advice about installing an uninstalling software is:
If you don't know what it does and…
1. …it is not installed then don't install it.
2. …it is installed then don't uninstall it.
Or things may break.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, James Stroud wrote:
> Better would be to remove windows xp and get another operating system.
Yeah XP is sooo ooold, the OP should install Vista. Or did you mean a
real OS instead of just another one? ;-)
SCNR,
Marc 'BlackJack' Rintsch
--
htt
ng library I would not expect changes to that package.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
es `i` come from? And there's no need
to read the file twice. Untested:
import os, sys, codecs
def checkfile(filename):
f = codecs.open(filename,encoding='ascii')
try:
for num, line in enumerate(f):
pass
except UnicodeError:
print
e Qt APIs. As Python also has APIs for such things
that work cross platform it might be better to use those, because you can
separate GUI and logic better. It's hard to replace the Qt libraries with
a Gtk, wxPython or web GUI if you still need Qt for networking or database
access.
Ciao,
racters that you are not interested in
anyway.
Then leave off the '*' after '\D'. It doesn't matter if there are
multiple non-digits before or after the ISBN, there just have to be at
least one. BTW with the star it even matches *no* non-digit too!
So the re looks like this: '\D(\d{10}|\d{9}X)\D'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
d the docs about the `shallow` argument of that
function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
als()` is a dictionary too, but it is more work to get an object by
name from it (globals()['SomeClass'] vs. some_dict['SomeClass']) and you
don't risk that some of your dynamically created classes overwrites an
existing one with the same name.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
?
As objects don't know to which name they are bound, that's a good way to
give some information in stack traces or when doing introspection.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Bjoern Schliessmann wrote:
> Michele Simionato wrote:
>> On Mar 1, 9:40 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
>>> In <[EMAIL PROTECTED]>, Bjoern Schliessmann
>
>>>> But what's it (__name__) go
***
>
> My question is why this or #text has been
> created and how to get rid of them by changing python code? (here I'm
> not interested to change xml file.)
They have been created because the text is in the XML source. Line breaks
are valid text.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Chris Garland
wrote:
> But an unsigned char & a short give me this
unpack('Bh','\x90\x06\x00')
> Traceback (most recent call last):
> File "", line 1, in ?
> struct.error: unpack str size does not match format
Let's pack this:
In [90]: pack('Bh', 0x90, 0x6)
Out[90]
Are you searching for the `description` attribute of cursors? Section
`Cursor Objects`:
http://www.python.org/dev/peps/pep-0249/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a 3.5G file that may be
broken.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
one that I receive from the 'datetime.date.today()'.
Build a `datetime.date` object from the timestamp you get from the stat
call:
In [438]: !touch test.py
In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime)
Out[439]: datetime.date(2007, 11, 6)
On Tue, 06 Nov 2007 01:45:02 -0800, awel wrote:
> On 6 nov, 09:00, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
>> > I am trying to to make a script to move all the files that has been
>> >
; > Could you explain a little more because I am new in scripting?
>>
>> Not really. I showed you the call I made and the result I got. How can I
>> be more clear and precise!?
>
> Ok but I run in Windows and I cannot understand your '!touch test.py'
Ah, sorry t
in a module named `inspect.py` that is
definitely not the one from the standard libarary. If that module has an
``import inspect`` it imports *itself*!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
return cmp(self.value, other.value)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 07 Nov 2007 18:35:51 +, kyosohma wrote:
> I've never had to put the command into a list or tuple...but you're
> welcome to try it that way.
You don't *have* to but if you do the module takes care of quoting the
arguments if necessary.
Ciao,
Marc 'B
On Thu, 08 Nov 2007 22:53:16 -0800, r.grimm wrote:
>>>> (1).__cmp__(10)
> -1
As the dot is an operator like ``+`` or ``/`` you can also add spaces to
avoid the ambiguity:
In [493]: 1 . __cmp__(10)
Out[493]: -1
In [494]: 1 .__cmp__(10)
Out[494]: -1
Ciao,
Marc
On Fri, 09 Nov 2007 02:51:10 -0800, Michel Albert wrote:
> Obviously this won't work as you cannot access a slice of a csv-file.
> Would it be possible to subclass the csv.reader class in a way that
> you can somewhat efficiently access a slice?
An arbitrary slice? I guess not as all records bef
der ? And if so, how could
> I *then* notify her ?-)
Ask a medium? Use a crystal ball for the very long distance call? Call
Dr. Frankenstein for help? =:o)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
> Specifically, the language in which I am most productive.
They are not thought out. You just ripped an aspect from that other
language and threw it into a Python environment. This doesn't mean it
will fit into the language or scales beyond the small toy examples. What
about functi
nd setBlah for every little thing?
Good $GOD no! He's talking about the `__get__` method on properties. Read
the docs for the built in `property()` function. It's a nice mechanism to
actually avoid all those getters and setters because you can turn "simple"
attributes into "computed" attributes without changing the API of the
objects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
mbers that you are adding and not strings or something!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
s namespace and on the right are
the objects in memory. From the `Test` objects there's also a reference
to the `class` that's bound to the name `Test` in the Module that is not
shown in the "drawing" but necessary to look up attributes in the class of
the instances.
> T
] ││
>│ │ [S2] [S3] └┬┘│
>│ │││┌─< C4 >─┐│
>│ │││ [S4] ││
>│ │││└───┬┘│
>│ └───┬┴┴┘ │
>│ [S5] │
>│ └───
On Sat, 10 Nov 2007 17:39:04 +, Marc 'BlackJack' Rintsch wrote:
> On Sat, 10 Nov 2007 18:53:08 +0200, Donn Ingle wrote:
>>>> print b.ref.attribute # print "haschanged"
>>>>
>>>> print j.ref.attribute #prints "original
{}
> for line in open('keys.txt'):
> v[long(line.strip())] = True
Takes about 40 seconds here.
[EMAIL PROTECTED]:~$ time python test.py
real0m38.758s
user0m25.290s
sys 0m1.580s
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
erations to easily find out the
differences between two set of names and the `pickle` module to store
Python objects in files.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
tion between
processes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
#x27;s
> equivalent to the following perl's search string?
> m/^\S{1,8}\.\S{0,3}/
It is ``re.match(r'\S{1,8}\.\S{0,3}', string)``. There's something called
"documentation"…
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
f.read(chunksize)
>
> I just don't feel comfortable with it for some reason I can't explain...
chunksize = 26
f = open('datafile.dat', 'rb')
for chunk in iter(lambda: f.read(chunksize), ''):
compute_data(chunk)
f.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ct. Changing the dictionary bound to `h` changes it::
h = orig['ca']
h['adanac'] = 69
> Yet since names are not exactly references, something else is needed
> for generalized ngram multi-level counting hash -- what?
Names *are* implemented as references to objects, but binding the name to
a different object has no effect on the object bound to that name before.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
gt; Of course if you want to have more or less realistic imaging for whatever
> purpose, 3D is the way to go. If you are after traffic-simulations, it's
> unneeded complexity.
Not if their solution includes flying buses and taxis. Or this pneumatic
delivery system for people from `Fut
o build
something with those functions.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
gt;
> This one returns the lowest value Object, but not the lowest value of
> age in all the Objects of the table.
In the example `min()` finds the object with the lowest `id()`. To change
that you can implement the `__cmp__()` method on your `Block` objects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 19 Nov 2007 10:50:28 -0800, Jens wrote:
> Generating documentation form code is a nice thing, but this pydoc.py
> is driving me insane - isn't there are better way?
Epydoc!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
UpKey(self,event):
> self.canv.move(tagOrId,xAmount=0,yAmount=10)
Where's `tagOrId` coming from? That's a `NameError` here.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
rgs)
return new_func
class A(object):
@pre
def func(self, a, b):
print a + b
a = A()
a.func(3, 5)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
which ``if`` does the ``else``
belong to here? ::
if 1: print 1 if: 1 print 1 else: print 1
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ic" way to define
`comma_separate()` is::
comma_separate = ','.join
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ook like if whitespace is
preserved. What matters is the actual text in the source, not the
formatting. That's left to the browser.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
> expands to
>
> def abs(self):
> x, y, z = self.__unpack__("x","y","z")
> return math.sqrt(x**2 + y**2 + z**2)
What about ``from`` instead of ``by``? That's already a keyword so we
don't have to add a new one.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a record
definition to make that decision.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
> dog = 'rover'
> def example():
> global cat, dog # not always required, but frequently needed
> return ', '.join((cat, dog))
Ouch that's bad design IMHO. The need to use ``global`` is a design
smell, if needed *frequently* it starts to stink.
Ciao,
M
erhaps there is a Python
> Elder here that knows?
AFAIK strings of length 1 and strings that would be valid Python
identifiers are treated this way.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote:
> On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote:
>> > I've had the same thought, along with another. You see, on of my pet
1101 - 1200 of 1812 matches
Mail list logo