alf a écrit :
> Hi,
>
> I have a reference to certain objects. What is the most pythonic way to
> test for valid reference:
>
> if obj:
Don't do this:
for o in [0, '', [], {}, ()]:
print obj, bool(obj), obj is None
> if None!=obs:
In python, assignement is a statement, not an exp
Chris Brat a écrit :
> Thanks, thats exactly what I was looking for - very neat.
>
Just note that both solutions rebind the name to a newly constructed
list instead of modifying the original list in place. This is usually
the RightThing(tm), but sometimes one wants an in-place modification.
--
Carl Banks wrote:
> Bruno Desthuilliers wrote:
>> In python, assignement is a statement, not an expression, so there's no
>> way you could write 'if obj = None' by mistake (-> syntax error). So
>> this style is unpythonic. Also, None is a singleton, and ident
ssible. In it's category,
it beats Access and MySQL hands down. Now if you want a real RDBMS,
you've just failed to choose the right tool. May I suggest PostgreSQL ?
(snip useless rant)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1]
the
current namespace. The 'import *' loads all public names from
. And FWIW it's usually considered bad style (potential
name clash, and can makes hard to tell where a name is defined...)
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
lazaridis_com wrote:
> Bruno Desthuilliers wrote:
>> lazaridis_com wrote:
>>> Ο/Η Bruno Desthuilliers έγραψε:
>>>> lazaridis_com wrote:
>>>>> John Salerno wrote:
>>>>>> Are there any major differences between these two? It seems th
d you read the manuals at all then ?
>> Live with it or use a real RDBMS.
>
> I don't mind living with it as long as it's documented.
It is. In SQLite manual. Or do you hope the Python manual to also fully
document PostgreSQL, MySQL, Oracle, Apache, Posix, Win32 etc ?
--
b
etc).
Coming from C++, you'll probably need a few days to grasp Python's
object model and idioms (Python looks much less like a dumbed-down C++
than Java), but my bet is that you'll be productive *way* sooner with
Python, and *much* more productive.
My 2 cents,
--
bruno desthuillie
as) some licencing limitations on Windows.
--
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
Jason wrote:
> Bruno Desthuilliers wrote:
>> With a GUI ? If so, you probably want to check out wxPython or PyGTK
>> (wxPython will also buy you MacOS X IIRC, and wil perhaps be easier to
>> install on Windows).
>
> Just a warning: wxPython does operate slightly dif
Or go for a
saner design...
> but clearly that is not happening.
> Can someone explain why.
Test2(2,True) calls Test2.__init__() with a Test2 instance 'self' and
y=True. Test2.__init__() then calls Test.__init__() with the same
instance and y=True. So the branch:
if y:
self.getx =
nstanciated. You
mentioned NotImplementedError, which is indeed the usual way to make
something "abstract" in Python.
--
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
his problem?
Not out of my hat. Just a few considerations on Python and OO: Python
being dynamically typed, inheritence is only about sharing
implementation. There's another way to do share implementation -
composition/delegation. It's more flexible, and can avoid "cartesian
product&quo
Butternut Squash wrote:
> What do you guys recommend for doing middle tier in python.
> I want to hide the database from the application
Why ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in &
there is a more correct
> term.
Depends if instanciating this base class would make any sense.
--
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
> sys.exit(2)
> #usage()
>
> for opt, arg in opts:
> if opt in ("-l", "--latest"):
> latest = int(arg)
> elif opt in ("--notfound"):
> ignoreNotFound = True #add notfound files to log
OMG. optparse is far better than this.
(snip)
My overall feeling is that in most function, you're mixing too much
different concerns. Each function should do *one* thing (and do it
well). The most obvious problem here is about mixing application logic
and UI. Application logic (what your app is effectively doing) should be
as independant as possible of UI concerns. If possible, you should be
able to reuse most of the application logic (except for the main() func,
which in your case is the command-line UI) as a module in other
applications. Now there are time when the application code needs to
notify the UI. The good news is that Python makes it easy to makes this
generic, using callback functions or objects provided by the UI and
called when appropriate by the application logic. The key here is to
come up with a clear, well-defined interface between logic code and UI code.
A last point : avoid globals whenever possible. Either pass values as
arguments to functions or use a kind of config object if there are too
much configuration stuff.
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
Frank Millman wrote:
> Bruno Desthuilliers wrote:
>> Frank Millman wrote:
>>> [EMAIL PROTECTED] wrote:
>>>> There aren't abstract classes in Python. They are all
>>>> concrete.
>> (snip)
>>> I use the term 'abstract class' in
Maric Michaud a écrit :
> Le vendredi 08 septembre 2006 10:15, Bruno Desthuilliers a écrit :
>
>>You
>>mentioned NotImplementedError, which is indeed the usual way to make
>>something "abstract" in Python.
>
>
> Hummm, some more thoughts about this.
James Stroud a écrit :
> Hello All,
>
> I am interested in setting up a modest invoicing system for some
> consulting I am doing. I like the idea of managing this on the web and
> creating invoices and printing them from a browser. However, I'm not
> really sure where to start. I've played with
jason a écrit :
Just some more suggestions:
> def parselog(data):
> other = 0
> records = {}
>
> for line in string.split(data, '\n'):
for line in data.split('\n'):
> str = line.strip()
This will shadow the builtin 'str' type. You could reassign to 'line'
instead, or
Wensheng a écrit :
> I installed pysqlite2 using easy_install.
> and got this when using it from modpython:
> --
> Mod_python error: "PythonHandler etc.modpython"
>
> Traceback (most recent call last):
ddtl a écrit :
> On 7 Sep 2006 10:42:54 -0700, in comp.lang.python you wrote:
>
>
>>Let's examine what the mro order is for class D:
>>
>D.mro()
>>
>>[, , ,
>>>n__.A'>, ]
>>
>>When you call d.met(), the call dispatches to the D.met() method.
>>After printing out 'D.met', you use super() to ge
ips of and between the items of data?
Looks a lot like a RDBMS...
> It seems to me that if this could be done, then it could be used to
> dynamically
> generate the routines needed for validation, update, etc...
>
> But my brain strains when I try to think about how to do it...
Yo
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
>> [EMAIL PROTECTED] wrote:
>>> Probably just me. I've only been using Access and SQL Server
>>> for 12 years, so I'm sure my opinions don't count for anything.
>>>
>> SQLite neve
[EMAIL PROTECTED] wrote:
(snip)
> Are you saying that MySQL is goofy? ;-)
>
This is an understatement.
--
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 Boddie wrote:
> Bruno Desthuilliers wrote:
>> Wensheng a écrit :
>>> I installed pysqlite2 using easy_install.
>>> and got this when using it from modpython:
>>> ---
eciated. Your sarcastic, condescending tone kind of gets in
> the way of the message, though.
What about jokes on "waterheadretard" then ?
--
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
Note to the OP: if None is a valid value for the variable, you may use
another object, ie:
def somefunc(*args, **kw):
variable = _marker = object()
(...)
if variable is _marker:
print "not defined"
(...)
--
bruno desthuilliers
python -c "print '@'.joi
Paul Boddie wrote:
> Bruno Desthuilliers wrote:
>> eggs are the Python's equivalent to Java's JAR, not a RPM-like. I said
>> it was not an egg-specific issue (which is not totally accurate) because
>> it mostly have to do with loading dynamic libs (.so, .dll etc)
)
def defaultFunc(*args, **kw):
return "defaultFunc called with %s %s" % (str(args), kw)
class SwitchFunc(object):
def __init__(self, default, **kw):
self._default = default
self._switch = kw
# makes the object callable.
def __call__(self, case, *args, **kw):
func = self._switch.get(case, self._default)
return func(*args, **kw)
switch = SwitchFunc(defaultFunc, a=funcA, b=funcB, c=funcC)
for case in "abcX":
print switch(case, "foo", q=42)
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
g, id(arg))
def runtest():
obj = ["Life, universe and everything"]
print "in runtest : obj is %s (%s)" % (obj, id(obj))
print "calling test with obj:"
test(obj)
print "in runtest: now obj is %s (%s)" % (obj, id(obj))
Here again, if you want your func
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
>> [EMAIL PROTECTED] wrote:
(snip)
>>> class caseFunction(object):
>>> def __init__(self):
>>> self.caseDict = {'a':"retval = 'a'",
>>> 'b':"r
waylan a écrit :
(snip)
>
> While Steve's examples certainly do the trick in this limited case, I
> assumed that the original poster was just starting with mod_python and
> I was simply trying to explain the bigger picture for future reference.
> As one develops more sophisticated code, simply add
to come up with the most possibly Q&D solution:
res = int(str(5 + 7)[-1])
Like it ?-)
--
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
x27; operator. For example:
>
> print 5 ^ 7
>
>
>>> 10 ^ 21
31
Not really "less than 10"...
--
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
Christophe wrote:
> Bruno Desthuilliers a écrit :
>> Bryan Olson wrote:
>>> Hugh wrote:
>>>> Sorry, here's an example...
>>>>
>>>> 5+7=12
>>>>
>>>> added without carrying, 5+7=2
>>>>
>>>>
;t care if the objects is a file or not - you just care if the
object support the subset of the file interface you intend to use. And
this, you'll only know at runtime.
--
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
the rest of the code, but if it's something
like this :
def show_lines(fileobj):
for line in fileobj:
print line
it will just work...
--
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
Luis P. Mendes a écrit :
> Hi,
>
> I have the following problem:
>
> I instantiate class Sistema from another class. The result is the same
> if I import it to interactive shell.
>
> s = Sistema("par")
>
> class Sistema:
> def __init__(self, par):
> cruza_ema = CruzaEmas(par)
>
>
Jon Ribbens a écrit :
> In article <[EMAIL PROTECTED]>, Bruno Desthuilliers wrote:
>
>>Hugh wrote:
>>
>>>Sorry, here's an example...
>>>
>>>5+7=12
>>>
>>>added without carrying, 5+7=2
>>>
>>>i.e the
Thorsten Kampe a écrit :
(snip)
> PS Actually the author wrote the finest and best Windows Editor and I
> also use EditPad Pro under Linux (together with Wine) because of the
> lack of usables editors under Linux.
I guess we don't have the same definition of a "usable" editor...
--
http://mail.py
times before understanding what it means.
>> >
>> Where have you read that?
>>
>> wildemar
>
> I don't mean to start a flame war about this but here are some
> reference of people, who like me, don't like the current python doc:
> http://xahlee.org/Unix
nload page, i'd greatly appreciate if you share it
> with me.
http://www.webwareforpython.org/WebKit/Docs/InstallGuide.html#mod-webkit
"""
The source code and a README file describing how to configure and build
mod_webkit are located in the Webware/WebKit/Adapters/mod_webkit
"
initively have a look at setuptools before
proceeding to reinventing the SquareWheel(tm):
http://peak.telecommunity.com/DevCenter/setuptools
--
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
w to generate SQLAlchemy schemas instead.
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
lert ! Unusable undocumented monstruosity ahead...
--
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
Samuel a écrit :
>>FWIW, there's a Python port of adodb:
>>http://phplens.com/lens/adodb/adodb-py-docs.htm
>>
>>and parsing XML in Python is quite easy. So you could as well port the
>>AdoDB XML to Python too.
>
>
> That is exactly what I am trying to avoid. While implementing the
> parser might
John Salerno a écrit :
> Forgive my excitement, especially if you are already aware of this, but
> this seems like the kind of feature that is easily overlooked (yet could
> be very useful):
>
>
> Both 8-bit and Unicode strings have new partition(sep) and
> rpartition(sep) methods that simplif
in the app code, a simple 'import config', which allow acces
to config vars via 'config.varname' (clean namespaces really improve
maintainability).
My 2 cents
> Regards
>
> Joakim
>
--
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
n.query(sqlcheck1)
pubType = cmi.fetch_rows(overseas1)
"""
May we have the url where we can see this application in action ? I know
some crackers that would be really pleased to mess with your production
database...
--
bruno desthuilliers
python -c "print '@&
Fuzzydave wrote:
> I am back developing futher our Python/CGI based web application run by
> a Postgres DB
> and as per usual I am having some issues. It Involves a lot of Legacy
> code.
s/Legacy/Norwegian Blue/
--
bruno desthuilliers
python -c "print '@'.join(
John Salerno a écrit :
> Bruno Desthuilliers wrote:
>
>> Err... is it me being dumb, or is it a perfect use case for str.split ?
>
>
> Hmm, I suppose you could get nearly the same functionality as using
> split(':', 1), but with partition you also get the se
Gabriel Genellina wrote:
(snip)
> When you construct an object instance, it is of a certain type from that
> precise moment, and you can't change that afterwards.
Err... Actually, in Python, you can. It's even a no-brainer.
(snip)
--
bruno desthuilliers
python -c "print
init__(self, world)
# 'override' World.dothat:
def dothat(self, bar):
bar = bar * 3
return self.world.dothat(bar)
# automagically delegate other stuff:
def __getattr__(self, name):
return getattr(self.world, name)
HTH
--
bruno desthuilliers
python -c "print &
ced', 'f', 'aazaz']
>>> "ab-eced-ff-aazaz".split('-')
['ab', 'eced', 'ff', 'aazaz']
>>>
--
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
y all the gory details of HTTP response
headers. And most also offer a data access layer over a RDBMS or an OODBMS.
IOW, wsgi will not saves you from learning to use a specific web
framework. Nor will it saves you from learning *at least* the HTTP
protocol, and most probably html, css, Javascript etc.
[EMAIL PROTECTED] wrote:
(please, *stop* top-posting - corrected)
> Bruno Desthuilliers wrote:
>>
>> [EMAIL PROTECTED] wrote:
>> (OT : please dont top-post)
>>
>>> What I tried to do is to write a string.split() module,
>> So don't waste time:
>
ess.
Else, it may or not be a valid email address - and then the only
reliable way to know is to send a mail to that address.
> and
> possibly belongs to the user...
How do you intend to check this ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for
Gabriel Genellina wrote:
> At Thursday 21/9/2006 09:14, Bruno Desthuilliers wrote:
>
>> > When you construct an object instance, it is of a certain type from
>> that
>> > precise moment, and you can't change that afterwards.
>>
>> Err... Actua
crystalattice a écrit :
> I've been working on a game for several months but now I'm thinking I
> may be going about it the wrong way. It's an online RPG designed to
> recreate a pen & paper session, kind of like the OpenRPG project.
>
> Originally I planned on doing something like OpenRPG with a
sam a écrit :
> i am starting to experiment with recursion, and decided to write a
> fairly trivial little program which took a float as input, then called
> a function to halve it recursively until it was less than 1:
And forgot to return the result from the recursive call, I guess ?-)
--
http:/
Neil Cerutti a écrit :
(snip)
> It's not out of the kindness of our hearts that we help. Heck, I
> don't know what it is. Probably I just like reading my own drivel
> on the internet and occassionally helping others is a good
> excuse.
Lol !-)
+1 OTQOTW
--
http://mail.python.org/mailman/listinf
George Sakkis a écrit :
> Daniel Nogradi wrote:
>
>>In a recent thread,
>>http://mail.python.org/pipermail/python-list/2006-September/361512.html,
>>a couple of very useful and enlightening itertools examples were given
>>and was wondering if my problem also can be solved in an elegant way
>>by it
crystalattice wrote:
> Bruno Desthuilliers wrote:
>> I have few experience with RPG softwares, but if your "domain" logic si
>> anything more than trivially complex, it's always better to keep it as
>> decoupled as possible from the user interface (unless of c
Sébastien Ramage wrote:
> Bonjour à tous,
Hi Sébastien.
Wrong newsgroup, I'm afraid - either repost here in english, or post to
fr.comp.lang.python...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.&
walterbyrd wrote:
> If so, I doubt there are many.
We're at least two here...
> I wonder why that is?
>
I wonder why you have such an a priori ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) fo
them ...
devices = ["PCI:2:3.0", "PCI:3.4:0"]
for d in device:
nums = tuple(map(int, d.split(':')[1:]))
print "for ", d, " : ", nums
--
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
Neal Becker a écrit :
> Any suggestions for transforming the sequence:
>
> [1, 2, 3, 4...]
> Where 1,2,3.. are it the ith item in an arbitrary sequence
>
> into a succession of tuples:
>
> [(1, 2), (3, 4)...]
>
> In other words, given a seq and an integer that specifies the size of tuple
> to r
Fabian Steiner a écrit :
> Bruno Desthuilliers wrote:
>
>>Fabian Steiner wrote:
>>
>>>I often have to deal with strings like "PCI:2:3.0" or "PCI:3.4:0" and
>>>need the single numbers as tuple (2, 3, 0) or (3, 4, 0). Is there any
>>>
John Salerno a écrit :
> It's a nice thought that a person can earn a living programming with
> Python, which is fun enough to use just for its own sake. But for
> someone like me (i.e. no programming experience) it's always a little
> disheartening to see that most (if not all) job descriptions
[EMAIL PROTECTED] a écrit :
> A very old thread:
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/2c5022e2b7f05525/1542d2041257c47e?lnk=gst&q=for+else&rnum=9#1542d2041257c47e
>
> discusses the optional "else:" clause of the for statement.
>
> I'm wondering if anyone has ever fo
example.py, and I'd like to incorporate it
> **into** part of an HTML page with nice syntax highlighting and all the
> shebang. Is there an easy way to do so?
I suppose this has more to do with the course presentation than with
it's content !-)
However, Trac's wiki is probably a go
ce). FWIW, you may want to post this on fclpy too - there are some
"hard-core" Windows developpers there...
You can also point your boss to IronPython - if MS puts some money on
it, it can't be a bad tool, isn't it ?-)
--
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
John Henry wrote:
> I don't know what windev is
A french (highly proprietary) so-called "CASE-Tool" with a so-called
"5th generation language" (lol) that is mostly a dumbed-down mix of
basic and pascal. It's so bad that it makes you regret VB6.
--
bruno desthu
urn [a,b]
>
> should be:
> return [a].extend(b)
A Lisp cons is made of a reference to it's content and a reference to
the rest of the list, so cons = lambda a, b : [a, b] seems the most
straightforward translation.
>> def car(structure)
>>return structure[
gain, you cannot *remove* anything from a string - you can just
have a modified copy copy of the string. (NB : answer is just above :
use str.strip())
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.compile('blah').atstartof(string)
> re.compile('blah').atendof(string)
What's wrong with:
re.search(r'^blah', somestring)
re.search(r'blah$', somestring)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w
Brendon Towle wrote:
> On 28 Sep 2006, at 8:05 AM, [EMAIL PROTECTED] wrote:
>
>> From: Bruno Desthuilliers <[EMAIL PROTECTED]>
>>
>> Brendon Towle wrote:
>>> Some of your Lisp translations are subtly off...
>>
>> Seems correct to me. Lisp l
= kw.get('titles', [])
self.birthdate = kw.get(birthdate, None)
# etc
> Does a question like this depend on how the class will be used?
I don't think it would make sens to design anything without any hint
about how it's supposed to be used.
My 2 cents
--
bruno des
Roy Smith a écrit :
> In article <[EMAIL PROTECTED]>,
> "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote:
>
>
>>>Things like decorators and metaclasses certainly add power, but they add
>>>complexity too. It's no longer a simple language.
>>>
>>
>>Well, I think a simple language is a language
tobiah a écrit :
> SpreadTooThin wrote:
>
>> f = open('myfile.bin', 'rb')
>>
>> How do I know if there was an error opening my file?
>>
> try:
> open('noexist')
> except:
> print "Didn't open"
>
Should be:
try:
f = open('noexists')
except IOError, e:
print >> sys.stderr, "
close my eyes
Well... Not quite Common Lisp yet, but :
http://www.biostat.wisc.edu/~annis/creations/PyLisp/
--
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
is. If it then happens that SQLite is the bottleneck, try
switching to a real RDBMS like PostgreSQL.
Remember the 3 golden rules about optimisation:
1/ don't optimize
2/ don't optimize
3/ for the experts only: don't optimize
My 2 cents...
--
bruno desthuilliers
"Premature
or the programmer.
NB : transmitted to [EMAIL PROTECTED] who will appreciate if OT
commercial adds are welcomes here.
> --
> PatBiker
>
--
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 this crap do something useful.
Heck, compared to PC-Soft, one could find that Microsoft's marketing
strategy is based on delivering smart, usable, cleanly debugged products
and being helpful to users...
--
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
y(s, chunksize):
f = StringIO.StringIO(long_string)
chunk = f.read(chunksize)
while chunk:
yield chunk
chunk = f.read(chunksize)
f.close()
Now I'm sure someone will come up with a solution that's both far better
and much more obvious (at least if you're Dutch )
--
bruno
[EMAIL PROTECTED] wrote:
> Hi,
>
> Bruno Desthuilliers a écrit :
>> I've never met a programmer that "loved" Windev.
>
> I have met some here (I'm the guy with a mustache-just kidding but
> actually I was there).
>
> http://www.pcsoft.f
ml
> http://www.pcsoft.fr/pcsoft/120pages/index.html
"Facts" ? Lol ! It's about as factual as the existence of Saddam
Hussein's mass destruction weapons.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.
de (which can boil down to a
single assignement), but about the unnecessary level of indirection
(which, as someone stated, is the one and only problem that cannot be
solved by adding a level of indirection !-).
--
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
be appreciated.
Could it be that one ?
http://adminspotting.net/building-web-pages-with-python/
--
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
ery nice which is the interactive python
shell. This lets you try code snippets and see by yourself how it really
works :
[EMAIL PROTECTED] ~ $ python
Python 2.4.3 (#1, Sep 29 2006, 20:26:46)
[GCC 4.1.1 (Gentoo 4.1.1-r1)] on linux2
Type "help", "copyright", "credits"
Fredrik Lundh wrote:
> Bruno Desthuilliers wrote:
>
>> Amanda wrote:
>> (snip)
>>> I am always amazed when I meet fanatics!!
>> I'm always amazed when I meet PC-Soft's salespersons...
>
> isn't there some non-python forum where you can sort
LaundroMat a écrit :
> Suppose I have this function:
>
> def f(var=1):
> return var*2
>
> What value do I have to pass to f() if I want it to evaluate var to 1?
>
> I know that f() will return 2, but what if I absolutely want to pass a
> value to f()? "None" doesn't seem to work..
Have you trie
has wrote:
> Python's type/class
> distinction
Which "type/class" distinction ?
--
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
Kai Kuehne a écrit :
> Hi list!
> It is possible to overwrite only one function with the property-function?
property is not function, it's a class. And it doesn't "overwrite" anything.
> x = property(getx, setx, delx, 'doc')
>
> I just want to overwrite setx, but when I set the others to None,
>
Diez B. Roggisch a écrit :
> [EMAIL PROTECTED] schrieb:
>
>> I have taken the coments and think I have implemented most. My only
>
>
> Unfortunately, no.
>
>> question is how to use the enumerator. Here is what I did, I have tried
>> a couple of things but was unable to figure out how to get th
walterbyrd a écrit :
> Fredrik Lundh wrote:
>
>
>>modularity, modularity, and modularity.
>>
>
>
> Can't PHP be made to be just as modular?
PHP has no notion of modules.
> As a matter of popular practise, I suppose that is not done. I would
> think that it could be.
Certainly not the way Pyt
body (ie, outside methods) are attached
to the class object itself (and then shared by all instances of the
class), not to instances themselves. Instance attributes initialisation
is usually done in the __init__(self, ...) 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
productive with a good
code editor, the command line, and a few external tools when needed.
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
[EMAIL PROTECTED] wrote:
> Hi
>
> Having a method:
>
> def method(self,x,y):
>
> is it possible to discover, from outside the method, that the methods
> arguments are ['self', 'x', 'y']?
import inspect
help(inspect.getargspec)
HTH
--
brun
701 - 800 of 3705 matches
Mail list logo