Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread Terry Reedy

Paul Rubin http://phr.cx@NOSPAM.invalid wrote in message 
news:[EMAIL PROTECTED]
 Steve Holden [EMAIL PROTECTED] writes:
 Of course. But onc you (sensibly) decide to use an if then there
 really isn't much difference between -1, None, () and sys.maxint as
 a sentinel value, is there?

 Of course there is.  -1 is (under Python's perverse semantics) a valid
 subscript.  sys.maxint is an artifact of Python's fixed-size int
 datatype, which is fading away under int/long unification, so it's
 something that soon won't exist and shouldn't be used.  None and ()
 are invalid subscripts so would be reasonable return values, unlike -1
 and sys.maxint.  Of those, None is preferable to () because of its
 semantic connotations.

I agree here that None is importantly different from -1 for the reason 
stated.  The use of -1 is, I am sure, a holdover from statically typed 
languages (C, in particular) that require all return values to be of the 
same type, even if the 'return value' is actually meant to indicat that 
there is no valid return value.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list


Virtual Slicing

2005-08-27 Thread Bryan Olson


I recently wrote a module supporting value-shared slicing. I
don't know if this functionality already existed somewhere, but
I think it's useful enough that other Pythoners might want it,
so here it is.

Also, my recent notes on Python warts with respect to negative
indexes were based on problems I encoutered debugging this
module, so I'm posting it partially as a concrete example of
what I was talking about.

--
--Bryan




 vslice.py by Bryan G. Olson, 2005
 This module is free software and may be modified and/or
 distributed under the same terms as Python itself.

 Virtual Slicing differs from normal Python slicing in that
 that the cells in the given sequence are not copied; they
 are shared between the underlying sequence and the VSlice.
 VSlices are themselves Python sequences. You can index
 VSlices, slice them, iterate over them, get their len(),
 test 'if val in', compare them, add them, and multiply them
 by integers.

 The 'vslice' function creates virtual slices of sequences:

 vslice(sequence, start, stop, step)

 returns an instance of VSlice that is much-the-same-as:

 sequence[start : stop : step]

 The default for start, stop and step is None, and passing
 None or omitting parameters works the same as in Python
 slicing.

 VSlices also have read-only properties 'sequence', 'start',
 'stop' and 'step', in case you need to access the underlying
 sequence directly. Like Python's 'slice' object, the stop
 value will be negative if and only if step is negative and
 the slice includes the zero index.

 A VSlice of a VSlice will use the same underlying sequence.
 It will translate the start-stop-step values upon
 construction, so later access will go through only one layer
 of VSlicing. The sequence, start, stop, and step properties
 of the VSlice-of-a-VSlice will generally not be same as the
 parameters passed to the vslice factory function; they
 relate to the underlying sequence.

  a = range(100)
  from vslice import vslice
  vs1 = vslice(a, 10, None, 2)
  vs2 = vslice(vs1, 2, -2, 3)
 
  print vs2 == a[10 : None : 2][2 : -2 : 3]
 True
  print vs2.sequence == vs1
 False
  print vs2.sequence == a
 True
  print vs2.sequence is a
 True
  print vs2.start, vs2.stop, vs2.step
 14 96 6
  print vs2 == a[14 : 96 : 6]
 True


 If the underlying sequence is mutable, the VSlice is semi-
 mutable. You can assign to elements, but not insert nor
 delete elements; similarly, no append, push, pop and such.
 Slice assignments must have the same length slice on both
 sides.

 A slice of a VSlice is a regular Python slice; it is a copy
 made by slicing the underlying sequence with translated
 start-stop-step values. For sane sequence types, the slice
 of the VSlice will therefore have the same type as the
 underlying sequence.

 A VSlice's start-stop-step and len are set on construction.
 Adding or removing indices from the underlying sequence will
 not change them, and is usually a bad thing to do.

 VSlices support any positive or negative integer step value,
 but are most efficient in both time and space when the step
 value is one. Fortunately, the need for any other step value
 is rare. The vslice function will choose between two sub-
 classes of VSlice, depending on whether the step is one. The
 VxSlice can support any step size; the V1Slice is faster and
 smaller, but only supports a step of one. VxSlice instances
 store five slots; V1Slices, 3.




def vslice(sequence, start=None, stop=None, step=None):
  Return a VSlice (virtual slice). See module's __doc__.
 
 start, stop, step = slice(start, stop, step).indices(len(sequence))
 if isinstance(sequence, VSlice):
 start = sequence.start + start * sequence.step
 stop = sequence.start + stop * sequence.step
 step *= sequence.step
 sequence = sequence.sequence
 if step == 1:
 return V1Slice(sequence, start, stop)
 else:
 return VxSlice(sequence, start, stop, step)



from itertools import islice

_type_err_note = 'VSlice index must be integer or slice.'

_module_doc = __doc__

class VSlice (object):

 __doc__ = _module_doc

 def __init__(self, *args):
 if self.__class__ == VSlice:
 raise RuntimeError(Attempt to instantiate abstract base  +
 class VSlice. To create a VSlice, call vslice.vslice().)

 def get_sequence(self):
 return self._seq
 sequence = property(get_sequence, None, None,
 'The underlying sequence, never itself a VSlice.')

 def get_start(self):
 return self._start
 start = 

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-27 Thread Bryan Olson
Steve Holden wrote:
  Bryan Olson wrote:
  [...] I see no good reason for the following
  to happily print 'y'.
 
   s = 'buggy'
   print s[s.find('w')]
 
Before using the result you always have to perform
a test to discriminate between the found and not found cases. So I
  don't
really see why this wart has put such a bug up your ass.
 
  The bug that got me was what a slice object reports as the
  'stop' bound when the step is negative and the slice includes
  index 0. Took me hours to figure out why my code was failing.
 
  The double-meaning of -1, as both an exclusive stopping bound
  and an alias for the highest valid index, is just plain whacked.
  Unfortunately, as negative indexes are currently handled, there
  is no it-just-works value that slice could return.
 
 
  If you want an exception from your code when 'w' isn't in the string you
  should consider using index() rather than find.

That misses the point. The code is a hypothetical example of
what a novice or imperfect Pythoners might have to deal with.
The exception isn't really wanted; it's just vastly superior to
silently returning a nonsensical value.


  Otherwise, whatever find() returns you will have to have an if in
  there to handle the not-found case.
 
  This just sounds like whining to me. If you want to catch errors, use a
  function that will raise an exception rather than relying on the
  invalidity of the result.

I suppose if you ignore the real problems and the proposed
solution, it might sound a lot like whining.


-- 
--Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question: Sub-interpreters for CAD program

2005-08-27 Thread David MacQuigg
On 24 Aug 2005 13:48:13 -0700, sonicSpammersGoToHellSmooth
[EMAIL PROTECTED] wrote:

Hi all,

I'm a newbie to Python, so I have a question about writing an
application that also has a scripting ability.  I'm thinking of Eric3
as an example.  It's written in Python, but it also has an interpreter
window.  The user doesn't have access (I don't think...) to all the
internal stuff that makes the IDE work.

In my case I'd like to write a CAD program which allows the user to
write Python scripts, and to provide an API to do CAD stuff, manipulate
parameters, circuits, layouts, simulations, etc.  The user should not
have access to the internals of the CAD program itself.  The CAD
program is written primarily in Python, with possibly C++ extensions
for speed critical stuff.

There is another posting currently asking about how many interpreters
are needed with how many thread states each.  Since this is new to me,
can someone please explain how this sort of thing is supposed to
work, from a high level?

