On Thu, 2012-06-21 at 21:25 +1000, John O'Hagan wrote:
> Sometimes a function gets called repeatedly with the same expensive argument:
>
> def some_func(arg, i):
> (do_something with arg and i)
>
> same_old_arg = big_calculation()
> for i in lots_of_items:
> some_func(same_old_arg, i)
>
source code at a given revision.
Cheers,
Cliff
On Sat, 2012-06-16 at 13:24 +1000, Mark Livingstone wrote:
> Hello!
>
> I wish to properly cite Python in an academic paper I am writing.
>
> Is there a preferred document etc to cite?
>
> Thanks in advance,
>
>
It is for reading all the lines from a complete file. If the file is
still being written to, it doesn't have an end yet. File objects do
many things besides RPC. Also, there are instances where all you want
to do is block until the file is done, and then get all the content.
readlines will do th
On Thu, 2012-06-07 at 16:04 +, Julio Sergio wrote:
> Up to this point it worked as expected. However, when I tryied with the
> methods
> that write and read several lines, apparently the process got stalled:
>
> ->>> fi.writelines(["uno\n","dos\n","tres\n"])
> ->>> fi.flush()
> ->>> s = fo.
data into useful python objects, and from python objects to
displayable values.
http://www.formencode.org/en/latest/Validator.html
Might be what you're looking for.
Cheers,
Cliff
On Mon, 2012-04-02 at 14:55 +0200, Stéphane Klein wrote:
> Hi,
>
> I look for a package to make
u've created the next
token, a string literal, that the parser discovers the error: you can't
have a string literal following a variable.
*You* think your error is that you misspelled "print." The parser
thinks your error is trying to put a string literal next to a variable.
hen format them using
standard string formatting operations when you want to print them.
There's more information on how to do formatting here:
http://docs.python.org/library/stdtypes.html#string-formatting
Cheers,
Cliff
On Mon, 2012-03-26 at 04:45 -0700, [email protected]
2008/10/why-explicit-self-has-to-stay.html
Cheers,
Cliff
On Thu, 2012-03-22 at 13:15 +, Andrea Crotti wrote:
> On 03/22/2012 10:51 AM, Steven Lehar wrote:
> > It seems to me that the Python class system is needlessly confusing.
> > Am I missing something?
> >
> >
Write a context manager.
Then you just do
with MyLDAPWrapper() as ldap
ldap.this()
ldap.that()
and when you leave the scope of the with statement, your ldap __exit__
method will get called regardless of how you left.
Cheers,
Cliff
On Wed, 2012-03-21 at 19:30 +, John Gordon wrote
Binding"
http://www.python.org/dev/peps/pep-0289/#early-binding-versus-late-binding
Cheers,
Cliff
On Tue, 2012-03-20 at 16:50 -0600, Ian Kelly wrote:
> On Tue, Mar 20, 2012 at 3:16 PM, Dennis Lee Bieber
> wrote:
> > On Tue, 20 Mar 2012 16:23:22 -0400,
as discovered in python 2.6. In python 3.2, both versions fail
with the same NameError.
Obviously, this is easy enough to work around. I'm curious though:
What's going on under the hood to cause the nested generator expression
to fail while the list comprehension succeeds?
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am looking for a Python library, which can handle the modelling of material
flows in Supply Chains.
Any idea ?
Thx
--
http://mail.python.org/mailman/listinfo/python-list
including libttsh11 fixed the problem. Thank you!
Now I can get on with fixing everything that Python 3 broke... err changed.
:)
--
Cliff
On Sat, Aug 28, 2010 at 11:20 AM, Alexander Gattin wrote:
> Hello,
>
> On Sat, Aug 28, 2010 at 09:27:05AM -0400, Cliff
> Martin wrote:
this work?). Python -v did, however, and it came up with a
number of unresolved symbols all seeming to be from libnnz11.so. I tried
linking against all of the *.so files in ORACLE_HOME/lib, but I don't
remember trying libttsh11 specifically. I will try it again on Monday.
--
Cliff
On Sat, A
hould work, but there
is not a lot of people doing this or posting notes about their install
problems or successes on HP-UX.
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2010-06-17 at 16:36 +, Deadly Dirk wrote:
> I cannot get right the super() function:
> Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22)
> [GCC 4.4.1] on linux2
> Type "copyright", "credits" or "license()" for more information.
> No Subprocess
> >>> class P:
> def __init_
+1
Options are options, arguments are arguments. An optional argument is
not an option. It is an argument that can be left out.
On Wed, 2010-06-02 at 12:42 +0200, Antoine Pitrou wrote:
> On Wed, 2 Jun 2010 01:49:18 -0700 (PDT)
> Michele Simionato wrote:
> >
> > Notice that optparse is bas
in s)
However, if you need an arbitrary number of zeros preserved, you're out
of luck. They are semantically meaningless in python. (Is semantically
meaningless redundant?)
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
Don't use regular expressions for that.
s = '0x340x5A0x9B0xBA'
return '0x' + ''.join(s.split('0x'))
On Tue, 2010-05-18 at 06:48 -0700, Back9 wrote:
> Hi,
>
> I have a string like this:
> 0x340x5A0x9B0xBA
> I want to extract 0x from the string but the first one.
>
> How I can use re for this cas
on of your `def
test_T1(self):` line is off by one column, relative to pass, and by
three columns relative to the other methods.
Cheers,
Cliff
On Mon, 2010-05-10 at 13:38 +0100, John Maclean wrote:
> hi,
>
> can some one explain why the __first__ test is not being run?
>
> #
On Fri, 2010-05-07 at 15:36 -0400, William R. Wing wrote:
>
> Maybe I should have been more explicit. The first line in the Python
> file is:
>
>
> #!/usr/bin/env Python (alternatively #!/usr/bin/Python - same results
> either way).
>
python should be lowercased when referring to the name of
On Fri, 2010-05-07 at 15:36 -0400, William R. Wing wrote:
>
> Maybe I should have been more explicit. The first line in the Python
> file is:
>
>
> #!/usr/bin/env Python (alternatively #!/usr/bin/Python - same results
> either way).
>
python should be lowercased when referring to the name of
That's kind of a nifty idea. However, python is currently under a
syntax moratorium. No syntax changes will be accepted for at least 24
months starting from the release date of Python 3.1. See more details
here: http://www.python.org/dev/peps/pep-3003/
Cheers,
Cliff
On Fri, 2010-04-30
our columns can have spaces within them, or are separated in other
ways, you'll need something else.
Cheers,
Cliff
On Mon, 2010-04-26 at 14:50 +, mannu jha wrote:
> Dear all,
>
> I am new in python, can anyone help me that how can I select two
> column out of 6 column from
You need to know what your input data actually looks like, and the best
thing for that is a little bit of formatting. I bet you can figure out
the problem yourself, once you see the structure of your data more
clearly. I've reformatted the JSON for you to help out.
On Fri, 2010-04-23 at 07:20
On Fri, 2010-04-16 at 09:50 -0700, Dave W. wrote:
> >>> old_print = __builtins__.print
> >>> __builtins__.print = printhook
> >>> yield
> >>> __builtins__.print = old_print
> >
> >> I'm pretty sure this is semantically equivalent to my original
> >> code, but I gave it a try anyway.
On Sat, 2010-04-17 at 00:37 +1000, Lie Ryan wrote:
> On 04/16/10 23:41, J wrote:
> > So, what I'm curious about, is there a list comprehension or other
> > means to reduce that to a single line?
>
> from itertools import chain
> def printout(*info):
> print '\n'.join(map(str, chain(*info)))
>
l it has enough.
So your opener returns as soon as the request is sent, and read() blocks
if it doesn't have enough data to handle your request.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
l it has enough.
So your opener returns as soon as the request is sent, and read() blocks
if it doesn't have enough data to handle your request.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
nvalid syntax
Admittedly, this is a trivial benefit. If you're using a literal, you
already know what type you're dealing with.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
The problem is that the class of platform.__builtins__ is a dict, not a
string containing the text "".
Try replacing line 16 with this:
self.assertEqual(type(platform.__builtins__), dict)
Cheers,
Cliff
On Tue, 2010-04-13 at 15:01 +0100, John Maclean wrote:
> I normally u
On Wed, 2010-02-10 at 13:18 -0800, Stephen Hansen wrote:
>
> The original code:
>
>
> s = f.readline()
> if 'mystring' in s: print 'foundit'
> if 'mystring' not in s: print 'not found'
> if 'mystring' in s:
> print 'processing'
>
>
> ... will only work on Python 2.x, as print is being used
practice. You leave yourself vulnerable not only
to attacks, but to simple absent-mindedness as well. Using parameters
in your execute statement will handle all necessary quoting for you,
which eliminates the possibility of a bad query sneaking in. For more
information, as I mentioned, look up SQL injection. Also, read this:
http://xkcd.com/327/
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
sum totals of nums"""
# ???
list_of_numbers = [1, 24, 34, 28, 4, 1]
cumulative_sum = summifier(list_of_numbers)
assert(cumulative_sum == [1, 25, 59, 87, 91, 92])
If you can come up with the summifier function, you're all set. I gotta
say, though, this smells like homework.
tion as I think, and explain a
clean, elegant implementation for this, many of my concerns would be
alleviated, and I would change my -1 to a -0.
Cheers,
Cliff
On Mon, 2009-08-24 at 00:01 +1000, Ben Finney wrote:
> [email protected] writes:
> > Why not
On Wed, 2009-08-19 at 15:56 +0200, Bruno Desthuilliers wrote:
> Terry Reedy a écrit :
> > Robert Dailey wrote:
> >
> >> I'm using Python 2.6. And using the legacy syntax in the lambda does
> >> not work either. I want to avoid using a def if possible. Thanks.
> >
> > In Python, writing
> >
> > n
u want your class to be able to do,
and what the API will be for performing each of those functions. Then
you should be able to begin implementing it, or at least come up with
some more specific questions.
> Thank you very much,
> Krishna
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
Learn the pythonic workaround of using
None in your parameters whenever you want a default empty list, and
don't let it bother you too much. Overall, python is a remarkably well
designed language. This is one of the relatively rare warts that crept
in because it enables a broader cleanliness of design.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
, but it is not. You are proposing changing the parsing
rules, which completely changes the scope of what is possible and what
isn't with python syntax. All to solve a problem that, so far, hasn't
been proven to exist in anything other than a speculative way.
You're trying to turn an ocean liner around because you left your
sunscreen on the dock.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 2009-07-20 at 12:26 -0700, Phillip B Oldham wrote:
> On Jul 20, 6:08 pm, Duncan Booth wrote:
> > The main reason why you need both lists and tuples is that because a tuple
> > of immutable objects is itself immutable you can use it as a dictionary
> > key.
>
> Really? That sounds interest
rity, a.k.a. don't you have something better to do?
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
plit()
>>>
>>> if data[1] not in thingies:
>>> # group data by data[1]
>>> thingies[data[1]] = {}
>>>
>>> thingies[data[1]][data[3]] = data[5]
Step two, extract the data from the list:
>>> for key, data in thingies.items():
>>> print key,
>>> for entry in data
>>> print '%s = %s' % (entry, data[entry]),
This should do what you want, minus some formatting issues.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
def __init__(self, color):
self.color = color
class Sign(object):
def __init__(self, inscription):
self.inscription = str(housenumber)
(Something like that)
Cheers,
Cliff
> Well, so far, so good. Now, what I'd like to achive is that the text of
> the "sign"
On Thu, 2009-07-09 at 13:53 +, Friðrik Már Jónsson wrote:
> Look at:
>
>len = len(text)
>
> You're overriding `len` (a built-in method), with an integer
> (`len(text)`). You then call:
>
>for i in range(len(fields)):
>
> But `len` is no longer a callable, but merely an integer.
>
On Fri, 2009-07-10 at 11:57 -0500, Robert Kern wrote:
> On 2009-07-10 11:50, J. Cliff Dyer wrote:
> > On Fri, 2009-07-10 at 02:57 +, Steven D'Aprano wrote:
> >> On Fri, 10 Jul 2009 03:28:04 +0100, Nobody wrote:
> >>
> >>> On Thu, 09 Jul
pening more
clearly. And it protects you if another caller (even one internal to
the class) calls it with a different set of assumptions.
At minimum, I think there's a heavy burden on an author to justify the
use of AssertionErrors rather than other kinds of Exceptions.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2009-07-09 at 18:10 +, Steven D'Aprano wrote:
> If programming is symbol manipulation, then you should remember that
> the
> user interface is also symbol manipulation, and it is a MUCH harder
> problem than databases, sorting, searching, and all the other
> problems
> you learn abou
Bearophile wins! (This only times the loop itself. It doesn't check
for __len__)
summer:5
0:00:00.51
bearophile:5
0:00:00.09
summer:50
0:00:00.30
bearophile:50
0:00:00.13
summer:500
0:00:00.77
bearophile:500
0:00:00.53
summer:5000
0:00:00.000575
bearophile:5000
0:00:00.00
On Wed, 2009-07-01 at 17:19 +1200, Lawrence D'Oliveiro wrote:
> In message , J. Cliff
> Dyer wrote:
>
> > If the lines got separated, a leading + could disappear into its line
> > without any errors showing up. A trailing + would raise a syntax error.
>
> Unle
On Tue, 2009-06-30 at 13:24 -0700, Beni Cherniavsky wrote:
> On Jun 24, 11:40 pm, "J. Cliff Dyer" wrote:
> > Also note that you can iterate over a file several times:
> >
> > f = open('foo.txt')
> > for line in f:
> > print line[0] # print
, I'm just getting my feet wet, and I'll try not to ask too many
> silly questions!
>
> First impressions are: (1) Python seems both elegant and practical;
> and (2) Beazley seems a pleasantly unfussy introduction for someone
> with at least a little programming exper
On Wed, 2009-06-24 at 09:17 -0700, Bryan wrote:
> Given a class:
>
> class Foo(object):
> pass
>
> How can I get the name "Foo" without having an instance of the class?
>
> str(Foo) gives me more than just the name Foo. "__main__.Account"
> Foo.__class__.__name__ gives me "type"
>
> I don
On Mon, 2009-06-22 at 22:52 +, Peter Billam wrote:
> I wonder on what grounds PEP8
> says "The preferred place to break around a binary operator is
> *after* the operator" ?
> Perhaps it's just the "continutation marker" rationale?
>
> Regards, Peter
>
> --
> Peter Billam www.pjb.com
were just defs. I changed the short defs
> into sub-classes out of desperation, since I don't understand why the
> main script is not recognizing functions that are in the same file.
>
> First is the shell input/output, then "ParseWork.py", the entire text
&g
trace which will help you (or us) debug the problem. If
you don't show us this information, we can't tell you what's going
wrong. It will tell you (in ways that are crystal clear once you have a
bit of practice reading them) exactly what went wrong.
Can you show your code, as well as the complete error message you are
receiving?
My suggestions here, are essentially a paraphrasing of Eric Raymond's
essay, "How to Ask Smart Questions." It is freely available on the web,
and easily found via google. I recommend reading that, in order to get
the most mileage out this news group.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
Have you looked at the JSON module?
On Mon, 2009-06-22 at 21:17 +0800, Jim Qiu wrote:
> Hi all,
>
> I have a object list list this:
>
> from bots.botsconfig import *
> from D96Arecords import recorddefs
> from edifactsyntax3 import syntax
>
> structure=[
> {ID:'UNH',MIN:1,MAX:1,LEVEL:[
> {I
On Mon, 2009-06-22 at 14:57 +0200, Jean-Michel Pichavant wrote:
> J. Cliff Dyer wrote:
> > On Wed, 2009-06-17 at 14:13 +0200, Jean-Michel Pichavant wrote:
> >
> >> On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote:
> >>
> >>>> What&
ple from doing a 'from package import *'. However, example code
should always include relevant imports.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
; But I think this is an obvious enough extension to the __getitem__ protocol
> that I for one would vote +1 on it being added to Python sequence objects
> (lists, tuples, strings).
>
I'd be +0. It won't change my life, but it seems like a decent idea.
>
> --
> Steven
>
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2009-05-22 at 10:54 -0700, Jan wrote:
> On May 22, 9:46 am, "J. Cliff Dyer" wrote:
>
> > You don't need a reset method. There is no hard and fast rule that
> > __iter__ must return the object itself. It just needs to return an
> > iterator.
alue
print serialc_bin.sum()
Any one of these seems like a better idea to me than trying to pollute
your local namespace with an unknown number of variables. You have a
collection of objects. It makes sense to store them in one of python's
collection types, or create an object of your own to store them.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
when using python 2.6 with old-style division. Probably because python
doesn't have to check the types of its arguments before deciding to do
integer division.
>>> a = timeit.Timer("(200 * 100.)/5")
>>> b = timeit.Timer("(200 * 100)/5")
>>> c = timeit.Timer("(200 * 100)//5")
>>> d = timeit.Timer("(200 * 100.0)//5")
>>> for each in a, b, c, d:
... each.timeit()
...
2.3681092262268066
2.417525053024292
0.81031703948974609
0.81548619270324707
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
> y = Y()
>>> for c in y:
... print c
...
1
2
3
>>> for c in y:
... if c < 3:
... print c
...
1
2
>>> for c in y:
... print c
...
1
2
3
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
order. But they are
processed in the order they appeared in the list. If you want to
process the elements of the list in alphabetical order, you have to sort
the list itself:
>>> for x in sorted(['hat', 'socks', 'shirt', 'pants']):
... print x
hat
pants
shirt
socks
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 2009-05-13 at 09:40 -0700, Mohan Parthasarathy wrote:
> Hi,
>
> I am new to Python. I tried searching this but could not find an
> answer. In the interactive shell, I write a new function and I want to
> be able to see all the code that I wrote at a later time. Just typing
> the function n
On Fri, 2009-05-08 at 17:19 +0200, Pascal Chambon wrote:
> PS : Am I the only one having most of answers rejected by the
> antispam
> system of python-list ? That's humiliating :p
>
I've had several messages not make it through.
:(
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2009-05-08 at 07:53 -0700, [email protected] wrote:
> #how can I print a list of object which may return unicode
> representation?
> # -*- coding: utf-8 -*-
>
> class A(object):
>
> def __unicode__(self):
> return u"©au"
>
> __str__ = __repr__ = __unicode__
>
Your
On Tue, 2009-05-05 at 12:15 -0400, J Kenneth King wrote:
> Emile van Sebille writes:
>
> > On 5/1/2009 7:31 AM J Kenneth King said...
> >> Chris Rebert writes:
> >>> b = []
> >>> for pair in a:
> >>> for item in pair:
> >>> b.append(item)
> >>
> >> This is much more clear than a nest
hidden breakage. But if you have one of
those in your data structure, why are you trying to flatten it anyway?
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
back up is
an exercise for the reader.
def general_xrange(start, stop, step=1):
target = stop * step
if start * step > target:
raise ValueError
i = start
while i * step < target:
yield i
i += step
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
native, but lo and
behold, they are the same, at least in the cases I was trying to account
for.
' a b c '.split() == ' a b c '.strip().split() == 'a b c'.split()
Thanks for pointing this out.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
ble, when the loop calls
iterable.__iter__(), it gets a fresh iterator, so it can loop over the
file again.
The important thing is that when you call x.__iter__() (which you do
when entering a loop), you get a fresh iterator that won't just call
StopIteration right away.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2009-04-16 at 14:11 -0700, John Fabiani wrote:
> Daniel Fetchinson wrote:
>
> > Hi folks, I've come across many times the claim that 'joins are bad'
> > for large databases because they don't scale
>
> IMO that's bull...
OK. That makes four legs so far
> --
> http://mail.python.org
"copyright", "credits" or "license" for more information.
>>> import cPickle as p
>>> class Foo(object):
... a = lambda self, x: x+1
>>> foo.a(1)
2
>>> type(foo.a)
>>> p.dumps(foo)
'ccopy_reg\n_reconstructor\np1\n(c__main__\nFoo\np2\nc__builtin__
\nobject\np3\nNtRp4\n.'
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 2009-04-08 at 01:57 +0100, Rhodri James wrote:
> On Tue, 07 Apr 2009 12:46:18 +0100, J. Clifford Dyer
> wrote:
>
> > On Mon, 2009-04-06 at 23:41 +0100, Rhodri James wrote:
> >> On Mon, 06 Apr 2009 23:12:14 +0100, Anish Chapagain
> >> wrote:
> >>
> >> > Hi,
> >> > I was trying to extrac
ode26.html
Something like the following might work:
print eval(line, {'tableTop': tableTop})
Cheers,
Cliff
On Tue, 2009-04-07 at 08:38 -0400, Victor Subervi wrote:
>
> I have excluded the code where I call the separate text files for
> printing normal text. They work. It's m
gt; from StringIO import StringIO
to
>>> from cStringIO import StringIO
3) Functions as first-class variables (which could connect to a
discussion of decorators or of dictionaries as dispatch tables).
4) List comprehensions
5) Generators using yield
6) Also very handy is the interactive inte
On Wed, 2009-03-18 at 08:18 -0700, Adam wrote:
> On Mar 18, 10:33 am, "J. Cliff Dyer" wrote:
> > You might be interested in redefining __getattribute__(self, attr) on
> > your class. This could operate in conjunction with the hash tables
> > (dictionaries)
hat is by changing the __class__
attribute on c.
class A(object):
x = 4
def __init__(self):
self.y = 5
class B(object):
x = u'cow'
def __init__(self):
self.y = u'goat'
>>> c = A()
>>> c.x
4
>>> c.y
5
>>> c.__class__ = B
>>> # Note that neither c nor x were changed in the last step
... c.x # Class attribute found on B now
u'cow'
>>> c.y # Instance attribute: already initialized from A.__init__
5
>>> c.__init__() # Reinitialize c, now using B.__init__
>>> c.y # Re-initialized instance attribute
u'goat'
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
ror
@GET
def foo(x):
return "Got", x
@POST
def foo(x)
return "Posted to", x
This is definitely not functional code, but might get you in the right
direction on __getattribute__. __getattr__ might also work for you. I
haven't worked too much
On Wed, 2009-02-25 at 15:54 -0500, Shawn Milochik wrote:
> On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote:
>
> > Not really. The point about properties is that you *can* make attribute
> > access trigger getter or setter code.
> >
> > But not that you do unless there is an actual reason
On Tue, 2009-02-17 at 06:15 -0800, 一首诗 wrote:
> Thanks for your reply.
>
> With sqlalchemy, an mapped must living in a session, you have no way
> to disconnect it with its session.
>
> For example :
>
> #-
> user = session.query(User).first()
> session.expung
ow wxpython works in this regard.
So:
s = u"Matični broj" # instead of "Matični broj"
text = wx.StaticText(self, -1, s,(0,100))
# or if that doesn't work try this:
#text = wx.StaticText(self, -1, s.encode('utf-8'), (0,100))
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 2009-02-16 at 00:28 -0500, Nicolas Dandrimont wrote:
> * [email protected] [2009-02-16 00:17:37 -0500]:
>
> > I need to test strings to determine if one of a list of chars is
> > in the string. A simple example would be to test strings to
> > determine if they have a vowel (aeiouAEIOU)
nary with 2.5 if you do install it yourself. Instead, install
it to python2.5, and set the shebang line (#!) on your scripts to point
to /usr/local/bin/python2.5 (or wherever you install it).
Cheers,
Cliff
On Mon, 2009-02-16 at 07:28 -0800, Germán Gutiérrez wrote:
> Hi,
>
> I ne
On Tue, 2009-02-03 at 08:33 -0700, Joe Strout wrote:
> J. Cliff Dyer wrote:
>
> > But what if your language allows functions to be used as first class
> > objects? (Mine does :))
> >
> > x = Beep
> >
> > Does that assign the name x to the Beep ob
does :))
x = Beep
Does that assign the name x to the Beep object or does it assign the
result of a Beep call to x?
There's no virtue in making ridiculously simple things even simpler if
it makes the interesting things impossible.
def tone_sequence(sound):
sequence = DialTone.follo
r which quote character is being used, and require
those characters to be escaped, and not the other (but then does "te
\'st" render as r"te'st" or r"te\'st"?) and only close the string when
the appropriate quote is found.
Not an impossible task, but certainly more complex than the current
parsing requirements for JSON.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2009-01-23 at 19:31 -0500, Benjamin Kaplan wrote:
>
>
> On Fri, Jan 23, 2009 at 7:28 PM, Gary Herron
> wrote:
> Steven D'Aprano wrote:
> > On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote:
> >
> >
> >> Hi -- Some time ago I ran across a co
On Mon, 2009-01-26 at 12:37 -0800, Paul McGuire wrote:
> On Jan 26, 2:06 pm, "J. Cliff Dyer" wrote:
> >
> > Thanks. That makes sense. But your example creates a new instance of
> > the new class each time, rather than changing the class of a persistent
> >
On Mon, 2009-01-26 at 09:52 -0800, Paul McGuire wrote:
> On Jan 26, 10:54 am, "J. Cliff Dyer" wrote:
> > On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote:
> > > Want to change the type/behavior of an object from class A to class
> > > B? H
l and fun. But scary. Any thoughts on how
you would use that in a way that wouldn't unleash sulphurous code
smells?
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
know that.
>
> So yay for Python, but don't get in the habit of criticising that which
> you do not know.
There are legitimate reasons to criticize things even when they are
powerful.
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote:
> On Jan 26, 1:03 pm, "Gabriel Genellina"
> wrote:
> > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase
> > escribió:
> >
> >
> >
> > > Unfortunately, a raw rstrip() eats other whitespace that may be
> > > important. I frequently get tab-de
Xah Lee wrote:
For those of you using emacs, here's the elisp code that allows you to
syntax color computer language source code in your blog or website.
http://xahlee.org/emacs/elisp_htmlize.html
to comment, here:
http://xahlee.blogspot.com/2009/01/dehtmlize-source-code-in-emacs-lisp.html
Xah
I dub it Schluehr's law.
On Thu, 2009-01-22 at 21:39 -0800, Kay Schluehr wrote:
> Whatever sufficiently sophisticated topic was the initially discussed
> it ends all up in a request for removing reference counting and the
> GIL.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
On Fri, 2009-01-16 at 08:57 +, Steven D'Aprano wrote:
> On Fri, 16 Jan 2009 10:03:28 +0200, Hendrik van Rooyen wrote:
>
> > Oh come on you lot - you are carrying on as if Diez were wearing his
> > skull socks again - do me a favour and give him a break!
> And... skull socks? Cool. Where can
On Fri, 2009-01-09 at 13:13 -0500, Steve Holden wrote:
> Aivar Annamaa wrote:
> >> As was recently pointed out in a nearly identical thread, the -3
> >> switch only points out problems that the 2to3 converter tool can't
> >> automatically fix. Changing print to print() on the other hand is
> >> ea
Thanks for the solutions everyone! I'm not sure which I'll end up
using, but I think I've got a better grasp of the problem now.
Cool stuff.
Cheers,
Cliff
On Thu, 2009-01-08 at 06:52 -0800, Paul McGuire wrote:
> On Jan 7, 12:00 pm, Paul McGuire wrote:
> > On Jan 7,
eld(Field):
def __new__(cls, a):
return object.__new__(cls, a)
Is there a cleaner way to do this? The main problem is that
Field.__new__ gets in the way of properly constructing the subclasses
once I've used it to select the proper subclass in the first place.
Cheers,
Cliff
--
Oook,
J. Cliff Dyer
Carolina Digital Library and Archives
UNC Chapel Hill
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 340 matches
Mail list logo