s of Stuff), not an
instance attribute.
To define instance attribute, the syntax is:
class Stuff(object):
def __init__(self):
self.z = [0, 0]
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
oms/patterns in dynamic languages that seems
somewhat alien at first, then become an obvious solution. When I
discovered first-class functions and anonymous functions with Python
some years ago, I wondered what could be the use of such things. Now I
couldn't live without...
--
bruno desthuillie
ionnalities ratio can be very different. So what would be a
medium-size project in Java usually become a small-size project in Python.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]
DENG a écrit :
> hi all,
>
> i use SGMLParser to process HTML files, in order to do some
> optimizations,
>
> something like this:
>
> TEXT1TEXT2
>
> optimise to
>
> TEXT1TEXT2
Doesn't Tidy do this already ?
>
> at the very beginning, i was thinking of analysing each text-block, to
> know t
something like PyMOL
would be *much more* difficult to understand if it was implemented in C++.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
peut etre we can talk about it in ecole
> polytechnique?
Peut-être pas, je ne mets jamais les pieds chez les polytechniciens.
> i'll be there waiting for you
I'm afraid you'll learn a long time.
Regards,
--
bruno desthuilliers
python -c "print '@'.join
Mike Meyer wrote:
> bruno modulix <[EMAIL PROTECTED]> writes:
>
>>Devan L wrote:
>>
>>>Kevin Little wrote:
>>>
>>>
>>>>I want to dynamically add or replace bound methods in a class.
>>
>>(snip)
>>
>>
&
Kevin Little a écrit :
Oops, sorry, forgot to answer
> '''
> I want to dynamically add or replace bound methods in a class.
(snip)
> Is there a more pythonic way that's as straight forward?
What's wrong with:
class Foo:
pass
def method(self):
print "%s" % self
f = Foo()
Foo.method = me
BBands a écrit :
(snip)
> class master:
> def __init__(self, list):
Don't use 'list' as an identifier, it will shadow the builtin list type.
--
http://mail.python.org/mailman/listinfo/python-list
igher level view of your data,
descriptors may be a good choice. I used them that way for a
higher-level ldap API, where the class representing the LDAP object
mainly stores the raw result (as returned by python-ldap) of the ldap
query and uses descriptors to provide controlled (an simpler) access
mine), the obvious, CS101 answer is to first
build an AST of your document, then transform this AST - collapsing
nodes when possible etc -, then write it back as (if possible valid) html.
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p|
D H wrote:
(snip)
> Go with Rails. Django is only like a month old.
Please take time to read the project's page. Django has in fact three
years of existence and is already used on production websites, so it's
far from pre-alpha/planning stage.
--
bruno desthuilliers
pyt
Paul McGuire wrote:
(snip)
> (This is a quick-and-dirty example, but it works. A proper iterator
s/iterator/decorator/
(snip)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED
D H wrote:
> bruno modulix wrote:
>
>> D H wrote:
>>
>> (snip)
>>
>>> Go with Rails. Django is only like a month old.
>>
>>
>> Please take time to read the project's page. Django has in fact three
>> years of existence and i
Ksenia Marasanova a écrit :
> 2005/9/8, Sokolov Yura <[EMAIL PROTECTED]>:
>
>>Django Model is wonderfull. But SQLObject more flexible (and powerfull,
>>as i think, and has already more db interfaces).
>>But Django Model is tied with Django, and using Django with another OO
>>mapping is not comfort
lass), and any
object having a __call__() method is callable:
class Greeter(object):
def __init__(self,
name,
greeting="hello %(who)s, my name is %(name)s"):
""" greeting is supposed to be a format string
with %(name)s and %
Stefano Masini a écrit :
(snip)
> If such a "quick and dirty" section existed, I think it would also
> become a natural randevouz point for innovators.
s/randevouz/rendez-vous/ !-)
pardon-my-french-ly y'rs
--
http://mail.python.org/mailman/listinfo/python-list
wargs):
def wrapped(fargs):
do_something_before_funcall(wargs, fargs)
res = fun(fargs)
do_something_after_funcall(wargs, fargs)
return res
return wrapped
class Machin(object):
def to_be_wrapped(self, args):
# code here...
# Zope 2.x uses Python 2.3.x, so no @decorator
ry posting on a Zope/Plone related mailing-list. This is a Zope
Page Template specific problem, and you'll get better answers if you ask
in the right place.
Also, googling for ZPT + macro + "incompatible version" may be helpful too.
--
bruno desthuilliers
python -c "print '
in Python, with source available, this would
> be quite easy.
Then there's probably something wrong with the way you manage security.
NB: splitting business logic from the GUI is still a good idea anyway.
--
bruno desthuilliers - unpythonic sig:
python -c "print '@'.joi
e
> their own program to make a connection to the database, and execute any
> SQL command they want.
That's why RDBMS have an authentication and security system. This
doesn't means your program doesn't have or cannot add it's own security
management, but it should be based on th
Frank Millman a écrit :
> bruno modulix wrote:
>
>>Frank Millman wrote:
>>
>>>Hi all
>>>
>>>I am writing a multi-user accounting/business system. Data is stored in
>>>a database (PostgreSQL on Linux, SQL Server on Windows). I have writte
Jerzy Karczmarczuk a écrit :
> Gurus,
No guru answered, so you'll have to bear with me...
> before I am tempted to signal this as a bug, perhaps
> you might convince me that it should be so. If I type
>
> l=range(4)
> l.extend([1,2])
>
> l gives [0,1,2,3,1,2], what else...
>
> On the other h
[EMAIL PROTECTED] wrote:
> I like to keep my classes each in a separate file with the same name of
> the class.
Let me guess: you have a C++ or Java background ?-)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.
y idea?
>
>
> Solution was trivial
>
>
Duh ! I should have spotted this one :(
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Jaroslaw Zabiello wrote:
> I would like to lauch macro from another zpt file.
(snip - tech answer in private)
Please stop posting Zope and ZPT related questions here. There are
mailing-lists dedicated to Zope. That's where you'll get the good answers.
--
bruno desthuilliers
r
Rob Conner wrote:
> Genius!
Nope. Just common Python idioms...
> Thanks guys that was exactly the help I was looking for. I'll be
> implementing this later today. I don't forsee any problems, so if I
> don't post anything else, thank you so much for the help.
t;>>m.arr.append("haha")
>>>>print m.arr, n.arr
>
> ['haha'] []
>
Here you define a class X with an *instance* variable arr, and two
instances m and n of X, then append to m.arr, which of course has no
impact on n.
I dont see anything interesting nor prob
; does this fall under what C programmers would call 'undefined
> behavior.'
Not being a Language Lawyer(tm), I can't tell for sure, but I'd think
it's the expected behavior. Anyway it's not a behavior I'd relie upon,
since it would be too much of a dirty
Johnny Lee wrote:
> bruno modulix wrote:
>
>>I dont see anything interesting nor problematic here. If you understand
>>the difference between class attributes and instance attributes, the
>>difference between mutating an object and rebinding a name, and the
>>at
e thing A.i points to
>
>## A.i -> (int 0 object)
>## a.i -> (int 0 object)
>## b.i -> (int 0 object)
idem
>>>>a.i = 1 ## point a.i to a new (int object)
>
> ## A.i -> (int 0 object)
>## b.i -&
Sakcee wrote:
> Hi
>
> I am using mod_python for web development, I am in need of some ide ,
> can i use ddd or eclipse with pydev with mod_python.
Don't know, but you may want to check Eric3, a full blown Python IDE
with support for mod_python debugging.
--
bruno desthu
ples and for each tuple
'replace' target with 'replacement
"""
for i, t in enumerate(alist):
l = list(t)
while target in l:
l[l.index(target)] = replacement
alist[i] = tuple(l)
my_replace(lists, 'None', 'NULL')
HTH
--
bruno d
or 'None'. May be too
> easy...
Nope, why ? If you need to turn this list into a string anyway, doing a
replace on the string is of course the simplest and most obvious solution.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for
er line come after a short one.
That's fine. Now try and do it, and ask for help when you're in trouble.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
contributing to it !-)
More seriously, I dont think IDLE is intended to be a real professional
IDE - anyway, I would not use it as such.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]&
Laszlo Zsolt Nagy a écrit :
>
>> is the doc writer, trying to write the doc with some austereness, but
>> is confused about the behavior of split, or confused about expressing
>> it? Did his pretension fucked him up?
>>
>>
> Dear Xah Lee,
>
> The Python community is very sorry because we have a
beza1e1 a écrit :
> I see myself shifting more and more over to the functional kind of
> coding. Could be related to the Haskell, we had to learn in CS. Now i
> was wondering, how other people use Python?
>
> With functional i mean my files mostly consist of functions
which is not enough to make
chand a écrit :
> Hi.,
>
> In my api.py file 'g_opt_list' is defined globally
> g_opt_list =[[],[],[],[],[],[],[]]
>
> when I run the py file, I am getting the Following Error
>
> SyntaxWarning: name 'g_opt_list' is used prior to global declaration
> SyntaxWarning: name 'layers' is used prior to
York a écrit :
(snip)
> I love python. However, as a biologist, I like some high-levels
> functions in R. I don't want to spend my time on parse a data file.
http://www.python.org/doc/current/lib/module-csv.html
> Then
> in my python script, I call R to read data file and write them into an
>
defining functions as
instances of class function. So even the most FP Python programs are
still OO, at least under the hood !-)
My 2 cents
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
modules,
eventually organized in packages, and a 'main' script that's the entry
point for the program [1]. Most Python projects being OSS, you can
examine existing projects.
[1] Note that this not Python specific. You'll find the same overall
organisation in C, C++, Java,
ribute 'method' "...
Try this
for method in dir(self.canvas):
print method
print help(getattr(self.canvas, "method"))
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
e trick is I have to do this using
> only 7-8 lines of code. Any ideas?
>
Yes : do your homework yourself. When you'll run into trouble with
*your* code, then post here for help.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p
changed library.
But someday, it happened before, there will be an update by the publisher
to that library and I have to do all again.
So, what is the most elegant solution to administer these changes?
Use a version control system (svn is quite fine...).
--
bruno desthuilliers
ruby -e "
is syntax comes from Haskell.
HTH !-)
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
e wrote:
here's what is probably an unusual question:
A very open one at least !-)
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
--
--
http://mail.python.org/mailman/listinfo/python-list
know what the heck it is/does/fixes/whatever!
lambda is a keyword that is used to create anonymous functions. This is
pretty handy for simple callbacks.
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p|
p.split('.').collect{|w
program like
Crystal Reports??
ReportLab is probably the place to go
http://www.reportlab.org/
- Database access: Firebird , I dont found correct information about
this tools and his conection/working with Python.
http://kinterbasdb.sourceforge.net/
Thanks!!!
HTH
--
bruno desthuilliers
ruby -e "
the integer division, ie 5 % 2 = 1)
One of the most commun use is to test wether a number is odd or even:
any_even_number % 2 == 0
any_odd_number % 2 == 1
Note that the % operator is also used for string formating, ie:
"%d modulo %d = %d" % (5, 2, 1)
=> "5 modulo 2 = 1"
Ple
D] modulix $ cls
-bash: cls: command not found
Bad luck ! didn't work !-)
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards a écrit :
On 2005-02-10, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
First of all, what's Python command equivalent to QBasic's "goto" ?
There isn't one.
One defines functions and calls them. One uses for and while
loops. One uses list comprehensions. One uses if/elif/else.
and even s
ht be able to teach other people what you
obviously know nothing about, teaching people from a language that you
know nothing about. *PLEASE STOP POSTING*!! *NOBODY WANTS YOU TO POST*!!
The guy is an obvious, well-known and self-proclaimed troll. Dont feed
the troll.
--
bruno desthuillie
xiaobin yang wrote:
Hi, if i am already skillful with c++. Is it useful to learn python? thanks!
Q : If I'm already skillfull with driving a big truck, is it useful to
learn driving a motorcycle?
(tip : Have you ever tried driving a big truck in a big city at rush
hour?-)
--
ock
2/ adding the tabs before printing:
rock = """
Igneous Sedimentary Metamorphic
Lava Grains Marble
Ramdom crystals LayerBands
Granite Salt Schist
IntrusiveWeathering Heat + Pr
; number
3/ guess == number
Here the 2/ and /3 are handled by the same branch...
guess = int(raw_input("Take Another guess: "))
tries += 1
print "You guessed it! The number was", number
print "And it only took you", tries, "tries!\n"
This will be ex
#x27;myfile.txt', 'w')
f.write(my_data)
f.close()
You'll of course need to add some code to handle IOErrors...
(snip)
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
[0, 0, 0], [0, 0, 0]]
>>> l[0][0], l[0][1] = l[0][1], l[0][0]
>>> l
[[0, 1, 0], [0, 0, 0], [0, 0, 0]]
>>>
So I guess that your problem has nothing to do with nested lists.
(Also note BTW that, thanks to the magic of multiple assignement, you
don't need the dummy stuff.
about essential needs and
requirements.
I couldn't agree more. You need to find a community that *does* care
about essential needs. Might I recommend Perl or Ruby?
Why do you hate Perl and Ruby community that much ?
--
bruno desthuilliers
python -c "print '@'.join(['.&
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps?
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
My trollometer's beeping...
--
bruno desthuilliers
python -c "print '@'.join(['.
jfj a écrit :
bruno modulix wrote:
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps?
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
My trollometer's beeping...
When person 'A' calls person
Stephen Kellett a écrit :
In message <[EMAIL PROTECTED]>, Simon
Brunning <[EMAIL PROTECTED]> writes
On Mon, 14 Feb 2005 14:12:57 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:
Why do you hate Perl and Ruby community that much ?
Oh, I don't. But fair's fair - we'v
rformMove(),
call the performMove() on each clone and store the clone.
(BTW, the name of the method may be somewhat misleading, and I'm not
sure this method really belongs to the Puzzle class. )
and finally (pun intend !-) :
try:
self.children.append(newchild)
Kenneth McDonald a écrit :
In article <[EMAIL PROTECTED]>, aurora <[EMAIL PROTECTED]> wrote:
What are the win 32 modules? Searching "OS X win 32" on Google gave me a bit
too much...
I guess Aurora did not took time to read your whole post. Win32 modules
are for Windows, of course...
--
http://mail
snacktime a écrit :
The primary question is how do I perform a match when the regular
expression contains string variables? For example, in the following
code I want to match a line that starts with STX, then has any number
of characters, then ends with STX.
Example 2 I'm pretty sure works as I ex
gh to read your mind !-)
(and please : avoid SCREAMING and l33t speak too...)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
when
done they'll retire the current implementation and lock everyone to a
proprietary platform. I know it's hard to believe, but there are clues...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p
st(path ?
What's your problem *exactly* ?-)
BTW, you may want to have a look at the path module :
http://www.jorendorff.com/articles/python/path/
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAI
Ilias Lazaridis wrote:
bruno modulix wrote:
Ilias Lazaridis wrote:
there are other reasons behind the decision to not support the MinGW
open-source-complier directly out of the main source-code base.
Yes, of course. The reason is they are lying about their commitment to
open source. They are
Ilias Lazaridis a écrit :
bruno modulix wrote:
Ilias Lazaridis wrote:
(snip)
impressive.
but things are much simpler.
Could you be more prolific ?
Please explain the word "prolific".
Say more
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Shannon a écrit :
bruno modulix wrote:
administrata wrote:
I wrote this, It's a bit lame though
(snip code - see other answers in this thread)
raw_input("\n\\t\t\t- The End -")
Why on earth are you using raw_input() here ?
This is a fairly common idiom, on Windows at least.
p://www.python.org/topics/web/
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Ilias Lazaridis wrote:
Bruno Desthuilliers wrote:
[...]
closing thread
http://groups-beta.google.com/group/comp.lang.python/msg/f2ae9cdbe16676d1
Nope. You are not entitled to close thread. This is irrelevant.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join(
Ilias Lazaridis wrote:
Should a professional developer take python serious?
A *professionnal developper*, yes. But this is irrelevant to you.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '
not defined
See above.
I cannot understand how I can define yes so that when they type yes the
data is printed out.
Yes = 'yes' ?-)
Also if they type no how do I make the program do
nothing. Or is that just infered.
May I suggest that you :
- subscribe to the 'tutor' mailing-
Gary Nutbeam a écrit :
I've noticed that the Perl camp has a very nice web/database environment
called Maypole. Ruby has the Rails environment which on the surface seems
similar to Maypole. I can't find anything in Python that ties a database
to a web interface anywhere near as well as Ruby on Rail
ding to learn Ruby.
A nice language, but yes, there can be practical reasons to stick with
Python.
(snip)
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
--
http://mail.python.org/mailman/listinfo/python-list
x27;]}
rev_phone[3]
--> ['john', 'jack']
But now you've got another problem : you need to update the reversed
index each time you modify the dictionary... Which would lead to writing
a class extending dict, maintaining a reversed index, and exposing extra
methods to handle this.
But there may be a better way (someone else ?)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
know what else needs to be done in Gerhard's process.
Hope I haven't been to harsh !-)
Of course, we
could put this loop in a call and return the name
yeps.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
andy2o a écrit :
Hi all,
Sorry if the post's title is confusing... I'll explain:
I have a class, called A say, and N>1 subclasses of A, called
A1, A2, A3, ..., AN say.
Instances of each subclass can sensibly be joined together with other
instances of the *same subclass*. The syntax of the join me
large dataset, you may want to
have a look at btrees (one possible implementation here :
http://zopewiki.org/BTree).
Now since it's XML related, this may also (or not) be useful:
http://effbot.org/zone/celementtree.htm
http://effbot.org/zone/element-index.htm
HTH
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
st sign of
'special chars' syntax.
I don't like Perl, I still prefer to use Python (over Ruby) for a number
of good and less good reasons, but I somewhat share Fernando's (and some
other's people here) concerns about the future of MyFavoriteLanguage.
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
7;s dict ? (most
client code - apart from subclass definitions - shouldn't even bother
about the existence of this attribute, it's there for the library
internal usage)
NB : in the real code I'm also messing with the AbstractBaseClass's
meta_class for other stuff (so it's not a
Valentino Volonghi aka Dialtone a écrit :
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
It is actually. Ruby's syntax is mostly consistent and coherent, and
there is much less special cases than in Python.
I'd be glad to know which special cases are you referring to.
A f
Martin Franklin a écrit :
Tim Daneliuk wrote:
In-Reply-To: <[EMAIL PROTECTED]>
(snip)
Of course we users will complain about removals, but we'll knuckle
down and take our medicine eventually ;-)
Except that in this case, removal will also complicate code in some
cases. Consider this fragment of Tk
ve the cleanest syntax for the subclass declaration. In
fact, in most cases, the client code should not have much more to do
than defining a handfull of class attributes to end up with a
taylor-made fully functional subclass.
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter a écrit :
On Tue, 15 Mar 2005 20:21:19 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:
Hi
How can I make a *class* attribute read-only ?
(snip)
Does this help, or did I misunderstand?
>>> class Base(object):
... class __metaclass__(type):
... def __seta
Tanteauguri a écrit :
Hi List, is there in python a variable variable like in PHP ($$var)?
Hopefully, no.
See other answers in that thread for pythonic idioms.
--
http://mail.python.org/mailman/listinfo/python-list
fraca7 a écrit :
Michael Hoffman wrote:
Enjoy ;)
That's not the exact word that first came to my mind :)
--
http://mail.python.org/mailman/listinfo/python-list
all 30 gigabytes of
third part libs | etc...] just to help you. Moreover, quite often, one
finds the bug while reducing the problematic code to it's smallest possible.
And one last: don't forget to put your bullet-proof jacket on before
reading the answers !-) (well, c.l.py is prob
ata1, data2 = line.strip().split(';')
except ValueError:
print >> sys.stderr, "wrong file format"
f.close()
sys.exit(1)
try:
users[user].append("%s : %s" % (data1, data2))
except KeyError:
users[user] = ["%s : %s" % (data1, data
ne. If you don't have the needed code yet,
you need to put a 'pass' here :
if some_condition:
pass
else:
pass
This will of course do nothing else than useless tests, but it will at
least satisfy the language's rules.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
NameError
problem with z to handle,
No. AFAICT, the name error could be with x and/or y and/or z.
so where is the gain of using
lambda or the mapping?
See upper...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
guments (sorry for the pun
!-) to gain my adhesion. (NB : I could use this syntax without problem,
it's just that we already have a syntax for this).
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
bruno modulix wrote:
Kay Schluehr wrote:
Since George Sakkis proposed a new way of doing list comprehensions
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/ac5023ad18b2835f/d3ff1b81fa70c8a7#d3ff1b81fa70c8a7
letting tuples-like objects (x,y,z=0) acting as functions on
where the lack of expressive power leads to overly
complicated code to get simple things done.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
lasses, first class functions, builtin datatypes like
lists and dicts, exceptions, dynamic typing, garbage collection, etc
too. Hurray, let's all happily program in assembly !-)
--
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p
lf AFAICT.
I think it would be nice to have, but I
can't imagine it to be really very helpful.
I once had the same feeling about first class functions, higher-order
functions, lambdas, list comprehension, __call__ special method,
descriptors, metaclasses, and a whole lot of other constructs
Ron a écrit :
(snip)
def dfv( arg = value):
return arg
>
>>> def dfv( arg = value):
... return arg
...
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'value' is not defined
And sorry, but -1 for using exec here.
--
http://mail.python.org/mailman/listinfo
Ron a écrit :
On 21 Mar 2005 22:37:42 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
Mappings like that:
((x,y),z) -> x+y-z
((x,y=0),z) -> None
should be valid actions too.
What is the audience thinking about that?
I think that there's too much implied, and that in the long run it,
if we k
201 - 300 of 4404 matches
Mail list logo