I have a strong EE and hardware background (hence my need to write a
CAD program that doesn't piss me off), but not a CS background.

Sounds like we have similar backgrounds and motivations.  I have a
project started along these lines, but I haven't had time to work on
it for the last few months.
http://www.ece.arizona.edu/~edatools/
  Project page
EDA Tools Projects:
An Open-Source Platform for Front-End IC Design   cdp_tut01-a1.zip
cdp_tut01-a1.tar.gz  
The goal of this project is an easily-learned, universal, open-source,
circuit design platform that will allow IC designers to use whatever
tools they want for design entry, simulation, and display of results.
The platform should provide a simple GUI, basic services such as
storage of tool setups, and should define a simple, standard interface
for each class of tool.  Most of the work will be in documenting the
design and construction of the platform, using a simple scripting
language ( Python ) and GUI toolkit ( Qt ) so that others may easily
follow the pattern and extend the platform to support new and more
varied tools.
--

Take a look also at the MyHDL link from the main page.  This is a
similar effort for digital design.  Mine is mostly analog.

The discouraging thing about the EDA tools situation is that no matter
how loudly design engineers complain about the poor quality of the
proprietary tools they are using, there is very little interest in
participating in an open-source project.  They just can't see how it
would ever do what their expensive tools do now.

There is a similar lack of interest in the academic community.  None
of this is likely to lead to publications in scholarly journals.

--
Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python library/module for MSAccess

2005-08-27 Thread Christos Georgiou
On Sat, 27 Aug 2005 04:45:25 GMT, rumours say that Stephen Prinster
[EMAIL PROTECTED] might have written:

Jonathon Blake wrote:

 [ Editing/creating msaccess databases on a Linux Box, and WINE _not_ 
 installed.]

I'm pretty sure I don't understand what you are wanting to do.  You say
you have   msaccess databases on a Linux Box and you are not using the
Jet Database engine.  As far as I know, MS Access is just a front-end to
databases, with Jet as the default backend (though it can connect to
many others).  What backend database engine/storage format are you
using?  There might be a python library for connecting to it, bypassing
Access altogether.

I think the OP wants to *use* .mdb files on a linux system without using
any msjet*.dll libraries.

There is a (C language) project that can read .mdb databases-- it can't
write them yet.[1]


[1] http://mdbtools.sourceforge.net/
-- 
TZOTZIOY, I speak England very best.
Dear Paul,
please stop spamming us.
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any projects to provide Javascript-style client-side browser access via Python?

2005-08-27 Thread Alessandro Bottoni
Kenneth McDonald wrote: 
 So anyone know if there are projects underway on this?

As long as I know, Mozilla (as Firefox, Thunderbird and Sunbird) can host
Python as an internal scripting language thanks to PyXPCOM (the Python
binding to the XPCOM cross-platform COM technology used by Mozilla). In
this case, you have to recompile Mozilla from source to enable the PyXPCOM
support (that is: you will end up having a custom Mozilla to distribute
to your users).

Have a look at www.mozilla.org and www.mozdev.org and/or search for PyXPCOM
on Google.

(Most likely, something like that is available for Konqueror and others
Linux browsers, as well)

HTH

---
Alessandro Bottoni
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python library/module for MSAccess

2005-08-27 Thread Alessandro Bottoni
Christos Georgiou wrote:
 I think the OP wants to *use* .mdb files on a linux system without using
 any msjet*.dll libraries.

Looks like you need a .mdb driver for the Python DB-API. Have a look here:
http://www.python.org/topics/database/
http://www.mayukhbose.com/python/ado/ado-connection.php (ADO)
http://www.vex.net/parnassus/ (Python Vaults of Parnassus)

Have a look at Kexi, as well (KDE based, no Python involved): 
http://www.koffice.org/kexi/
http://www.kexi-project.org/

HTH

---
Alessandro Bottoni
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding Python in other programs

2005-08-27 Thread webraviteja
Steve,
  He said VB6 not VB.NET

Greg,
  Just write COM servers in Python and call them from VB6. No need to
embed. Lot easier too.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-27 Thread Ulrich Hobelmann
Mike Meyer wrote:
 This can be designed much better by using iframes, maybe even Ajax.
 
 Definitely with Ajax. That's one of the things it does really well.

But then you're probably limited to the big 4 of browsers: MSIE, 
Mozilla, KHTML/Safari, Opera.  Ok, that should cover most desktop users, 
but you might run into problems on embedded.

I've also noticed that especially web forums and dynamic websites take 
up looots of memory on my machine (but then I have lts).

 Why can't we use the Web for what it was meant for: viewing hypertext
 pages? Why must we turn it into a wrapper around every application
 imaginable?
 Because it works?
 
 Because you can - if you know how to use HTML properly - distribute
 your application to platforms you've never even heard of - like the
 Nokia Communicator.

If the NC has software that can properly interpret all that HTML, CSS, 
JavaScript plus image formats, yes.  But who guarantees that?  I'd 
rather develop a native client for the machine that people actually WANT 
to use, instead of forcing them to use that little-fiddly web browser on 
a teeny tiny display.

And again: connections might be slow, a compact protocol is better than 
loading the whole UI every time.  And while Ajax might work, despite the 
UI being maybe too big for the little browser window, and even if it 
works, it's still probably more work than a simple, native UI.  First of 
all it needs to load all the JS on first load, secondly sometimes for a 
flexible UI you'd have to replace huge parts of the page with something 
else.  Native UIs are more up to the task.

 I started writing web apps when I was doing internal tools development
 for a software development company that had 90+ different platform
 types installed inhouse. It was a *godsend*. By deploying one

If that's 90+ GUI platforms, then I agree.  I just wonder who wrote 
fully standards compliant web browsers for those 90 platforms.  If you 
have one Windows GUI (maybe C#), one Mac GUI (Cocoa), one Gtk GUI for X, 
you're done.  A GUI should be the smallest bunch of work on any given 
application, so it's not prohibitive to write a couple of them, IMHO. 
But then I've only ever used Swing and Cocoa and the latter *is* really 
convenient, might be that the others are a PITA, who knows...

 well-written app, I could make everyone happy, without having to do
 versions for the Mac, Windows, DOS (this was a while ago), getting it
 to compile on umpteen different Unix version, as well as making it
 work on proprietary workstation OS's.

Well, stick to POSIX and X APIs and your stuff should run fine on pretty 
much all Unices.  I never understood those people who write all kinds of 
weird ifdefs to run on all Unices.  Maybe that was before my time, 
during the Unix wars, before POSIX.  And if it's not Unix, what's a 
prop. workstation OS?

 Of course, considering the state of most of the HTML on the web, I
 have *no* idea why most of them are doing this.

Yep.  Maybe it would be best to reengineer the whole thing as ONE UI 
spec+action language, incompatible with the current mess, compact, so it 
can be implemented with minimum fuss.  And most of all, I wouldn't use a 
MARKUP language, as a real application is not text-based (at least not 
as characteristic #1).

-- 
I believe in Karma.  That means I can do bad things to people
all day long and I assume they deserve it.
Dogbert
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Closing programs that use sockets

2005-08-27 Thread billiejoex
Awesome. :-)
Thank you.

 You may find that CTRL/Break works even when CTRL/C doesn't.

 regards
  Steve
 -- 
 Steve Holden   +44 150 684 7255  +1 800 494 3119
 Holden Web LLC http://www.holdenweb.com/
 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ideas for university project ??

2005-08-27 Thread Richard Lewis

On Fri, 26 Aug 2005 11:49:34 +0100, Jon Hewer [EMAIL PROTECTED]
said:
 
 Areas of interested include AI, distributed systems.
Have you considered looking at Semantic Web stuff? Its all still
experimental but its quite AI and very distributed.

Cheers,
Richard
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need a little help with time

2005-08-27 Thread Randy Bush
i am doing disgusting looking junk based on calendar.  example

now = calendar.timegm(time.gmtime())
aWeek = 7*24*60*60
print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(now + aWeek))

randy

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-27 Thread axel
In comp.lang.perl.misc John Bokma [EMAIL PROTECTED] wrote:
 Chris Head [EMAIL PROTECTED] wrote:
 
 What advantages would those be (other than access from 'net cafes, but
 see below)?
 
 And workplaces. Some people have more then one computer in the house. My 
 partner can check her email when I had her over the computer. When I 
 want to check my email when she is using it, I have to change the 
 session, fire up Thunderbird (which eats away 20M), and change the 
 session back.
 
Not a Windows solution, but I find the 'screen' utility invaluable as
I can have my email, news, and an editor open in different screens
and then when I need to move to a different machine, I can simply
detach and reattach screen without disturbing anything that
might be running.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Virtual Slicing

2005-08-27 Thread Sybren Stuvel
Bryan Olson enlightened us with:
 I recently wrote a module supporting value-shared slicing.

Maybe I'm dumb, but could you explain this concept? Why would someone
whant this?

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Virtual Slicing

2005-08-27 Thread Oren Tirosh
Bryan Olson wrote:
 I recently wrote a module supporting value-shared slicing. I
 don't know if this functionality already existed somewhere,

In the Numarray module slices are a view into the underlying array
rather than a copy.

http://www.stsci.edu/resources/software_hardware/numarray

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any module to play mp3 or wav format files?

2005-08-27 Thread Lucas Raab
el chupacabra wrote:
 Is there any module to play mp3 or wav format files?
 
 any sample code available somewhere?
 
 thanks,
 el chupacabra
 
 
 --=  Posted using GrabIt  =
 --=  Binary Usenet downloading made easy =-
 -=  Get GrabIt for free from http://www.shemes.com/  =-
 

http://pymedia.org

-- 
--
Lucas Raab
lvraab@earthlink.net
dotpyFE@gmail.com
AIM:Phoenix11890
MSN:dotpyfe @ gmail.com
IRC:lvraab
ICQ:324767918
Yahoo:  Phoenix11890
-- 
http://mail.python.org/mailman/listinfo/python-list


Modify a C++ instance from the embed python interpreter

2005-08-27 Thread Wezzy
Hi, is there a tool that automatically expose an object to python? i
have an instance of a C++ (or ObjC) object and i want to pass it to the
embed interpreter that runs inside my program.
Python code have to call c++ method and register some callback.

I know that swig helps when python creates c++ instance but i've the
instance and i want to use it with python.

Thanks

-- 
Ciao
Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in string.find; was: Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-27 Thread Steve Holden
Paul Rubin wrote:
 Steve Holden [EMAIL PROTECTED] writes:
 
If you want an exception from your code when 'w' isn't in the string
you should consider using index() rather than find.
 
 
 The idea is you expect w to be in the string.  If w isn't in the
 string, your code has a bug, and programs with bugs should fail as
 early as possible so you can locate the bugs quickly and easily.  That
 is why, for example, 
 
   x = 'buggy'[None]
 
 raises an exception instead of doing something stupid like returning 'g'.

You did read the sentence you were replying to, didn't you?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread Steve Holden
Terry Reedy wrote:
 Paul Rubin http://phr.cx@NOSPAM.invalid wrote in message 
 news:[EMAIL PROTECTED]
 
Steve Holden [EMAIL PROTECTED] writes:

Of course. But onc you (sensibly) decide to use an if then there
really isn't much difference between -1, None, () and sys.maxint as
a sentinel value, is there?

Of course there is.  -1 is (under Python's perverse semantics) a valid
subscript.  sys.maxint is an artifact of Python's fixed-size int
datatype, which is fading away under int/long unification, so it's
something that soon won't exist and shouldn't be used.  None and ()
are invalid subscripts so would be reasonable return values, unlike -1
and sys.maxint.  Of those, None is preferable to () because of its
semantic connotations.
 
 
 I agree here that None is importantly different from -1 for the reason 
 stated.  The use of -1 is, I am sure, a holdover from statically typed 
 languages (C, in particular) that require all return values to be of the 
 same type, even if the 'return value' is actually meant to indicat that 
 there is no valid return value.

While I agree that it would have been more sensible to choose None in 
find()'s original design, there's really no reason to go breaking 
existing code just to fix it.

Guido has already agreed that find() can change (or even disappear) in 
Python 3.0, so please let's just leave things as they are for now.

A corrected find() that returns None on failure is a five-liner.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


pcapy - print the DATA field of a packet

2005-08-27 Thread billiejoex
Hi all. I'm using pcapy module to sniff some ICMP packets. I would like to 
modify this source:
http://www.google.it/search?hl=itq=pcapybtnG=Cerca+con+Googlemeta=
and visualize only the DATA filed of the sniffed packets instead of all 
fields that are generally visualized (for example: ip src, ip dest, packet 
type...)
For example in this sniffing output:

ICMP type: ECHOREPLY code: UNKNOWN

6efb bf0d 0800 4500 0027 9c42  ff01n.E..'.B
72eb 29ff 0459 2907 5549  9942 0001r.)..Y).UI...B..
 6e65 7473 7461 7420 2d61 6e   ..Hello world!

... I would like to visualize the 'Hello world' string only.
Sorry for my bad english.

Best regards. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding Python in other programs

2005-08-27 Thread Gregory Piñero
see below

On 27 Aug 2005 02:18:14 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Steve,
   He said VB6 not VB.NET
 
 Greg,
   Just write COM servers in Python and call them from VB6. No need to
 embed. Lot easier too.
 
Any idea how I would get started on this?  I'll do a search later today.


 --
 http://mail.python.org/mailman/listinfo/python-list
 


-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


Twice bound method

2005-08-27 Thread Carlos
Hi!

I want to instrumentate a class with a number of getter/setters.
Each pair of getter/setter must keep it's own state gsState but also
access to the state iState of instances of the instrumentated class.
For example:

class GetterSetter:
  def __init__(gsInstance, gsState):
   
  def get(gsInstance, iInstance, attr):
   
  def set(gsInstance, iInstance, attr, value):
   

class Instrumentated:
  def __init__(iInstance, iState):
   

getterSetter = GetterSetter(gsState1)
Instrumentated.getter1 = getterSetter.get
Instrumentated.setter1 = getterSetter.set

getterSetter = GetterSetter(gsState2)
Instrumentated.getter2 = getterSetter.get
Instrumentated.setter2 = getterSetter.set

instrumentated = Instrumentated(...)
instrumentated.getter1(x)
instrumentated.setter2(x, 5)

