Re: explicit self revisited

2006-11-11 Thread Doug

Fredrik Lundh wrote:
> Fredrik Lundh wrote:
> > cannot all you clueless trolls who cannot think of a single useful thing
> > to contribute to Python start your own newsgroup?
>
> and before anyone complains; please note that they're working through
>
>  http://www.effbot.org/pyfaq/design-index.htm

That site is a bunch of FUD -
The explicit self is there simply because OOP was tacked onto python as
an afterthought.
Why not just be honest about it.  It's too late to change Python's
syntax.  It just means a little extra typing.  If it really bothers
someone, use "s" instead of "self" or else use Ruby.

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


Fredrik Lundh [was "Re: explicit self revisited"]

2006-11-12 Thread Doug

Fredrik Lundh wrote:
> Doug wrote:
>>
>> Fredrik Lundh wrote:
>>> Fredrik Lundh wrote:
>>> > cannot all you clueless trolls who cannot think of a single useful thing
>>> > to contribute to Python start your own newsgroup?
>>
>>> and before anyone complains; please note that they're working through
>>
>>>  http://www.effbot.org/pyfaq/design-index.htm
>>
>> That site is a bunch of FUD -
>> The explicit self is there simply because OOP was tacked onto python as
>> an afterthought.
>> Why not just be honest about it.  It's too late to change Python's
>> syntax.  It just means a little extra typing.  If it really bothers
>> someone, use "s" instead of "self" or else use Ruby.
>
> the official FAQ is a bunch of FUD?  are you sure you know what FUD means?
>
> 

You idiot.  Putting the word "official" in front of something doesn't
mean it can't be FUD.  Especially when it is written by people such as
yourself.  Have you not paid attention to anything happening in
politics around the world during your lifetime?
And yes, actually, the dash after FUD was where I was going to link to
a definition of FUD to show I really meant to use that term.  It
doesn't appear that you believe anything that isn't on your own effbot
site, however.

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


Re: Py3K idea: why not drop the colon?

2006-11-12 Thread Doug

Michael Hobbs wrote:
> Can anyone find a flaw with this change in syntax?
>
> Instead of dividing a compound statement with a colon, why not divide it
> on a newline? For example, the colon could be dropped from this statement:
> if self.hungry:
> self.eat()
> to
> if self.hungry
> self.eat()
>
> Python is already sensitive to whitespace and the newline anyway, so why
> not put it to good use? For example, Python rejects this statement
> because of the newline present:
> if self.hungry or
>   self.depressed:
> self.eat()
> You need to use the backslash to continue the expression on the next line:
> if self.hungry or \
>   self.depressed:
> self.eat()
> The colon that divides the statement therefore seems redundant. The
> colon could continue to be used for single-line statements:
> if self.hungry: self.eat()
>
> I think the colon could be omitted from every type of compound
> statement: 'if', 'for', 'def', 'class', whatever. Am I missing anything?
>
> Thanks,
> - Mike

It is a very good idea as the colon is technically redundant (not
necessary for parsing, aside from one liners) and actually hurts
readability (and writeability).  The "evidence" people cite for the
advantage of using a colon is research done by users of the ABC
language, python's predecessor.  They forget that A) that was like 20
years ago, B) the language was designed for children, and C) the
keywords in ABC are IN ALL CAPS LIKE THIS (hurting readability and
writeability) and thus adding a colon obviously helps restore some
readability for users in that case but not in python's.

However, python is far too old to accept any fundamental changes to
syntax at this point.

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


Re: Molten Metal Pools in WTC after weeks, only micronuke could have produced so much heat

2006-12-01 Thread Doug

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> W88 warhead design
>
> http://www.thepriceofliberty.org/06/09/25/wardpics-5.htm
>
> http://www.thepriceofliberty.org/06/09/25/wardpics-4.htm


the diagrams are all wrong, they are fiction.




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


Re: Soap Client

2009-01-16 Thread Doug

I believe that I have answered my own question.  If anyone else is
interested in what I did ... using iPython's code completion (. then
hit tab tab) I noticed that msg had a _request attribute.  I set that
attribute to "1" and that
sent the message that I needed!

Hope everyone has a great day!

Doug

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


libglade for python-2

2006-03-15 Thread Doug
I am having some fun running a program called pygps.  This uses libglade
and runs fine on my very old Redhat 7.?  system running Python 1.5.2.  I
have not needed to make any changes to the import files (see below). The
program uses a glade generated pygps.glade xml file for the gui.  I like
the way this works and the ability to edit the xml(?) with glade.

Now on my Fedora system which has version 2 of just about everything it
will not run and I cannot figure how to get the code to work.  The
site packages include a glade.so file but there is no libglade.

Googling I have not found specifc support for libglade in anything other
than ada and c, nothing for python 2.0.

Is there a mechanism to invoke libglade operation (ie a separate xml
file generated by glade-2 like I have with the old python 1 system?

Note that I have discovered the older glade files are not compatible with
glade-2.

Is libglade dead now for python-2 or am I missing something?

See:
http://pygps.org/

Imports from pygps:

import GDK
from gtk import *
import math
import socket, string
import libglade
import GdkImlib
import os
from LatLongUTMconversion import LLtoUTM
import NMEA

(Ignore the last two, they are local but I have
included them for completeness)

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


Python / glade fundamentals

2006-03-16 Thread Doug
Hi all,
Can someone tell me why I do not get a connection between the events and
the functions in the sample below.  GUI window appears OK, just no
connections seem to be made.
I am new to this so may be missing something fundamental. 
Thanks, 
Doug



file pgtest.glade
=

 
http://glade.gnome.org/glade-2.0.dtd";>




  True
  GDK_KEY_PRESS_MASK
  PGtestWindow
  GTK_WINDOW_TOPLEVEL
  GTK_WIN_POS_NONE
  False
  640
  480
  True
  True
  True
  False
  False
  GDK_WINDOW_TYPE_HINT_NORMAL
  GDK_GRAVITY_NORTH_WEST
  

  

  True
  GDK_KEY_PRESS_MASK
  GDK_EXTENSION_EVENTS_ALL
  
  

  




file pgtest.py
==
import gtk
import gtk.glade

def on_drawingarea1_key_press(widget):
   print "keypress"   

xml = gtk.glade.XML('pgtest.glade')
widget = xml.get_widget('drawingarea1')
#print type(xml)

xml.signal_autoconnect({
  "on_drawingarea1_key_press_event": on_drawingarea1_key_press,
  "on_page_destroy_event":gtk.mainquit
})

gtk.main()


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


Re: Python / glade fundamentals

2006-03-17 Thread Doug
OK, I have solved the problem.  The reference was a help. The clue is that
the events may not get passed through the parent. For reference here is
the code that worked.
It's good to finally get the basics working.
Doug

import gtk
import gtk.glade

def key_press(widget,event):
   print "keypress"   

xml = gtk.glade.XML('pgtest.glade')
widget = xml.get_widget('drawingarea1')

xml.signal_autoconnect({
  "on_page_key_press_event": key_press,
  "on_page_destroy_event": gtk.main_quit
})

gtk.main()


===file: pgtest.glade===

 
http://glade.gnome.org/glade-2.0.dtd";>




  True
  PGtestWindow
  GTK_WINDOW_TOPLEVEL
  GTK_WIN_POS_NONE
  False
  640
  480
  True
  True
  True
  False
  False
  GDK_WINDOW_TYPE_HINT_NORMAL
  GDK_GRAVITY_NORTH_WEST
  
  

  

  True
  
  

  





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


Writing a Carriage Return in Unicode

2009-11-18 Thread Doug

Hi!

I am trying to write a UTF-8 file of UNICODE strings with a carriage
return at the end of each line (code below).

filOpen = codecs.open("c:\\temp\\unicode.txt",'w','utf-8')

str1 = u'This is a test.'
str2 = u'This is the second line.'
str3 = u'This is the third line.'

strCR = u"\u240D"

filOpen.write(str1 + strCR)
filOpen.write(str2 + strCR)
filOpen.write(str3 + strCR)

filOpen.close()

The output looks like
This is a test.␍This is the second line.␍This is the third
line.␍ when opened in Wordpad as a UNICODE file.

Thanks for your help!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Carriage Return in Unicode

2009-11-19 Thread Doug

Hi! Thanks for clearing this up!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to run python script in emacs

2009-11-25 Thread doug

When I type C-c C-c my emacs window just hangs.  If I use Task Manager
to kill cmdproxy I can get emacs back but of course interactivity with
Python is not accomplished.  By the way, if I do C-c ! then I get a
functional python shell.  Does anybody know a solution to this?

On Oct 13, 7:12 am, rustom  wrote:
> On Sep 26, 8:54 pm, devilkin  wrote:
>
> > I'm just starting learning python, and coding in emacs. I usually
> > split emacs window into two, coding in one, and run script in the
> > other, which is not very convenient. anyone can help me with it? is
> > there any tricks like emacs short cut?
>
> > also please recommand some emacs plug-ins for python programming, i'm
> > also beginner in emacs.currently i'm only using python.el.
>
> python.el comes with emacs
> python-mode.el comes from python  https://launchpad.net/python-mode/
> Because of some emacs politics the first ships with emacs although
> most uses prefer the second.
> Note 1. The key bindings are different
> Note 2. Does not work with python3. See my 
> posthttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> > Are any plugins supply code folding and autocomplete?
>
> See ropehttp://rope.sourceforge.net/ropemacs.htmlif you want
> but its an installation headache (requires pymacs bleeding edge
> version etc)
> I suggest you just get used to python-mode first (C-c ! and C-c C-c)
> and then explore these questions a bit later.
>
>
>
> > BTW, I'm not a english native speaker, any grammer mistakes, please
> > correct them. :)
>
> grammer is spelt grammar :-)

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


Using elementtree to Create HTML Form / Set "selected"

2010-08-12 Thread Doug
I'm using elementtree to create a form.

I would like to set the "selected" attribute.

Setting using the usual
 option.set( "selected" = "" )
gives me
  Operations
how does one make
  Operations
which is what I need.

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


Re: Using elementtree to Create HTML Form / Set "selected"

