, is to be able to get the results without having to
redirect, capture, and then reset sys.stdout.
But I still need to rewrite disassemble_string() and need to test it
with tracebacks.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
in it.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
renaming cx_Oracle to _cx_Oracle then
import as...
import _cx_Oracle as cx_Oracle
Of course your problem might be entirely different. But this might help.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
On Wed, 05 Oct 2005 11:10:58 GMT, Ron Adam [EMAIL PROTECTED] wrote:
Looking at it from a different direction, how about adding a keyword to
say, from this point on, in this local name space, disallow new
names. Then you can do...
def few(x,y):
a = 'a'
b = 'b'
i
Fredrik Lundh wrote:
Ron Adam wrote:
Is there a way to conditionally decorate? For example if __debug__ is
True, but not if it's False? I think I've asked this question before. (?)
the decorator is a callable, so you can simply do, say
from somewhere import debugdecorator
Antoon Pardon wrote:
Op 2005-10-04, Ron Adam schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Op 2005-10-03, Steven D'Aprano schreef [EMAIL PROTECTED]:
And lo, one multi-billion dollar Mars lander starts braking either too
early or too late. Result: a new crater on Mars, named after the NASA
not a problem as I think what you want to prevent is erroneous results
due to unintentional name changes or object changes.
I think both of these would have unexpected side effects in many cases,
so their use would be limited.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python
checking. This is where self validating objects are useful and
there is nothing preventing anyone from using them in Python.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
Ron Adam
I think I'm going to make it a habit to put parentheses around these
things just as if they were required.
Yes, that's the best way to make it readable and understandable.
Reinhold
Now that the syntax is settled, I wonder if further discussion
()
xyz.y()
print xyz.q # prints 2
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Ron Adam wrote:
Also,
In your example 'q' is assigned the value 2, but as soon as the method
'y' exits, it is lost. To keep it around you want to assign it to self.y.
Ooops, That should say ...
To keep it around you want to assign it to self.q. ---self.q
Cheers,
Ron
--
http
)
I think I'm going to make it a habit to put parentheses around these
things just as if they were required.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
Ron Adam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Actually I think I'm getting more confused. At some point the function
is wrapped. Is it when it's assigned, referenced, or called?
When it is referenced via the class.
Ok, that's what I suspected
# wrapped in a labeled
# block comment.
#
:##
The markup form might make it easy to read labeled comments into a
dictionary where the labels become the keys. Then special field
definitions wouldn't be needed.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python
Steven D'Aprano wrote:
On Tue, 27 Sep 2005 16:42:21 +, Ron Adam wrote:
def beacon(self, x):
...print beacon + %s % x
...
Did you mean bacon? *wink*
Of course... remembering arbitrary word letter sequences is probably my
worst skill. ;-) That, and I think for some reason
', 'l', 'o']
The attribute aa.boo is not there, so call boo.__get__() in class a.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Sun, 25 Sep 2005 14:52:56 +, Ron Adam wrote:
Steven D'Aprano wrote:
Or you could put the method in the class and have all instances recognise
it:
py C.eggs = new.instancemethod(eggs, None, C)
py C().eggs(3)
eggs * 3
Why not just add it to the class directly
', 'beacon', 'ham', 'spam']
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
,
%s object has no attribute %s \
% (leader, set_name) )
Of course this wouldn't use the object names directly... I guess I'll
need to look in the C object code to see exactly how it works. But the
links you gave help.
Thanks,
Ron
--
http://mail.python.org
Erik Max Francis wrote:
Ron Adam wrote:
When you call a method of an instance, Python translates it to...
leader.set_name(leader, John)
It actually translates it to
Person.set_name(leader, John)
I thought that I might have missed something there.
Is there a paper on how
.
Anyway... just wishful thinking. I'm sure there are a lot of problems
that would need to be worked out. ;-)
Cheers,
Ron Adam
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
Ron Adam wrote:
2. Expressions that will be used in a calculation or another
expression.
By which you appear to mean expressions in which Boolean values are
used as numbers.
Or compared to other types, which is common.
This matters because if you aren't
Steve Holden wrote:
Ron Adam wrote:
Tony Houghton wrote:
I'm using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I'd probably use
~/.bombz, in Windows something like
C:\Documents And Settings\user\Applicacation Data
= os.path.join( os.environ[USERPROFILE],
'Application Data',
'Bombz' )
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Terry Hancock wrote:
On Thursday 22 September 2005 12:26 pm, Ron Adam wrote:
Steve Holden wrote:
Ron Adam wrote:
True * True
1 # Why not return True here as well?
Why not return 42? Why not return a picture of a banana?
My question still stands. Could it be helpful
details go to:
http://whois.godaddy.com
You can find out more by following the godaddy link or just go here and
enter the numbers displayed to access it.
https://www.godaddy.com/gdshop/whois.asp?se=%2Bdomain=LIAGE%2Enetci=1718
Maybe an email to them would clear it up?
Cheers,
Ron
--
http
wrote the
class. So self is a convienent place holder.
I hope this helped.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
] --- lindensys.net not found
---
The web site at tictek give the same exact under construction notice as
LIAGE.NET.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
to the PEP they were introduced to help reduce
errors. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
, and it not an acceptable
alternative to good security either.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
this is something that's crying out
for an official function in os or sys.
This works on Win XP. Not sure if it will work on Linux.
import os
parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0]
file = parent + os.sep + '.bombz'
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python
py2exe script. You'll need to change it to suite your
own needs of course. The rmtree is my own module to remove directories
and contents. The newest version of py2exe I think does a better job of
cleaning up I think.
Cheers,
Ron
# makeexe.py
Create a stand alone distribution using py2exe
, self.last
Cheers,
Ron
C:\Python24\Libdiff.py inspect.py inspect_.py
*** inspect.py Tue Mar 15 13:22:02 2005
--- inspect_.py Mon Sep 19 14:26:26 2005
***
*** 531,536
--- 531,538
raise EndOfBlock, self.last
elif type == tokenize.NAME and scol == 0
Delaney, Timothy (Tim) wrote:
Ron Adam wrote:
While playing around with the inspect module I found that the
Blockfinder doesn't recognize single line function definitions.
Adding the following two lines to it fixes it, but I'm not sure if it
causes any problems anywhere else.
elif
) * value == bool(2 and 1) * value
So..
bool(a and b) * value
Would return value or zero, which is usually what I want when I do this
type of expression.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm developing a piece of software to assist illiteraate adults to learn to
read. I'm trying to figure out how, if possible, to make audio playback
asynchrnous but still controllable. I'm using python 2.4 with pymedia on
XP. I started out with the example in the tutorials section of
a majority agreement.
Or to put it another way; risk management by ... keep it simple,
don't have too many cooks, get second opinions, and don't put all
your eggs in one basket.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
on successive calls, but then I realized that it's nearly
identical to a loop in that context, so why not just write it as a loop
to start with.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Kirk Job Sluder wrote:
Ron Adam [EMAIL PROTECTED] writes:
I would think that any n digit random number not already in the data
base would work for an id along with a randomly generated password
that the student can change if they want. The service provider has
full access to the data
password.
Or am I missing something?
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
On Saturday 10 September 2005 15:02, Ron Adam wrote:
Kirk Job Sluder wrote:
I would think that any n digit random number not already in the data
base would work for an id along with a randomly generated password that
the student can change if they want. The service provider
Michael Hudson wrote:
Ron Adam [EMAIL PROTECTED] writes:
With current slicing and a negative step...
[ 1 2 3 4 5 6 7 8 9 ]
-9 -8 -7 -6 -5 -4 -3 -2 -1 -0
r[-3:] - [7, 8, 9]# as expected
r[-3::-1] - [7, 6, 5, 4, 3, 2, 1, 0] # surprise
The seven is include
it on his
desk Monday situation. ;-)
Regards,
Bengt Richter
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Patrick Maupin wrote:
I previously wrote (in response to a query from Ron Adam):
In any case, you asked for a rationale. I'll give you mine:
L = range(10)
L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]
True
After eating supper, I just realized that I could probably make my
Steve Holden wrote:
Ron Adam wrote:
Steve Holden wrote:
What misconception do you think I have?
This was not an ad hominem attack but a commentary on many attempts to
improve the language.
Ok, No problem. ;-)
No one has yet explained the reasoning (vs the mechanics
Patrick Maupin wrote:
Ron Adam wrote:
This should never fail with an assertion error. You will note that it
shows that, for non-negative start and end values, slicing behavior is
_exactly_ like extended range behavior.
Yes, and it passes for negative start and end values as well
Magnus Lycka wrote:
Ron Adam wrote:
Ok, lets see... This shows the problem with using the gap indexing
model.
L = range(10)
[ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] # elements
0 1 2 3 4 5 6 7 8 9 10 # index's
L[3::1] - [3, 4, 5, 6, 7, 8, 9] 3rd index
the '~' values.
LL=list(range(10))
Lx=nxlist(range(10))
LL[ 1: 2]==[LL[ 1]]==[1]
Lx[~2:~1]==[Lx[~1]]==[8]
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Magnus Lycka wrote:
Ron Adam wrote:
Slicing is one of the best features of Python in my opinion, but
when you try to use negative index's and or negative step increments
it can be tricky and lead to unexpected results.
Hm... Just as with positive indexes, you just need to understand
order of the selected range. I would appreciated it.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
works?
Actually I can, but it would be off topic for this news group.
Cheers,
Ron
regards
Steve
--
http://mail.python.org/mailman/listinfo/python-list
] # interesting symmetry.
r.range_sub(d,3)
Of course adding and subtracting slice objects could also be possible.
d = [10:20]
e = [15:25]
f = d + e- [10:25]
or ...
d = [10:10]
e = [15:10]
f = d + e- [10:15]
Cheers,
Ron
Regards,
Bengt Richter
--
http
Terry Reedy wrote:
Ron Adam wrote:
However, I would like the inverse selection of negative strides to be
fixed if possible. If you could explain the current reason why it does
not return the reverse order of the selected range.
To repeat, the current reason is compatibility
, it would be nice to get
a few opinions at this point. So blast away... or hopefully tell me
what you like about it instead. ;-)
(Any suggestions or contributions to make it better would be appreciated.)
Cheers,
Ron Adam
IMPROVED SLICING
Slicing is one of the best features
Terry Reedy wrote:
Ron Adam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Slicing is one of the best features of Python in my opinion, but
when you try to use negative index's and or negative step increments
it can be tricky and lead to unexpected results.
This topic has come up
for the feedback, it was helpful.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
b[-1:] = ['Z']# replaces last item
b[-1:-0] = ['Z'] # this doesn't work
If you are using negative index slices, you need to check for end
conditions because you can't address the end of the slice in a
sequential/numerical way.
OK, now I understand your
Bengt Richter wrote:
IMO the problem is that the index sign is doing two jobs, which for zero-based
reverse indexing have to be separate: i.e., to show direction _and_ a _signed_
offset which needs to be realtive to the direction and base position.
Yes, that's definitely part of it.
A
Terry Reedy wrote:
Ron Adam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Fredrik Lundh wrote:
Ron Adam wrote:
The problem with negative index's are that positive index's are zero
based, but negative index's are 1 based. Which leads to a non
symmetrical situations.
indices
', 'last', 'end', 'final']
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
won't need to know or care
what language you developed your application with as long as it works.
Hope that helps,
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED],
Benji York [EMAIL PROTECTED] wrote:
Peter Maas wrote:
suffix = 'var'
vars()['a%s' % suffix] = 45
avar
45
Quoting from http://docs.python.org/lib/built-in-funcs.html#l2h-76 about
the vars built in:
The returned dictionary should not be
In article [EMAIL PROTECTED],
Robert Kern [EMAIL PROTECTED] wrote:
In the
bowels of my modules, I may not know what the contents are at code-time,
Then how do you write your code?
rg
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED],
Steve Holden [EMAIL PROTECTED] wrote:
rafi wrote:
Reinhold Birkenfeld wrote:
exec(eval('a%s=%s' % (count, value)))
why using the eval?
exec ('a%s=%s' % (count, value))
should be fine
And this demonstrates why exec as a statement was a mistake
to meet that guideline.
This could be extended to:
2. The minimum required to run an agreed upon set of simple Python
programs.
I expect there may be a lot of differing opinions on just what those
minimum Python programs should be. But that is where the PEP process
comes in.
Regards,
Ron
Martin v. Löwis wrote:
Ron Adam wrote:
I would put the starting minimum boundary as:
1. The minimum required to start the python interpreter with no
additional required files.
Currently python 2.4 (on windows) does not yet meet that guideline, so
it seems some modules still need
easier as
it's only needed in the method that initiates the result calculation.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
are copies.
I too have wondered why copy isn't a builtin, and yet some builtin
objects do make copies.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
) in every function or class
that uses them.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
' twice with the same name in the same function should cause
an error. Using 'shared' with a name that is not in shared name space
would cause an error.
Just a few thoughts.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
it if it's implemented. I'd rather not see that, so I'm still -1
concerning '/' for that reason among others.
Cheers,
Ron
PS. Could someone repost the links to the current pre-pep and the most
recent module version so I can look at it closer look?
--
http://mail.python.org/mailman
]] - item = D['a']['b']
This give a more general purpose for path objects. Working out ways to
retrieve path objects from a dictionary_tree also would be useful I
think. I think a Tree class would also be a useful addition as well.
Any thoughts on this?
Cheers,
Ron
--
http
Brian Beck wrote:
Ron Adam wrote:
This give a more general purpose for path objects. Working out ways
to retrieve path objects from a dictionary_tree also would be useful I
think. I think a Tree class would also be a useful addition as well.
Any thoughts on this?
I don't think
posted
improvements. (hint hint) ;-)
Cheers,
Ron Adam
+ output --
Define paths:
path1 = ['hello', 'world']
path2 = ['hello', 'there', 'world']
path3 = ['hello', 'there', 'wide', 'world']
Store path keys in tree:
hello
world
None
there
world
None
system as well as it's files. ;-)
(Add more or less methods as needed of course.)
apath = device(dev_obj).path(some_path_sting)
apath.open().write(data).close()
or if you like...
device(dev_obj).append(path_sting).open().write(data).close()
Just a few thoughts,
Cheers,
Ron
be best for newbies to Python, depending on their
background. It can be reached at
http://www.awaretek.com/python/index.html
Ron
--
http://mail.python.org/mailman/listinfo/python-list
]+='.zip' Or this?
Cheer's Ron.
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
Ron Adam wrote:
In all current cases, (that I know of), of differing types, '+' raises
an error.
Not quite:
hello + uworld
u'hello world'
4.5 + 5
9.5
Question: Is a path object mutable?
No.
This should answer the rest of your questions.
Yes
Peter Hansen wrote:
Ron Adam wrote:
Michael Hoffman wrote:
Ron Adam wrote:
In all current cases, (that I know of), of differing types, '+'
raises an error.
Not quite:
hello + uworld
u'hello world'
4.5 + 5
9.5
In the case of numeric types, it's an addition and not a join. I
with the
language is concerned.
Cheers,
Ron
As for features we don't have yet, you could use an inerator.
Something that gets stuff a little bit at a time.
If you combine an iterator with a inerator, you would have a itinerator
which would be quite useful for managing 'flight-paths
Kay Schluehr wrote:
Ron Adam wrote:
Kay Schluehr wrote:
BTW.. Usually when people say I don't want to discourage..., They
really want or mean the exact oppisite.
Yes, but taken some renitence into account they will provoke the
opposite. Old game theoretic wisdoms ;)
True.. but I
Kay Schluehr wrote:
Hi Ron,
I really don't want to discourage you in doing your own CAS but the
stuff I'm working on is already a bit more advanced than my
mono-operational multiplicative algebra ;)
I figured it was, but you offered a puzzle:
Here might be an interesting puzzle
Kay Schluehr wrote:
Ron Adam wrote:
Kay Schluehr wrote:
On a more general note, I think a constrained sort algorithm is a good
idea and may have more general uses as well.
Something I was thinking of is a sort where instead of giving a
function, you give it a sort key list. Then you can
Raymond Hettinger wrote:
[Ron Adam]
Currently we can implicitly unpack a tuple or list by using an
assignment. How is that any different than passing arguments to a
function? Does it use a different mechanism?
It is the same mechanism, so it is also only appropriate for low
volumes
the
wheel yet again.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
as you can use a for loop
to add or multiply them until you get to a not digit.
Anyway, interesting stuff. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
function that you might be able to play with..
There are shorter versions of this, but this has a few optimizations added.
Overall it's about 10 times slower than pythons built in sort for large
lists, but that's better than expected considering it's written in
python and not C.
Cheers,
Ron
peoples code
more difficult.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
in can go in just about any direction you
could want.
http://www.muppetlabs.com/~breadbox/orth/
;-)
Cheers,
Ron
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
Ron Adam wrote:
'abc' is 'abcd'[:3]
False
Well of course it will be false... your testing two different strings!
And the resulting slice creates a third.
Try:
ABC = 'abc'
value = ABC
if value is ABC: # Test if it is the same object
pass
and then optimizing the parts that need it.
When it's run on faster computers, those optimizations would be a bonus.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
On Sun, 10 Jul 2005 05:35:01 GMT, Ron Adam [EMAIL PROTECTED] wrote:
So far they are fairly equivalent. So there's not really any advantage
over the equivalent inline function. But I think I see what you are
going towards. Decorators currently must be used when
']
Works for me. ;-)
I always thought list([1,2,3]) - [1,2,3] was kind of silly.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
Ron Adam wrote:
def count_records(record_obj, start=0, end=len(record_obj)):
That would work really well, except that it doesn't work at all.
Yep, and I have to stop trying to post on too little sleep.
Ok, how about... ?
def count_records(record_obj, start=0
style:
abc.tolist()
list('a','b','c')
abc.splitchrs()
There's already a str.split() to create a list of words,
and a str.splitline() to get a list of lines, so it would group related
methods together.
I don't thin adding sting methods to lists is a good idea.
Cheers,
Ron
--
http
Reinhold Birkenfeld wrote:
Ron Adam wrote:
Given the statement:
a = None
And the following are all true:
a == None
Okay.
(a) == (None)
Okay.
(a) == ()
Whoops! a (which is None) is equal to the empty tuple (which is not None)?
It's not an empty tuple, it's an empty
.
The lambda may be perfectly fine for that. But why not use def?
func_x = lambda x: (someother_func_x(x,'value'))
def func_x(x): return someother_func_x(x,'value')
There's both nearly identical, but the def is understandable to
beginners and advanced python programs.
Cheers,
Ron
Am I just
Grant Edwards wrote:
On 2005-07-07, Ron Adam [EMAIL PROTECTED] wrote:
It would be a way to set an argument as being optional without
actually assigning a value to it.
So it would still work like you expect even though v is not
bound to anything. Like I said the bigger problem is that
globals
Steven D'Aprano wrote:
Ron Adam wrote:
Why would you want to use None as an integer value?
If a value isn't established yet, then do you need the name defined?
Wouldn't it be better to wait until you need the name then give it a
value?
Er, maybe I'm misunderstanding something here
a {dictionary_comp} would make it a complete set. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
701 - 800 of 940 matches
Mail list logo