At first sight I thought that the above would work fine
as getterSetter.get would bind the getter to the GetterSetter
instance and then instrumented.getter1 would bind the already
bound getter to the Instrumentated instance, so at the end
an invocation like instrumentated.getter1(x) would be calling the
original getter passing a GetterInstance as first implicit
argument, an Instrumented instance as a second one and x
as the third -explicit- one. Well, the fact is that the getter
is only bound to the last instance, there are no nested bindings.

Another solution could come from the use of function nested
lexical scopes and closures, with a factory function which
takes the gsState as argument and produces a getter (or setter)
function taking an iState as first argument and the attribute as
second one. Then the class can be instrumentated with the generated
getter (or setter) which keeps the gsState captured within its closure.
For example:

def getterGen(gsState):
  def getter(iState, attr):

  return getter

Instrumentated.getter1 = getterGen(gsState1)
Instrumentated.getter2 = getterGen(gsState2)

Do you know of another -elegant- solution for the above problem?
Is there any way to get the nested method binding behaviour that
the first failed attempt required?

Thank you in advance.
Regards,
Carlos

-- 
http://mail.python.org/mailman/listinfo/python-list


pydoc, best practices, and Data class

2005-08-27 Thread nathan_kent_bullock
I have a python program that I am trying to generate documentation for.
But in one of my files I have a class called Data, when pydoc gets to
this class it just barfs. Well more specifically it generates
documentation for only that one class in the file, it ignores the rest
of the classes, plus it doesn't create the standard header, Package
Contents section, Classes section, or anything else. Just wondering if
this is a known bug, I can get around it by naming the class something
else and then just changing all other references to this class.

Second question I have is is there somewhere that gives a good overview
of best practices for documenting code in python. I read something
about ReST (reStructuredText), is this supported by pydoc? Is it
commonly used? I found links to docutils and other things, is pydoc
still the standard method of creating python documentation?

Thanks,
Nathan Bullock

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pcapy - print the DATA field of a packet

2005-08-27 Thread Peter Hansen
billiejoex wrote:
 Hi all. I'm using pcapy module to sniff some ICMP packets. I would like to 
 modify this source:
 http://www.google.it/search?hl=itq=pcapybtnG=Cerca+con+Googlemeta=
 and visualize only the DATA filed of the sniffed packets instead of all 
 fields that are generally visualized (for example: ip src, ip dest, packet 
 type...)

Sorry, but *which* source are you talking about?  The link you provided 
appears to be merely a page of Google search results.

Was there a specific page in there which you meant to point us to instead?

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


fontifying a pattern in a Tkinter Text widget

2005-08-27 Thread [EMAIL PROTECTED]
Hi, I'm writing a program which needs to change various format features
of a specific pattern (remote_user for example) withing a Text
widget. This pattern could potentially be anywhere within the widget.

I'm unsure of how to implement the various tag methods, so a little
push in the right direction would be greatly appreciated. Thanks

-Andrew

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modify a C++ instance from the embed python interpreter

2005-08-27 Thread Diez B. Roggisch
Wezzy wrote:
 Hi, is there a tool that automatically expose an object to python? i
 have an instance of a C++ (or ObjC) object and i want to pass it to the
 embed interpreter that runs inside my program.
 Python code have to call c++ method and register some callback.
 
 I know that swig helps when python creates c++ instance but i've the
 instance and i want to use it with python.

That is the same case, wrt SWIG - the objects methods get accessed by 
functions like

int Object_foo(Object *s) {
 return s-foo();
}


So passing a exiting object reference to such a function will work. You 
might also consider using SIP, it appears to me to be much more OO.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SocketServer and a Java applet listener

2005-08-27 Thread Steve Horsley
[EMAIL PROTECTED] wrote:
 Dear newsgroup,
 
 I give up, I must be overseeing something terribly trivial, but I can't
 get a simple (Java) applet to react to incoming (python) SocketServer
 messages.
 
 Without boring you with the details of my code (on request available,
 though), here is what I do :
 
 I have a TCPServer and BaseRequestHandler .
 Connecting via telnet : everything goes OK.
 
 Connecting from Applet :
 problem 1 (worked around it) : java has some 'propietary' UTF-8 format,
 python's unicode doesn't seem to handle it correctly and I have to
 strip the first two bytes/chars , then all goes OK .
 