2010-08-12 Thread Doug
On Aug 12, 10:47 am, Peter Otten <__pete...@web.de> wrote:
> Doug wrote:
> > I'm using elementtree to create a form.
>
> > I would like to set the "selected" attribute.
>
> > Setting using the usual
> >  option.set( "selected" = "" )
>
> Maybe that should be option.set(selected="selected"). I think
>
> 
>
> and
>
> 
>
> are equivalent.
>
> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4.2
>
>
>
> > gives me
> >   Operations
> > how does one make
> >   Operations
> > which is what I need.

Makes sense to me. Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Ctypes, pthreads and pthread_mutex_t

2009-06-29 Thread Doug
Has any converted the structure  pthread_mutex_t   to
a ctypes structure class ?
I looking at some C code that is using pthreads and need to translate
pthreads_mutex_t structure into python (via ctypes)

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


print syntax

2009-09-03 Thread doug
I am new to python, working by way through 'Core Python Programming'. I can find 
no description of using print with the built-in type for formatting. I think I 
have got some [most?] of it from Chun, google, and python.org. My comment is - 
it should not be that hard to find. I would suggest a link from the print syntax 
section.


What is seems to be is:

  print "format-spec" % (variable-list)

I assume the '%' is required token.



_
Douglas Denault
http://www.safeport.com
d...@safeport.com
Voice: 301-217-9220
  Fax: 301-217-9277
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python enabled gdb on Windows and relocation

2011-05-13 Thread Doug Evans
On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem
 wrote:
> (now in plain-text as required by gdb mailing list)
>
> Hi,
>
> I am currently trying to integrate Python support into my toolchain
> build (including GDB of course). It is a sysrooted
> binutils+GCC+GDB+mingw-w64 toolchain.
>
> I currently have the basic setup working: I can link gdb with my
> manually generated import lib to the python dll from the official
> Windows install. If there is anything I am missing or a very easy
> solution to the problems decsribed below, please just say so. I am
> only suggesting what I would like to happen.
>
> Now on to the problems I'd like to discuss:
>
> 1. gdb.exe won't start without me having set PYTHONPATH manually.

In a properly configured/built gdb on linux this isn't necessary, even
if python is installed in some random place.
I'm not sure about windows though.
Did you specify --with-python when you configured gdb, and if so did
you specify a value?
e.g., --with-python=SOME_VALUE

> I understand the need for this, but as gdb requires Python 2, and users
> of my toolchain may have installed Python 3 or a 32-bit version python
> they want to use from the same environment (without changing their own
> PYTHONPATH), there is no way to run python-enabled gdb.
> [...]

Yeah.
There is a proposal to add GDB_PYTHONPATH (or some such IIRC) and have
gdb use that instead of PYTHONPATH if it exists, but there's been
resistance to it.
I think(!) what would happen is that gdb would set $PYTHONPATH to the
value of $GDB_PYTHONPATH.
[Inferiors started by gdb should still get the original value of
PYTHONPATH though.]

> 2. With PYTHONPATH set as a temporary workaround, gdb starts, but
> spits out a traceback:
> Traceback (most recent call last):
>   File "", line 35, in 
>   File "m:\development\mingw64\share\gdb/python/gdb/__init__.py", line
> 18, in 
>     gdb.command.pretty_printers.register_pretty_printer_commands()
>   File 
> "m:\development\mingw64\share\gdb/python/gdb\command\pretty_printers.py",
> line 368, in register_pretty_printer_commands
>     InfoPrettyPrinter()
>   File 
> "m:\development\mingw64\share\gdb/python/gdb\command\pretty_printers.py",
> line 100, in __init__
>     gdb.COMMAND_DATA)
> RuntimeError: Could not find command prefix info.
>
> This is a minor problem I think, as "python import time" "python print
> time.clock()" works as expected. What is wrong?

I'm not sure.
The error message is complaining that the "info" command prefix doesn't exist.
I don't see how that can happen as python is initialized long after
the info command is created.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem
 wrote:
> 2011/5/14 Doug Evans :
>> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem
>>  wrote:
>>> (now in plain-text as required by gdb mailing list)
>>>
>>> Hi,
>>>
>>> I am currently trying to integrate Python support into my toolchain
>>> build (including GDB of course). It is a sysrooted
>>> binutils+GCC+GDB+mingw-w64 toolchain.
>>>
>>> I currently have the basic setup working: I can link gdb with my
>>> manually generated import lib to the python dll from the official
>>> Windows install. If there is anything I am missing or a very easy
>>> solution to the problems decsribed below, please just say so. I am
>>> only suggesting what I would like to happen.
>>>
>>> Now on to the problems I'd like to discuss:
>>>
>>> 1. gdb.exe won't start without me having set PYTHONPATH manually.
>>
>> In a properly configured/built gdb on linux this isn't necessary, even
>> if python is installed in some random place.
>> I'm not sure about windows though.
>> Did you specify --with-python when you configured gdb, and if so did
>> you specify a value?
>> e.g., --with-python=SOME_VALUE
>
> I was cross-compiling a mingw toolchain+gdb from Linux, so I used
> --with-python without a value (because gdb configure tries to find the
> Python executabe), and I added -I"/path/to/python/includes" to CFLAGS
> and -L"/path/to/pythondll/importlib" to LDFLAGS, which built as it
> should. This is hacky though, and gdb configure should provide
> --with-python-libs and --with-python-include to make it more
> streamlined with any other build prerequisite (like
> gmp/mpfr/mpc/cloog/ppl in GCC for example).

Ah.
Cross-compiling gdb with python is in need of improvement.
Alas python hasn't been designed with cross-compilation in mind (e.g.
build on linux, run on windows).
AIUI, the way to get the parameters required for compiling with
libpython is to get them from python's "distutils": kinda hard to do
in a cross-compile.  Done correctly there's no need to run python.

I haven't done anything more to support python in gdb's configure.ac
because it's not clear to me what the right thing to do is: distutils
provides more than just --libs and --includes (btw, we don't use
--libs though, we use --ldflags which includes all of: the directory
in which to find libpython, the -l for libpython, and the -l's for all
the other libraries python needs). [Which isn't to say that someone
else isn't free to tackle this.]

In the meantime, what I've been doing is a hack: write a script that
responds to:
--includes
--ldflags
--exec-prefix
and pass that as --with-python.

E.g.
bash$ cat $HOME/my-python-for-config
#! /bin/sh

if [ $# -ne 2 ]
then
echo "Bad # args.  Blech!" >&2
exit 1
fi

# The first argument is the path to python-config.py, ignore it.

case "$2" in
--includes) echo "-I/usr/include/python2.6 -I/usr/include/python2.6" ;;
--ldflags) echo "-L/usr/lib/python2.6/config -lpthread -ldl -lutil -lm
-lpython2.6" ;;
--exec-prefix) echo "/usr" ;;
*) echo "Bad arg $2.  Blech!" >&2 ; exit 1 ;;
esac

exit 0
bash$ ./configure --with-python=$HOME/my-python-for-config [...]
[...]


Note that --exec-prefix is the runtime location of python.
GCC uses this to tell libpython where to find its support files.
[grep for Py_SetProgramName in gdb/python/python.c]

>>> I understand the need for this, but as gdb requires Python 2, and users
>>> of my toolchain may have installed Python 3 or a 32-bit version python
>>> they want to use from the same environment (without changing their own
>>> PYTHONPATH), there is no way to run python-enabled gdb.
>>> [...]
>>
>> Yeah.
>> There is a proposal to add GDB_PYTHONPATH (or some such IIRC) and have
>> gdb use that instead of PYTHONPATH if it exists, but there's been
>> resistance to it.
>> I think(!) what would happen is that gdb would set $PYTHONPATH to the
>> value of $GDB_PYTHONPATH.
>> [Inferiors started by gdb should still get the original value of
>> PYTHONPATH though.]
>
> That way would be almost ideal, but a hardcoded *relative* path to the
> python scripts (that is standardized within gdb) wouldn't hurt.

See above re: --exec-prefix.

> An
> extra environment variable would require a lot of explaining for
> Windows, and is not "plug-and-play", like the rest of a sysrooted
> toolchain is supposed to be like. I think this should work on all
> setups:
>
> 1. Check hardcoded path; my suggestion would 

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 2:29 AM, Eli Zaretskii  wrote:
>> Date: Sat, 14 May 2011 11:09:13 +0200
>> From: Ruben Van Boxem 
>> Cc: g...@sourceware.org, python-list@python.org
>>
>> 1. Check hardcoded path; my suggestion would be "> executable>/../lib/python27"
>> 2. If this fails to find the necessary files/scripts, find it like you
>> described above in Linux, without PYTHONPATH set.
>> 3. Check PYTHONPATH.
>>
>> I would think only number one would change, and perhaps be only
>> enabled with a special configure option. Nothing else would have to
>> change, and Windows users would rejoice :)
>
> The problem, I think, is that it's not so easy on Unix to get the
> place where the GDB executable leaves.  There isn't a system call to
> do that (similar to what Windows gives you).
>
> So I think on Posix platforms, number 2 would be used most of the
> time.

