. wrote:
> What is the fast way for a fast implementation of Python?
Please define "fast".
--
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
(void)memcpy(&mac, LLADDR(sdl), sizeof(mac));
> masklen = mac_to_ip(&mac, ab_to_ip, &iaddr);
> rc = sockaddr_snprintf(buf, sizeof(buf), "%a", iaddr);
> if (rc == -1 || rc >= sizeof(buf))
> errx(EXIT_FAILURE, "%s: sockaddr_snprintf", getprogname());
> sockaddr_free(iaddr);
> (void)printf("%s/%d\n", buf, masklen);
>
> freeifaddrs(ifap);
> return 0;
> }
>
BEGIN PROGRAM
read_this('http://www.catb.org/~esr/faqs/smart-questions.html')
do_your_homework()
END PROGRAM
--
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
Paul McGuire wrote:
> "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>
>>
>>
>>BEGIN PROGRAM
>> read_this('http://www.catb.org/~esr/faqs/smart-questions.html')
>>
o avoid globals first.
--
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
[EMAIL PROTECTED] wrote:
please stop top-posting, it's getting very annoying
> ya know, I've searched for these "new classes" at least five times.
Then go and buy yourself a pair of glasses. It's one of the entrie in
the "documentation" menu of python.or
27;L0C1', 'L1C1', 'L2C1'],
['L0C2', 'L1C2', 'L2C2']
]
NB : There are probably more elegant solutions.
> I have made the following changes and it still doesn't work.
"doesn't work" is the worst possible description of a problem...
(snip)
--
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
;>this would be something like this:
>>
>>for line in reader[:7]:
>># no need for the "if cnt > 6: break" clause now
>>
> I am getting
>
> TypeError: unsubscriptable object
>
> when specifying
>
> for line in reader[:7]:
>
Sho
ere:
http://www.python.org/download/releases/2.2.3/descrintro/#__new__
(FWIW, read the whole page)
(snip)
> Looks like my __init__ isn't even being called here. Why not, and how do I
> fix this?
cf above
> Is there a way to subclass built-in types without needing to write the
Roman a écrit :
Roman, please stop top-posting and learn to quote.
> Bruno Desthuilliers wrote:
>
>>Roman wrote:
>>(please dont top-post - corrected)
>>
>>>
>>>My intention is to create matrix based on parsed csv file. So, I
>>>would l
Roel Schroeven a écrit :
(snip)
> AFAIK, shape files are files with geospatial information used by ESRI
(snip)
> But I still can't answer the question. I don't even know if there's a
> way for python to read shape files.
There's of course a way to read files in Python - look at the
open( [,]) b
ver, this will still result in inefficient code.
Indeed. One could even say "broken" and "braindead".
> Since every line
> you read in via the csv reader is already a list, try this (untested)
Given your obvious lack of even the most basic knowledge concerning
Pytho
g the same problem : share your
solution. As a side effect, you'll also have your code checked by lot of
confirmed Python programmer !-)
--
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
Steven D'Aprano wrote:
> On Tue, 04 Jul 2006 19:26:36 +0200, Bruno Desthuilliers wrote:
>
>
>>Steven D'Aprano wrote:
>>
>>>I'm having problems with sub-classes of built-in types.
>>>
>>>Here is a contrived example of my subc
t "finding a name/identifier", it's about the difference
between (re)binding a name and mutating an object.
--
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
*t)
>
>
> Thank you very much Luke Plant, Steven D'Aprano and Sybren Stuvel.
>
> This was exactly what I was looking for. I'm happy now. ;-)
FWIW, there's something similar for dicts and named args:
>>> def foo(a, b): print str(a), str(b)
...
>>&g
ine manual).
> b = ['f','g','h']
> v = ['f1','g1','h1']
>
> if a[1][2] == b
>print 'good!'
>
> a[1][4] = b
>
> x = 4
> g = ['p1','l1','g1']
>
> for i in range[g]
> a[x][i] = g[i]
>
>
> these are the kinds of list/array functions i'd like to be able to
> accomplish
>
> pointers/code samples/pointers to code would be helpful...
start here : http://www.python.org/doc/
> and yeah. i've been looking via google...
Really ?
--
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
Sybren Stuvel wrote:
> Bruno Desthuilliers enlightened us with:
>
>>Python has lists (which AFAIK really are arrays not linked lists,
>>but they are called 'lists').
>
>
> An array is generally understood as a list of items of the same type,
> henc
e the relationel model directly
available into Python (which SQLAlchemy somewhat try to do AFAICT)
instead on insisting on 'domain-object'<->RDBMS tuple mapping ?
my 2 cents...
(snip)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[:
madpython a écrit :
> I've been doing an application with Tkinter widgets. Nothing really
> fancy just routine stuff. Though I have no problems with it by now I
> guess it would be reasonable to ask about a thing that's been bothering
> me a bit. Look at this piece of code:
>
> class A(object):
>
madpython a écrit :
> Marc 'BlackJack' Rintsch wrote:
>
>>In <[EMAIL PROTECTED]>, madpython
>>wrote:
>>
>>
>>No it's not the normal way. Why don't you give `c` as argument to the
>>`interClassCall()`?
>>
>>class B(object):
>>def interClassCall(self, c):
>>print c.a.a()
>>
>>class C(ob
Antoon Pardon wrote:
> On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>
>>>>>>>Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote:
>>
>>>AP> On 2006-07-05, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>>>
>>&
the global defaults.
> If the page is called with form arguments then it should be able to
> change the global defaults)
Modifying globals from within a function is usually a very bad idea.
--
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
file
> dicAnsMorph = {}
> for line in filAnsMorph:
> if line[0] != '#': # Get rid of comment lines
> x = eval(line)
> dicAnsMorph[x[0][1]] = x[1][1] # recid is key, parse dict is
> value
>
> But it crashes every time on x = eval(line). Why
meridian wrote:
> Bruno Desthuilliers wrote:
>
>>def doIt(name=None):
>> global gname
>> if name is None:
>>name = gname
>> else:
>>gname = name
>>
>
>
> Thanks Bruno, works a treat...
>
But still very probably a bad idea.
meridian a écrit :
> Bruno Desthuilliers wrote:
>
>>meridian wrote:
>>
>>>Bruno Desthuilliers wrote:
>>>
>>>
>>>>def doIt(name=None):
>>>> global gname
>>>> if name is None:
>>>> name = gname
>>
meridian a écrit :
> You mentioned earlier that
> "Modifying globals from within a function is usually a very bad idea."
>
> Most of my app consists of functions or class/object functions, that's
> all I do in OOP.
> Did you mean that modifying globals from anywhere is bad?
Yes, definitively. Ev
Antoon Pardon wrote:
> On 2006-07-06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>
>>Antoon Pardon wrote:
>>
>>>On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>>>>It's not about "fin
corators and
lot of *very* useful things. Remove this from Python, and you'll see a
*lot* of experimented programmers switch to another language.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EM
m sure there are areas where my understanding of
> the language is shaky, metaclasses being one of them, but understanding
> how names are searched doesn't seem to be one of them.
It is, obviously.
And you're definitively a crank.
--
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
> using python globals.
Think this will be better !-)
But still, avoid overusing sessions - ie, don't make session available
to objects just for covenience when you can pass required data as params.
My 2 cents...
--
bruno desthuilliers
python -c "print '@'.join(['.'
Fredrik Lundh wrote:
> Bruno Desthuilliers wrote:
>
>> Certainly not. Nested scopes allow closures, which allow decorators and
>> lot of *very* useful things.
>
>
> decorators can be trivially implemented as classes, of course. it's a
> bit unfortunate
ype3", 2)
)
increment(1)
increment(1)
increment(0)
increment(4)
print increment.type1, increment.type2, increment.type3
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
sanjeevdivekar a écrit :
> hi,
>
> i am newbie to python so i am trying to learn mod_python as my new
> development kit for my small web apps.
>
> i am getting strange result
Nothing strange here AFAICT.
> can anybody explain me.
> index.py
>
Peter Otten a écrit :
(snip)
> I don't think your code is ugly. Anyway, here are two more alternatives:
>
>
types = [0] * 3
dispatch = [0, 0, 2, 0, 1]
for value in [1, 1, 0, 4]:
> ... types[dispatch[value]] += 1
> ...
>
types
>
> [3, 1, 0]
I wonder why I'm still pretendin
[EMAIL PROTECTED] a écrit :
> I'm working with the following code. I included some tests to make it
> easy to see--if you run the code--what troubles I'm having.
>
> Can some one *please* splain me why str(obj) works but not print obj,
May have something to do with escape chars... I tried with:
Luis M. González a écrit :
> Bruno Desthuilliers wrote:
>
>>def doIt(name=None):
>> global gname
>> if name is None:
>>name = gname
>> else:
>>gname = name
>>
>
>
> Sorry for this very basic question, but I don't understa
Luis M. González a écrit :
(snip)
> OK, so I should include the global only if I plan to modify it.
> Otherwise, I don't need to include it. Am I right?
s/modify/rebind/
--
http://mail.python.org/mailman/listinfo/python-list
Frank Millman a écrit :
> Paddy wrote:
>
>>Hi,
>>I am trying to work out why I get UnboundLocalError when accessing an
>>int from a function where the int is at the global scope, without
>>explicitly declaring it as global but not when accessing a list in
>>similar circumstances.
>>
>
>
> There
Paddy a écrit :
> Frank Millman wrote:
>
>>Paddy wrote:
>>
>>>Hi,
>>>I am trying to work out why I get UnboundLocalError when accessing an
>>>int from a function where the int is at the global scope, without
>>>explicitly declaring it as global but not when accessing a list in
>>>similar circumsta
hdixon a écrit :
> Ive spent a few days going thru a couple of Python tutorials. No
> problem until I got to classes. I guess my java mindset is blocking my
> vision.
Then http://dirtsimple.org/2004/12/python-is-not-java.html
> I've borrowed another thread's code snippet and cannot explain
> the
Gregory Guthrie a écrit :
> I am comparing Python to a few other scripting languages, and used a simple
> anagrams program as a sample.
>
> I was surprised ast a few python features that did not work as I would
> expect/wish; which caused less compact/expressive program styles that I
> wanted -
Paddy a écrit :
> Bruno Desthuilliers wrote:
>
>>Frank Millman a écrit :
>>
>>>Paddy wrote:
>>>
>>>
>>>>Hi,
>>>>I am trying to work out why I get UnboundLocalError when accessing an
>>>>int from a function where the
Paddy a écrit :
> Dennis Lee Bieber wrote:
>
>>On 9 Jul 2006 11:30:06 -0700, "Paddy" <[EMAIL PROTECTED]> declaimed
>>the following in comp.lang.python:
>>
>>
>>>So,
>>>An assignment statement may assign an object to a name, in which case
>>>the name is 'tagged' as being local,
>>
>> Reverse..
Alex Martelli wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>...
>
>>>This would allow things like:
>>>key = '',join( list(word.lower().strip()).sort() )
>>
>>key = ''.join(list(sorted(word.lower().strip
7;bb', 'c'], key=len)
> ['c', 'bb', 'aaa']
Nope, but it still doesn't require len() being a function
> If len() were a method of string objects, you could try using the
> unbound method and writing this as::
>
> &
obj : obj.__len__().
--
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
Piet van Oostrum wrote:
>>>>>>Bruno Desthuilliers <[EMAIL PROTECTED]> (BD) wrote:
>
>
>>BD> Actually, and AFAIK, len(obj) = lambda obj : obj.__len__().
>
>
> You mean: len = lambda obj : obj.__len__().
yes, of course - not enough caffein, I gu
en it's a change in the API and getters/setters
wouldn't have help (you'd have to do the same "tedious and unreliable"
search/replace dance). If it's about implementation, then it was time to
use a property - that's what they are for.
--
bruno desthuilliers
python -
ZeD wrote:
> Bruno Desthuilliers wrote:
>
>
>>>I decided to change the name of an attribute. Problem is I've used the
>>>attribute in several places spanning thousands of lines of code. If I
>>>had encapsulated the attribute via an accessor, I wouldn&
Bayazee wrote:
> hi
> i want a free hosting for python .
Then setting up your own hosting might be a good solution - if you can
have a decent internet connection.
> www.python.ir --> Persian Python Community !
I'm afraid I won't be able to contribute !-)
--
bruno d
better solution if you use different languages.
--
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
setters with the most straightforward
behaviour, and of properties as the way to override this default behaviour.
> Plus it's
> really hard to choose crappy accessor name.
What about getMyCrappyAttributeName/setMyCrappyAttributeName ?-)
--
bruno desthuilliers
python -c &quo
the following ?
if someBooleanExpression == True:
return True
else:
return False
If yes, time to look for another place to work IMHO. Else, what do they
think of the above snippet, vs:
return someBooleanExpression
Do they think the first one is safer and/or more explicit ?-)
--
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
Pupeno a écrit :
(snip)
>
> and then I have another module called SensorSingleton that emulates the
> hard-to-code-on-python singleton (snip)
What do you mean "hard to code on python singleton" ?
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano a écrit :
(snip)
> class BaseClass():
> def foo(self):
> return "foo"
>
> class Foo(BaseClass):
> def foo(self):
> return self.__class__.foo() # call the parent class method
Err... May I suggest that you re-read the Fine Manual ?
--
http://mail.python.org/
[EMAIL PROTECTED] a écrit :
> As you mention, wether the methods take arguments or not is something
> to have into account.
> And they do take arguments, and a variable number of them, so AFAIK
> hooking with __getattr__ or __getattribute__ will not work, as you can
> only get the method name with
D a écrit :
> Hello, I apologize in advance for the vague description, but as of now
> I only have an idea of what I'd like to do, and need some guidance as
> to if it is feasible, and where to begin. Basically, I'd like to
> create a web-based "job jar", that users in my office can access in
> or
Georg Brandl a écrit :
> Antoon Pardon wrote:
>
>> I have been reading http://www.python.org/dev/peps/pep-3100/
>> en there is written:
>>
>> To be removed:
>> ...
>>
>> callable(): just call the object and catch the exception
>> ...
>
>
>
>> Is there a chance this will be
neoedmund wrote:
Please repeat the whole question in the message body
=>how to get the os file icon for a given content-type?
> any simple method?
This is specific to your OS (and FWIW, there's nothing like a "file
icon" on the OS I'm using).
--
bruno desthuilliers
/www.sqlalchemy.org/
Probably not - I fail to see how SqlAlchemy could talk to MySQL without
the MySQL/Python binding.
--
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
bobrik wrote:
> Hello,
>
> I am using the Python DB API for access to MySQL. But it is not
> platform-independent
It is. You don't have to change your Python code according to the OS or
CPU.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join
Ray wrote:
(snip)
> Sadly, there are more Java guys who know about Ruby than Python,
> despite the fact that Python predates Ruby by quite a few years...
FWIW, Python is somewhat older than Java too...
--
bruno desthuilliers
python -c "print '@'.join(['.'
y,
> but the most recent version of TurboGears seem to have
> fixed a lot of the "ad hoc" feeling I got from previous
> versions. But I'm still very much up in the air.
Then take a few days to play with both Rails and TG and go with the one
that better fits your brain.
FWIW, you
Boris Dušek wrote:
> Bruno Desthuilliers wrote:
>> bobrik wrote:
>>> Hello,
>>>
>>> I am using the Python DB API for access to MySQL. But it is not
>>> platform-independent
>> It is. You don't have to change your Python code according to
KraftDiner a écrit :
(snip)
>
> Here I tried this example and maybe this will explain the difficulties
> I'm having.
> 1) at the time the baseClass is constructed shouldn't the constructor
> of the appropriate type be called.
It is. But neither the constructor nor 'the appropriate type' are what
flit a écrit :
> Hi!
> I am using the csv modules..
>
> when I use the command:
>
> if nome in row[rowcsv]:
> print "\n"
> print row[rowcsv] + "\n > " + row[11] + "\n"
> print
> ""
Python 2
fegge a écrit :
> when i declare a class, is there difference between the below:
> class myClass():
> class myClass(threading.Thread)
>
If you don't know the answer to this, then it's time to read the fine
manual. Please come back when done.
--
http://mail.python.org/mailman/listinfo/python-list
neoedmund a écrit :
please don't top-post (corrected)
> Bruno Desthuilliers wrote:
>
>>neoedmund wrote:
>>Please repeat the whole question in the message body
>>
>>=>how to get the os file icon for a given content-type?
>>
>>>any simple method?
Martin v. Löwis a écrit :
> Paul Boddie schrieb:
>
>>neoedmund wrote:
>>
>>[File icons for a given content type]
>>
>>
>>>So what? Java 5.0 has the method, why python has not?
>>
>>I'd be generally surprised if whichever Java API responsible for this
>>managed to work it out correctly for the diff
neoedmund a écrit :
> So what? Java 5.0 has the method, why python has not?
Sidenote : I didn't say it was not possible in Python. Just that it's OS
(or desktop-manager) specific, so you have to check your OS (or
desktop-manager) API documentation.
--
http://mail.python.org/mailman/listinfo/pyt
[EMAIL PROTECTED] a écrit :
> Hi folks, I have accomplished to make a python program that make some
> image manipulation to bmp files.
> I now want to provide this program as a web service. A user can visit a
> site and through a web interface he should upload the file to the web
> server , the ser
tobiah a écrit :
> def foo(thing):
>
> if thing:
> return thing + 1
> else:
> return -1
>
> def foo(thing):
>
> if thing:
> return thing + 1
> return -1
>
> Obviously both do the same thing. The first is
> possibly clearer, while the second is more conci
Sam Pointon a écrit :
> Bruno Desthuilliers wrote:
>
>>foo = lambda thing: thing and thing + 1 or -1
>
>
> The and ... or trick is buggy (what if thing == -1?)
Yes, true - Should be:
foo2 = lambda t: t != -1 and (t and t+1 or -1) or 0
> and bad style.
Lol. Well, so
r
compatibility with some old zope install).
--
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
Boris Dušek wrote:
> Bruno Desthuilliers wrote:
>
>>> but what if the OS with server accessing the site that is on
>>> shared area changes?
>> And what if Python is not installed on it ?-)
>>
>> Seriously, do you think that hosting companies swap OS very
rstand why you want to do so - perhaps you could
tell more about your real use case ?
Anyway, and since it's not directly possible, a possible workaround
could be to pass a sequence of (key, value) tuples instead (possibly as
*args). This of course requires that you can modify the implementatio
;s certainly not enough by itself to explain the
phenomenon, I think that Ruby's object model being much more
conventional than Python's may have some influence too on RoR's adoption
by the Java world.
--
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
our to third-party code which you
> may not have possibility to modify.
It's usually possible to modify third-parts classes behaviour on the fly
(googling for 'monkey-patching' should get you started). But true, this
doesn't work with builtins.
--
bruno desthuilliers
python
object):
noise = ""
def voice(self):
return "voice:" + self.noise
class Dog(Creature):
noise="bark"
def voice(self):
print "brace your self:"
return Creature.voice(self)
# can also use this instead, cf the Fine Manual
return super
Adam Jones wrote:
> Bruno Desthuilliers wrote:
>> Paul Boddie wrote:
>>> Ray wrote:
>> (snip)
>>>> We're a Java shop so
>>>> our developers are trained in Java, Struts, Tomcat, etc. Any switch to
>>>> a dynamic language will be a
Ben Finney wrote:
> "glenn" <[EMAIL PROTECTED]> writes:
>
>> Bruno Desthuilliers wrote:
>>> It might be better to use newstyle classes if you can. Also, the
>>> convention is to use CamelCase for classes names (unless you have
>>> a stron
glenn wrote:
> Bruno Desthuilliers wrote:
>
(snip)
>>
>> Here you could use a class attribute to provide a default:
>>
>> class Creature(object):
>> noise = ""
>>
>> def voice(self):
>> return "voice:" + self.no
e name to a
different object, no, it isn't possible actually.
--
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
here I had a constructor
> with parameters
Programming by accident is a well-known antipattern.
> - except now Im feeling foolish because I cant
> replicate the error - which suggests I didnt understand the error
> message properly in the first place...
And that you misunderstood
glenn wrote:
>>> Bruno Desthuilliers wrote:
>>
>> http://www.python.org/download/releases/2.2.3/descrintro/#mro
> thanks - interesting essay/article - a lot in their I've never really
> considered - though its only recently ive started playing with multiple
>
our friend:
class Knight(object):
def __init__(self):
self._saywhat = "ni"
self._wantwhat ="shrubbery"
def says(self):
return self._saywhat
def wants(self):
return self._wantwhat
k = Knight()
print getattr(k, "says")()
print getattr(k, "wa
choice', False)
# braindead metaclass
class ChoicesMeta(type):
def __init__(cls, name, bases, classdict):
cls.choices = [name for name, attrib in classdict.items() \
if is_choice(attrib)]
# our class...
class Foo(object):
__metaclass__ = ChoicesMeta
def __init
John Salerno a écrit :
> Are there any major differences between these two?
Yes. SQLAlchemy is, mainly, a very higher-level DB-API that makes
working with a RDBMS almost transparent (no embedded SQL unless you
really wants to) without trying to pretend there's no RDBMS nor forcing
you into ORM
Joel Hedlund a écrit :
> Hi!
>
> The question of type checking/enforcing has bothered me for a while,
(snip)
>
> I've also whipped up some examples in order to put the above questions
> in context and for your amusement. :-)
(snip)
> These are the attached modules:
>
> * nocheck_module.py:
>
software than what I could
come with by myself (been here, done that...), is IMVHO a wrong
solution. I mean, a RDBMS is not a persistence engine, it's a data
management tool. If you don't need a relational model, or if it doesn't
match your app's needs, then why use one when we
have a specific syntax for the class object definition and not
> for objects of different type?
>
> so if i want to define a new class object (my_class for example) with a
> new object syntax:
>>> instance my_class:
>>> __class__ = object
>>> __metaclass__
quot;silent" data corruption with Python - FWIW, I
once had such a problem, but with a lower-level statically typed
language (integer overflow), and I was a very newbie programmer by that
time. Usually, one *very quickly* notices when something goes wrong. Now
if you're really seri
ut what comes from the outside world and
mostly confident about what comes from other parts of the application.
--
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
gt; if you're really serious, unit tests is the way to go - they can check
>> for much more than just types.
>
> Yes, I'm very much serious indeed. But I haven't done any unit testing.
Then you probably want to read the relevant chapter in DiveIntoPython.
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
Antal Rutz wrote:
> hi,
>
> is there something wrong with django's website (djangoproject.com)
Obviously, yes.
> or I have problems?
I don't think so.
I warned them on the google group, I think things should be fixed soon.
--
bruno desthuilliers
python -c "print
es here,
Nope --> My Very Humble Opinion
--
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
elevant for an persistency mechanism targetting an OO language:
RDBMS are not "persistency mechanism", they are data management tools.
--
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
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>I've rarely encoutered "silent" data corruption with Python - FWIW, I
>>once had such a problem, but with a lower-level statically typed
>>language (integer overflow), and
lazaridis_com wrote:
> Ο/Η Bruno Desthuilliers έγραψε:
>> lazaridis_com wrote:
>>> John Salerno wrote:
>>>> Are there any major differences between these two? It seems they can
>>>> both be used with TurboGears, and SQLAlchemy with Django. I'm just
&g
-style classes and the descriptor protocol
may help:
http://www.python.org/download/releases/2.2.3/descrintro/
http://users.rcn.com/python/download/Descriptor.htm
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
601 - 700 of 3705 matches
Mail list logo