Those 2 bytes are important! They are a string length indicator. 
Here are the docs that tell you that it puts a 2-byte length on 
the front:
http://java.sun.com/j2se/1.5.0/docs/api/java/io/DataOutputStream.html#writeUTF(java.lang.String)
If you are ignoring these bytes, then how can you be sure you 
have received the whole string? Please don't tell me you just 
hope that the whole string will always arrive in a single read() 
call. There is no guarantee of that. TCP does NOT have message 
boundaries, and TCP packets can be both fragmented and coalesced.
E.g. if you do:
 out.write('Steve was here)
 out.flush()
 out.write(Bilbo Baggins wasn't)
 out.flush()

it is entirely legal for two successive read() calls to retrieve 
steve was  and hereBilbo Baggins wasn't. Although in 
practice, fragmentation won't normally happen until strings reach 
  around 1500 bytes.

writeUTF tries to fix the problem by telling the receive how much 
string to expect.


 problem 2:
 I have tried IMHO everything.
 In the BaseRequestHandler.handle() method, I want to update a list of
 clients in the server, i.e.:
 
 self.server.players[username] = self
 
 self := instance of the BaseRequestHandler, I only do this after
 succesfull connect , i.e. first time socket. I assume (wrongfully?)
 that I can now use the self.request socket for future transmissions to
 the client.
 
 In the applet, I start a thread that listens to the socket by eternally
 looping over:
 String line = self.din.readUTF()
 if (line == null)
 break;
 handle(line);
 

Probably the same problem. If you didn't send a 2 byte length 
indicator first, then java's readUTF() will have tried to 
interpret the first 2 bytes that you did actually send as the 
string length, and may well simply be waiting patiently for the 
rest to arrive.

HTH
Steve
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing portable applications (Was: Jargons of Info Tech industry)

2005-08-27 Thread Mike Meyer
Ulrich Hobelmann [EMAIL PROTECTED] writes:
 Mike Meyer wrote:
 This can be designed much better by using iframes, maybe even Ajax.
 Definitely with Ajax. That's one of the things it does really well.
 But then you're probably limited to the big 4 of browsers: MSIE,
 Mozilla, KHTML/Safari, Opera.  Ok, that should cover most desktop
 users, but you might run into problems on embedded.

True - using Ajax definitely defeats what I consider to be the best
feature of the web.

 Why can't we use the Web for what it was meant for: viewing hypertext
 pages? Why must we turn it into a wrapper around every application
 imaginable?
 Because it works?
 Because you can - if you know how to use HTML properly - distribute
 your application to platforms you've never even heard of - like the
 Nokia Communicator.
 If the NC has software that can properly interpret all that HTML, CSS,
 JavaScript plus image formats, yes.  But who guarantees that?

You don't need that guarantee. All you need is a reasonable HTML
renderer. The folks at W3C are smart, and did a good job of designing
the technologies so they degrade gracefully. Anyone with any
competence can design web pages that will both take advantage of
advanced technologies if they are present and still work properly if
they aren't. Yeah, the low-end interface harks back to 3270s, but IBM
had a *great* deal of success with that technology.

 I'd rather develop a native client for the machine that people
 actually WANT to use, instead of forcing them to use that
 little-fiddly web browser on a teeny tiny display.

You missed the point: How are you going to provide native clients for
platforms you've never heard of?

 And again: connections might be slow, a compact protocol is better
 than loading the whole UI every time.  And while Ajax might work,
 despite the UI being maybe too big for the little browser window, and
 even if it works, it's still probably more work than a simple, native
 UI.  First of all it needs to load all the JS on first load, secondly
 sometimes for a flexible UI you'd have to replace huge parts of the
 page with something else.  Native UIs are more up to the task.

I'm not arguing that native UI's aren't better. I'm arguing that web
applications provide more portability - which is important for some
applications and some developers.

 I started writing web apps when I was doing internal tools development
 for a software development company that had 90+ different platform
 types installed inhouse. It was a *godsend*. By deploying one
 If that's 90+ GUI platforms, then I agree.

Why do you care if they are GUI or not? If you need to provide the
application for them, you need to provide the application for
them. Them not being GUI just means you can't try and use a standard
GUI library. It also means you have to know what you're doing when you
write HTML so that it works properly in a CLUI. But your native app
would have to have a CLUI anyway.

 I just wonder who wrote fully standards compliant web browsers for
 those 90 platforms.

Nobody. I doubt there's a fully standards compliant web browser
available for *any* platform, much less any non-trivial collection of
them. You write portable web applications to the standards, and design
them to degrade gracefully. Then you go back and work around any new
bugs you've uncovered in the most popular browsers - which
historically are among the *worst* at following standards.

 If you have one Windows GUI (maybe C#), one Mac GUI (Cocoa), one Gtk
 GUI for X, you're done.

You think you're done. A lot of developers think you can stop with the
first one or two. You're all right for some applications. For others,
you're not.  Personally, I like applications that run on all the
platforms I use - and your set doesn't cover all three of those
systems.

 well-written app, I could make everyone happy, without having to do
 versions for the Mac, Windows, DOS (this was a while ago), getting it
 to compile on umpteen different Unix version, as well as making it
 work on proprietary workstation OS's.
 Well, stick to POSIX and X APIs and your stuff should run fine on
 pretty much all Unices.

You know, the same kind of advice applies to writing portable web
apps. Except when you do it with HTML, portability means damn near
any programmable device with a network interface, not some relatively
small fraction of all deployed platforms.

 I never understood those people who write all kinds of weird ifdefs
 to on all Unices. Maybe that was before my time, during the
 Unix wars, before POSIX.

There were standards before POSIX. They didn't cover everything people
wanted to do, or didn't do them as fast as the OS vendor wanted. So
Unix vendors added their own proprietary extensions, which software
vendors had to use to get the best performance out of their
applications, which they had to do if they wanted people to buy/use
them.

That's still going on - people are adding new functionality that isn't
covered by POSIX to Unix systems 

Re: global interpreter lock

2005-08-27 Thread Piet van Oostrum
 Paul Rubin http://[EMAIL PROTECTED] (PR) wrote:

PR [EMAIL PROTECTED] (phil hunt) writes:
 Let's see. Reality is that writing correct programs is hard. Writing
 correct programs that use concurrency is even harder, because of the
 exponential explosion of the order that operations can happen
 in. Personally, I'm willing to use anything I can find that makes
 those tasks easier.
 
 Indeed so. Use threading (or whatever) when one has to, use an 
 asynchronous single-threaded process whenever you can.

PR This is silly.  You could say the exact same thing about if
PR statements.  The number of paths through the program is exponential in
PR the number of if statements executed.  So we better get rid of if
PR statements.

PR Really, the essence of programming is to find ways of organizing the
PR program to stay reliable and maintainable in the face of that
PR combinatorial explosion.  That means facing the problem and finding
PR solutions, not running away.  The principle is no different for
PR threads than it is for if statements.

The principle is (more or less) similar, but for parallel programs it is an
order of magnitude more complicated. Compare the correctness proofs of
parallel programs with those of sequential programs.
-- 
Piet van Oostrum [EMAIL PROTECTED]
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing portable applications (Was: Jargons of Info Tech industry)

2005-08-27 Thread Rich Teer
On Sat, 27 Aug 2005, Mike Meyer wrote:

 I think you're right - a web standard designed for writing real
 applications probably wouldn't start life as a markup for text. The
 only thing I can think of that even tries is Flash, but it's

What about Java?

-- 
Rich Teer, SCNA, SCSA, OpenSolaris CAB member

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-27 Thread Chris Head
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

John Bokma wrote:
 Chris Head [EMAIL PROTECTED] wrote:
 
 
John Bokma wrote:

Chris Head [EMAIL PROTECTED] wrote:
 
 
 [HTML]
 
 
It can be made much faster. There will always be a delay since
messages have to be downloaded, but with a fast connection and a good
design, the delay will be very very small and the advantages are big.

What advantages would those be (other than access from 'net cafes, but
see below)?
 
 
 And workplaces. Some people have more then one computer in the house. My 
 partner can check her email when I had her over the computer. When I 
 want to check my email when she is using it, I have to change the 
 session, fire up Thunderbird (which eats away 20M), and change the 
 session back.
 
 [ .. ]

Hmm. That would just be a matter of preference. Personally I moved my
Thunderbird profile into a shared directory and pointed everyone at it.
Now only one login session can run Thunderbird at a time, but any login
can see everyone's mailboxes.

 
 
Each has it's place. A bug in a thick client means each and everyone
has to be fixed. With a thin one, just one has to be fixed :-D. 

True. However, if people are annoyed by a Thunderbird bug, once it's
fixed, most people will probably go and download the fix (the
Thunderbird developers really only need to fix the bug once too).
 
 
 Most people who use Thunderbird, yes. Different with OE, I am sure. With 
 a thin client *everybody*.

True. As a programmer I don't usually think about the people who never
download updates. The way I look at it, if somebody doesn't have the
latest version, they shouldn't be complaining about a bug. I guess thin
clients could be taken to mean you have a very light-weight auto-update
system ;)

 
 
Depends on where your mailbox resides. Isn't there something called
MAPI? (I haven't used it myself, but I recall something like that). 

IMAP. It stores the messages on the server. Even so, it only has to
transfer the messages, not the bloated UI.
 
 
 But technically the UI (whether bloated or not) can be cached, and with 
 Ajax/Frames, etc. there is not really a need to refresh the entire page. 
 With smarter techniques (like automatically zipping pages), and 
 techniques like transmitting only deltas (Google experimented with this 
 some time ago) and better and faster rendering, the UI could be as fast 
 as a normal UI. 
 
 Isn't the UI in Thunderbird and Firefox created using JavaScript and 
 XML? Isn't how future UIs are going to be made?

I believe it is. I'm not sure if it's a good idea, but that's neither
here nor there.

 
 
I concede that Webmail
might be just as fast when using a perfectly-designed
Javascript/frames-driven interface. In the real world, Webmail isn't
(unfortunately) that perfect.
 
 
 Maybe because a lot of users aren't really heavy users. A nice example 
 (IMO) of a web client that works quite good: webmessenger ( 
 http://webmessenger.msn.com/ ). It has been some time since I used it 
 the last time, but if I recall correctly I hardly noticed that I was 
 chatting in a JavaScript pop up window.

Haven't ever needed to use that program.

 
 
As I said above regarding 'net cafes:

If the Internet cafe has an e-mail client installed on their
computers, you could use IMAP to access your messages. You'd have to
do a bit more configuration than for Webmail, so it depends on the
user I guess. Personally I doubt my ISP would like me saving a few
hundred megs of e-mail on their server, while Thunderbird is quite
happy to have 1504 messages in my Inbox on my local machine. If I had
to use an Internet cafe, I would rather use IMAP than Webmail.
 
 
 I rather have my email stored locally :-) But several webmail services 
 offer a form to download email.

I've not seen a service that allows that. Sounds nice.

 
 
Ergo,
Thunderbird is faster as soon as the Internet gets congested.

Ah, yeah, wasn't that predicted to happen in like 2001?

Wasn't what predicted to happen? Congestion? It happens even today
(maybe it's the Internet, maybe it's the server, whatever...). Hotmail
is often pretty slow.
 
 
 I read sometime ago that about 1/3 of traffic consists out of bittorrent 
 traffic... If the Internet gets congested, new techniques are needed, 
 like mod_gzip on every server, a way to transfer only deltas of webpages 
 if an update occured (like Google did some time ago). Better handling of 
 RSS (I have the impression that there is no page has not been 
 modified thing like with HTML, or at least I see quite some clients 
 fetch my feed every hour, again and again).
 

Eventually you reach the point where it's not bandwidth any more, it's
server load. All these things like mod_gzip, deltas, and so on add
server load.

As to the point about page not modified, it's not in the HTML spec,
it's in the HTTP spec. RFC2616 (HTTP1.1) defines an If-Modified-Since
header a client may send to the server indicating that it has a cached
copy of the page at that date. If 

Re: Jargons of Info Tech industry

2005-08-27 Thread Mike Meyer
Ulrich Hobelmann [EMAIL PROTECTED] writes:
 Mike Meyer wrote:
 Try turning off JavaScript (I assume you don't because you didn't
 complain about it). Most of the sites on the web that use it don't
 even use the NOSCRIPT tag to notify you that you have to turn the
 things on - much less use it to do something useful.
 I had JS off for a long time, but now so many websites expect it, and
 even make browsing more convenient, that I grudgingly accepted it. ;)

I've turned it on because I'm using an ISP that requires me to log in
via a javascript only web page. They have a link that claims to let
non-JS browsers log in, but it doesn't work. My primary browser
doesn't support JavaScript or CSS, and is configured with images
turned off, mostly because I want the web to be fast. What it does
have is the ability to launch one of three different external browsers
on either the current page or any link on the page, so those faciities
are a few keystrokes away. The default browser on my mac has all that
crap turned on, but I dont have anything I consider either import or
sensitive on it, and the only client who has data on it considers such
thinsg an acceptable risk.

 Sturgeon's law applies to web sites, just like it does to everything
 else.
 Yep.  Filtering is the future in the overloaded world.

And to the best of my knowledge, Google filters out content that my
primary desktop browser can't display.

 mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes:
 A corrected find() that returns None on failure is a five-liner.

If I wanted to write five lines instead of one everywhere in a Python
program, I'd use Java.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-27 Thread Mike Meyer
[EMAIL PROTECTED] writes:
 In comp.lang.perl.misc John Bokma [EMAIL PROTECTED] wrote:
 Chris Head [EMAIL PROTECTED] wrote:
 What advantages would those be (other than access from 'net cafes, but
 see below)?
 And workplaces. Some people have more then one computer in the house. My 
 partner can check her email when I had her over the computer. When I 
 want to check my email when she is using it, I have to change the 
 session, fire up Thunderbird (which eats away 20M), and change the 
 session back.
 Not a Windows solution, but I find the 'screen' utility invaluable as
 I can have my email, news, and an editor open in different screens
 and then when I need to move to a different machine, I can simply
 detach and reattach screen without disturbing anything that
 might be running.

For a more  portable solution, check out VNC.

mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


gdbm dying wierdly

2005-08-27 Thread Seth Nielson
Hi guys.

I'm using a python script as a redirector for Squid. My python script uses gdbm and exhibits some weird behavior.

1. If I run the script stand-alone, it loads the gdbm database file just fine.
2. If the script is launched from squid, when it tries to load the gdbm
database, it dies WITHOUT an exception! It just disappears! (signal
maybe?)

Please help! I'm up against the wall!

-- Seth N.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: pcapy - print the DATA field of a packet

2005-08-27 Thread billiejoex
I'm really sorry. I was talking about this source:
http://oss.coresecurity.com/impacket/sniff.py
...but nevermind. I discovered the get_data_as_string() function that 
resolved my problem


 Sorry, but *which* source are you talking about?  The link you provided 
 appears to be merely a page of Google search results.

 Was there a specific page in there which you meant to point us to instead?

 -Peter 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: gdbm dying wierdly

2005-08-27 Thread Seth Nielson
Nevermind. The problem wasn't in gdbm. I had exception in stead of Exception in the try-except statement.
-- SethNOn 8/27/05, Seth Nielson [EMAIL PROTECTED] wrote:
Hi guys.

I'm using a python script as a redirector for Squid. My python script uses gdbm and exhibits some weird behavior.

1. If I run the script stand-alone, it loads the gdbm database file just fine.
2. If the script is launched from squid, when it tries to load the gdbm
database, it dies WITHOUT an exception! It just disappears! (signal
maybe?)

Please help! I'm up against the wall!

-- Seth N.


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread skip

Paul Steve Holden [EMAIL PROTECTED] writes:
 A corrected find() that returns None on failure is a five-liner.

Paul If I wanted to write five lines instead of one everywhere in a
Paul Python program, I'd use Java.

+1 for QOTW.

Skip

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP: Object-oriented file module

2005-08-27 Thread Gerrit Holl
Kenneth McDonald wrote:
 Subject: pre-PEP: Object-oriented file module

Please have a look at
http://topjaklont.student.utwente.nl/creaties/path/pep-.html
if you haven't done so already.

Gerrit.

-- 
Temperature in Luleå, Norrbotten, Sweden:
| Current temperature   05-08-27 22:20:00   11.8 degrees Celsius ( 53.3F) |
-- 
In the councils of government, we must guard against the acquisition of
unwarranted influence, whether sought or unsought, by the
military-industrial complex. The potential for the disastrous rise of
misplaced power exists and will persist.
-Dwight David Eisenhower, January 17, 1961
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread Steve Holden
Paul Rubin wrote:
 Steve Holden [EMAIL PROTECTED] writes:
 
A corrected find() that returns None on failure is a five-liner.
 
 
 If I wanted to write five lines instead of one everywhere in a Python
 program, I'd use Java.

We are arguing about trivialities here. Let's stop before it gets 
interesting :-)

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: classes and list as parameter, whats wrong?

2005-08-27 Thread Dirk Zimmermann
Thanks to everyone! I think I understand the things behind this
behaviour, now.

And as the life goes: Today I found the description of my problem in
the Python Tutorial! I think I should read it more often, more
carefully:-)


Best,
Dirk

-- 
http://mail.python.org/mailman/listinfo/python-list


OpenSource documentation problems