For reference sake, gdb is "relocatable".
[meaning, if you take a gdb installation and move it, it should
continue to work fine]
And if gdb's python lives inside the gdb tree, that too should
continue to work fine if moved with gdb (the value to pass to
Py_SetProgramName is appropriately (re-)computed when gdb is run).
[For completeness sake, IIRC the calculation of a path being
"relocatable" isn't bulletproof, but it works in practice.]

It's not impossible for gdb to find where it lives, but you're right
it can be moderately difficult (basically, if argv[0] isn't an
absolute path then scan $PATH for it).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 11:30 AM, Doug Evans  wrote:
> Note that --exec-prefix is the runtime location of python.
> GCC uses this to tell libpython where to find its support files.
> [grep for Py_SetProgramName in gdb/python/python.c]

Oops.  s/GCC/GDB/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python enabled gdb on Windows and relocation

2011-05-17 Thread Doug Evans
On Sun, May 15, 2011 at 6:26 AM, Ruben Van Boxem
 wrote:
> Wow, I think I have a partial solution. Delving into the Python docs,
> for example here:
> http://docs.python.org/using/windows.html#finding-modules, you can see
> that PYTHONPATH is used first, then the Windows registry, then
> PYTHONHOME, then some default relative paths. I placed the python
> scripts all in the directory structure like so:
>
> /bin/gdb
> /bin/Lib/
> /bin/python27.dll
>
> This works, even without any manual PYTHONPATH intervention. Problem
> is though, that as soon as someone has a PYTHONPATH environment
> variable from a (incompatible) Python installation (think different
> bitness or version 3.x instead of 2.7.1), I cannot predict what will
> go wrong. This problem originates in Python's way of filling in the
> search path (sys.path). A true solution in the GDB case to prevent
> this collision of an incompatible PYTHONPATH would be that GDB sets an
> internal PYTHONPATH as directed by configure, uses that to load its
> Python internals, and allows the GDB child processes (apps being
> debugged) to use the environment PYTHONPATH. For now, I have a
> functional installation, but it will break as soon as someone installs
> Python on their system.

What if the user *wants* gdb's python to use $PYTHONPATH from his/her
environment?
To handle *this* case, *and* the case of an incompatible python
installation using $PYTHONPATH, there is the $GDB_PYTHONPATH proposal
(see earlier email for details).  It feels problematic to decide at
configure time whether there will or will not be an incompatible
python at runtime.

[I realize you have subsequent messages.
Just replying in sequence.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python enabled gdb on Windows and relocation

2011-05-17 Thread Doug Evans
On Sun, May 15, 2011 at 9:11 AM, Ruben Van Boxem
 wrote:
> I am sorry for the repeated messages that no one cares about, but I
> may have discovered GDB in its current form already allows what I
> want: I tried to figure out what exact paths the snake in gdb was
> using to search for its modules, and came up with this:
> (gdb) python import sys
> (gdb) python print sys.path
> ['m:\\development\\mingw64\\share\\gdb/python',
> 'M:\\Development\\mingw64\\bin\\python27.zip',
> 'M:\\Development\\mingw64\\bin\\DLLs',
> 'M:\\Development\\mingw64\\bin\\lib',
> 'M:\\Development\\mingw64\\bin\\lib\\plat-win',
> 'M:\\Development\\mingw64\\bin\\lib\\lib-tk',
> 'M:\\Development\\mingw64\\bin',
> 'M:\\Development\\mingw64\\bin\\lib\\site-packages']
>
> This means that every python command within gdb searches
> /share/gdb/python FIRST (even before an environment's
> PYTHONPATH), alleviating any concerns or problems I or anyone would
> have with another python installation, as this apparently built-in
> path comes up first. All I, or anyone interested in doing this kind of
> thing, have to do is copy all the python scripts from the Windows
> installation's Lib directory to the /share/gdb/python
> directory.
>
> I don't know where this path comes from, but it is quite handy, and
> makes this whole discussion  moot for Python people. Only "issue" that
> I'll have to work around is the --with-python-includes and
> --with-python-libs that are missing, using either manual
> CFLAGS/LDFLAGS or a variant of your script.

IMO *if* gdb wanted to support people adding files to *its*
/share/gdb directory, more thought is needed - e.g. maybe
document a "site" directory for such files.  Dunno.  IMO we certainly
don't want to formally allow folks to willy-nilly put anything there -
no guarantees a future release might add something that collides with
something the user put there.
If and until then, you're probably pretty safe if you put everything
in a subdirectory with a unique enough name, if you really wanted to
go this route.

Btw, there is the system.gdbinit file which sites *are* free to customize.

E.g., configure --with-system-gdbinit=/share/gdb/system.gdbinit.

You can put whatever you want in that file.
E.g., you could add a directory to python's sys.path.

[Technically speaking, the path /share/gdb/system.gdbinit
goes against what I just said, but IMO this name is safe.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python3 regex?

2016-09-10 Thread Doug OLeary
Hey, all;

thanks for the replies - reading data in one slurp vs line by line was the 
issue.  In my perl programs, when reading files, I generally do it all in one 
swell foop and will probably end up doing so again in this case due to the 
layout of the text; but, that's my issue.

Thanks again.  I appreciate the tip.

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


iterating over multi-line string

2016-09-11 Thread Doug OLeary
Hey;

I have a multi-line string that's the result of reading a file filled with 
'dirty' text.  I read the file in one swoop to make data cleanup a bit easier - 
getting rid of extraneous tabs, spaces, newlines, etc.  That part's done.

Now, I want to collect data in each section of the data.  Sections are started 
with a specific header and end when the next header is found.

^1\. Upgrade to the latest version of Apache HTTPD
^2\. Disable insecure TLS/SSL protocol support
^3\. Disable SSLv2, SSLv3, and TLS 1.0. The best solution is to only have TLS 
1.2 enabled
^4\. Disable HTTP TRACE Method for Apache
[[snip]]

There's something like 60 lines of worthless text before that first header line 
so I thought I'd skip through them with:

x=0  # Current index
hx=1 # human readable index
rgs = '^' + str(hx) + r'\. ' + monster['vulns'][x]
hdr = re.compile(rgs)
for l in data.splitlines():
  while not hdr.match(l):
next(l)
  print(l)

which resulted in a typeerror stating that str is not an iterator.  More 
googling resulted in:

iterobj = iter(data.splitlines())

for l in iterobj:
  while not hdr.match(l):
next(iterobj)
  print(l)

I'm hoping to see that first header; however, I'm getting another error:

Traceback (most recent call last):
  File "./testies.py", line 30, in 
next(iterobj)
StopIteration

I'm not quite sure what that means... Does that mean I got to the end of data 
w/o finding my header?

Thanks for any hints/tips/suggestions.

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: iterating over multi-line string

2016-09-11 Thread Doug OLeary
Hey;

Never mind; I finally found the meaning of stopiteration.  I guess my 
google-foo is a bit weak this morning.

Thanks

Doug
-- 
https://mail.python.org/mailman/listinfo/python-list


more python3 regex?

2016-09-11 Thread Doug OLeary
Hey

This one seems like it should be easy but I'm not getting the expected results.

I have a chunk of data over which I can iterate line by line and print out the 
expected results:

  for l in q.findall(data):
#   if re.match(r'(Name|")', l):
# continue
print(l)

$ ./testies.py | wc -l
197

I would like to skip any line that starts with 'Name' or a double quote:

$ ./testies.py | perl -ne 'print if (m{^Name} || m{^"})'
  
Name IP Address,Site,
"",,7 of 64
Name,IP Address,Site,
"",,,8 of 64
Name,IP Address,Site,
"",,,9 of 64
Name,IP Address,Site,
"",,,10 of 64
Name,IP Address,Site,
"",,,11 of 64
Name IP Address,Site,

$ ./testies.py | perl -ne 'print unless (m{^Name} || m{^"})' | wc -l
186


When I run with the two lines uncommented, *everything* gets skipped:

$ ./testies.py  
$

Same thing when I use a pre-defined pattern object:

skippers = re.compile(r'Name|"')
  for l in q.findall(data):
if skippers.match(l):
  continue
print(l)

Like I said, this seems like it should be pretty straight forward so I'm 
obviously missing something basic.  

Any hints/tips/suggestions gratefully accepted.

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: more python3 regex?

2016-09-11 Thread Doug OLeary
Hey, all;

The print suggestion was the key clue.  Turned out my loop was slurping the 
whole of data in one big line.  Searching for a line that begins with Name when 
it's in the middle of the string is... obviously not going to work so well.

Took me a bit to get that working and, once I did, I realized I was on the 
wrong track altogether.  In perl, if possible, I will read a file entirely as 
manipulation of one large data structure is easier in some ways.  

Even with perl, though, that approach is the wrong one for this data.  While I 
learned lots, the key lesson is forcing data to match an algorithm works as 
well in python as it does in perl.  Go figure.

My 200+ script that didn't work so well is now 63 lines, including comments... 
and works perfectly.  

Outstanding!  Thanks for putting up with noob questions

Doug
-- 
https://mail.python.org/mailman/listinfo/python-list


xml parsing with lxml

2016-10-07 Thread Doug OLeary
Hey;

I'm trying to gather information from a number of weblogic configuration xml 
files using lxml.  I've found any number of tutorials on the web but they all 
seem to assume a knowledge that I apparently don't have... that, or I'm just 
being rock stupid today - that's distinct possibility too.

The xml looks like:



  Domain1
  10.3.5.0
  
[[snipp]]

[[realm children snipped]

myrealm
  
  [[snip]]

[[snip]]

   [[snip]]


  [[snip]]
   [[snip]]
  byTime
  14
  02:00
  Info

[[snip]]
40024
true
snip]]

  [[children snipped]]

${hostname}
${hostname}
40022
javac

   [[children snipped]

   [[rest snipped]
  


The tutorials all start out well enough with:

$ python 
Python 3.5.2 (default, Aug 22 2016, 09:04:07) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> doc = etree.parse('config.xml')

Now what?  For instance, how do I list the top level children of 
.*??  In that partial list, it'd be name, domain-version, 
security-configuration, log, and server.  

For some reason, I'm not able to make the conceptual leap to get to the first 
step of those tutorials.

The end goal of this exercise is to programatically identify weblogic clusters 
and their hosts.  

thanks

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: xml parsing with lxml

2016-10-07 Thread Doug OLeary
On Friday, October 7, 2016 at 3:21:43 PM UTC-5, John Gordon wrote:
> root = doc.getroot()
> for child in root:
> print(child.tag)
> 

Excellent!  thank, you sir!  that'll get me started.  

Appreciate the reply.

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


lxml and xpath(?)

2016-10-24 Thread Doug OLeary
Hey;

Reasonably new to python and incredibly new to xml much less trying to parse 
it. I need to identify cluster nodes from a series of weblogic xml 
configuration files. I've figured out how to get 75% of them; now, I'm going 
after the edge case and I'm unsure how to proceed.

Weblogic xml config files start with namespace definitions then a number of 
child elements some of which have children of their own.

The element that I'm interested in is  which will usually have a 
subelement called  containing the hostname that I'm looking for.

Following the paradigm of "we love standards, we got lots of them", this model 
doesn't work everywhere. Where it doesn't work, I need to look for a subelement 
of  called . That element contains an alias which is expanded 
in a different root child, at the same level as .

So, picture worth a 1000 words:


< [[ heinous namespace xml snipped ]] >
   [[text]]
   ...
   
  EDIServices_MS1
  ...
  EDIServices_MC1
  ...
   
   
  EDIServices_MS2
  ...
  EDIServices_MC2
  ...
   
   
 EDIServices_MC1
 
   EDIServices_MC1
   SSL
   host001
   7001
 
   
   
 EDIServices_MC2
 
   EDIServices_MC2
   host002
   7001
 
   


So, running it on 'normal' config, I get:

$ ./lxml configs/EntsvcSoa_Domain_config.xml  
EntsvcSoa_CS=> host003.myco.com
EntsvcSoa_CS   => host004.myco.com

Running it against the abi-normal config, I'm currently getting:

$ ./lxml configs/EDIServices_Domain_config.xml
EDIServices_CS => EDIServices_MC1
EDIServices_CS => EDIServices_MC2

Using the examples above, I would like to translate EDIServices_MC1 and 
EDIServices_MC2 to host001 and host002 respectively.

The primary loop is:

for server in root.findall('ns:server', namespaces):
  cs = server.find('ns:cluster', namespaces)
  if cs is None:
continue
  # cluster_name = server.find('ns:cluster', namespaces).text
  cluster_name = cs.text
  listen_address = server.find('ns:listen-address', namespaces)
  server_name = listen_address.text
  if server_name is None:
machine = server.find('ns:machine', namespaces)
if machine is None:
  continue
else:
  server_name = machine.text

  print("%-15s => %s" % (cluster_name, server_name))

(it's taken me days to write 12 lines of code... good thing I don't do this for 
a living :) )

Rephrased, I need to find the  under the  child who's 
name matches the name under the corresponding  child. From some of the 
examples on the web, I believe xpath might help but I've not been able to get 
even the simple examples working. Go figure, I just figured out what a 
namespace is...

Any hints/tips/suggestions greatly appreciated especially with complete noob 
tutorials for xpath.

Thanks for your time.

Doug O'Leary
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Some more odd behaviour from the Regexp library

2005-10-19 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>,
 "David Veerasingam" <[EMAIL PROTECTED]> wrote:

> Can anyone explain why it won't give me my captured group?
> 
> In [1]: a = 'exit: gkdfjgfjdfsgdjglkghdfgkd'
> In [2]: import re
> In [3]: b = re.search(r'exit: (.*?)', a)
> In [4]: b.group(0)
> Out[4]: 'exit: '
> 
> In [5]: b.group(1)
> Out[5]: ''
> 
> In [6]: b.group(2)
> IndexError: no such group

The ? tells (.*?) to match as little as possible and that is nothing.  
If you change it to (.*) it should do what you want.

-- 
Doug Schwarz
dmschwarz&urgrad,rochester,edu
Make obvious changes to get real email address.
-- 
http://mail.python.org/mailman/listinfo/python-list


ElementTree - Why not part of the core?

2005-12-07 Thread doug . bromley
Why is the ElementTree API not a part of the Python core?
I've recently been developing a script for accessing the Miva API only
to find all the core API's provided by Python for parsing XML is messy
and complicated.  Many of the examples I see for parsing the data using
these API's uses a similar additional Class for collapsing the XML data
into a more manageable format.
This is clearly not following the Python-way of clean, simple code and
easy development.

ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way.  Why has the API not been
included in the Python core?

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


Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Doug Holton
Steven Bethard wrote:
Simo Melenius wrote:
map (def x:
 if foo (x):
 return baz_1 (x)
 elif bar (x):
 return baz_2 (x)
 else:
 global hab
 hab.append (x)
 return baz_3 (hab),
 [1,2,3,4,5,6])

I think this would probably have to be written as:
Right the comma plus other things make this difficult for a parser to 
handle correctly.  Other people have already come up with working solutions.

We have a special way to pass a multiline closure as a parameter to a 
function.  Put it outside the parameter list.

First, the single-line way using curly braces:
newlist = map({x as int | return x*x*x}, [1,2,3,4,5,6])
Then the multi-line way.  I had to add an overload of map to support 
reversing the order of parameters (list first, then the closure):

newlist = map([1,2,3,4,5,6]) def (x as int):
 return x*x*x
for item in newlist:
 print item
--
http://mail.python.org/mailman/listinfo/python-list


Re: What can I do with Python ??

2005-01-01 Thread Doug Holton
BOOGIEMAN wrote:
Thanks everybody, I downloaded latest windows version and
Python-Docs-2.4 archive. Is that enough for absolute beginner.
Is there any e-book, step by step guide ... etc for download,
or anything else important what I have to know before I start
learning Python ?
The main thing I would do is subscribe to the python-tutor list.  It is 
the best place by far to ask any questions when you are learning to use 
python: http://mail.python.org/mailman/listinfo/tutor

Second, here are some of the best tutorials specifically designed for 
people with little or no previous programming experience:
http://www.honors.montana.edu/~jjc/easytut/easytut/
http://www.freenetpages.co.uk/hp/alan.gauld/
http://www.dickbaldwin.com/tocpyth.htm
http://www.ibiblio.org/obp/pyBiblio/

And lastly, really a great way to learn is to look at what's already out 
there in python.  Try out some of the many 3rd party libraries and 
programs for python:
For games: http://pygame.org/
For GUI applications: http://www.wxpython.org/
and others: http://www.python.org/pypi
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-04 Thread Doug Holton
Istvan Albert wrote:
But if python
were to become overly complicated I'll find something else.
Three years ago I have not not used python at all, now I'm
using it for everything.
You're in luck, python 2.4 won't be significantly changing anytime soon.
PS. why can't decorators solve this optional type checking
problem? I clearly remember this as being one of the
selling points for having decorators in the first place...
Because they are quite obviously an ugly and overly complicated 
solution.  Even Guido understood this:
http://mail.python.org/pipermail/python-dev/2004-September/048518.html

"A warning: some people have shown examples of extreme uses of
decorators. I've seen decorators proposed for argument and return type
annotations, and even one that used a decorator to create an object
that did a regular expression substitution. Those uses are cute, but I
recommend being conservative when deciding between using a decorator
or some other approach, especially in code that will see a large
audience (like 3rd party library packages). Using decorators for type
annotations in particular looks tedious, and this particular
application is so important that I expect Python 3000 will have
optional type declarations integrated into the argument list."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-04 Thread Doug Holton
Istvan Albert wrote:
Doug Holton wrote:
application is so important that I expect Python 3000 will have
optional type declarations integrated into the argument list."

I think that *optional* part of the "optional type declaration"
is a myth.
It may be optional in the sense that the language will
accept missing declarations but as soon as the feature
is available it will become "mandatory" to use it
(peer pressure, workplace practices).
I didn't write that, Guido did.  I agree with you, and others who have 
made the same point you made.  I would have to think Guido is already 
aware of this issue (keep python simple).  I'm not sure what his 
motivations are for wanting to add static typing to python, not that I'm 
against it.

It doesn't matter a whole lot either way since Python 3000 is still 
years away and you can already do static typing now with Pyrex or boo, 
as well as many other things that people have requested for python from 
little things like ++i to bigger features like multi-line anonymous 
methods/closures.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I make Windows Application with Python ?

2005-01-05 Thread Doug Holton
BOOGIEMAN wrote:
Thanks all for very detailed answers. BTW I tried this one but it seems
that it doesn't use VS'es visual designer. Also it doesn't have "build"
option so it is basicly only usefull to higlight Python syntax.
Active Sate Komodo looks like much better choice
I don't know of any python IDE with a visual designer and a build to exe 
option.

But since you are familiar with Visual Studio and you are developing on 
Windows, you might check out the free SharpDevelop IDE: 
http://www.icsharpcode.net/OpenSource/SD/

Then unzip this boo add-in into the SharpDevelop folder under Program 
Files: http://coedit.net/boo/BooBinding.zip

Then you can start up SharpDevelop, create a new boo project, press the 
green play button, and your exe will be built and executed (the one 
below is only 4kb in size).  We are working on adding support for 
SharpDevelop's visual form designer soon.

To show a Windows message box instead of printing to the console like 
you were asking earlier, you can use code like this:

import System.Windows.Forms
MessageBox.Show("your message")
Or for a more complete windows app:
import System.Drawing
import System.Windows.Forms
class MainForm(Form):
def constructor():
self.Text = "My Window"

b = Button(Text: "Click Me")
b.Location = Point(100,75)
b.Click += def():
MessageBox.Show("Button clicked")
#or:
#b.Click += OnButtonClick
self.Controls.Add(b)
def OnButtonClick():
MessageBox.Show("Button clicked")
f = MainForm()
Application.Run(f)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a restricted python interpreter

2005-01-06 Thread Doug Holton
Rolf Magnus wrote:
Hi,
I would like to embed a python interpreter within a program, but since that
program would be able to automatically download scripts from the internet,
I'd like to run those in a restricted environment, which basically means
that I want to allow only a specific set of modules to be used by the
scripts, so that it wouldn't be possible for them to remove files from the
hard drive, kill processes or do other nasty stuff.
Is there any way to do that with the standard python interpreter?
Hi, there is a page on this topic here:
http://www.python.org/moin/SandboxedPython
The short answer is that it is not possible to do this with the CPython, 
but you can run sandboxed code on other virtual machines, such as Java's 
JVM with Jython, or .NET/Mono's CLR with Boo or IronPython.

In the future it may also be possible to do this with PyPy or Parrot.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Doug Holton
Alan Gauld wrote:
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. 
Getting rid of lambda seems like a worthy goal, 

Can I ask what the objection to lambda is? 
1) Is it the syntax?
2) Is it the limitation to a single expression?
3) Is it the word itself?

