On Nov 28, 12:32 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> The Python position on singletons is generally to just use a module
> instead (preferred), or apply the Borg
> pattern:http://code.activestate.com/recipes/66531/
The same problem appears if I use the module (as I pointed in the
firs
> Python supporters on this list don't really care about
> Python -- only money, and depravity. you and i and the
> other few, pure of heart, must fight for Python!!
Unfortunatly no others besides yourself have come forward. This is not
a fight for my ideas anymore as a test of the community! Y
Stefan Behnel wrote:
> I think what you have in mind is that smaller changes make code reload
> easier than bigger changes, especially API changes.
... or ABI changes in the general case, although that's not a major
difference in the Python context.
Stefan
--
http://mail.python.org/mailman/listin
ZelluX wrote:
> For example, by comparing two versions of a program, may be we can
> generate some scripts to direct the virtual machine update a running
> python program.
I had to read this sentence a couple of times, as it sounds too much like
StarTrek speak.
My guess is that you are talking ab
On Nov 28, 3:16 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> ZelluX <[EMAIL PROTECTED]> writes:
> > I want to write a version-tracking tool for Python projects
>
> Not to dissuade you, but what do you hope to achieve by this?
> Version-control systems are difficult to do well, and we are blessed
> w
ZelluX <[EMAIL PROTECTED]> writes:
> I want to write a version-tracking tool for Python projects
Not to dissuade you, but what do you hope to achieve by this?
Version-control systems are difficult to do well, and we are blessed
with an abundance of them already.
--
\ “Holy as
On Nov 28, 12:52 am, [EMAIL PROTECTED] wrote:
> On Nov 27, 10:28 pm, r <[EMAIL PROTECTED]> wrote:
>
> > To think...that I would preach freedom to the slaves and be lynched
> > for it...IS MADNESS!
>
> > Not one vote for Python, not a care. I think everyone here should look
> > deep within their sel
Hi, all
I want to write a version-tracking tool for Python projects, and need
some sample projects whose even smallest modifications can be
downloaded from the internet.
Could you recommend some to me?
Thanks for your reply
--
http://mail.python.org/mailman/listinfo/python-list
alex23 wrote:
On Nov 28, 4:32 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote:
http://en.wikipedia.org/wiki/Zero-sum#Complexity
You're a far more generous soul than I am, I would've been more
inclined to link to the following:
http://en.wikipedia.org/wiki/Persecution_complex
Maybe it's just:
On Nov 27, 10:28 pm, r <[EMAIL PROTECTED]> wrote:
> To think...that I would preach freedom to the slaves and be lynched
> for it...IS MADNESS!
>
> Not one vote for Python, not a care. I think everyone here should look
> deep within their self and realize the damage that has been done
> today! I hop
On Nov 28, 12:32 am, alex23 <[EMAIL PROTECTED]> wrote:
> On Nov 28, 3:28 pm, r <[EMAIL PROTECTED]> wrote:
>
> > To think...that I would preach freedom to the slaves and be lynched
> > for it...IS MADNESS!
>
> There's is madness in this thread, of that I have no doubt.
>
> Please don't presume to sp
On Nov 28, 4:32 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote:
> http://en.wikipedia.org/wiki/Zero-sum#Complexity
You're a far more generous soul than I am, I would've been more
inclined to link to the following:
http://en.wikipedia.org/wiki/Persecution_complex
--
http://mail.python.org/mailman/l
On Nov 28, 3:28 pm, r <[EMAIL PROTECTED]> wrote:
> To think...that I would preach freedom to the slaves and be lynched
> for it...IS MADNESS!
There's is madness in this thread, of that I have no doubt.
Please don't presume to speak for Guido, he's a big boy and has shown
he's more than capable of
r wrote:
To think...that I would preach freedom to the slaves and be lynched
for it...IS MADNESS!
Not one vote for Python, not a care. I think everyone here should look
deep within their self and realize the damage that has been done
today! I hope Guido's eyes never see this thread, for he may l
[alex23]
How much is this API -worth- to you? How much time are -you- willing
to commit to developing it? If you lack the ability, how much -money-
are you willing to spend on hiring the people with that ability?
[/alex23]
Alex,
Are you telling me that out of all the great and wonderful developers
On Nov 27, 11:28 pm, r <[EMAIL PROTECTED]> wrote:
> To think...that I would preach freedom to the slaves and be lynched
> for it...IS MADNESS!
>
> Not one vote for Python, not a care. I think everyone here should look
> deep within their self and realize the damage that has been done
> today! I hop
Hello,
Is ter any way to identify the file name and the path in which the
function is called.
for example: if the function definition is in the file c:\script1.py
and if I call this function in a script: c:\script2.py than in the
function definition part(script1.py) some how I need to know that i
To think...that I would preach freedom to the slaves and be lynched
for it...IS MADNESS!
Not one vote for Python, not a care. I think everyone here should look
deep within their self and realize the damage that has been done
today! I hope Guido's eyes never see this thread, for he may lose all
hop
On Nov 28, 2:08 pm, r <[EMAIL PROTECTED]> wrote:
> Did you even read my OP, I mean the whole thing... not just the title?
> I am working on the problem, I am trying to garner support for a
> Python intergration. Grass Roots kinda thing.
Jesus wept. Of course I did. It's why I actually made suggest
On Nov 27, 10:57 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Nov 27, 10:45 pm, r <[EMAIL PROTECTED]> wrote:
>
> > I am still flabbergasted by the solid resistance to promoting Python.
> > Here of all places, NOT even one person(well Terry did kinda half
> > agree with me =), wants to support
On Nov 27, 10:45 pm, r <[EMAIL PROTECTED]> wrote:
> I am still flabbergasted by the solid resistance to promoting Python.
> Here of all places, NOT even one person(well Terry did kinda half
> agree with me =), wants to support Python. I am completely perplexed.
> I had to check and make sure this
On Nov 27, 10:08 pm, r <[EMAIL PROTECTED]> wrote:
> On Nov 27, 9:56 pm, alex23 <[EMAIL PROTECTED]> wrote:
>
> > On Nov 28, 1:45 pm, r <[EMAIL PROTECTED]> wrote:
>
> > > Does it bother you that i am so ambitious[...] Answer that if
> > > you are a man. [...] Do you feel you should give back or just
On Nov 27, 9:56 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On Nov 28, 1:45 pm, r <[EMAIL PROTECTED]> wrote:
>
> > Does it bother you that i am so ambitious[...] Answer that if
> > you are a man. [...] Do you feel you should give back or just
> > take, take, take??? I have shared my feelings, let's hea
On Nov 28, 1:45 pm, r <[EMAIL PROTECTED]> wrote:
> Does it bother you that i am so ambitious[...] Answer that if
> you are a man. [...] Do you feel you should give back or just
> take, take, take??? I have shared my feelings, let's hear yours.
It bothers me that you seem to be off your medication
On Nov 27, 9:31 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On Nov 28, 12:49 pm, r <[EMAIL PROTECTED]> wrote:
>
> > Well... 3 for Ruby 1 for python. Not looking good so far. Any more
> > votes?
>
> I don't see -any- of the responses in this thread "voting" for
> anything other than a more civil approac
On Nov 27, 8:55 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
> Then another thing - it strikes me that any problem that can be solved
> by metaprogramming, can be solved by putting similar code into a class
> and instanciating an instance.
>
> Does anybody know if this is true?
>
> If it is,
On Nov 28, 12:49 pm, r <[EMAIL PROTECTED]> wrote:
> Well... 3 for Ruby 1 for python. Not looking good so far. Any more
> votes?
I don't see -any- of the responses in this thread "voting" for
anything other than a more civil approach to your request. If you're
seeing these in a "if you're not with
On Nov 27, 8:01 pm, r <[EMAIL PROTECTED]> wrote:
> On Nov 27, 7:40 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> > r wrote:
> > > On Nov 27, 6:15 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> > >> r wrote:
> > >>> Hello fellow Python Advocates!
> > >>> Help me promote Python to a larger audience.
>
On Thu, 27 Nov 2008 17:58:55 -0800, Asun Friere wrote:
> if __name__ == '__main__' :
> import sys
> sys.exit(main(sys.argv))
>
> Doesn't this just pollute the namespace with main()?
Agreed. I don't see anything wrong with that. You have one function more
than you otherwise would have h
On Fri, 28 Nov 2008 05:05:10 +0200, Hendrik van Rooyen wrote:
> "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>
>> Hendrik van Rooyen wrote:
>>
>> > I am using the term in the restricted sense of Python writing Python
>> > source.
>> >
>> > Given that, can anybody think of an example that you could
On Nov 27, 7:40 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> r wrote:
> > On Nov 27, 6:15 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> >> r wrote:
> >>> Hello fellow Python Advocates!
> >>> Help me promote Python to a larger audience.
> >>> An introduction to SketchUp:
> >>>
>
On Nov 27, 9:05 pm, Bruno Desthuilliers wrote:
> The problem is that you often have more to do in the __main__ section of
> a script than just calling one simple function, and you don't
> necessarily want to pollute the module's namespace with all this code.
As I said, it's probably just me ;)
> Python 2.6 implemented PEP 370: Per-user site-packages Directory[1]
>
> Now, are there any tools I could use to create and activate virtual
> environments like workingenv, virtualenv etc. but that will use
> PYTHONUSERBASE instead of hard-linking the python program.
>
>
> [1]
> http://docs.pyt
r wrote:
On Nov 27, 6:15 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
r wrote:
Hello fellow Python Advocates!
Help me promote Python to a larger audience.
An introduction to SketchUp:
There is no need to puff up Python or put down Ruby to this audience.
Given how much Google
On Thu, 27 Nov 2008 12:12:38 +, adam carr wrote:
> I'm still in the position of having to right code to deal with
> converting None to an empty list and one object to a list with a single
> entry.
> Python casting doesn't work here.
Python doesn't have type-casting. Python has type conversion
On Thu, 27 Nov 2008 08:32:12 -0800, Emanuele D'Arrigo wrote:
> On Nov 27, 5:00 am, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> Refactor until your code is simple enough to unit-test effectively,
>> then unit-test effectively.
>
> Ok, I've taken this wise suggestion on board and of course I fo
On Nov 27, 7:13 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On Nov 28, 10:09 am, r <[EMAIL PROTECTED]> wrote:
>
> > Are you against promoting python?
>
> > Maybe your a Ruby fan, i don't know, but that
> > would explain your quick disposal of the idea though.
>
> Are you intending to come off so patron
On Nov 28, 10:09 am, r <[EMAIL PROTECTED]> wrote:
> Are you against promoting python?
>
> Maybe your a Ruby fan, i don't know, but that
> would explain your quick disposal of the idea though.
Are you intending to come off so patronising? To angrily dismiss
someone who has been posting some solid h
On Thu, 27 Nov 2008 10:45:47 -0800, bearophileHUGS wrote:
> A question for other people: Can Python change a little to allow nested
> functions to be tested? I think this may solve some of my problems.
Remember that nested functions don't actually exist as functions until
the outer function is c
On Thu, 27 Nov 2008 11:17:04 -0800, willie wrote:
> My code:
>
> from time import time
> def leibniz(terms):
>
>
> acc = 0.0
> num = 4.0 # numerator value remains constant in the series den = 1
> count = 0
> start_time = 0.0
This line is wrong. You're starting your timer at the
On Nov 27, 6:15 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> r wrote:
> > Hello fellow Python Advocates!
> > Help me promote Python to a larger audience.
>
> > An introduction to SketchUp:
> >
>
> There is no need to puff up Python or put down Ruby to this audience.
> Given how
On Nov 27, 5:47 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Emanuele D'Arrigo:
> >> I can fragment the code of the original method into one public method and
> >> a few private support methods.<
>
> > Python also support nested functions, that you can put into your
>
On Thu, 27 Nov 2008 11:54:54 -0800, lkcl wrote:
> On Nov 27, 7:43 pm, [EMAIL PROTECTED] wrote:
>> lkcl> Very simple question: how do you apply a decorator to an
>> entire lkcl> module?
>>
>> Function-by-function or class-by-class. There is no decorator support
>> for modules.
>
> awWww!
Announcing the first beta release of appscript for Python 2.x, a user-
friendly Apple event bridge that allows you to control AppleScriptable
applications using ordinary Python scripts.
Py-appscript 0.19.0 adds Python 2.6 compatibility and 64-bit support,
and cleans up the codebase and documentati
r wrote:
Hello fellow Python Advocates!
Help me promote Python to a larger audience.
An introduction to SketchUp:
There is no need to puff up Python or put down Ruby to this audience.
Given how much Google uses Python as a core language, I am a bit shocked
that they would
On Nov 27, 5:42 pm, r <[EMAIL PROTECTED]> wrote:
> On Nov 27, 5:38 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Thu, Nov 27, 2008 at 3:33 PM, r <[EMAIL PROTECTED]> wrote:
> > > On Nov 27, 5:27 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> > >> On Thu, Nov 27, 2008 at 3:18 PM, r <[EM
Decorators are syntactic sugar. They add no functionality.
@decorator
def/class possibly_long_name ...
abbreviates
def/class possibly_long_name ...
possibly_long_name = decorator(possibly_long_name)
thereby warning the reader at the beginning that possibly_long_name will
be rebound and avoid
[EMAIL PROTECTED] wrote:
Emanuele D'Arrigo:
I can fragment the code of the original method into one public method and a few
private support methods.<
Python also support nested functions, that you can put into your
method. The problem is that often unit test functions aren't able to
test nest
On Nov 27, 5:38 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 27, 2008 at 3:33 PM, r <[EMAIL PROTECTED]> wrote:
> > On Nov 27, 5:27 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> >> On Thu, Nov 27, 2008 at 3:18 PM, r <[EMAIL PROTECTED]> wrote:
> >> > Hello fellow Python Advocates!
>
On Thu, Nov 27, 2008 at 3:33 PM, r <[EMAIL PROTECTED]> wrote:
> On Nov 27, 5:27 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
>> On Thu, Nov 27, 2008 at 3:18 PM, r <[EMAIL PROTECTED]> wrote:
>> > Hello fellow Python Advocates!
>> > Help me promote Python to a larger audience.
>>
>> > An introductio
On Nov 27, 5:27 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 27, 2008 at 3:18 PM, r <[EMAIL PROTECTED]> wrote:
> > Hello fellow Python Advocates!
> > Help me promote Python to a larger audience.
>
> > An introduction to SketchUp:
> >
> > I don't know if you are f
On Thu, Nov 27, 2008 at 2:36 PM, Viktor Kerkez <[EMAIL PROTECTED]> wrote:
> A better way to do this was http://pastebin.com/m1130d1fe :)
> --
> http://mail.python.org/mailman/listinfo/python-list
>
The Python position on singletons is generally to just use a module
instead (preferred), or apply th
On Thu, Nov 27, 2008 at 3:18 PM, r <[EMAIL PROTECTED]> wrote:
> Hello fellow Python Advocates!
> Help me promote Python to a larger audience.
>
> An introduction to SketchUp:
>
> I don't know if you are familiar with "Google Sketchup". It is the
> best 3d CAM program available.
On Thu, Nov 27, 2008 at 12:33 PM, tekion <[EMAIL PROTECTED]> wrote:
> Hello,
> I am getting the following error and my script is bailing out because
> of it. I have tried capturing it but it does not seem to work. Below
> is the error:
>
> ValueError: I/O operation on closed file
>
>
> the above e
TP wrote:
[EMAIL PROTECTED] wrote:
a=("1","2")
b=[("3","4"),("5","6")]
list(a)+b
['1', '2', ('3', '4'), ('5', '6')]
a = ("1", "2")
b = [("3", "4"), ("5", "6")]
[a] + b
[('1', '2'), ('3', '4'), ('5', '6')]
Thanks a lot.
Why this difference of behavior between list(a) and [a]?
list(a) itera
Hello fellow Python Advocates!
Help me promote Python to a larger audience.
An introduction to SketchUp:
I don't know if you are familiar with "Google Sketchup". It is the
best 3d CAM program available.
If you have not checked it out and do modeling of any kind, or want to
lea
On Thu, Nov 27, 2008 at 2:39 PM, TP <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>
>>> >>> a=("1","2")
>>> >>> b=[("3","4"),("5","6")]
>>> >>> list(a)+b
>>> ['1', '2', ('3', '4'), ('5', '6')]
>>
> a = ("1", "2")
> b = [("3", "4"), ("5", "6")]
> [a] + b
>> [('1', '2'), ('3', '4'
TP schrieb:
[EMAIL PROTECTED] wrote:
a=("1","2")
b=[("3","4"),("5","6")]
list(a)+b
['1', '2', ('3', '4'), ('5', '6')]
a = ("1", "2")
b = [("3", "4"), ("5", "6")]
[a] + b
[('1', '2'), ('3', '4'), ('5', '6')]
Thanks a lot.
Why this difference of behavior between list(a) and [a]?
Because th
[EMAIL PROTECTED] wrote:
>> >>> a=("1","2")
>> >>> b=[("3","4"),("5","6")]
>> >>> list(a)+b
>> ['1', '2', ('3', '4'), ('5', '6')]
>
a = ("1", "2")
b = [("3", "4"), ("5", "6")]
[a] + b
> [('1', '2'), ('3', '4'), ('5', '6')]
Thanks a lot.
Why this difference of behavior between list
A better way to do this was http://pastebin.com/m1130d1fe :)
--
http://mail.python.org/mailman/listinfo/python-list
But this means that there is no way to create a safe Singleton in
python, because the classes are also created twice.
This is the problem that I encountered. I created a complex
implementation of a Singleton pattern using metaclasses because I
needed the __init__ method to be called just once and
lkcl schrieb:
On Nov 27, 7:43 pm, [EMAIL PROTECTED] wrote:
lkcl> Very simple question: how do you apply a decorator to an entire
lkcl> module?
Function-by-function or class-by-class. There is no decorator support for
modules.
awWww! i'm going to quietly throw my toys out of my pram.
tekion schrieb:
Hello,
I am getting the following error and my script is bailing out because
of it. I have tried capturing it but it does not seem to work. Below
is the error:
ValueError: I/O operation on closed file
the above error is received when, the following code snippet is
executed:
On 18 Nov., 21:40, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Tue, 18 Nov 2008 09:41:46 -0200, Christan K. <[EMAIL PROTECTED]> escribió:
>
> > ckkart gmail.com> writes:
> >> on XP when starting a certainexternalprogram (plain C calculation
> >> program which communicates via stdout/fs) fr
Ken> Unfortunately, Python has some problems in this area. In
Ken> particular, since ubiquitous lists and dictionaries are dynamically
Ken> resized as needed, memory fragmentation seems inevitable.
That's not necessarily true. Also, I would say that Python has made
tradeoffs in this
Hello,
I am getting the following error and my script is bailing out because
of it. I have tried capturing it but it does not seem to work. Below
is the error:
ValueError: I/O operation on closed file
the above error is received when, the following code snippet is
executed:
try:
Diez B. Roggisch wrote:
della wrote:
On 27 Nov, 11:21, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
You can't do that. How should python distinguish between the two modules
with the same name?
That's why I was trying to import them with different names :)
You weren't. The "as" creates jus
lkcl <[EMAIL PROTECTED]> writes:
> On Nov 27, 7:43 pm, [EMAIL PROTECTED] wrote:
>> lkcl> Very simple question: how do you apply a decorator to an entire
>> lkcl> module?
>>
>> Function-by-function or class-by-class. There is no decorator support for
>> modules.
>
> awWww! i'm going to qu
>> Function-by-function or class-by-class. There is no decorator
>> support for modules.
lkcl> ... but seriously - doesn't that strike people as... a slightly
lkcl> odd omission?
Decorators are still a new feature in the language and were purposely added
in an incremental fashion
On Nov 27, 2:54 pm, lkcl <[EMAIL PROTECTED]> wrote:
> On Nov 27, 7:43 pm, [EMAIL PROTECTED] wrote:
>
> > lkcl> Very simple question: how do you apply a decorator to an entire
> > lkcl> module?
>
> > Function-by-function or class-by-class. There is no decorator support for
> > modules.
>
>
Viktor Kerkez <[EMAIL PROTECTED]> writes:
> Here is the situation:
>
> $ ls
> test
> $ cd test
> $ ls
> __init__.py data.py
> $ cat __init__.py
>
> $ cat data.py
> DATA = {}
>
> $ cd ..
> $ python
import os
from test.data import DATA
DATA['something'] = 33
os.chdir('test')
On Nov 27, 7:43 pm, [EMAIL PROTECTED] wrote:
> lkcl> Very simple question: how do you apply a decorator to an entire
> lkcl> module?
>
> Function-by-function or class-by-class. There is no decorator support for
> modules.
awWww! i'm going to quietly throw my toys out of my pram.
... but
"adam carr" <[EMAIL PROTECTED]> writes:
> Denis kindly provided the following code which does this well:
>
> def mkiter( x ):
>""" list -> list, el -> [el], None -> []
>usage: for x in mkiter( func returning list or
> singleton ): ...
>"""
>return (x if hasattr( x, "__iter__" )
My beta testers are complaining about excessive memory usage. It's a
wxPython app with several embedded mozilla activex controls and a local
web server.
Unfortunately, Python has some problems in this area. In particular,
since ubiquitous lists and dictionaries are dynamically resized as
ne
lkcl> Very simple question: how do you apply a decorator to an entire
lkcl> module?
Function-by-function or class-by-class. There is no decorator support for
modules.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python
willie wrote:
> My code:
>
> from time import time
> def leibniz(terms):
>
>
> acc = 0.0
> num = 4.0 # numerator value remains constant in the series
> den = 1
> count = 0
> start_time = 0.0
> for aterm in range(terms):
> nextterm = num/den * (-1)**aterm # (-1)
Very simple question: how do you apply a decorator to an entire
module? an idea whose time has properly arrived is to merge pyjamas
(http://pyjs.org) into web2py (http://web2py.com), and to do that,
it's necessary to "identify" functions, classes, global variables and
modules that should be compil
On 27 Nov., 06:11, Rafe <[EMAIL PROTECTED]> wrote:
> On Nov 27, 11:41 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > "Steven D'Aprano" wrote:
>
> > > Well, I don't know about "any problem". And it's not so much about
> > > whether metaprograms can solve problems that can't be sol
My code:
from time import time
def leibniz(terms):
acc = 0.0
num = 4.0 # numerator value remains constant in the series
den = 1
count = 0
start_time = 0.0
for aterm in range(terms):
nextterm = num/den * (-1)**aterm # (-1) allows fractions to
alternate
Hendrik van Rooyen wrote:
"Terry Reedy" <[EMAIL PROTECTED]> wrote:
Hendrik van Rooyen wrote:
I am using the term in the restricted sense of Python writing Python source.
Given that, can anybody think of an example that you could not do with
a class? (excepting the "stored procedure" aspec
tekion wrote:
> I have a while iterates forever. I would like to trap a SIGTERM signal
> and execute some clean up code. How would I do this in python? Thanks.
look into module "signal"
Diez
--
http://mail.python.org/mailman/listinfo/python-list
Emanuele D'Arrigo:
>I can fragment the code of the original method into one public method and a
>few private support methods.<
Python also support nested functions, that you can put into your
method. The problem is that often unit test functions aren't able to
test nested functions.
A question
TP:
> >>> a=("1","2")
> >>> b=[("3","4"),("5","6")]
> >>> list(a)+b
> ['1', '2', ('3', '4'), ('5', '6')]
>>> a = ("1", "2")
>>> b = [("3", "4"), ("5", "6")]
>>> [a] + b
[('1', '2'), ('3', '4'), ('5', '6')]
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
If I do:
>>> a=("1","2")
>>> b=[("3","4"),("5","6")]
>>> list(a)+b
['1', '2', ('3', '4'), ('5', '6')]
I would like rather to obtain:
[('1', '2'), ('3', '4'), ('5', '6')]
Am I compelled to do:
>>> c=[]
>>> c.append(a)
>>> c+b
[('1', '2'), ('3', '4'), ('5', '6')]
Thanks
Julien
--
python
On Nov 27, 6:42 pm, Viktor Kerkez <[EMAIL PROTECTED]> wrote:
> Is this a bug?
It is not a bug: the dictionaries are different because they are
loaded from different modules.
>>> import os
>>> import test.data
>>> test.data
>>> os.chdir('test')
>>> import data
>>> data
>>> test.data is data
Fals
Emanuele D'Arrigo wrote:
On Nov 27, 5:00 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
Refactor until your code is simple enough to unit-test effectively, then
unit-test effectively.
Ok, I've taken this wise suggestion on board and of course I found
immediately ways to improve the method. -Ho
I have a while iterates forever. I would like to trap a SIGTERM signal
and execute some clean up code. How would I do this in python? Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
"Gilles Ganault" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Thu, 27 Nov 2008 01:00:28 +, MRAB <[EMAIL PROTECTED]>
wrote:
No problem here:
>>> import urllib
>>> data = urllib.urlopen("http://www.amazon.co.jp/";).read()
>>> decoded_data = data.decode("shift-jis")
>>>
T
Viktor Kerkez wrote:
> Here is the situation:
>
> $ ls
> test
> $ cd test
> $ ls
> __init__.py data.py
> $ cat __init__.py
>
> $ cat data.py
> DATA = {}
>
> $ cd ..
> $ python
import os
from test.data import DATA
DATA['something'] = 33
os.chdir('test')
from data import
Here is the situation:
$ ls
test
$ cd test
$ ls
__init__.py data.py
$ cat __init__.py
$ cat data.py
DATA = {}
$ cd ..
$ python
>>> import os
>>> from test.data import DATA
>>> DATA['something'] = 33
>>> os.chdir('test')
>>> from data import DATA as NEW_DATA
>>> DATA
{'something': 33}
>>> NEW_DAT
On Fri, 28 Nov 2008 04:20:22 +0100, Hendrik van Rooyen
<[EMAIL PROTECTED]> wrote:
If you are not already doing it, you need to make a "stutter thread"
by using the after() call on some gui object to periodically check for
input on the queue.
You don't need to in fact: from the secondary thread
On Nov 27, 5:00 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> Refactor until your code is simple enough to unit-test effectively, then
> unit-test effectively.
Ok, I've taken this wise suggestion on board and of course I found
immediately ways to improve the method. -However- this generates
ano
"Michele Simionato" <[EMAIL PROTECTED]> wrote:
>The namedtuple recipe by Raymond Hettinger (http://
>code.activestate.com/recipes/500261)
>is an interesting example of code generation. My own decorator module
>use a similar
>trick. Here code generation (plus eval/exec) is needed since you need
>c
"Kay Schluehr" <[EMAIL PROTECTED]> wrote:
>
> I just noticed that corepy 1.0 [1] has been released. Corepy is an
> embedded DSL for synthesizing machine code from chaining Python
> commands. This means it provides objects and exploits control
> structures used to create machine code that can f
"Steven D'Aprano" <[EMAIL PROTECTED]>
>GUI designer. You write a program to let the user create code by clicking
>buttons, dragging objects, drawing lines, etc. The GUI designer may use
>classes, but the purpose of those classes is to generate source code.
>
Yikes, this is getting hairy- If "
"Terry Reedy" <[EMAIL PROTECTED]> wrote:
> Hendrik van Rooyen wrote:
>
> > I am using the term in the restricted sense of Python writing Python source.
> >
> > Given that, can anybody think of an example that you could not do with
> > a class? (excepting the "stored procedure" aspect)
>
> I am
<[EMAIL PROTECTED]> wrote:
On 26 Nov, 13:42, Steve Holden <[EMAIL PROTECTED]> wrote:
>> One approach would be to run the socket code in blocking mode in a
>> separate thread started by the (main program) GUI thread at program
>> startup, and communicating results back via a Queue.Queue or simil
"Aaron Brady" <[EMAIL PROTECTED]> wrote:
>On Nov 26, 10:41 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]>
>wrote:
>> "Steven D'Aprano" wrote:
>>
>>
>>
>> > Well, I don't know about "any problem". And it's not so much about
>> > whether metaprograms can solve problems that can't be solved by anythi
On Nov 27, 8:57 am, Roy Smith <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> "adam carr" <[EMAIL PROTECTED]> wrote:
>
> > I call a function get_items() which returns a list of items.
> > However, in some cases, it returns just one item.
> > It returns the item as an object though,
[EMAIL PROTECTED] wrote:
It's mostly a problem of culture.
If you look, for example, at chinese [sic] names, the name space is not that
much important:
"Xee Laa" only takes this space:
" "
^^^
Chinese names are presumably not spelled with Roman letters in Chinese, so
this really sa
1 - 100 of 144 matches
Mail list logo