2005-08-27 Thread Xah Lee
previously i've made serious criticisms on Python's documentations
problems.
(see http://xahlee.org/perl-python/re-write_notes.html )

I have indicated that a exemplary documentation is Wolfram Research
Incorporated's Mathematica language. (available online at
http://documents.wolfram.com/mathematica/ )

Since Mathematica is a proprietary language costing over a thousand
dollars and most people in the IT industry are not familiar with it, i
like to announce a new discovery:

this week i happened to read the documentation of Microsoft's
JavaScript. See
http://msdn.microsoft.com/library/en-us/script56/html/js56jsconjscriptfundamentals.asp

This entire documentary is a paragon of technical writing. It has
clarity, conciseness, and precision. It does not abuse jargons, it
doesn't ramble, it doesn't exhibit author masturbation, and it covers
its area extremely well and complete. The documentation set are very
well organized into 3 sections: Fundamentals, Advanced, Reference. The
tutorial section “fundamentals” is extremely simple and to the
point. The “advanced” section gives a very concise yet easy to read
on some fine details of the language. And its language reference
section is complete and exact.

I would like the IT industry programers and the OpenSource fuckheads to
take note of this documentation so that you can learn.

Also, this is not the only good documentation in the industry. As i
have indicated, Mathematica documentation is equally excellent. In
fact, the official Java documentation (so-called Java API by Sun
Microsystems) is also extremely well-written, even though that Java the
language is unnecessarily very complex and involves far more technical
concepts that necessitate use of proper jargons as can be seen in their
doc.

A additional note i like to tell the OpenSource coding morons in the
industry, is that in general the fundamental reason that Perl, Python,
Unix, Apache etc documentations are extremely bad in multiple aspects
is because of OpenSource fanaticism. The fanaticism has made it that
OpenSource people simply became UNABLE to discern quality. This
situation can be seen in the responses of criticisms of OpenSource
docs. What made the situation worse is the OpenSource's mantra of
“contribution” — holding hostile any negative criticism unless
the critic “contributed” without charge.

Another important point i should point out is that the OpenSource
morons tend to attribute “lack of resources” as a excuse for their
lack of quality. (when they are kicked hard to finally admit that they
do lack quality in the first place) No, it is not lack of resources
that made the OpenSource doc criminally incompetent. OpenSource has
created tools that take far more energy and time than writing manuals.
Lack of resource of course CAN be a contribution reason, along with
OpenSource coder's general lack of ability to write well, among other
reasons, but the main cause as i have stated above, is OpenSource
fanaticism. It is that which have made them blind.

PS just to note, that my use of OpenSource here do not include Free
Software Foundation's Gnu's Not Unix project. GNU project in general
has very excellent documentation. GNU docs are geeky in comparison to
the commercial entity's docs, but do not exhibit jargon abuse,
rambling, author masturbation, or hodgepodge as do the OpenSource ones
mentioned above.

 Xah
 [EMAIL PROTECTED]
∑ http://xahlee.org/

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Any projects to provide Javascript-style client-side browser access via Python?

2005-08-27 Thread Terry Hancock
On Friday 26 August 2005 02:29 pm, Kenneth McDonald wrote:
 I'm curious about this because, quite aside their function as web  
 browsers, it is now possible to build some very useable interfaces  
 using browsers with HTML, CSS, and JavaScript. (The biggest problem  
 is still the lack of a decent text widget.) However, JavaScript isn't  
 really a good language for building complex applications, and it  
 would be very cool if there were some way to use Python to replace  
 client-side JavaScript, in order to gain access the DOM.
 
 So anyone know if there are projects underway on this?

You can currently do this by requiring Java in the browser and
using Jython for scripting.  However, it's not terribly efficient (the
Jython interpreter has to be part of the download).

OTOH, it would be possible in principle to make that into a plugin
instead of just an applet, then you would have reduced the
repeated overhead.

There hasn't seemed to be much interest in doing this, though.

Another problem is that there is some dissatisfaction that there
is any way to provide an adequate secure sandbox for the
python applet to run in.  OTOH, if it were running in Jython
on a Java applet, it would be subject to the same sandboxing
that is provided for Java applets.

I don't know how to ensure the same limits from a Java plugin,
but I assume it's probably possible.

Cheers,
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OpenSource documentation problems

2005-08-27 Thread Rich Teer
On Sat, 27 Aug 2005, Xah Lee wrote:

His usual crap.

  ___
  /|  /|  |  |
  ||__||  |  Please do   |
 /   O O\__ NOT  |
/  \ feed the|
   /  \ \ trolls |
  /   _\ \ __|
 /|\\ \ ||
/ | | | |\/ ||
   /   \|_|_|/   \__||
  /  /  \|| ||
 /   |   | /||  --|
 |   |   |// |  --|
  * _|  |_|_|_|  | \-/
   *-- _--\ _ \ //   |
 /  _ \\ _ //   |/
   *  /   \_ /- | - |   |
 *  ___ c_c_c_C/ \C_c_c_c

-- 
Rich Teer, SCNA, SCSA, OpenSolaris CAB member

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Embedded python debug build crashing.

2005-08-27 Thread Adam Tomjack
I'm trying to embed Python 2.3.5 into a C++ application on Windows XP. 
When I build my app with debug symbols and link to a debug build of 
Python, then my program seems to crash most (but not all) of the time. 
Sometimes it crashes on startup, and sometimes at exit, sometimes not at 
all.  I haven't seen it crash with non-debug builds of my app and 
Python.  The release build runs my Python test code just fine.  When the 
debug build doesn't crash at startup, it gets through some, but not all 
of my test code.  It still crashes even if I only run Py_Intialize() and 
Py_Finalize().  My app is multithreaded, but Python only runs in the 
main thread.


I use Visual Studio .NET 2003 7.1.  If I understand things correctly, 
that means I need to recompile Python, since the prebuilt binaries are 
compiled with MSVC 6.  I've compiled both debug and non-debug versions 
of Python.  I'm sure that I'm linking my app to the correct build type. 
  I'm also pretty sure that I'm setting the PYTHONHOME environment 
variable correctly so that my app is trying to use the right Python 
runtime.  Windows has a trick where, if my app's executable is called 
app.exe, then the presence of a file called app.exe.local in the same 
directory will force my app to use local copies of DLLs first.  I've 
used that, so I'm pretty sure I'm not accidentally using the wrong DLLs 
at runtime.


I've googled and couldn't find any similar problems.  Is there something 
simple I'm forgetting to do?  I'm out of ideas.  Does anybody have any 
ideas about how to attack this problem?

Thanks,

Adam Tomjack
-- 
http://mail.python.org/mailman/listinfo/python-list


Windows/win32all, unicode and long filenames

2005-08-27 Thread Kevin Ollivier
Hi all,

On Windows, it's very common to have a string of long directories in the
pathname for files, like C:\Documents and Settings\My Long User Name\My
Documents\My Long Subdirectory Name\ For a wxPython application I'm
working on, this has actually caused me to run into what appears to be
Python's pathname length limit for opening files. (247 chars on Win) Yes,
I can hear people saying yipes! but this stuff does happen sometimes on
Windows. :-)

My first inclination was to use win32api.GetShortPathName(mypath), which
worked fine until I had an unicode pathname with non-ascii characters in
it. Those give me the 'oridnal not in
range' errors performing an ascii encode, meaning that GetShortPathName
doesn't handle unicode objects. The problem is that I'm working with
Unicode filenames that contain characters that are not only non-ascii
characters, but characters not in the current locale's character set as
well. So I can't just 'down convert' from a unicode object to a string
object in the current character set without corrupting the filename.
Looking at the pyWin32 sources, it does look like only the ASCII version
of this function exists, which suggests that for now this route is a
dead-end.

The only other solution I could think of is to call
os.chdir(long_pathname) and open the file using a filename relative to
long_pathname instead of an absolute path. But I was wondering if there
was another solution, preferably one that doesn't require me to muck with
the current directory, and I was also wondering if there was a simple way
to get one or both of the above limitations removed. :-)

Thanks in advance for any help,

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


network mapper Gui question

2005-08-27 Thread kyle.tk
I am trying to make a program much like cheops that will make a
graphical representation of my network. What would be the best language
to make the actuall interface in, Tkinter, wxPython, PyGtk? And in
those what module would work for something like this. It needs to be
able to redraw it self about every half minute or so without being to
heavy on the processor. Any ideas?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows/win32all, unicode and long filenames

2005-08-27 Thread Neil Hodgson
Kevin Ollivier:

 On Windows, it's very common to have a string of long directories in the
 pathname for files, like C:\Documents and Settings\My Long User Name\My
 Documents\My Long Subdirectory Name\ For a wxPython application I'm
 working on, this has actually caused me to run into what appears to be
 Python's pathname length limit for opening files. (247 chars on Win) Yes,
 I can hear people saying yipes! but this stuff does happen sometimes on
 Windows. :-)

 The Win32 API restricts path arguments to 260 characters. Longer 
paths can be passed to wide character functions by using a \\? prefix.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp
 This may work from Python although I haven't tested it.

 My first inclination was to use win32api.GetShortPathName(mypath),
 ...
 Looking at the pyWin32 sources, it does look like only the ASCII version
 of this function exists, which suggests that for now this route is a
 dead-end.

All APIs can be accessed through ctypes.

Neil
-- 
http://mail.python.org/mailman/listinfo/python-list


formal math ?

2005-08-27 Thread mehdi . rabah
Hi,

I have just discovered python and it seems so easy ans so powerful to
me that it remind me matlab or maple programming language (sorry free
software purists ears).

So I was wondering if there a sort of formal math library, that can do
a thing like:

lib.solve(x+1=0)
- x=-1

I have checked numarray and I think it can not do this.

Thanks in advance,

Mehdi

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question: Sub-interpreters for CAD program

2005-08-27 Thread sonicSpammersGoToHellSmooth
Cool, I went to the UofA for my MS in ECE, 2000.  I did my theses under
Chuck Higgins. --
http://neuromorph.ece.arizona.edu/pubs/ma_schwager_msthesis.pdf

The tools we had were constantly underwhelming me, so I've been
thinking for years that a properly designed new toolset for students
should be marketable, etc.  I'll take a look at your site (although I
think I may have come across it before.)

Michael :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows/win32all, unicode and long filenames

2005-08-27 Thread Kevin Ollivier
On Sat, 27 Aug 2005 23:30:46 +, Neil Hodgson wrote:

 Kevin Ollivier:
 
 On Windows, it's very common to have a string of long directories in the
 pathname for files, like C:\Documents and Settings\My Long User Name\My
 Documents\My Long Subdirectory Name\ For a wxPython application I'm
 working on, this has actually caused me to run into what appears to be
 Python's pathname length limit for opening files. (247 chars on Win) Yes,
 I can hear people saying yipes! but this stuff does happen sometimes on
 Windows. :-)
 
  The Win32 API restricts path arguments to 260 characters. Longer 
 paths can be passed to wide character functions by using a \\? prefix.
 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp
  This may work from Python although I haven't tested it.
 
 My first inclination was to use win32api.GetShortPathName(mypath),
 ...
 Looking at the pyWin32 sources, it does look like only the ASCII version
 of this function exists, which suggests that for now this route is a
 dead-end.
 
 All APIs can be accessed through ctypes.