I can sympathise with 1 and 2 but the 3rd seems strange since a
lambda is a well defined name for an anonymous function used in
several programming languages and originating in lambda calculus
in math. Lambda therefore seems like a pefectly good name to
choose.
I agree with keeping lambda functionality, and I don't care what name is 
used, but there are people who do not like "lambda":
http://lambda-the-ultimate.org/node/view/419#comment-3069
The word "lambda" is meaningless to most people.  Of course so is "def", 
which might be why Guido van Robot changed it to "define": 
http://gvr.sourceforge.net/screen_shots/

Even a simple word like "type" can be difficult to explain to beginners:
http://lambda-the-ultimate.org/node/view/337
Python is easier for beginners to learn than other mainstream 
programming languages (like java or C++), but that's not to say it 
doesn't have some stumbling blocks for beginners of course: 
http://www.linuxjournal.com/article/5028

So why not retain the name lambda but extend or change the syntax
to make it more capable rather than invent a wholly new syntax
for lambdas?
Yes, I agree, and either keep the "lambda" keyword or else reuse the 
"def" keyword for anonymous methods.  See this page Steven Bethard 
created: http://www.python.org/moin/AlternateLambdaSyntax

I really don't think anyone should worry about lambda disappearing.
By the way, you've done great work with your learning to program site 
and all the help you've given on the python-tutor list:

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
--
http://mail.python.org/mailman/listinfo/python-list