Thanks for the tips! I had heard of ctypes but it never crossed my mind it
was for accessing functions from shared libraries. :-) I'll try both of
your tips out, and one of them should resolve the problem.

Kevin

 Neil

-- 
http://mail.python.org/mailman/listinfo/python-list


Automatic language translation

2005-08-27 Thread Jon
Does python have a module that will translate between different spoken
languages?  My python program displays all of its messages in English
currently and my boss wants it to default to Korean now.

Any ideas how to go about doing this?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automatic language translation

2005-08-27 Thread Mariano Draghi
Jon wrote:
 Does python have a module that will translate between different spoken
 languages?  My python program displays all of its messages in English
 currently and my boss wants it to default to Korean now.
 
 Any ideas how to go about doing this?
 

You need to use gettext.
Please, have a look at http://docs.python.org/lib/module-gettext.html

-- 
Mariano

-- 
http://mail.python.org/mailman/listinfo/python-list



Re: Writing portable applications (Was: Jargons of Info Tech industry)

2005-08-27 Thread Mike Meyer
Rich Teer [EMAIL PROTECTED] writes:
 On Sat, 27 Aug 2005, Mike Meyer wrote:
 I think you're right - a web standard designed for writing real
 applications probably wouldn't start life as a markup for text. The
 only thing I can think of that even tries is Flash, but it's
 What about Java?

Using HTML, I can build applications that work properly on anything
from monochrome terminals to the latest desktop box. Is there a
UI toolkit for Java that's that flexible?

   mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list insertion

2005-08-27 Thread Bengt Richter
On Tue, 23 Aug 2005 20:58:11 -0700, Randy Bush [EMAIL PROTECTED] wrote:

i am trying to insert into a singly linked list

hold = self.next
self.next = DaClass(value)
self.next.next = hold

but i suspect (from print statement insertions) that the result
is not as i expect.  as the concept and code should be very
common, as i am too old for pride, i thought i would ask.

I think you're fine. Here's some possible context for your code:

  class DaClass(object):
 ... def __init__(self, value):
 ... self.value = value
 ... self.next = None
 ... def values(self):
 ... while True:
 ... yield self.value
 ... if self.next is None: break
 ... self = self.next
 ... def insert(self, value):
 ... hold = self.next
 ... self.next = DaClass(value)
 ... self.next.next = hold
 ... return self
 ... def __repr__(self):
 ... return 'DaClass %s'%(' - '.join(map(repr, self.values(
 ...
 ...
  sll = DaClass(1)
  sll
 DaClass 1
  sll.insert(2)
 DaClass 1 - 2
  sll
 DaClass 1 - 2
  sll.insert('a')
 DaClass 1 - 'a' - 2
  sll.next
 DaClass 'a' - 2
  sll.next.insert('b')
 DaClass 'a' - 'b' - 2
  sll
 DaClass 1 - 'a' - 'b' - 2

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Experience regarding Python tutorials?

2005-08-27 Thread Joal Heagney
Steve wrote:
 Python is an excellent place to start.  Avoid Perl at all costs.
 
 There is a new beginners book on Python that looks interesting.  It is
 from WROX (the red cover folks) and called Beginning Python.
 
 http://www.amazon.com/exec/obidos/tg/detail/-/0764596543/qid=1125072498/sr=1-1/ref=sr_1_1/002-4477837-1552864?v=glances=books
 
There is also a python tutor newsgroup at gmane 
(gmane.comp.python.tutor). It's good to be able to learn with other 
beginner/semi-beginners because you can pick up a lot just by lurking on 
other people's questions.

Joal
-- 
http://mail.python.org/mailman/listinfo/python-list


python image thumbnail generator?

2005-08-27 Thread Chris Dewin
Hi. I run a website for my band, and the other guys want an image gallery.

I'm thinking it would be nice and easy, if we could just upload a jpg into
a dir called gallery/. When the client clicks the gallery link, a 
cgi script could search the gallery/ dir, and create thumbnails of any
jpeg images that don't already have a thumbnail associated with them. The
script could then generate a page of clickable thumbnails.

A few questions:

(1) Can this be done with python? If so, what module do I need to look up?

(2) If it can't be done with python, is there some small utility that will
do it for me? Something I could easily install locally in my own
public_html dir on my website?

(3) Is this the sort of thing which, if done regularly, would hog far far
too much of my webhosts system resources?

(4) Am I talking about re inventing the wheel?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python image thumbnail generator?

2005-08-27 Thread Paul Rubin
Chris Dewin [EMAIL PROTECTED] writes:
 (1) Can this be done with python? If so, what module do I need to look up?

You could do it with PIL, or run jpegtran in an external process. 
jpegtran may be easier.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python image thumbnail generator?

2005-08-27 Thread Mike C. Fletcher
Chris Dewin wrote:

Hi. I run a website for my band, and the other guys want an image gallery.

I'm thinking it would be nice and easy, if we could just upload a jpg into
a dir called gallery/. When the client clicks the gallery link, a 
cgi script could search the gallery/ dir, and create thumbnails of any
jpeg images that don't already have a thumbnail associated with them. The
script could then generate a page of clickable thumbnails.

A few questions:

(1) Can this be done with python? If so, what module do I need to look up?
  

PIL can certainly handle the functionality.

(2) If it can't be done with python, is there some small utility that will
do it for me? Something I could easily install locally in my own
public_html dir on my website?
  

The core function looks something like this:

import Image # this is PIL

def getThumbnail( filename, size = (32,32) ):
'''Get a thumbnail image of filename'''
image = Image.open(filename)
rx, ry = image.size[0]/float(size[0]), image.size[1]/float(size[1])
if rx  ry:
resize = int(size[0]), int(round(image.size[1]*(1.0/rx), 0))
else:
resize = int(round(image.size[0]*(1.0/ry), 0)), int(size[1])
image = image.resize( resize, Image.BILINEAR )
newimage = Image.new( 'RGB', size, )
x,y = image.size
newimage.paste(
image, ((size[0]-x)/2, (size[1]-y)/2),
)
return newimage

then you call newImage.save( filename, format ) to save the result.

(3) Is this the sort of thing which, if done regularly, would hog far far
too much of my webhosts system resources?
  

As long as you *only* generate images for sources that don't yet have 
(or are newer than) their thumbnail you should be fine.

(4) Am I talking about re inventing the wheel?
  

Probably.  ZPhotoSlides (a Zope product) provides thumnailing, 
slideshows and the like, probably closer to what you'd want for this 
kind of application.  You'll probably find other non-Zope versions as well.

Good luck,
Mike

-- 

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Experience regarding Python tutorials?

2005-08-27 Thread Randy Bush
 There is also a python tutor newsgroup at gmane
 (gmane.comp.python.tutor).

is there a mailing list to which it is gated?

randy

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Experience regarding Python tutorials?

2005-08-27 Thread Steve Holden
Randy Bush wrote:
There is also a python tutor newsgroup at gmane
(gmane.comp.python.tutor).
 
 
 is there a mailing list to which it is gated?
 
 randy
 
It's actually primarily a mailing list ([EMAIL PROTECTED], IIRC). 
See http://mail.python.org/mailman/listinfo/tutor

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Experience regarding Python tutorials?

2005-08-27 Thread Steve Holden
Sorry, that email address is [EMAIL PROTECTED]

Steve Holden wrote:
 Randy Bush wrote:
 
There is also a python tutor newsgroup at gmane
(gmane.comp.python.tutor).


is there a mailing list to which it is gated?

randy

 
 It's actually primarily a mailing list ([EMAIL PROTECTED], IIRC). 
 See http://mail.python.org/mailman/listinfo/tutor
 
 regards
   Steve


-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list insertion

2005-08-27 Thread Randy Bush
hold = self.next
self.next = DaClass(value)
self.next.next = hold

 but i suspect (from print statement insertions) that the result
 is not as i expect.  as the concept and code should be very
 common, as i am too old for pride, i thought i would ask.
 I think you're fine.

indeed.  the bug was elsewhere.  i got confused and tried to
look-ahead too far when i could have just recursed.  i threw
away the too-clever code and replaced it with one line.  i
love it when that happens.

randy

-- 
http://mail.python.org/mailman/listinfo/python-list


Cygwin font problems

2005-08-27 Thread Steve Holden
Is anyone aware of (a fix for) problems I'm having getting PIL 1.1.5 to 
create bitmaps using TrueType and openType fonts? When I create an image 
using the standard PIL fonts everything seems fine, but when I use 
ImageFont.truetype(font-file, size) no text is drawn.

setup.py reports from debug print statements that it's finding freetype21.

The same code using (Fredrik's pre-built binary) on Windows runs 
correctly and produces correct images.

Cygwin runs Python 2.4.1, Windows runs 2.4. Any light on this mystery 
gratefully received.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: overload builtin operator

2005-08-27 Thread Bengt Richter
On Thu, 25 Aug 2005 16:12:20 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] 
wrote:

Shaun wrote:
 Hi,
 
 I'm trying to overload the divide operator in python for basic arithmetic.
 eg. 10/2 ... no classes involved.
 
 I am attempting to redefine operator.__div__ as follows:
 
  # my divide function
  def safediv(a,b):
  return ...
 
  # reassign buildin __div__
  import operator
  operator.__div__ = safediv
 
 The operator.__dict__ seems to be updated OK but the '/' operator still  
 calls buildin __div__

It won't work that way. You cannot globally modify the behaviour of an 
operator,
but you can customize how an operator works for your type.

Consider:

class safeint(int):
def __div__(self, other):
return safediv(self, other)

safeint(10)/2

You are right that you cannot globally modify the behaviour of an operator in 
the
sense the OP seems to be envisioning, but with some trouble I think it would be 
possible
to interfere with the translation of 'numerator-term/denominator-term' to 
become
'safediv(numerator-term, denominator-term)' by transforming the AST during 
a custom
import process, such that wherever a Div node is found, a CallFunc node is 
substituted. E.g.,

for a node like

Div((Name('numerator'), Name('denominator')))

substitute another node like

CallFunc(Name('safediv'), [Name('numerator'), Name('denominator')], None, 
None)

where the Name('numerator') and Name('denominator') in the latter are actually
the Div node's .left and .right, so as to operate on the same args (which can
be abitrary expression-representing subtrees).

Of course, you probably also want to replace

AugAssign(Name('a'), '/=', Name('b'))

with

Assign([AssName('a', 'OP_ASSIGN')], CallFunc(Name('safediv'), [Name('a'), 
Name('b')], None, None))

Unfortunately, the AST tree does not seem to be designed to be edited easily wrt
_replacing_ nodes found by walking via flattened lists vs. just _using_ them in 
order.

I think I can create special walker that can do replacements of nodes found 
anywhere, and
calling node-type-specific or default supplied callbacks to supply replacements 
for original nodes
passed to them, but this will require a number of specialized visitor methods 
etc., so I will
have to get back to this later. But at least the OP and you nudged me into 
thinking about
AST rewriting again ;-) (also affects my @@sourcedeco ideas ;-)

... this didn't go out due to news server problem, so I'll add some clips from 
what I did re ast editing:

 testdiv.py 
-
def test():
print 1.0/2.0
print 12/3
a=12; b=3
print a/b
print 2**a/(b+1)
try:
print 'print 1/0 ='
print 1/0
except Exception, e: print '%s: %s' %(e.__class__.__name__, e)
try:
print 'print a/(b*(a-12)) ='
print a/(b*(a-12))
except Exception, e: print '%s: %s' %(e.__class__.__name__, e)
try:
print 'def foo(x=1/(b-3)): return x ='
def foo(x=1/(b-3)): return x
print 'print foo() ='
print foo()
except Exception, e: print '%s: %s' %(e.__class__.__name__, e)
try:
print 'b /= (a-12) ='
b /= (a-12)
print 'b after b/=(a-12):', b
except Exception, e: print '%s: %s' %(e.__class__.__name__, e)

if __name__ == '__main__': test()
---
Outputfrom run without conversion of / :

0.5
4
4
1024
print 1/0 =
ZeroDivisionError: integer division or modulo by zero
print a/(b*(a-12)) =
ZeroDivisionError: integer division or modulo by zero
def foo(x=1/(b-3)): return x =
ZeroDivisionError: integer division or modulo by zero
b /= (a-12) =
ZeroDivisionError: integer division or modulo by zero


 import_safediv.py 
--
# import_safediv.py
from importast import importast
from compiler.ast import Div, CallFunc, Name
from compiler.ast import AugAssign, Assign, AssName

def safediv(num, den):
if den==0: result = 0*num
else: result = num/den
print 'safediv(%r, %r) = %r'%(num, den, result)
return result

def div2safediv(divnode):
replace Div nodes with CallFunc nodes calling safediv with same args
return  CallFunc(Name('safediv'),[divnode.left, divnode.right], None, None, 
divnode.lineno)

def divaugass2safediv(auganode):
if auganode.op != '/=': return auganode
assname =auganode.node.name
return Assign([AssName(assname, 'OP_ASSIGN')],
CallFunc(Name('safediv'),[Name(assname), auganode.expr], None, None, 
auganode.lineno))

callbacks = {Div:div2safediv, AugAssign:divaugass2safediv}
def import_safediv(modname, verbose=False):
return importast(modname, callbacks, verbose)

if __name__ == '__main__':
import sys
modname, args = sys.argv[1], sys.argv[2:]
verbose = (args[0:] and args[0]=='-verbose') or False

Re: formal math ?

2005-08-27 Thread Robert Kern
[EMAIL PROTECTED] wrote:
 Hi,
 
 I have just discovered python and it seems so easy ans so powerful to
 me that it remind me matlab or maple programming language (sorry free
 software purists ears).
 
 So I was wondering if there a sort of formal math library, that can do
 a thing like:
 
 lib.solve(x+1=0)
 - x=-1

There are some old ones laying about in various states of usefulness.
Nothing really full-featured, though.

http://www.tildesoft.com/Pythonica.html
http://cens.ioc.ee/cgi-bin/viewcvs.cgi/python/ginac/

It's easier to integrate with a full-featured CAS than it is to write
one yourself.

http://home.arcor.de/mulk/projects/mascyma/index.xhtml.en
http://library.wolfram.com/infocenter/MathSource/585/

 I have checked numarray and I think it can not do this.

No, it cannot.

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die.
  -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Advanced concurrancy

2005-08-27 Thread travlr
Hi, I've been on the research pursuit regarding these subjects and I
wonder why Erlang doesn't fit well into this category of concurrency.

Also, from what I have seen, there hasn't been a recent interest in an
updated interface. Maybe I'm mistaken and Erlang's features don't apply
well. Thanks for your comments. 

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 16:25
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Nobody/Anonymous (nobody)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 12:30

Message:
Logged In: YES 
user_id=21627

Clearly, the difference is bound by buffersize (since, if it
is larger, readsize is set to buffersize). buffersize is
initialized to SMALLCHUNK, which is 8192, and never changed,
so yes, the difference fits to an int an all supported
platforms.

OTOH, the condition of the if statement is bogus:

if ((size_t)offset-bytesread  buffersize)

offset is of type Py_off_t, which is a 64-bit type on most
platforms. Casting it to size_t causes truncation on 32-bit
platforms.

Furthermore, I think self-pos should be of type Py_off_t,
as it will wrap around for files larger 2GB on 32-bit
platforms; the same for self-size.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-26 17:05

Message:
Logged In: YES 
user_id=1188172

I think declaring readsize as size_t should fix the problem.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 16:25
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Nobody/Anonymous (nobody)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 14:55

Message:
Logged In: YES 
user_id=21627

As Tim says: the cast deserves a comment, explaining why it
cannot overflow. Even when readsize is size_t, it might
still overflow, since Py_off_t might be wider than size_t.

Apart from that, the patch looks good - but I can't check
whether it silences the warning on Windows.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 14:27

Message:
Logged In: YES 
user_id=1188172

Attaching patch for f-pos and f-size as Py_off_t.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 12:30

Message:
Logged In: YES 
user_id=21627

Clearly, the difference is bound by buffersize (since, if it
is larger, readsize is set to buffersize). buffersize is
initialized to SMALLCHUNK, which is 8192, and never changed,
so yes, the difference fits to an int an all supported
platforms.

OTOH, the condition of the if statement is bogus:

if ((size_t)offset-bytesread  buffersize)

offset is of type Py_off_t, which is a 64-bit type on most
platforms. Casting it to size_t causes truncation on 32-bit
platforms.

Furthermore, I think self-pos should be of type Py_off_t,
as it will wrap around for files larger 2GB on 32-bit
platforms; the same for self-size.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-26 17:05

Message:
Logged In: YES 
user_id=1188172

I think declaring readsize as size_t should fix the problem.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 16:25
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Nobody/Anonymous (nobody)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 16:36

Message:
Logged In: YES 
user_id=1188172

Okay, next try. Someone with Windows should check this
before I check in.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 14:55

Message:
Logged In: YES 
user_id=21627

As Tim says: the cast deserves a comment, explaining why it
cannot overflow. Even when readsize is size_t, it might
still overflow, since Py_off_t might be wider than size_t.

Apart from that, the patch looks good - but I can't check
whether it silences the warning on Windows.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 14:27

Message:
Logged In: YES 
user_id=1188172

Attaching patch for f-pos and f-size as Py_off_t.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 12:30

Message:
Logged In: YES 
user_id=21627

Clearly, the difference is bound by buffersize (since, if it
is larger, readsize is set to buffersize). buffersize is
initialized to SMALLCHUNK, which is 8192, and never changed,
so yes, the difference fits to an int an all supported
platforms.

OTOH, the condition of the if statement is bogus:

if ((size_t)offset-bytesread  buffersize)

offset is of type Py_off_t, which is a 64-bit type on most
platforms. Casting it to size_t causes truncation on 32-bit
platforms.

Furthermore, I think self-pos should be of type Py_off_t,
as it will wrap around for files larger 2GB on 32-bit
platforms; the same for self-size.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-26 17:05

Message:
Logged In: YES 
user_id=1188172

I think declaring readsize as size_t should fix the problem.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 09:25
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Reinhold Birkenfeld (birkenfeld)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-08-27 11:31

Message:
Logged In: YES 
user_id=80475

The latest patch gives me the following:

Configuration: bz2 - Win32
Debug
Compiling...
bz2module.c
C:\py25\Modules\bz2module.c(1143) : warning C4244:
'function' : conversion from '__int64 ' to 'long ', possible
loss of data
C:\py25\Modules\bz2module.c(1143) : warning C4761: integral
size mismatch in argument; conversion supplied
 lib /out:libbz2.lib blocksort.obj   huffman.obj
crctable.objrandtable.obj   compress.obj   
decompress.obj  bzlib.obj
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o bzip2
bzip2.c libbz2.lib setargv.obj
bzip2.c
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o
bzip2recover bzip2recover.c
bzip2recover.c
 type words1
Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.
 
 .\bzip2 -1   sample1.ref  sample1.rb2
 .\bzip2 -2   sample2.ref  sample2.rb2
 .\bzip2 -3   sample3.ref  sample3.rb2
 .\bzip2 -d   sample1.bz2  sample1.tst
 .\bzip2 -d   sample2.bz2  sample2.tst
 .\bzip2 -ds  sample3.bz2  sample3.tst
All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.
 fc sample1.bz2 sample1.rb2
Comparing files sample1.bz2 and sample1.rb2
FC: no differences encountered
 fc sample2.bz2 sample2.rb2
Comparing files sample2.bz2 and sample2.rb2
FC: no differences encountered
 fc sample3.bz2 sample3.rb2
Comparing files sample3.bz2 and sample3.rb2
** sample3.bz2
BZh31AYSYºÍ3É
·ïuU‰©´`†Û2 [EMAIL PROTECTED]
‹¾Œàý£^‘1 ˯ðú£¦Ç“º™€•)„ëô·alèDh3H¯‘Ú\mIL´hiiȕB°Ró
** sample3.rb2
BZh31AYSY›îÜ
ò#óAŠJ3ù²ªÔ©zÉêè7UÎ{ýÍC2 
‹l
}ۇ**
 fc sample1.tst sample1.ref
Comparing files sample1.tst and sample1.ref
FC: no differences encountered
 fc sample2.tst sample2.ref
Comparing files sample2.tst and sample2.ref
FC: no differences encountered
 fc sample3.tst sample3.ref
Comparing files sample3.tst and sample3.ref
FC: no differences encountered
Linking...

bz2_d.pyd - 1 error(s), 2 warning(s)


--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 09:36

Message:
Logged In: YES 
user_id=1188172

Okay, next try. Someone with Windows should check this
before I check in.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 07:55

Message:
Logged In: YES 
user_id=21627

As Tim says: the cast deserves a comment, explaining why it
cannot overflow. Even when readsize is size_t, it might
still overflow, since Py_off_t might be wider than size_t.

Apart from that, the patch looks good - but I can't check
whether it silences the warning on Windows.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 07:27

Message:
Logged In: YES 
user_id=1188172

Attaching patch for f-pos and f-size as Py_off_t.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 05:30

Message:
Logged In: YES 
user_id=21627

Clearly, the difference is bound by buffersize (since, if it
is larger, readsize is set to buffersize). buffersize is
initialized to SMALLCHUNK, which is 8192, and never changed,
so yes, the difference fits 

[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 16:25
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Reinhold Birkenfeld (birkenfeld)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 19:02

Message:
Logged In: YES 
user_id=1188172

Tackled the two warnings (tell() should return a long int if
64 bits) with new patch.

I can't see the error in your output.

--

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-08-27 18:31

Message:
Logged In: YES 
user_id=80475

The latest patch gives me the following:

Configuration: bz2 - Win32
Debug
Compiling...
bz2module.c
C:\py25\Modules\bz2module.c(1143) : warning C4244:
'function' : conversion from '__int64 ' to 'long ', possible
loss of data
C:\py25\Modules\bz2module.c(1143) : warning C4761: integral
size mismatch in argument; conversion supplied
 lib /out:libbz2.lib blocksort.obj   huffman.obj
crctable.objrandtable.obj   compress.obj   
decompress.obj  bzlib.obj
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o bzip2
bzip2.c libbz2.lib setargv.obj
bzip2.c
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o
bzip2recover bzip2recover.c
bzip2recover.c
 type words1
Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.
 
 .\bzip2 -1   sample1.ref  sample1.rb2
 .\bzip2 -2   sample2.ref  sample2.rb2
 .\bzip2 -3   sample3.ref  sample3.rb2
 .\bzip2 -d   sample1.bz2  sample1.tst
 .\bzip2 -d   sample2.bz2  sample2.tst
 .\bzip2 -ds  sample3.bz2  sample3.tst
All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.
 fc sample1.bz2 sample1.rb2
Comparing files sample1.bz2 and sample1.rb2
FC: no differences encountered
 fc sample2.bz2 sample2.rb2
Comparing files sample2.bz2 and sample2.rb2
FC: no differences encountered
 fc sample3.bz2 sample3.rb2
Comparing files sample3.bz2 and sample3.rb2
** sample3.bz2
BZh31AYSYºÍ3É
·ïuU‰©´`†Û2 [EMAIL PROTECTED]
‹¾Œàý£^‘1 ˯ðú£¦Ç“º™€•)„ëô·alèDh3H¯‘Ú\mIL´hiiȕB°Ró
** sample3.rb2
BZh31AYSY›îÜ
ò#óAŠJ3ù²ªÔ©zÉêè7UÎ{ýÍC2 
‹l
}ۇ**
 fc sample1.tst sample1.ref