Re: Game programming in Python

2005-01-11 Thread Doug Holton
Baza wrote:
I'm looking for any books or on-line resources on game programming using
Python. Does anyone have any advice?
See http://pygame.org/
There is also a book called "Game Programming with Python".
--
http://mail.python.org/mailman/listinfo/python-list


Re: Windows GUIs from Python

2005-01-11 Thread Doug Holton
Bob Swerdlow wrote:
Anyone have opinions about whether we will be better off using PythonNet or 
wxPython for the GUI layer of our application on Windows?  Our code is all 
Python and is now running on Mac OS X with PyObjC and Cocoa, which works 
very well.  Our goal is not necessarily to move to a cross-platform 
solution, but rather to create a solid Windows version that looks and feels 
like a native application.  All the code that interacts with the user is 
factored out of our business logic, so it is a matter of find a good 
view/controller library and writing a thin glue layer.  And, of course, we 
want to build it as efficiently and robustly as we can.
I would also recommend wxPython.  It runs on Macs, too, so you can at 
least see how it compares to your PyObjC interface and keep primarily 
developing on your Mac.
You might also be interested in PyGUI although it doesn't have a native 
Windows implementation yet: 
http://nz.cosc.canterbury.ac.nz/~greg/python_gui/
--
http://mail.python.org/mailman/listinfo/python-list


Re: java 5 could like python?

2005-01-15 Thread Doug Holton
vegetax wrote:
In the other hand, with the recent changes in java 5 i can pythonize
java,
Have you seen Jython? http://www.jython.org/
It may be the best option for you.  It will run just as fast as a 
regular java program.  Also there is groovy: http://groovy.codehaus.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Fredrik Lundh wrote:
A.M. Kuchling wrote:

IMHO that's a bit extreme.  Specifications are written to be detailed, so
consequently they're torture to read.  Seen the ReStructured Text spec
lately?

I've read many specs; YAML (both the spec and the format) is easily
among the worst ten-or-so specs I've ever seen.
What do you expect?  YAML is designed for humans to use, XML is not. 
YAML also hasn't had the backing and huge community behind it like XML.
XML sucks for people to have to write in, but is straightforward to 
parse.  The consequence is hordes of invalid XML files, leading to 
necessary hacks like the mark pilgrim's universal rss parser.  YAML 
flips the problem around, making it harder perhaps to implement a 
universal parser, but better for the end-user who has to actually use 
it.  More people need to work on improving the YAML spec and 
implementing better YAML parsers.  We've got too many XML parsers as it is.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Fredrik Lundh wrote:
and trust me, when things are hard to get right for developers, users will
suffer too.
That is exactly why YAML can be improved.  But XML proves that getting 
it "right" for developers has little to do with getting it right for 
users (or for saving bandwidth).  What's right for developers is what 
requires the least amount of work.  The problem is, that's what is right 
for end-users, too.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
rm wrote:
this implementation of their idea. But I'd love to see a generic, 
pythonic data format.
That's a good idea.  But really Python is already close to that.  A lot 
of times it is easier to just write out a python dictionary than using a 
DB or XML or whatever.  Python is already close to YAML in some ways. 
Maybe even better than YAML, especially if Fredrik's claims of YAML's 
inherent unreliability are to be believed.  Of course he develops a 
competing XML product, so who knows.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Doug Holton
Peter Hansen wrote:
   Good question. The point is that an XML document is sometimes
   a file, sometimes a record in a relational database, sometimes an
   object delivered by an Object Request Broker, and sometimes a
   stream of bytes arriving at a network socket.
   These can all be described as "data objects".
"""
I would ask what part of that, or of the simple phrase
"data object", or even of the basic concept of a markup language,
doesn't cry out "data interchange metalanguage" to you?
Actually I don't see any explicit mention that XML was meant to be 
limited to data interchange only.
"data object" has to do with more than data interchange.  There is data 
entry as well.  And people are having to hand enter XML files all the 
time for things like Ant, XHTML, etc.

I guess all those people who learned how to write web pages by hand were 
violating some spec and so they have no cause to complain about any 
difficulties doing so.  Tim Berners-Lee never intended people to have to 
type in URLs, either, but here we are.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Steve Holden wrote:
Yet again I will interject that XML was only ever intended to be wriiten 
by programs. Hence its moronic stupidity and excellent uniformity.
Neither was HTML, neither were URLs, neither were many things used the 
way they were intended.  YAML, however, is specifically designed to be 
easier for people to write and to read, as is Python.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Daniel Bickett wrote:
In my (brief) experience with YAML, it seemed like there were several
different ways of doing things, and I saw this as one of it's failures
(since we're all comparing it to XML). However I maintain, in spite of
all of that, that it can easily boil down to the fact that, for
someone who knows the most minuscule amount of HTML (a very easy thing
to do, not to mention most people have a tiny bit of experience to
boot), the transition to XML is painless. YAML, however, is a brand
new format with brand new semantics.
That's true and a very good point.  Like you said, that's probably the 
reason XML took off, because of our familiarity with HTML.

As for the human read-and-write-ability, I don't know about you, but I
have no trouble whatsoever reading and writing XML. 
You might like programming in XML then: http://www.meta-language.net/
:)
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
You might like programming in XML then: http://www.meta-language.net/
Actually, the samples are hard to find, they are here:
http://www.meta-language.net/sample.html
Programming in XML makes Perl and PHP look like the cleanest languages 
ever invented.
--
http://mail.python.org/mailman/listinfo/python-list


Re: compile python to binary

2005-01-23 Thread Doug Holton
Fredrik Lundh wrote:
Daniel Bickett wrote:

I believe Sam was talking about "frozen" python scripts using tools
such as py2exe:

oh, you mean that "python compiler" didn't mean "the python compiler".
I wouldn't assume a novice uses terms the same way you would.  It was 
quite clear from his message that py2exe and the like were what he was 
referring to, if you had read his first sentence:

"I have seen some software written in python and delivered as binary form."
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-24 Thread Doug Holton
rm wrote:
Doug Holton wrote:
rm wrote:
this implementation of their idea. But I'd love to see a generic, 
pythonic data format.

That's a good idea.  But really Python is already close to that.  A 
lot of times it is easier to just write out a python dictionary than 
using a DB or XML or whatever.  Python is already close to YAML in 
some ways. 
true, it's easy enough to separate the data from the functionality in 
python by putting the data in a dictionary/list/tuple, but it stays 
source code.
Check out JSON, an alternative to XML for data interchange.  It is 
basically just python dictionaries and lists:
http://www.crockford.com/JSON/example.html

I think I would like this better than YAML or XML, and it looks like it 
already parses as valid Python code, except for the /* */ multiline 
comments (which boo supports).

It was mentioned in a story about JSON-RPC-Java:
http://developers.slashdot.org/article.pl?sid=05/01/24/125236
--
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-22 Thread Doug Ly








Is there a good IDE for Python? I have heard that Eclipse
has a plugin for Jython only.

Thanks

 

--Doug

 






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

Re: Favorite non-python language trick?

2005-06-24 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>,
 "Enrico" <[EMAIL PROTECTED]> wrote:

> "Joseph Garvin" <[EMAIL PROTECTED]> ha scritto nel messaggio
> news:[EMAIL PROTECTED]
> > --This code won't run because it's in a comment block
> > --[[
> > print(10)
> > --]]
> >
> > --This code will, because the first two dashes make the rest a comment,
> > breaking the block
> > ---[[
> > print(10)
> > --]]
> >
> > So you can change whether or not code is commented out just by adding a
> > dash. This is much nicer than in C or Python having to get rid of """ or
> > /* and */. Of course, the IDE can compensate. But it's still neat :)
> 
> python:
> 
> """
> print 10
> """
> 
> and
> 
> #"""
> print 10
> #"""


It seems to me that this trick works in Python,too.

"""
print 10
#"""

and

#"""
print 10
#"""


You only have to change the first triple quote.

-- 
Doug Schwarz
dmschwarz&urgrad,rochester,edu
Make obvious changes to get real email address.
-- 
http://mail.python.org/mailman/listinfo/python-list


CGI File Uploads and Progress Bars

2005-09-07 Thread Doug Helm
Hey, Folks:

I'm writing a CGI to handle very large file uploads.  I would like to
include a progress bar.  I think I'm about done.  I have code to handle the
file upload, and I think I can add an IFrame to my page which posts to check
file size (so I can tell how many bytes have been received).  My problem is
that I want to provide a % complete.  In order to do that, of course, I need
to know not only the number of bytes received, but also the total number of
incoming bytes.  Here's the heart of the code:

while afcommon.True:
  lstrData = lobjIncomingFile.file.read(afcommon.OneMeg)
  if not lstrData:
break
  lobjFile.write(lstrData)
  llngBytes += long(len(lstrData))
lobjFile.close()

Assume that lobjIncomingFile is actually a file-type element coming from
CGI.FieldStorage.  It's already been tested to ensure that it is a file-type
element.  Also, assume that I've already opened a file on the server,
referred to by lobjFile (so lobjFile is the target of the incoming data).

If this were a client application opening a file, I would just do the
following:

import os
print os.stat('myfile.dat')[6]

But, of course, this isn't a local file.  In fact, it's not really a file at
all.  It is the contents of a file already rolled up into the HTTP header of
the incoming HTTP request to the Web server.  The CGI module is kind enough
to handle all of the really hard stuff for me (like unpacking and decoding
the header contents, etc.).  But, I still need to know the size of the
incoming file data.

Of course, I could do this by reading the whole thing into a string variable
and then testing the length of the string, as follows:

s = lobjIncomingFile.file.read()
SizeOfFileIs = len(s)

But that really defeats the purpose, since my whole goal here is to provide
a progress bar, which is contingent upon a "chunking" approach.  Besides,
for the file sizes that I'll be dealing with, I surely wouldn't want to read
the whole thing into memory.

So, bottom line: Does anyone know how to get the size of the incoming file
data without reading the whole thing into a string?  Can I do something with
content_header?

Thanks much for any insight that you might have.

Doug


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


Re: programmatically calling a function

2005-03-05 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>,
 Dave Ekhaus <[EMAIL PROTECTED]> wrote:

> hi
> 
>   i'd like to call a python function programmatically - when all i have 
> is the functions name as a string.  i.e.
> 
>   
> fnames = ['foo', 'bar']
> 
> for func in fnames:
> 
>   #
>   # how do i call function 'func' when all i have is the name of the 
> function ???
>   #
>   
> 
> 
> def foo():
>   
>   print 'foo'
> 
> def bar():
> 
>   print 'bar'
> 
> 
>   i'd really appreciate any help the 'group' has to offer.
> 
> 
> thanks
> dave


Dave,

I think eval might be what you're looking for:

f = eval('len')
length = f([1,2,3])


By the way, are you the Dave Ekhaus I used to work with at Kodak?

-- 
Doug Schwarz
dmschwarz&urgrad,rochester,edu
Make obvious changes to get real email address.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: programmatically calling a function

2005-03-05 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>,
 Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:

> Doug Schwarz wrote:
> 
> > Dave,
> > 
> > I think eval might be what you're looking for:
> > 
> > f = eval('len')
> > length = f([1,2,3])
> 
> But only if the string given to eval is checked thorougly for allowed
> contents. Better use getattr.
> 
> Reinhold


Actually, upon reading Peter Hansen's reply more carefully, I wil defer 
to his approach, namely,

def foo():
print "foo"

f = globals()["foo"]

as I suspect that it will be more efficient.  You still need to make 
sure that the string in question is one of the keys in the globals() 
dictionary or else handle the error -- just as with eval.

I don't see how getattr solves the original problem.  What, exactly, is 
the first argument to getattr?

-- 
Doug Schwarz
dmschwarz&urgrad,rochester,edu
Make obvious changes to get real email address.
-- 
http://mail.python.org/mailman/listinfo/python-list


Module list generation

2004-12-03 Thread Doug Kearns
Is this the best/simplest way to generate a module list?

python -c 'from pydoc import help; help("modules")'

Thanks,
Doug
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Module list generation

2004-12-05 Thread Doug Kearns
In article <[EMAIL PROTECTED]>, Scott David Daniels wrote:
> Doug Kearns wrote:
>> Is this the best/simplest way to generate a module list?
>> 
>> python -c 'from pydoc import help; help("modules")'
>> 
>> Thanks,
>> Doug
> I am not sure if this is what you want, but how about:

I'm updating the zsh completion function for python and need to
generate a list of modules for completing the new '-m' option.

> For python 2.4, try:
> python -c "import sys; print sorted(sys.modules)"

I don't know python, but as I understand it, this only lists _loaded_
modules.

Thanks,
Doug
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Seeking Python + Subversion hosting.

2004-12-05 Thread Doug Holton
Tom Locke wrote:
Hi,
Anyone know of a good hosting company that offers both server-side
Python and a subversion repository?

With user-mode linux hosting you can have your own virtual root system 
with which you can run whatever python stuff you want as well as 
subversion or other server processes for about the price of standard 
shared (php+mysql) hosting.  I picked this option so that for example I 
could run mod_python.  The catch is that disk access is a little slower 
and RAM is more constricted, unless you pay for higher RAM.  See:
http://developers.coedit.net/UserModeLinux
--
http://mail.python.org/mailman/listinfo/python-list


Re: Time for : comp.lang.python.newbies ??

2004-12-05 Thread Doug Holton
gmduncan wrote:
Maybe a time for a new discussion group along that suggested
by the Subject line ?
http://mail.python.org/mailman/listinfo/tutor
Or is their increasing presence here a price we must pay for their
belated recognition of this wonderful language ?
Don't forget the price we pay for not having a 
comp.lang.python.cynicaloldfarts
--
http://mail.python.org/mailman/listinfo/python-list


Re: collaborative editing

2004-12-10 Thread Doug Holton
Michele Simionato wrote:
Suppose I want to write a book with many authors via the Web. The book has 
a hierarchical structure with chapter, sections, subsections, subsubsections, 
etc. At each moment it must be possible to print the current version of the 
book in PDF format. There must be automatic generation of the table of contents,
indices, etc. Conversions to many formats (Latex, DocBook, etc.) would be
welcome. Does something like that already exists? Alternatively, I would need
some hierarchical Wiki with the ability of printing its contents in an
structured way. 
You want a wiki engine.  There are many to choose from, some of which 
have all the features you want.
See for example Atlassian Confluence.  We are using it to create 
documentation for boo ( http://boo.codehaus.org ).  This page for 
example has child pages and you can export pages to html, pdf, or xml.
http://docs.codehaus.org/display/BOO/Recipes
http://docs.codehaus.org/spaces/exportspace.action?key=BOO

I think the PHP/MySQL-based Tiki wiki has similar features, too.
http://tikiwiki.org/tiki-index.php
--
http://mail.python.org/mailman/listinfo/python-list


Re: how can I import a module without using pythonpath?

2004-12-13 Thread Doug Holton
Phd wrote:
Hi,
I'm using python 2.2, I want to import a module by referring to its 
relative location. The reason for this is that there is another module 
with the same name that's already in pythonpath( not my decision, but I 
got to work around it, bummer). So is there any easy way to do it?
import sys, os
sys.path.insert(0,os.path.abspath("relative path"))
import module
sys.path.remove(os.path.abspath("relative path"))
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python good for graphics?