Comparing files sample1.tst and sample1.ref
FC: no differences encountered
 fc sample2.tst sample2.ref
Comparing files sample2.tst and sample2.ref
FC: no differences encountered
 fc sample3.tst sample3.ref
Comparing files sample3.tst and sample3.ref
FC: no differences encountered
Linking...

bz2_d.pyd - 1 error(s), 2 warning(s)


--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 16:36

Message:
Logged In: YES 
user_id=1188172

Okay, next try. Someone with Windows should check this
before I check in.

--

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 14:55

Message:
Logged In: YES 
user_id=21627

As Tim says: the cast deserves a comment, explaining why it
cannot overflow. Even when readsize is size_t, it might
still overflow, since Py_off_t might be wider than size_t.

Apart from that, the patch looks good - but I can't check
whether it silences the warning on Windows.

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 14:27

Message:
Logged In: YES 
user_id=1188172

Attaching patch for f-pos and f-size as Py_off_t.

--


[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 10:25
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Reinhold Birkenfeld (birkenfeld)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Tim Peters (tim_one)
Date: 2005-08-27 13:13

Message:
Logged In: YES 
user_id=31435

Raymond, did you read the error output and verify that you're 
not suffering from the sample3.bz2 problem it explains?


All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.


Since the error you saw did come from sample3.bz2, that 
would be a good thing to check ;-)

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 13:02

Message:
Logged In: YES 
user_id=1188172

Tackled the two warnings (tell() should return a long int if
64 bits) with new patch.

I can't see the error in your output.

--

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-08-27 12:31

Message:
Logged In: YES 
user_id=80475

The latest patch gives me the following:

Configuration: bz2 - Win32
Debug
Compiling...
bz2module.c
C:\py25\Modules\bz2module.c(1143) : warning C4244:
'function' : conversion from '__int64 ' to 'long ', possible
loss of data
C:\py25\Modules\bz2module.c(1143) : warning C4761: integral
size mismatch in argument; conversion supplied
 lib /out:libbz2.lib blocksort.obj   huffman.obj
crctable.objrandtable.obj   compress.obj   
decompress.obj  bzlib.obj
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o bzip2
bzip2.c libbz2.lib setargv.obj
bzip2.c
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o
bzip2recover bzip2recover.c
bzip2recover.c
 type words1
Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.
 
 .\bzip2 -1   sample1.ref  sample1.rb2
 .\bzip2 -2   sample2.ref  sample2.rb2
 .\bzip2 -3   sample3.ref  sample3.rb2
 .\bzip2 -d   sample1.bz2  sample1.tst
 .\bzip2 -d   sample2.bz2  sample2.tst
 .\bzip2 -ds  sample3.bz2  sample3.tst
All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.
 fc sample1.bz2 sample1.rb2
Comparing files sample1.bz2 and sample1.rb2
FC: no differences encountered
 fc sample2.bz2 sample2.rb2
Comparing files sample2.bz2 and sample2.rb2
FC: no differences encountered
 fc sample3.bz2 sample3.rb2
Comparing files sample3.bz2 and sample3.rb2
** sample3.bz2
BZh31AYSYºÍ3É
·ïuU‰©´`†Û2 [EMAIL PROTECTED]
‹¾Œàý£^‘1 ˯ðú£¦Ç“º™€•)„ëô·alèDh3H¯‘Ú\mIL´hiiȕB°Ró
** sample3.rb2
BZh31AYSY›îÜ
ò#óAŠJ3ù²ªÔ©zÉêè7UÎ{ýÍC2 
‹l
}ۇ**
 fc sample1.tst sample1.ref
Comparing files sample1.tst and sample1.ref
FC: no differences encountered
 fc sample2.tst sample2.ref
Comparing files sample2.tst and sample2.ref
FC: no differences encountered
 fc sample3.tst sample3.ref
Comparing files sample3.tst and sample3.ref
FC: no differences encountered
Linking...

bz2_d.pyd - 1 error(s), 2 warning(s)


--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 10:36

Message:
Logged In: YES 
user_id=1188172

Okay, next try. Someone with Windows should check this
before I check in.

--

Comment By: 

[ python-Bugs-1274069 ] bz2module.c compiler warning

2005-08-27 Thread SourceForge.net
Bugs item #1274069, was opened at 2005-08-26 09:25
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274069group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Reinhold Birkenfeld (birkenfeld)
Summary: bz2module.c compiler warning

Initial Comment:
On Python HEAD, there's a new warning while 
compiling bz2module.c (MSVC 7.1):

python\Modules\bz2module.c(1095) : warning 
C4244: '=' :
   conversion from 'Py_off_t' to 'int', possible loss of data

Looks like a legitimate complaint to me.  The line in 
question:

readsize = offset-bytesread;

Those have types int, Py_off_t, and int respectively.  Is 
it true that offset-bytesread _necessarily_ fits in an int?  
If so, a comment should explain why, and a cast should 
be added to squash the warning.  Or If the difference 
doesn't necessarily fit in an int, the code is wrong.

--

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-08-27 12:52

Message:
Logged In: YES 
user_id=80475

The new patch works fine on this end.

--

Comment By: Tim Peters (tim_one)
Date: 2005-08-27 12:13

Message:
Logged In: YES 
user_id=31435

Raymond, did you read the error output and verify that you're 
not suffering from the sample3.bz2 problem it explains?


All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.


Since the error you saw did come from sample3.bz2, that 
would be a good thing to check ;-)

--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-27 12:02

Message:
Logged In: YES 
user_id=1188172

Tackled the two warnings (tell() should return a long int if
64 bits) with new patch.

I can't see the error in your output.

--

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-08-27 11:31

Message:
Logged In: YES 
user_id=80475

The latest patch gives me the following:

Configuration: bz2 - Win32
Debug
Compiling...
bz2module.c
C:\py25\Modules\bz2module.c(1143) : warning C4244:
'function' : conversion from '__int64 ' to 'long ', possible
loss of data
C:\py25\Modules\bz2module.c(1143) : warning C4761: integral
size mismatch in argument; conversion supplied
 lib /out:libbz2.lib blocksort.obj   huffman.obj
crctable.objrandtable.obj   compress.obj   
decompress.obj  bzlib.obj
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o bzip2
bzip2.c libbz2.lib setargv.obj
bzip2.c
 cl -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo -o
bzip2recover bzip2recover.c
bzip2recover.c
 type words1
Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.
 
 .\bzip2 -1   sample1.ref  sample1.rb2
 .\bzip2 -2   sample2.ref  sample2.rb2
 .\bzip2 -3   sample3.ref  sample3.rb2
 .\bzip2 -d   sample1.bz2  sample1.tst
 .\bzip2 -d   sample2.bz2  sample2.tst
 .\bzip2 -ds  sample3.bz2  sample3.tst
All six of the fc's should find no differences.
If fc finds an error on sample3.bz2, this could be
because WinZip's 'TAR file smart CR/LF conversion'
is too clever for its own good. Disable this option.
The correct size for sample3.ref is 120,244. If it
is 150,251, WinZip has messed it up.
 fc sample1.bz2 sample1.rb2
Comparing files sample1.bz2 and sample1.rb2
FC: no differences encountered
 fc sample2.bz2 sample2.rb2
Comparing files sample2.bz2 and sample2.rb2
FC: no differences encountered
 fc sample3.bz2 sample3.rb2
Comparing files sample3.bz2 and sample3.rb2
** sample3.bz2
BZh31AYSYºÍ3É
·ïuU‰©´`†Û2 [EMAIL PROTECTED]
‹¾Œàý£^‘1 ˯ðú£¦Ç“º™€•)„ëô·alèDh3H¯‘Ú\mIL´hiiȕB°Ró
** sample3.rb2
BZh31AYSY›îÜ
ò#óAŠJ3ù²ªÔ©zÉêè7UÎ{ýÍC2 
‹l
}ۇ**
 fc sample1.tst sample1.ref
Comparing files sample1.tst and sample1.ref
FC: no differences encountered
 fc sample2.tst sample2.ref
Comparing files sample2.tst and sample2.ref
FC: no differences encountered
 fc sample3.tst sample3.ref
Comparing files sample3.tst and sample3.ref
FC: no differences encountered
Linking...

bz2_d.pyd - 1 error(s), 2 warning(s)


--

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 

[ python-Bugs-1274828 ] splitunc not documented

2005-08-27 Thread SourceForge.net
Bugs item #1274828, was opened at 2005-08-27 15:40
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274828group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Poor Yorick (pooryorick)
Assigned to: Nobody/Anonymous (nobody)
Summary: splitunc not documented

Initial Comment:
a description of splitunc is missing from

http://docs.python.org/lib/module-os.path.html

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1274828group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com