2004-12-15 Thread Doug Holton
Esmail Bonakdarian wrote:
First of all, I *really* like Python ;-)
I need some help with the graphical side of things. I would like to do
some basic graphics with Python, but I am not sure what the best/most
effective way for me to do what I want.
Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)
Or to create and manipulate programmatically a simple 2-D block puzzle
(like this: http://www.johnrausch.com/SlidingBlockPuzzles/quzzle.htm).
Note, the ability to do this via the web would be nice, but definitely
is *not* required at the moment.
I'll tell you know it's not going to be so easy.  There isn't something 
in python like flash.  But here are some options:

See pyxel for python: http://bellsouthpwp.net/p/r/prochak/pyxel.html
and pygame: http://pygame.org/
Gato, the graph animation toolkit, is implemented in python and tkinter: 
http://www.zpr.uni-koeln.de/~gato/

You know you can use java with python, too.  It's called jython.  You 
could use jython to interface the open source physics toolkit, for 
example: http://www.opensourcephysics.org/
See also the Jython Environment for Students (JES).  A book about it is 
supposed to be published tomorrow actually.

And you can use a python-like language for .NET called boo with the 
Piccolo.NET structured graphics toolkit: http://www.cs.umd.edu/hcil/jazz/
or these graph drawing toolkits: http://netron.sourceforge.net/ewiki/
http://www.codeproject.com/cs/miscctrl/quickgraph.asp
--
http://mail.python.org/mailman/listinfo/python-list


Re: BASIC vs Python

2004-12-16 Thread Doug Holton
abisofile wrote:
hi 

I'm new to programming.I've try a little BASIC so I want ask since 
Python is also interpreted lang if it's similar to BASIC.
Which BASIC did you try?  Realbasic? Visual Basic?
You should check out some of these beginner's python tutorials:
http://www.honors.montana.edu/~jjc/easytut/easytut.pdf
http://www.dickbaldwin.com/tocpyth.htm
http://www.freenetpages.co.uk/hp/alan.gauld/
and then if you have any questions at all about anything, people on the 
python-tutor list would be glad to help:
http://mail.python.org/mailman/listinfo/tutor

If you want to make applications with a graphical user interface (GUI), 
check out wxpython, although they haven't yet released a version that 
works with the new python 2.4 however: http://wxpython.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for "syntax error": ++i, --i

2004-12-14 Thread Doug Holton
Petr Prikryl wrote:
Hi,
Summary: In my opinion, the C-like prefix
increment and decrement operators (++i and --i)
should be marked as "syntax error".
We have a patch for increment and decrement operators in boo ( 
http://boo.codehaus.org/ ), along with an operator overloading syntax 
like below.  See http://jira.codehaus.org/browse/BOO-223

def +:
pass
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.0

2004-12-14 Thread Doug Holton
Chris wrote:
Okay, color me stupid, but what is everyone referencing when they 
mention Python 3.0?  I didn't see any mention of it on the Python site.
http://www.python.org/moin/Python3.0
has more information than the PEP 3000, plus you can contribute to the page.
--
http://mail.python.org/mailman/listinfo/python-list


Re: better lambda support in the future?

2004-12-18 Thread Doug Holton
Jason Zheng wrote:
I'm wondering why python still has limited lambda support. What's 
stopping the developers of python to support more lisp-like lambda 
function?
See boo and its support for closures: http://boo.codehaus.org/
http://boo.codehaus.org/Closures
It works with "def" or "do", or single-line closures use {}.
x = def:
print "hello"
A closure with parameters:
c = def(x1 as int, x2 as string):
print x1, x2
Single line closures use {}
c = {print("hello")}
Single line with parameters
c = {item as string | print(item)}
#Passing closures to a method as a parameter:
def mymethod(c as callable):
c()
x = mymethod( {print("hello")} )
#passing a multi-line closure as a parameter:
x = mymethod() do():
print "hello"
#Adding a closure to an event handler:
button.Click += def ():
print("${button} was clicked!")
--
http://mail.python.org/mailman/listinfo/python-list


Re: How about "pure virtual methods"?

2004-12-19 Thread Doug Holton

Noam Raphael wrote:
even in the best solution that I know of, 
there's now way to check if a subclass has implemented all the 
required methods without running it and testing if it works. 
I think there are some solutions like PyProtocols, see section 2.2 on 
this page: http://www.python.org/cgi-bin/moinmoin/MetaClasses

But what you are wanting is used more in statically typed languages. 
If you want interfaces, abstract classes and virtual methods in a 
python-like language see boo: http://boo.codehaus.org/
It will catch errors like this at compile-time.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How about "pure virtual methods"?

2004-12-19 Thread Doug Holton
Fredrik Lundh trolled:
(I think you could create some kind of drinking game based on the number of
...times the nasty trolls pounce on this list?
No, I think the idea is to actually address the content of someone's 
question, politely and in the *holiday spirit*, not spirits.
--
http://mail.python.org/mailman/listinfo/python-list


Re: input record seperator (equivalent of "$|" of perl)

2004-12-19 Thread Doug Holton
[EMAIL PROTECTED] wrote:
Hi,
I know that i can do readline() from a file object.
However, how can I read till a specific seperator?
for exmple,
if my files are
name
profession
id
#
name2
profession3
id2
I would like to read this file as a record.
I can do this in perl by defining a record seperator;
is there an equivalent in python? 
thanks

To actually answer your question, there is no equivalent to $| in python.
You need to hand code your own record parser, or else read in the whole 
contents of the file and use the string split method to chop it up into 
fields.
--
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question

2004-12-19 Thread Doug Holton
David Wurmfeld wrote:
I am new to python; any insight on the following would be appreciated, even 
if it is the admonition to RTFM (as long as you can direct me to a relevant 
FM)

Is there a standard approach to enumerated types? I could create a 
dictionary with a linear set of keys, but isn't this overkill? There is 
afterall a "True" and "False" enumeration for Boolean.
To actually answer your question, no, there is no standard for enums in 
python.  There are custom hacks for it that you can search for.

Boo, a programming language that is virtually identical to python, does 
have standard enums:

enum Color:
Red
Green
Blue
See http://boo.codehaus.org/
In fact, since not many seem to be aware of its existence, I encourage 
everyone here to check out boo as an alternative to python.


Is there a way to ignore case in string comparisons? I want 'Oranges' to 
equal 'oranges' when using the evaluation operator (==). I don't care about 
string inequalities (<, >)
No, not with the == operator, unless you use:
s1.lower() == s2.lower()
Visual Basic is the only language I am aware of that has 
case-insensitive strings.


Finally, (for now at least) consider the following list.
myList = [apple, 13, plum, cherry, 'Spam', tomato, 3.35]
Exactly how does the "for x in myList" work?
If the list is a heterogeneous list of disparate types, the == operator 
works fine, independent of type.
For example, (if x == 'spam') evaluates as false if the item in the list is 
an integer. But if I try to do this: (if x.__abs()__) throws an exception if 
x "pulls" a non integer from the list. Wouldn't you think that an iterative 
would have the "sense" to understand that in this limited scope if a method 
didn't apply to the iterator just "fail" (i.e. evaluate to False) the 
evaluation and move along? Do I have to manually interrogate each iteration 
for the proper type before I test?
Think about it; the interpreter has to evaluate disparate types for 
equality. How exactly does the it "know" that for this iteration, x is an 
integer, and the evaluation (if x == 'spam') is False, and doesn't throw an 
exception for a type mismatch?
Because python is a strongly typed.  If you want to perform a type 
specific operation like abs() or string.lower(), but the object's type 
may not be the right type, then you have to check its type first.

In boo, we have an "isa" operator for this purpose:
if x isa string:

or:
for item in myList:
given typeof(item):
when string:
print item.ToLower()
when int:
print Math.Abs(item)
--
http://mail.python.org/mailman/listinfo/python-list


Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Doug Holton
Fredrik Lundh wrote:
If you find a good solution to this problem,  please let me know.

well, since I'm not in the ego-stroking business, what if I promise never to
reply to posts by you, robert, and alex?
That's not fair to the rest of us though :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Easy "here documents" ??

2004-12-19 Thread Doug Holton
Jim Hill wrote:
Is there a way to produce a very long multiline string of output with
variables' values inserted without having to resort to this wacky
"""v = %s"""%(variable)
No, not without the god-awful hacks you've already seen.
But it is possible in boo: : http://boo.codehaus.org/
See http://boo.codehaus.org/String+Interpolation
variable1 = 1
variable2 = 2
s = """
   v = ${variable1}
   v2's value is: ${variable2}
"""
print s
--
http://mail.python.org/mailman/listinfo/python-list


Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Gezer Punta wrote:
hi all
I am looking for a forum which was produced by python
If you want Zope-based, try Plone.  But probably you don't.
I am not aware of any standard python CGI-based forum software, but I am 
sure you could find one if you search sourceforge or google.

I am surprised no one else already answered this for you.  I guess your 
question was too simple to challenge the large egos here.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Jp Calderone wrote:
  Part of fostering a friendly environment on python-list is not making
comments like these.  
Another part is actually answering the content of a person's question 
like I did, instead of trolling and flaming, like Fredrik and others 
here are want to do.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Doug Holton
Peter Hansen wrote:
Why?  If it's virtually identical, why would anyone bother even
visiting that site?  ;-)
But I suspect you mean that the syntax of the language is virtually
identical, while probably there are some significant differences.
Maybe in the richness of its standard library?  Or the size of
its community?  Or something else
That's why I wrote:
> See http://boo.codehaus.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Doug Holton
Steven Bethard wrote:
I don't really have a good solution; despite the unnecessarily vicious 
comments, I don't feel like I can set my newsreader to ignore messages 
from, for example, Fredrik, because his answers, when not attacks, are 
often very insightful.  If you find a good solution to this problem, 
please let me know.
Thankyou for bringing it up.  It looks like it may have a positive effect.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Doug Holton
Peter Hansen wrote:
"Virtually identical" indeed. :-)
As noted on the website that I've pointed out to you multiple times now, 
the syntax of boo is indeed virtually identical to python.  The 
functionality however, is more like C#.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Peter Hansen wrote:
None of which in any way invalidates Jp's point...
Neither does it invalidate mine.  What is up with the trollers today? 
They are out in force now that the holidays are here.
--
http://mail.python.org/mailman/listinfo/python-list


ANN: Python Multimedia Computing book and software

2004-12-19 Thread Doug Holton
This book is due to be published any day now:
"Introduction to computing and programming with Python: A Multimedia 
Approach" by Mark Guzdial, a CS professor at Georgia Tech.

It uses the Jython Environment for Students (JES).  It is completely 
free and open source.  You can use it for example to work with and 
manipulate images or sounds.

A similar book is available in preview form: "Introduction to Media 
Computation: A Multimedia Cookbook in Python".

See this page for info on the books, the software, course notes, 
research papers, and more info: http://coweb.cc.gatech.edu/mediaComp-plan

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


Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Doug Holton
Steven Bethard wrote:
Doug Holton wrote:
Fredrik Lundh wrote:
well, since I'm not in the ego-stroking business, what if I promise 
never to reply to posts by you, robert, and alex?

That's not fair to the rest of us though :)

That's not even fair to the non-rest of us. =)  As I noted, "his answers 
... are often very insightful" -- it would be a pity to lose them.

He was only acknowledging the problem to those 3 people who complained 
about it.  I was making the point that others do not like being trolled 
either.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Doug Holton
Peter Hansen wrote:
Doug Holton wrote:
Peter Hansen wrote:
"Virtually identical" indeed. :-)

As noted on the website that I've pointed out to you multiple times 
now, the syntax of boo is indeed virtually identical to python.  The 
functionality however, is more like C#.

Sadly your second post hasn't reached my news server, which is
quite flaky.  Fortunately (checking Google Groups), I see it
added nothing of substance, as it merely points to the site again,
without addressing my comments about how syntactical similarity
or even identity doesn't justify the term "virtually identical",
which implies that in all respects one thing is essentially
identical to another.
I gave such a short answer because the way you framed your "questions" 
and the context of your post made it clear you are a troll.  Your reply 
here was yet another troll.  You are one of the reasons why so-called 
"newbies" and others are being intimidated away from this list.
-Doug
--
http://mail.python.org/mailman/listinfo/python-list


Re: Web forum (made by python)

2004-12-20 Thread Doug Holton
Fredrik Lundh wrote:
ask yourself if that thing you read really was a vicious attack by bunch of 
nasty
trolls, or if, perhaps, you missed the point.
You still do not even acknowledge your behavior then?  If it is your 
wish that I never mention boo again, then I will not, even though you 
and not I are the one with a financial conflict of interest in the matter.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Doug Holton
Istvan Albert wrote:
Doug Holton wrote:
the syntax of boo is indeed virtually identical to python.  

All that boo does is borrows a few syntactical constructs
from python. Calling it virtually identical
is *very* misleading.
The syntax is indeed virtually identical to python.  You are yet another 
person who has trolled before.  See your obvious trolling reply here, 
for example:
http://groups-beta.google.com/group/comp.lang.python/messages/c57cf0e48827f3de,a750c109b8ee57c3,cf89205a5e93051e,cfb1c7453e1f3c07,58a2dedd1059783e,8a1ee82cc328d023,7a51cdc9ffecbc72,38304f35cb42bb63,fc5e4ae1cbae0248,2de118caa7010b30?thread_id=5a7018d37b7bf4b8&mode=thread&noheader=1&q=boo#doc_a750c109b8ee57c3

Do you have financial conflict of interest too like Fredrik?  Or is it 
just a psychological issue?  I have no stake in python or any other 
language changing or not changing.  You guys need to accept change 
rather than fear it.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for "syntax error": ++i, --i

2004-12-20 Thread Doug Holton

Petr Prikryl wrote:
Hi,
Summary: In my opinion, the C-like prefix
increment and decrement operators (++i and --i)
should be marked as "syntax error".

Let me rephrase my answer.
This is a good sugestion for Python 3.0, a.k.a. Python 3000:
http://www.python.org/cgi-bin/moinmoin/Python3.0
In the future you may be able to to this:
variable++
However, Python 3.0 is likely years away.  If you want to know how to 
run this code today, ask Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question

2004-12-20 Thread Doug Holton

David Wurmfeld wrote:
I am new to python; any insight on the following would be appreciated, 
even if it is the admonition to RTFM (as long as you can direct me to 
a relevant FM)

Is there a standard approach to enumerated types? I could create a 
dictionary with a linear set of keys, but isn't this overkill? There 
is afterall a "True" and "False" enumeration for Boolean.
To actually answer your question, no, there is no standard for enums in 
python.  There are custom hacks for it that you can search for.

This is a good sugestion for Python 3.0, a.k.a. Python 3000:
http://www.python.org/cgi-bin/moinmoin/Python3.0
In the future you may be able to to this:
enum Color:
 Red
 Green
 Blue
However, Python 3.0 is likely years away.  If you want to know how to 
run this code today, consult Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How about "pure virtual methods"?

2004-12-20 Thread Doug Holton
Doug Holton wrote:
Noam Raphael wrote:
even in the best solution that I know of,
there's now way to check if a subclass has implemented all the 
required methods without running it and testing if it works. 

I think there are some solutions like PyProtocols, see section 2.2 on 
this page: http://www.python.org/cgi-bin/moinmoin/MetaClasses
Let me rephrase the rest of my answer.
This is something we could use in Python.  You should add a feature 
request to have this in Python 3.0, a.k.a. Python 3000:
http://www.python.org/cgi-bin/moinmoin/Python3.0

You might have simple code such as:
inteface ICallable:
def Call(args)
However, Python 3.0 is likely years away.  If you want to know how to 
run code like this and have real interfaces, abstract classes and 
virtual methods today, consult Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list


Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-20 Thread Doug Holton
Doug Holton wrote:
Steven Bethard wrote:
I don't really have a good solution; despite the unnecessarily vicious 
comments, I don't feel like I can set my newsreader to ignore messages 
from, for example, Fredrik, because his answers, when not attacks, are 
often very insightful.  If you find a good solution to this problem, 
please let me know.

Thankyou for bringing it up.  It looks like it may have a positive effect.
Unfortunately, I may have jumped the gun on that one.  He does not even 
acknowledge his behavior outside of the three instances he referred to.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Doug Holton
Hans Nowak wrote:
Regardless of the merits of Boo, this is comp.lang.python, not 
comp.lang.boo.  The language may *look* like Python, but its inner 
workings are nothing like Python, as several people have correctly 
pointed out now.  (Just like Java's syntax may look like C or C++ in 
some areas, but the languages are nowhere near alike.)  Pointing out the 
difference is not trolling.
Let me say it again then, although I do not know why it threatens people 
so much: the syntax of boo is indeed virtually identical to python's. 
That is what I said and what is clear from the website.

I already stated that I will not mention boo again, to comply with 
Fredrik's wishes and yours.  I will refer to CPython, and CPython only. 
 But I will not be intimidated by the likes of Fredrik Lundh.  Trollers 
will be held accountable.  If it continues at this pace, then I suggest 
a weekly troll alert, to educate and prepare the so-called newbies for 
the behavior that occurs on this list.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Easy "here documents" ??

2004-12-20 Thread Doug Holton
Jim Hill wrote:
Is there a way to produce a very long multiline string of output with
variables' values inserted without having to resort to this wacky
"""v = %s"""%(variable)
No, it is currently not possible in Python without the hacks you have 
seen already.  Python is long overdue for simpler string interpolation 
as seen in many other scripting languages.

You should add a feature request to have this in Python 3.0, a.k.a. 
Python 3000: http://www.python.org/cgi-bin/moinmoin/Python3.0

Then you could simple do something like:
variable1 = 1
variable2 = 2
s = """
   v = ${variable1}
   v2's value is: ${variable2}
"""
However, Python 3.0 is likely years away.  If you want to know how to 
run code like this today, consult Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Easy "here documents" ??

2004-12-20 Thread Doug Holton
Bengt Richter wrote:
variable1 = 1
variable2 = 2
s = """
  v = ${variable1}
  v2's value is: ${variable2}
"""
However, Python 3.0 is likely years away.  If you want to know how to 
run code like this today, consult Fredrik Lundh.

Or replace ${...} with equally simple %(...)s in the above and be happy ;-)
I'm afraid you are incorrect.  Simply replacing the $ with % in my 
example will not work in Python.
If you would like to use % instead of $, I recommend requesting that 
feature for Python 3.0: http://www.python.org/cgi-bin/moinmoin/Python3.0
--
http://mail.python.org/mailman/listinfo/python-list


Re: BASIC vs Python

2004-12-20 Thread Doug Holton
Michael Hoffman wrote:
Gregor Horvath wrote:
 > Or make any given standard python object accessible from MS Excel in 2
 > minutes.
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.Workbooks.Add()
xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!'
xlApp.ActiveWorkbook.ActiveSheet.Cells(1,2).Value = 'Python Rules 2!'
xlApp.ActiveWorkbook.Close(SaveChanges=0)
xlApp.Quit()
del xlApp
(stolen from )

As already pointed out to you, that is the exact opposite of what the 
poster was asking for.
--
http://mail.python.org/mailman/listinfo/python-list


Re: expression form of one-to-many dict?

2004-12-20 Thread Doug Holton
Mike Meyer wrote:
Personally, I'd love a language feature that let you create a function
that didn't evaluate arguments until they were actually used - lazy
evaluation. That lets you write the C ?: operator as a function, for
a start.
Hmmm. No, iterators can't be used to fake it. Oh well.
That is a brilliant idea.  I would suggest requesting such a feature for 
Python 3.0: http://www.python.org/cgi-bin/moinmoin/Python3.0

However, Python 3.0 is likely years away.  If you want to know how to 
use this feature today, consult Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list


Re: BASIC vs Python

2004-12-20 Thread Doug Holton
Mike Meyer wrote:
Logo (my pick) has been called "Lisp without the parenthesis". It has
the advantage of using standard algebraic notation for formulas,
instead of operator post or pre.
This is comp.lang.python, not comp.lang.logo.  Please refrain from 
discussing topics not related to CPython.
--
http://mail.python.org/mailman/listinfo/python-list


What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Steve Holden wrote:
'Scuse me? This group has a long history of off-topic posting, and 
anyway who decided that CPython should be the exclusive focus? Even 
on-topic we can talk about Jython and PyPy as well as CPython.
I agree with your point, although Hans Nowak and others may not. 
Anything related to python or from the perspective of a current or 
potential python user is on-topic for this list.  We can talk about 
logo, jython, java or other topics whenever and whereever we want.  If 
you can't accept free speech and different perspectives, you're going to 
be disappointed.  But please do not react by trying to intimidate and 
troll others here.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Nick Vargish wrote:
Doug Holton <[EMAIL PROTECTED]> writes:

If you can't accept free speech and different perspectives, you're
going to be disappointed.  But please do not react by trying to
intimidate and troll others here.

Weren't you the one telling the rest of us what's appropriate for this
group? Maybe you should try to lead by example, not decree.
I never did any such thing.  Logo was my example.  I was making a point 
in the logo example, which Steve Holden articulated.  Hans Nowak and 
others were the ones unsuccessfully trying to control what people could 
talk about here.
--
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question

2004-12-21 Thread Doug Holton
Fredrik Lundh wrote:
"have you harrassed a Pythoneer today?"
 
Yes, you have.  I'll ask again that you stop.  Just because you make a 
living in part off of a CPython module, doesn't mean we cannot discuss 
python-related things on this list, or discuss things from the 
perspective of a python user, or suggest alternative solutions when 
someone asks for a feature that Python does not have.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Hans Nowak wrote:
Now you're trying to make it seem like I am against free speech on this 
list, and against people's rights to discuss whatever they want.  I 
never said that, and I in fact enjoy the fact that c.l.py posters are an 
eclectic bunch who have knowledge of, and like to talk about, a great 
number of topics.
You said that boo should not be mentioned on this newsgroup.  That is a 
fact.  You cannot and should not try to dictate any standard for what 
can and cannot be said in this forum, other than what I already 
suggested in the quote below:

>> Anything related to python or from the perspective of a current or
>> potential python user is on-topic for this list.  We can talk about
>> logo, jython, java or other topics whenever and whereever we want. If
>> you can't accept free speech and different perspectives, you're going
>> to be disappointed.
Sorry to disappoint.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Hans Nowak wrote:
You said that boo should not be mentioned on this newsgroup.  

Please point me to the post where I said that.  Since everything is 
stored in Google Groups, it should be easy for you to come up with an 
URL... if such a post existed.
Quote:
"this is comp.lang.python, not comp.lang.boo."
This is not comp.lang.logo, either, but discussing it from the point of 
view of a python user is perfectly acceptable.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Hans Nowak wrote:
Quote:
"this is comp.lang.python, not comp.lang.boo."

Which is obviously not the same as "Boo should not be mentioned on this 
newsgroup".  
I used the exact same phrase in another note except using the term 
"logo" instead of "boo", and that is the exact interpretation I 
immediately received from others - they felt I was censuring the 
discussion here, as I felt you were.

> The discussion with Logo and other languages in it was off-topic too,
> but it wasn't offensive to anyone.
I'm not going to dignify that or the rest of your note with a response.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Doug Holton
Hans Nowak wrote:
 > The discussion with Logo and other languages in it was off-topic too,
 > but it wasn't offensive to anyone.
I'm not going to dignify that or the rest of your note with a response.

No, by all means, let's ignore any pieces of a post that might lead to 
constructive discussion.

Well, it's been fun, but I really don't have time for this.  If we 
cannot end this thread with some kind of mutual understanding, then I 
will end it unilaterally.  You have the dubious honor of being the first 
person in my killfile since 1997.

You've yet again confirmed that your only point in this whole thread was 
to be disrepectful and complain about what offends you.  And you end it 
with yet more parting insults.  If you had better articulated what you 
really meant at the beginning, I never would have responded to you.
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >