Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-26 Thread Ed Leafe
On Jan 26, 2021, at 18:16, Grant Edwards  wrote:
> 
>> How do you troubleshooting/debugging in Python?
> 
> Mostly I read exception trace and read the code and think about it.
> 
> If that doesn't work, I add some print() or syslog() calls.
> 
> If I really get stuck, I try to write as small a program as possible
> that demonstrates the problem.

I do the first two, but if I get really stuck, I use the pudb debugger 
(https://pypi.org/project/pudb/).

Using that, I can see all the locals, jump to any point in the stack and see 
the locals there, or shell into ipython if I need to run some quick code. For 
me, this is much faster than trying to write an additional program that is 
close enough to the problem code to be useful.

-- Ed Leafe






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


Request help w/pip install jq

2020-07-19 Thread Ed Walser
Hi all,

I've tried installing jq several times in my local environment, but it
fails, saying it can't find a file that pip downloads.  Here is the entire
pip output:

(base) C:\Users\edwal>pip install jq

Collecting jq

  Downloading jq-1.0.2.tar.gz (57 kB)

 || 57 kB 703 kB/s

  Installing build dependencies ... done

  Getting requirements to build wheel ... done

Preparing wheel metadata ... done

Building wheels for collected packages: jq

  Building wheel for jq (PEP 517) ... error

  ERROR: Command errored out with exit status 1:

   command: 'C:\Users\edwal\anaconda3\envs\planet1\python.exe'
'C:\Users\edwal\anaconda3\envs\planet1\lib\site-packages\pip\_vendor\pep517\_in_process.py'
build_wheel 'C:\Users\edwal\AppData\Local\Temp\tmpd0skcxv2'

   cwd: C:\Users\edwal\AppData\Local\Temp\pip-install-bwgrrs8c\jq

  Complete output (7 lines):

  running bdist_wheel

  running build

  running build_ext

  Downloading
https://github.com/kkos/oniguruma/releases/download/v6.9.4/onig-6.9.4.tar.gz

  Downloaded
https://github.com/kkos/oniguruma/releases/download/v6.9.4/onig-6.9.4.tar.gz

  Executing: ./configure CFLAGS=-fPIC
--prefix=C:\Users\edwal\AppData\Local\Temp\pip-install-bwgrrs8c\jq\_deps\onig-install-6.9.4

  error: [WinError 2] The system cannot find the file specified

  

  ERROR: Failed building wheel for jq

Failed to build jq

ERROR: Could not build wheels for jq which use PEP 517 and cannot be
installed directly

-- 
Ed Walser
e...@walseranalyticsconsulting.com
571.364.9618
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What user-defined request error levels are recommended?

2020-04-30 Thread Ed Leafe via Python-list
On Apr 30, 2020, at 15:14, Dan Campbell  wrote:
> 
> Hi, what range of error codes are recommended, if we wanted to return a 
> user-defined code?
> 
> Obviously, we don't want to use a code in the 200+ range, or the 400+ range, 
> e.g.
> 
> I want to throw, or just return, a code that represents that the size of a 
> web page (len(response.content)) is less than the expected size.

You can create your own internal codes as long as they don’t clash with the 
standard code. If the custom code is for a success, a 2xx code would be 
appropriate. If it is a user error, you could use a 4xx code.

However, I would prefer to use the standard codes, and add a custom header with 
more information on the issue.


-- Ed Leafe






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


Re: How to force "python -m site" ENABLE_USER_SITE to false?

2019-06-21 Thread Ed Leafe
On Jun 21, 2019, at 8:49 AM, Malcolm Greene  wrote:
> 
> Any suggestions on how one can force the "python -m site" ENABLE_USER_SITE 
> value to false?
> 
> Is it possible to globally force this setting - across all users - when 
> installing a system wide version of Python ... or via a command line option 
> when starting a Python session?

>From StackOverflow: 
>https://stackoverflow.com/questions/25584276/how-to-disable-site-enable-user-site-for-an-environment

-- Ed Leafe





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


Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Ed Kellett
On 2018-07-15 15:52, Steven D'Aprano wrote:
> On Sun, 15 Jul 2018 14:17:51 +0300, Marko Rauhamaa wrote:
> 
>> Steven D'Aprano :
>>
>>> On Sun, 15 Jul 2018 11:43:14 +0300, Marko Rauhamaa wrote:
 Paul Rubin :
> I don't think Go is the answer either, but it probably got strings
> right.  What is the answer?
>>>
>>> Go strings aren't text strings. They're byte strings. When you say that
>>> Go got them right, that depends on your definition of success.
>>>
>>> If your definition of "success" is:
>>>
>>> - fail to be able to support 80% + of the world's languages
>>>   and a majority of the world's text;
>>
>> Of course byte strings can support at least as many languages as
>> Python3's code point strings and at least equally well.
> 
> You cannot possibly be serious.
> 
> There are 256 possible byte values. China alone has over 10,000 different 
> characters. You can't represent 10,000+ characters using only 256 
> distinct code points.
> 
> You can't even represent the world's languages using 16-bit word-strings 
> instead of byte strings.

I think you're tearing down a straw man here. (So is Marko.)

The byte-string-only argument is to use byte strings containing encoded
text. This does always work. It's just very easy to make mistakes like
double-encoding.

The "do what Python 3 does" argument is, as I see it, that it's better
to deal with text independently of its encoding, and explicitly
converting to and from byte representations. I'm very much in favour,
not particularly because it prevents errors (though it does), but
because it saves me from having to manage irrelevant details like the
encoding of the text in question.

Imagine if people made the same argument: "byte strings are better than
a representation-independent type" about, say, integers. Using byte
strings instead of integers is great! You can roundtrip any integer and
not care how it's encoded! You can print it to a terminal or a file or
anything without having to pointlessly re-encode it! Okay, so things get
a bit hairy if someone uses hex instead of the obviously-superior
decimal, but nobody does that. And when they do, you can just
bytes.decode('int-hex'). Just remember not to do it more than once, a
famously easy problem in programming that has never bitten anyone ever,
and you're golden. Look at all the problems this solves! Now we can even
parse a file format with integers in it and emit them again without
having to know what encoding the integers are, which doesn't actually
save us from any encoding headaches because we need to figure out the
encoding to work with those integers at all, but will make for good
ammunition against those ridiculous integer zealots.

On a more serious note, I think this particular aspect of Python causes
quite a lot of difficulty for Python 2 programs that make heavy use of
the bytes-text duality, and quite a lot of peace of mind for every other
case. So, Marko, I don't know what code you work on, but I think it's
unfair to attack Python 3's unicode handling too hard if you haven't
written a new project with it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable scope in try ... EXCEPT block.

2018-07-13 Thread Ed Kellett
On 2018-07-12 18:00, Chris Angelico wrote:
> What do you mean by "fix"? Make the 'x' bind eagerly? That would break
> basically every other use of closures.

No. I mean make each x a new variable--closures would work as before,
for-loops would change. If we have subscopes, it seems natural that
entering a subscope multiple times creates a new instance of that
subscope's namespace.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ed Kellett
On 2018-07-12 14:03, Chris Angelico wrote:
> Dealing with reference cycles is generally done *periodically* rather
> than immediately (CPython disposes of unreferenced objects immediately
> upon last deref). You can avoid having a dedicated cycle detection
> pass by using a mark-and-sweep GC, but that just means that *all*
> garbage is dealt with periodically rather than immediately. I can
> imagine having some sort of flag on every object that's involved in a
> cycle, and then doing a mini-GC every time any of those objects gets
> any dereferencing, but that would be ridiculously expensive. There are
> ALWAYS tradeoffs. How is Python's arrangement "the worst"?

It pays the cost of a reference counter and a garbage collector and the
language designers *still* feel like they have to add weird hacks like
the implicit del. I agree there are always tradeoffs. But it feels like
Python has made tradeoffs that should allow it to never worry about
cycles ever, and then it goes ahead and worries about cycles anyway.

> Personally, I think this would be better with an *actual* subscope.
> But apparently that's a ridiculously insane suggestion with no chance
> whatsoever of being accepted. Kinda like assignment expressions.

FWIW, I'd vastly prefer some kind of reconsidering of the scoping
approach to assignment expressions. I don't want to have a 1th
iteration of the same old argument about them, but I think subscoping is
way more applicable: at least to me, it'd make all code more readable by
default, because it'd tend to make namespaces emptier and therefore
easier to hold in memory.

Could we fix:

  for x in something:
blah(lambda a: a + x)

while we're at it?

Also, since we're well into the realm of crazy here, when are we making
nonlocal the default?

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


Re: variable scope in try ... EXCEPT block.

2018-07-12 Thread Ed Kellett
On 2018-07-12 10:59, Steven D'Aprano wrote:
> On Thu, 12 Jul 2018 01:37:24 -0700, aleiphoenix wrote:
> 
>> My question is, does except ... as ... create a new scope from outer
>> block, causing 'err' be hidden from outer scope? Is this intentional?
> 
> No, it is not a new scope, and yes, it is intentional. It's a nasty hack, 
> but a *necessary* nasty hack: when the except block exits, the "err" 
> local variable (or whatever it happens to be called) is implicitly 
> deleted.
> 
> You can work around this by explicitly assigning to another local 
> variable:
> 
> try:
> ...
> except Exception as e:
> err = e  # only "e" will be deleted when we exit the block
> 
> 
> This is necessary in Python 3 [...]

"necessary" is debatable. When we have reference counting, general
garbage collection, *and* nasty hacks like this, one could be forgiven
for thinking Python has chosen the worst of all memory-management worlds.

That said, in this case it's entirely livable-with once one knows about it.

Unrelatedly, having stared at this email for a moment, I really wish
Thunderbird had an option to avoid orphan
words

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


Re: Static variables [was Re: syntax difference]

2018-06-24 Thread Ed Kellett
From: Ed Kellett 

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Xw5fa1GFtucLPGBT1sLtLtUpmbraGkiYl
Content-Type: multipart/mixed; boundary="lDyl22ZCUIEM3fl5YMnfJ3B8O9bwBCY9r";
 protected-headers="v1"
From: Ed Kellett 
To: python-list@python.org
Message-ID: <98ecd8c1-13b7-8317-8177-6a3592171...@kellett.im>
Subject: Re: Static variables [was Re: syntax difference]
References: <72edc16a-69e0-41a2-bec3-290083f6e...@googlegroups.com>
 
 
 
 <01092eb6-172f-5ee0-91fb-4e3e1df99...@gmail.com>
 
 
 <6eUVC.491716$Qg7.378011@fx08.am4> 
 
 
 
 
 
 
 <2937f981-e2dc-41d6-9d89-373496cb5...@googlegroups.com>
 
 
 
 
 
 
In-Reply-To: 

--lDyl22ZCUIEM3fl5YMnfJ3B8O9bwBCY9r
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 2018-06-23 06:21, Chris Angelico wrote:
> Let's start finding all the edge cases that don't work, so I can work
> on fixing them :)

Very long functions (or, more specifically, functions with a very large number
of consts) will likely prove annoying.


--lDyl22ZCUIEM3fl5YMnfJ3B8O9bwBCY9r--

--Xw5fa1GFtucLPGBT1sLtLtUpmbraGkiYl
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-BEGIN PGP SIGNATURE-

iQEzBAEBCAAdFiEECzNSP7n340AYaHPmcC7hJ3E8yBAFAlsuRkYACgkQcC7hJ3E8
yBBYbQf/fqEhdZWJoA/1Zq2x9dV0LgDTTAU0T8ze6jjMoq/Wxj/kzovLSgWODD8u
63tJgR9c2twEVdfILiWmgKD1BSzyLGXN/LOEjieFu62tqYVfDJOf6g0/pBzG5Ih3
rsGt9e1tx8S60xUR7pnEtbSrMtKruclUaUQQXnpJG4mHKwaLKgpQDSknTKyHzOec
ulf+iQxWb5v9pG8fwsygdrKYsObKdQJrCUI3ggeDFYkSJK/sDBYitIlpSaHNNaV+
QZQFaf0j9ACLttVIhOJxWxnlxmbbNQ7P5Z4QdznI1y5xUnEIAgNKPTMjjgsb1h5Y
Q8gx7MxYB6+reNHQNl7V2b5UxAWYwQ==
=rmC2
-END PGP SIGNATURE-

--Xw5fa1GFtucLPGBT1sLtLtUpmbraGkiYl--

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-23 Thread Ed Kellett
On 2018-06-23 06:21, Chris Angelico wrote:
> Let's start finding all the edge cases that don't work, so I can work
> on fixing them :)

Very long functions (or, more specifically, functions with a very large
number of consts) will likely prove annoying.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-19 Thread Ed Kellett
On 2018-06-19 11:21, Chris Angelico wrote:
> Isn't it nice how comments, being terminated exclusively by
> end-of-line, allow the introduction of subtle bugs? Let's see how many
> people spot the (presumably deliberate) bug in Steve's code here.

Hardly subtle.

It does also make them considerably easier to remove from code. I think
we're all--still--missing the larger point that "easy to remove" is a
completely stupid metric for judging language features. Seriously. Not a
little bit stupid. What would Python look like if every new feature had
to be possible to grep out?



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-18 Thread Ed Kellett
are you someone's ironic 3rd-year art project



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-18 Thread Ed Kellett
On 2018-06-18 13:18, Chris Angelico wrote:
> 1) Parse the code, keeping all the non-essential parts as well as the
> essential parts.
> 2) Find the comments, or find the annotations
> 3) If comments, figure out if they're the ones you want to remove.
> 4) Reconstruct the file without the bits you want to remember.
> 
> Step 3 is removed if you're using syntactic annotations. Otherwise,
> they're identical.

It's likely that Python comments are much easier to remove than
arbitrary bits of Python syntax--you need to know the answer to "am I in
a string literal?", which is a lexical analysis problem you could hack
together a solution for over the course of about one coffee, as opposed
to "where exactly am I in the Python parse tree?", which is... harder.
The information you need to keep track of and later reconstruct is
substantially simpler, too.

I don't think "they're hard to mechanically remove" is a particularly
good argument against type hints, but considered on its own it probably
is true.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Does inspect.getstack work on other Python implementations?

2018-06-17 Thread Ed Kellett
On 2018-06-17 10:19, Steven D'Aprano wrote:
> Anyone here use IronPython, Jython or PyPy?
> 
> Does inspect.getstack always work? Is it considered an implementation
> detail for CPython or something promised to work on any compliant
> Python interpreter?
> 
> I see that it doesn't even exist on Jython 2.5, does anyone know 
> whether it exists in later versions?

Well, inspect.currentframe says:

> CPython implementation detail: This function relies on Python stack 
> frame support in the interpreter, which isn’t guaranteed to exist in 
> all implementations of Python. If running in an implementation 
> without Python stack frame support this function returns None.

and presumably if stack frame support isn't guaranteed to exist for one
inspect function it's similarly un-guaranteed in others.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Splitting up large python module impact on performance?

2018-06-13 Thread Ed Kellett
On 2018-06-13 05:24, Chris Angelico wrote:
> Oh wait, your code isn't anything remotely sane. But for the rest of
> us, large files aren't a problem.

I don't like large files--I think mostly because files are an
organisational tool, they're quite good at that job, and one might as
well use them. But slightly more concretely, Python encourages us to use
module scope for things like imports, which can easily get messy and
confusing when files are large. A find feature isn't a replacement for a
global scope that's small enough to remember.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why exception from os.path.exists()?

2018-06-09 Thread Ed Kellett
On 2018-06-08 03:42, Chris Angelico wrote:
> Apart from the one odd bug with SimpleHTTPServer not properly sending
> back 500s, I very much doubt that the original concern - namely that
> os.path.exists() and os.stat() raise ValueError if therels a %00 in
> the URL - can be abused effectively.
Dismissing HTTP 500s as "not a vulnerability" sounds reasonable enough
to me. But you're assuming that all other expressions of this bug in
applications will be at least as benign. I'm not sure that that's warranted.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python web server weirdness

2018-06-07 Thread Ed Kellett
On 2018-06-07 14:32, Steven D'Aprano wrote:
> I'm following the instructions here:
> 
> https://docs.python.org/3/library/http.server.html
> 
> 
> and running this from the command line as a regular unprivileged user:
> 
> python3.5 -m http.server 8000
> 
> What I expected was a directory listing of my current directory.
> 
> What I got was Livejournal's front page.
> 
> W.T.F.???
> 
> 

Do you have LiveJournal's index.html in your current directory?



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


I need help with this python regex

2018-04-27 Thread Ed Manning
Here is the source code.


import re


log = open("csg.txt", "r") # Opens a file call session.txt
regex = re.compile(r'policy id \d+') # search for the policy ID
regex1 = re.compile(r'log count \d+') # search for the policy ID

for match in log:
x = regex.findall(match)
y = regex1.findall(match)

q = x + y
print(q)
 

The problem I am having i when it print out ti looks like this


L'Policy ID 243"|
[]
[]
[]
[]
[]
[]
[]
[]
{'log count 777,"]



How so I fix the code sone that it does not print empty []






Here so to the test file 


 get policy id 243
name:"csg to wes" (id 243), zone csg -> fwc,action Permit, status "enabled"
10 sources: "206.221.59.229", "206.221.59.246/32", "csg_205.144.151.107/32", 
"csg_205.144.151.177/32", "csg_205.144.151.24/32", "csg_205.144.152.50/32", 
"csg_205.144.153.55/32", "csg_206.221.59.244/32", "csg_206.221.59.250/32", 
"csg_206.221.61.29/32"
19 destinations: "MIP(204.235.119.135)", "MIP(204.235.119.136)", 
"MIP(204.235.119.243)", "MIP(204.235.119.34)", "MIP(204.235.119.39)", 
"MIP(204.235.119.40)", "MIP(204.235.119.41)", "MIP(204.235.119.42)", 
"MIP(204.235.119.43)", "MIP(204.235.119.44)", "MIP(204.235.119.45)", 
"MIP(204.235.119.46)", "MIP(204.235.119.47)", "MIP(204.235.119.50)", 
"MIP(204.235.119.51)", "MIP(204.235.119.52)", "MIP(204.235.119.79)", 
"MIP(204.235.119.82)", "MIP(204.235.119.83)"
1 service: "ANY"
Rules on this VPN policy: 0
nat off, Web filtering : disabled
vpn unknown vpn, policy flag 0001, session backup: on
traffic shaping off, scheduler n/a, serv flag 00
log close, log count 777, alert no, counter yes(79) byte rate(sec/min) 0/0
total octets 0, counter(session/packet/octet) 0/0/79
priority 7, diffserv marking Off
tadapter: state off, gbw/mbw 0/0 policing (no)
No Authentication
No User, User Group or Group expression se
 get policy id 602
name:"ID 36129" (id 602), zone csg -> fwc,action Permit, status "enabled"
src "csg_205.144.151.107/32", dst "MIP(204.235.119.191)", serv "ANY"
Rules on this VPN policy: 0
nat off, Web filtering : disabled
vpn unknown vpn, policy flag 0001, session backup: on
traffic shaping off, scheduler n/a, serv flag 00
log close, log count 0, alert no, counter yes(80) byte rate(sec/min) 0/0
total octets 0, counter(session/packet/octet) 0/0/80
priority 7, diffserv marking Off
tadapter: state off, gbw/mbw 0/0 policing (no)
No Authentication
No User, User Group or Group expression set
csg-vx-fw-n-12:csg-vx-fw-n-01(M)-> get policy id 420
name:"ID 12637" (id 420), zone csg -> fwc,action Permit, status "enabled"
1 source: "csg_204.235.119.78/32"
1 destination: "eg_csg"
6 services: "PING", "tcp_30001-30100", "tcp_6051-6055", "tcp_7041-7091", 
"TELNET", "TRACEROUTE"
Rules on this VPN policy: 0
nat off, Web filtering : disabled
vpn unknown vpn, policy flag 0001, session backup: on
traffic shaping off, scheduler n/a, serv flag 00
log close, log count 0, alert no, counter yes(81) byte rate(sec/min) 0/0
total octets 0, counter(session/packet/octet) 0/0/81
priority 7, diffserv marking Off
tadapter: state off, gbw/mbw 0/0 policing (no)
No Authentication
No User, User Group or Group expression set
-- 
https://mail.python.org/mailman/listinfo/python-list


learn from the masters of python and other languages, free

2014-11-17 Thread ed
Hey all,

Wanted to let you know about a special opportunity for subscribers to this 
list..

I'm hosting a virtual conference called hack.summit() happening December 1-4, 
where you can learn from some of the best programmers in the world.  An 
unprecedented line-up of programmers are speaking, including creators of Ruby 
on Rails, CSS, Google Glass, the Java language spec, Agile, Extreme 
Programming, Test Driven Development, Heroku, Spark, Bittorrent, UML, the Wiki, 
and many more.

ALL proceeds go to support coding non-profits, such as ones that help drive 
inclusivity and diversity in the coding space.

I'm happy to offer you guys free passes to bypass the registration process and 
join for free.  Just visit hacksummit.org and register using the code 
REGISTERFREE.

Over 12,000 developers registered in the first few days -- if this continues, 
then this will be one of the largest developer events ever held.  You're not 
going to want to miss it.

Hope to see you at the summit, and thanks for your time :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Python code to distinguish between data having, 2 different formats, in a given cell(MS Excel).

2014-08-23 Thread Ed Joz
I got an excel sheet having,2 blocks of data in 2 different formats, in any 
given cell.

Lets take cell A1 for example, 1st block has font = Arial, character size =10 
2nd block has font = Times New Roman, character size = 16 OR **no data**

sample: "abcd123

PQRS456"

A python code need to be developed. It should check every cell, and print the 
data whose, font = Times New Roman & character size = 16 .If the cell is not 
having any data in that format, '0' should be printed.The data can be printed 
into a notepad.

Please suggest a sample python code.
-- 
https://mail.python.org/mailman/listinfo/python-list


[Announce] Python-Future v0.13; cheatsheet for Python 2/3 compatible code

2014-08-12 Thread Ed Schofield
Hi all,

I am happy to announce an update to Python-Future for Python 2/3 compatibility 
and a new cheat-sheet for writing code compatible with both versions.

Here’s the "What’s New" page for v0.13:

http://python-future.org/whatsnew.html

Here’s the Py2/3 compatibility cheat-sheet:

http://python-future.org/compatible_idioms.html

or as a PDF:

http://python-future.org/compatible_idioms.pdf

The cheat-sheet accompanies a talk I gave at PyCon AU 2014 last weekend called 
“Writing Python 2/3 compatible code”. I will add a link to the video and slides 
from the cheat-sheet page when they are online.

I would be happy to accept pull requests for additions or changes to the Py2/3 
cheat-sheet. The source is here:


https://github.com/PythonCharmers/python-future/blob/master/docs/notebooks/Writing%20Python%202-3%20compatible%20code.ipynb

Best wishes,
Ed


--
Dr. Edward Schofield
Python Charmers
http://pythoncharmers.com

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


Save/restore breakpoints between pdb runs

2014-07-11 Thread Ed Blackman
I've recently started using Python for my job (as opposed to writing 
smallish scripts for personal use), and so have needed to debug quite a 
bit more.


I've been using pdb mainly via 'python -m pdb script args'.  Perhaps 
it's my Java background, but even when I have permissions to change the 
source, I find editing source to insert 'import pdb; pdb.set_trace()' 
unnatural.  The consequence is that I have to recreate my breakpoints 
when I have to exit pdb.


I've written the following code, which I load from .pdbrc with 
'execfile(os.path.expanduser('~/.pydb.py'))'


Is there an alternate solution to keeping persistant breakpoints that 
works much better?  My python editing happens on a lot of different 
machines/VMs, so I prefer alternate solutions that allow me to sync over 
a couple of files, not install new binaries.


If not:
1) If is there a way in pdb to set a breakpoint on a function that isn't 
in the current file?  I can see the .funcname property of the 
breakpoint, and would prefer restoring breakpoints on functions so they 
don't break if I change line numbers.  "b func_name" works in the 
current file, but "b file:func_name" doesn't.
2) Is there a way to list the commands for each breakpoint, so that they 
can be restored as well?


Any other comments or suggestions for improvement would be welcome.

def savebps():
   import pdb

   bp_num = 0
   for bp in pdb.bdb.Breakpoint.bpbynumber:
   # pdb commands operate on breakpoint number, so keep track of
   # the number the recreated breakpoint would have
   if bp is None:
   continue
   else:
   bp_num += 1

   command = 'tbreak' if bp.temporary else 'b'
   cond = '' if bp.cond is None else ', ' + bp.cond

   print("%s %s:%d%s" % (command, bp.file, bp.line, cond))

   if not bp.enabled:
   print("disable %d" % (bp_num))

   if bp.ignore > 0:
   print("ignore %d %d" % (bp_num, bp.ignore))

   print('')

--
Ed Blackman
--
https://mail.python.org/mailman/listinfo/python-list


Can Python do this? First steps, links to resources or complete software referals appreciated.

2014-05-22 Thread ed . cottam
Hi, I'm an academic and I want to find/adapt/create a script that will grab 
abstracts (150-250 words of text) from Google Scholar search results and sort 
them by relevance (e.g. keywords, keyword combinations, anything other way you 
can think of). 

Any of you guys know of a script that does this already? Preferably open 
source? If not, any resources you could bring to my attention? I' a complete 
Newb!

Thanks for your help. 

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


Question about import hooks

2013-11-23 Thread Ed Schofield
Hi all, 

I am the author of the ``future`` package for Python 2/3 compatibility 
(http://python-future.org). A bug report has recently been posted about its use 
of import hooks that I don't yet have an answer for, and I am looking for some 
guidance on how to customize the import mechanism in a safer way.

The current interface is as follows:

>>> from future import standard_library

Any subsequent import statements using Python 3-style module names are mapped 
onto the relevant Python 2-style names (or, where needed, backported modules 
provided by ``future``). For example, these then work in the same way on both 
Python 2 and Python 3:

>>> from http.client import HttpConnection
>>> import html.parser
>>> import queue

>>> import configparser

Although this is a nice interface, reminiscent of ``from __future__ import 
...``, the problem is that the current implementation, which appends finder 
objects to the ``sys.meta_path`` list 
(http://docs.python.org/2/library/sys.html#sys.meta_path) renders the import 
hooks globally, even for modules imported by other modules. What I want instead 
is for the import hooks to apply only to a particular module, so that a script 
containing:

from future import standard_library
import requests

would not apply the import hooks to modules imported within the ``requests`` 
module, merely to import statements in the script itself.

There is a note in the Python 3.3 documentation (and the current Python 3.4 
draft) that I had hoped would provide the answer for how to implement this:

"When calling __import__() 
(http://docs.python.org/3/library/functions.html#__import__)
as part of an import statement, the import system first checks the module 
global namespace for a function by that name. If it is not found, then the 
standard builtin __import__() 
(http://docs.python.org/3/library/functions.html#__import__)
is called."


If this were true, it would be possible to change the interface to something 
like this:

>>> from future.standard_library import __import__

which would then override the ``__import__`` function in ``builtins`` or 
``__builtin__`` affecting subsequent ``import`` statements only in that module. 
The interface wouldn't be quite as nice, but it wouldn't cause the import hooks 
to bleed into other modules that don't need them. However, the docs seem to be 
wrong; defining __import__ as a global seems to have no effect on imports in 
Py3.3, and ``future`` needs to implement this for Python 2 anyway.

Can you think of a way to implement import hooks safely, for one particular 
module, while providing a nice clean interface? Preferably this would remain 
accessible through a one-line import like ``from future import 
standard_library``.

Thanks in advance for any ideas!

Best wishes,
Ed


-- 
Dr. Edward Schofield
(M) +61 (0)405 676 229
Python Charmers
http://pythoncharmers.com


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


How can I get the variable to subtract the input please?

2013-11-18 Thread Ed Taylor
This will be very simple to most of you I guess but it's killing me!

print ("Please type in your age")
age =  input ()
leave = 16
print ("You have" + leave - age + "years left at school")

I want to have an input where the users age is inserted and then subtracted 
from the variable age which is set to 16 and the answer displayed as You have x 
years left at school.

Help much appreciated.

Thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 5:30 PM, Devyn Collier Johnson  
wrote:

> Evidently, it is personal preference. I prefer to read computer code like a 
> book (yes, I am a weirdo (^u^)). The only time I exced 79 characters is when 
> I write a set of commands that perform similar tasks. I do not make too many 
> lines over 79 char. Thanks everyone for the comments and feedback.

I have heard this statement before, and so I'm wondering: do you read books 
printed in monospaced typefaces, or do they have proportional fonts? I've yet 
to come across anything meant to be read as literature that was monospaced, 
because it is much harder to read.

I had read about a developer who switched to using proportional fonts for 
coding, and somewhat skeptically, tried it out. After a day or so it stopped 
looking strange, and after a week it seemed so much easier to read. I only 
switched back because I found I lost productivity switching from vim to a 
graphical text editor.


-- Ed Leafe





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


Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 3:08 PM, Joel Goldstick  wrote:

>> Would following
>> this recommendation improve script performance?
> 
> Not performance, but human readability

IMO, this isn't always the case. There are many lines of code that are 
broken up to meet the 79 character limit, and as a result become much less 
readable. 


-- Ed Leafe





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


Re: IDE for GUI Designer

2013-04-04 Thread Ed Leafe
On Apr 4, 2013, at 10:41 AM, Renato Barbosa Pim Pereira 
 wrote:

> Guys, is this, I wonder if there is an IDE with native support for the 
> development of GUI's such as Netbeans with Swing,Visual Basic, etc., already 
> tested the Boa Constructor, and PyQt, but did not like what I'm looking for 
> is an IDE "all in one", ie power encode and draw the screens of the program, 
> someone indicates some?, but what I would like to knoweverything together 
> with an IDE: Coding + GUI (via visual elements) without the need to import or 
> export anything, like so: I want a button, I click and drag it to a window, 
> give two clicks and encode their actions, understand?

    Check out Dabo: http://dabodev.com


-- Ed Leafe (one of the authors)





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


Re: send email with bcc

2012-11-30 Thread Ed
Oops. Sorry 'bout that. I somehow didn't grab the entire traceback info. Well, 
turns out one if not more of my BCC attempts is working. Just thought to check 
my spam filter of the BCC email address and there are quite a few messages in 
there. I've got it working now.

Thanks to you both for the quick responses!!
~Ed
-- 
http://mail.python.org/mailman/listinfo/python-list


send email with bcc

2012-11-30 Thread Ed
Hi,

I have found many different suggestions on "how to" code python to send a bcc 
email. None of which have worked in my environment - yet. Following is what I 
have at this time, which is erroring. Most of the code I've found will 
successfully send the message to the TO & CC recipients, but not the BCC. Any 
help is very much appreciated. Thx, Ed .


from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from smtplib import SMTP

to = 'e...@domain.gov'
cc = 'e...@gmailmail.com'
bcc = 'e...@domain.net'
sender = 'edsb...@domain.gov'

msg = MIMEMultipart()
msg['To'] = to
msg['Cc'] = cc
msg['Subject'] = 'Monthly Report'
msg['From'] = sender

smtp = SMTP("smtp.server.com")
# Start the server:
smtp.ehlo()

# Send the email
smtp.sendmail(sender, [to] + bcc, msg.as_string())

The above generates the following error:
Traceback (most recent call last):
  File "/opt/batch/ebtest/example4.py", line 46, in 
smtp.sendmail(sender, [to] + bcc, msg.as_string())

Other iterations of the code have worked without error, but do not send mail to 
the BCC recipient.

Thanks in advance for any assistance!
~Ed
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Ed Morton

On 10/25/2012 11:45 PM, Rivka Miller wrote:

Thanks everyone, esp this gentleman.

The solution that worked best for me is just to use a DOT before the
string as the one at the beginning of the line did not have any char
before it.


That's fine but do you understand that that is not an RE that matches on 
"$hello$ not at the start of a line", it's an RE that matches on "char>$hello$ anywhere in the line"? There's a difference - if you use a tool 
that prints the text that matches an RE then the output if the first RE existed 
would be "$hello$" while the output for the second RE would be "X$hello$" or 
"Y$hello$" or


In some tools you can use /(.)$hello$/ or similar to ignore the first part of 
the RE "(.)" and just print the second "$hello", but that ability and it's 
syntax is tool-specific, you still can't say "here's an RE that does this", 
you've got to say "here's how to find this text using tool ".


   Ed.


I guess, this requires the ability to ignore the CARAT as the beginning of the 
line.

I am a satisfied custormer. No need for returns. :)

On Oct 25, 7:11 pm, Ben Bacarisse  wrote:

Rivka Miller  writes:

On Oct 25, 2:27 pm, Danny  wrote:

Why you just don't give us the string/input, say a line or two, and
what you want off of it, so we can tell better what to suggest



no one has really helped yet.


Really?  I was going to reply but then I saw Janis had given you the
answer.  If it's not the answer, you should just reply saying what it is
that's wrong with it.


I want to search and modify.


Ah.  That was missing from the original post.  You can't expect people
to help with questions that weren't asked!  To replace you will usually
have to capture the single preceding character.  E.g. in sed:

   sed -e 's/\(.\)$hello\$/\1XXX/'

but some RE engines (Perl's, for example) allow you specify zero-width
assertions.  You could, in Perl, write

   s/(?<=.)\$hello\$/XXX/

without having to capture whatever preceded the target string.  But
since Perl also has negative zero-width look-behind you can code your
request even more directly:

   s/(?
I dont wanna be tied to a specific language etc so I just want a
regexp and as many versions as possible. Maybe I should try in emacs
and so I am now posting to emacs groups also, although javascript has
rich set of regexp facilities.


You can't always have a universal solution because different PE
implementations have different syntax and semantics, but you should be
able to translate Janis's solution of matching *something* before your
target into every RE implementation around.


examples



$hello$ should not be selected but
not hello but all of the $hello$ and $hello$ ... $hello$ each one
selected


I have taken your $s to be literal.  That's not 100 obvious since $ is a
common (universal?) RE meta-character.


--
Ben.




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


Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread Ed Morton

On 10/25/2012 8:08 PM, Rivka Miller wrote:

On Oct 25, 2:27 pm, Danny  wrote:

Why you just don't give us the string/input, say a line or two, and what you 
want off of it, so we can tell better what to suggest


no one has really helped yet.


Because there is no solution - there IS no _RE_ that will match a string not at 
the beginning of a line.


Now if you want to know how to extract a string that matches an RE in awk, 
that'd be (just one way):


   awk 'match($0,/.[$]hello[$]/) { print substr($0,RSTART+1,RLENGTH-1) }'

and other tools would have their ways of producing the same output, but that's 
not the question you're asking.


Ed.


I want to search and modify.

I dont wanna be tied to a specific language etc so I just want a
regexp and as many versions as possible. Maybe I should try in emacs
and so I am now posting to emacs groups also, although javascript has
rich set of regexp facilities.

examples

$hello$ should not be selected but
not hello but all of the $hello$ and $hello$ ... $hello$ each one
selected

=
original post
=


Hello Programmers,

I am looking for a regexp for a string not at the beginning of the
line.

For example, I want to find $hello$ that does not occur at the
beginning of the string, ie all $hello$ that exclude ^$hello$.

In addition, if you have a more difficult problem along the same
lines, I would appreciate it. For a single character, eg < not at the
beginning of the line, it is easier, ie

^[^<]+<

but I cant use the same method for more than one character string as
permutation is present and probably for more than one occurrence,
greedy or non-greedy version of [^<]+ would pick first or last but not
the middle ones, unless I break the line as I go and use the non-
greedy version of +. I do have the non-greedy version available, but
what if I didnt?

If you cannot solve the problem completely, just give me a quick
solution with the first non beginning of the line and I will go from
there as I need it in a hurry.

Thanks



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


Re: dbf.py API question

2012-08-07 Thread Ed Leafe
On Aug 2, 2012, at 10:55 AM, Ethan Furman wrote:

> SQLite has a neat feature where if you give it a the file-name of ':memory:' 
> the resulting table is in memory and not on disk.  I thought it was a cool 
> feature, but expanded it slightly: any name surrounded by colons results in 
> an in-memory table.
> 
> I'm looking at the same type of situation with indices, but now I'm wondering 
> if the :name: method is not pythonic and I should use a flag (in_memory=True) 
> when memory storage instead of disk storage is desired.

When converting from paradigms in other languages, I've often been 
tempted to follow the accepted pattern for that language, and I've almost 
always regretted it.

    When in doubt, make it as Pythonic as possible.


-- Ed Leafe



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


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:57 PM, MRAB wrote:

>>  #4 is probably the most Pythonic approach. The calling code can then 
>> decide how to react to attempting to access a deleted record. Even if you're 
>> accessing data stored in VFP tables, your module should be as Pythonic as 
>> possible.
>> 
> I disagree. I think that if you can see it should be able to go to it.

The use case was a deleted record with SET DELETED ON, which means you 
shouldn't "see" it. 


-- Ed Leafe



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


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:16 PM, Ethan Furman wrote:

> Your memory is good!  I typed it in wrong.

Well, I was an MVP for Visual Foxpro for 10 years, so... 

;-)

> I see four other options:
> 
> 0) don't move the pointer (listed for completeness)
> 1) go to that record anyway
> 2) go to the next undeleted record
> 3) go to the seventh undeleted record (possibly the least practical)
> 4) raise an exception
> 
> I still don't like it.  Any opinion on the other four choices?  I'm leaning 
> towards 1, possibly with 4 as an option:

#4 is probably the most Pythonic approach. The calling code can then 
decide how to react to attempting to access a deleted record. Even if you're 
accessing data stored in VFP tables, your module should be as Pythonic as 
possible.

> Part of the reason I feel this is reasonable is that with my dbf module it is 
> possible to create an index that does /not/ include certain records:

Deleting a record in VFP doesn't remove it from the index; I believe it 
marks that index entry as deleted, too. I think that as long as you treat the 
deleted status as the same as any other boolean column you'll be good.


-- Ed Leafe



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


Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 17, 2012, at 5:57 PM, Ethan Furman wrote:

> In Foxpro if you do a
> 
> GOTO 7
> 
> with deleted off and record 7 is deleted, the record pointer doesn't
> move (at least in version 6).
> 
> I don't like that.
> 
> I see four other options:
> 
> 0) don't move the pointer (listed for completeness)
> 1) go to that record anyway
> 2) go to the next undeleted record
> 3) go to the seventh undeleted record (possibly the least practical)
> 4) raise an exception
> 
> Any opinions?

It's been many years since I fired up VFP, but the above doesn't sound 
correct. If you have SET DELETED OFF and the GOTO 7, the pointer should move to 
the 7th record, whether it is marked deleted or not. With SET DELETED ON, the 
pointer should not move, since 7 is not a valid record.


-- Ed Leafe



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


RE: Framework for a beginner

2012-04-11 Thread Ed W LaHay
You may want to look at udacity.com CS101.  This is a free web based
training program. CS101 introduces Python the next sessions starts the week
of April 16.  During the 7 weeks of sessions you will build a web browser.


Ed W LaHay
+1 925 429 1958



-Original Message-
From: python-list-bounces+edwlahay=astound@python.org
[mailto:python-list-bounces+edwlahay=astound@python.org] On Behalf Of
biofob...@gmail.com
Sent: Wednesday, April 11, 2012 1:12 PM
To: python-list@python.org
Subject: Framework for a beginner

I am new to python and only have read the Byte of Python ebook, but want to
move to the web. I am tired of being a CMS tweaker and after I tried python,
ruby and php, the python language makes more sense (if that makes any
"sense" for the real programmers). I heard a lot of good things about
Django, Pyramid, etc, but I dont want to pick the most used or the one with
the most magic. Instead I was thinking about one that could "teach" me
python along the way. My plan is to rebuild my portfolio using python and a
framework and also benefit my python learning along the way.

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

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


Re: Dabo 0.9.4 Released!

2011-10-07 Thread Ed Leafe
On Oct 6, 2011, at 12:18 PM, Neal Becker wrote:

> What is it?

Sorry, I guess I should have included that. We've been around for so 
long I sometimes assume that everyone knows what Dabo is.

Dabo is a framework for building desktop applications. It is strongly 
geared toward database applications, although a database connection is 
completely optional. We wrap the wxPython GUI toolkit, hiding its C++ roots and 
presenting a more Pythonic interface for creating your UI.

 See more at http://dabodev.com, and feel free to ask any more 
questions.



-- Ed Leafe



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


Dabo 0.9.4 Released!

2011-10-06 Thread Ed Leafe
Yes, it's been over a year, but today we're finally releasing Dabo 
0.9.4!

What can I say? While we've been actively developing Dabo all along, 
and committing improvements and fixes regularly, we don't seem to get around to 
doing releases as often as we should. Since Dabo has a Web Update feature that 
lets developers receive regular updates between releases, most people are 
fairly current, but creating a new release will help newcomers to Dabo get up 
to speed quicker.

The changes won't be too big for most current users of the framework, 
but compared to the 0.9.3 release, lots has been fixed and improved! Full 
release notes are at:
http://svn.dabodev.com/dabo/tags/dabo-0.9.4/ChangeLog

...but here are just a few of the major changes since 0.9.3:

- better handling of edge cases in bizobj relations
- addition of support in bizobjs for many-to-many relationships
- improved efficiency in detecting changed records
- added the dDatePicker control
- added the option of vertical text for grid headers
- integrated a code editor into the command window

You can grab the latest version, as always, from 
http://dabodev.com/download



-- Ed Leafe



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


Re: Hello, and request for help with 'dynamic grids'

2011-10-03 Thread Ed Leafe
On Sep 5, 2011, at 8:33 AM, Simon Cropper wrote:

> Dabo is a great product. Spoke extensively with Ed Leafe and Paul McNett. 
> Unfortunately the framework is not 'dynamic'. If you have an fixed database 
> and tables it can quite quickly create a basic data entry setup and menu. 
> Looks great when it runs. The problem is creating the window and grid on the 
> fly.

Sorry, someone just pointed me to this message.

Of course we can build a window and grid on the fly: the command is:

form, grid = dabo.ui.browse()

...where  is a data set, or any object with a getDataSet() method, such 
as a bizobj or a cursor. I demonstrated this at my session at PyCon 2007: 
http://www.youtube.com/watch?v=y8G8AefXDo8&t=3m6s

If you don't want to do this in a separate window, you can call the 
grid's buildFromDataSet() method directly. This command has a ton of optional 
parameters to control just how you would like the grid to appear.


-- Ed Leafe



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


Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Ed Leafe
Religious fervor is one thing; freedom of religion is another!  ;-)

We strive for readability in our code, yet every printed material designed to 
be read, such as books, newspapers, etc., uses a proportional font. I switched 
to proportional fonts years ago, and am only reluctantly using fixed width 
because of vim. It doesn't take as long to get used to as you might think. 

-- Ed

Sent from my iPhone, so please excuse any top-posting.

On Jul 21, 2011, at 8:12 PM, Roy Smith  wrote:

> There are very few things I am absolutely religious about, but 
> programming in a fixed width font is one of them.

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


Re: Kind of OT - Books on software development?

2011-05-25 Thread Ed Keith
--- On Wed, 5/25/11, Ed Keith  wrote:

> I do not have my library with me, but
> I remember a book that fits the bill exactly, is was from
> Microsoft Press, I think it was called "Writing Solid Code"

I have done some research at amazon.com, and while "Writing Solid Code" is an 
excellent book that I would also recommend highly, the book I was thinking of 
was "Code Complete".

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


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


Re: Kind of OT - Books on software development?

2011-05-25 Thread Ed Keith
I do not have my library with me, but I remember a book that fits the bill 
exactly, is was from Microsoft Press, I think it was called "Writing Solid Code"

Hope this helps,

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


--- On Wed, 5/25/11, Matty Sarro  wrote:

> From: Matty Sarro 
> Subject: Kind of OT - Books on software development?
> To: "Python list" 
> Date: Wednesday, May 25, 2011, 11:40 AM
> Hey everyone,
> I am looking at some projects coming up, which may or may
> not involve
> python. So I figured I would throw the question out there
> and see what
> everyone thinks.
> I am looking for some books on software
> engineering/development...
> something that discusses techniques from ideation, up
> through testing,
> QA, production, and then maintenance. Is there such a
> book?
> -Matthew
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abandoning Python

2011-05-22 Thread Ed Keith
Have you looked at Falcon (http://www.falconpl.org/)? It seems to have a lot of 
what you are looking for. I do not have much experience with it but I like what 
I've seen so far, except that there are not any third party tools or libraries 
libraries. Which is where Python shines.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com

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


Short circuting

2011-01-21 Thread Ed Connell
Hi,

Consider the following please:  (re_section, re_name, etc are previously
compiled patterns)

   result1 = re_section.search(line);
   result2 = re_name.search(line);
   result3 = re_data1.search(line);
   result4 = re_data2.search(line);

   if result1:
   last_section = result1.group()[18:-5]
   elif result2:
   last_name = result2.group(0)[6:-1]
   elif result3:
   data[last_section] = {last_name:
result3.group()[13:-5]}
   elif result4:
   data[last_section] = {last_name:
result4.group()[17:-5]}

It gets my goat to have to obtain all resultx when I just want the first
that is not None.  (In theory, the number of results can be much longer.)  I
can think of alternatives (raising exceptions), but they all use deep
indenting.

Ideas?

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


Modifying an existing excel spreadsheet

2010-12-20 Thread Ed Keith
I have a user supplied 'template' Excel spreadsheet. I need to create a new 
excel spreadsheet based on the supplied template, with data filled in. 

I found the tools here http://www.python-excel.org/,  and 
http://sourceforge.net/projects/pyexcelerator/. I have been trying to use the 
former, since the latter seems to be devoid of documentation (not even any 
docstrings).


My first thought was to copy the template, open the copy, modify it and save 
the modifications. But it looks like if I open an existing spreadsheet it must 
be read only. So I tried to  open the template, copy it to a new spreadsheet 
and write the new spreadsheet, but I can't seem to copy the images, and it 
looks like copying the formatting is going to be difficult.

Can anyone give me any tips or advice?

Thanks in advance,

   -EdK

Ed Keith

e_...@yahoo.com



Blog: edkeith.blogspot.com


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


Re: Style question for conditional execution

2010-11-24 Thread Ed Leafe
On Nov 24, 2010, at 1:46 PM, Gerald Britton wrote:

> Say that I have some function "f" that I will execute if some variable
> "v" evaluates true.  Using a classical procedural approach, I might
> write:
> 
>if v:
>f()
> 
> I might, however, think more in a functional-programming direction.
> Then I might write:
> 
>v and f()
> 
> Interestingly, this second expression compiles smaller (though only by
> a little) in both Python 2.6 and 3.1, which I currently have
> installed.  If I had thousands of such expressions, I could boast
> about a measurable difference but practically speaking, it is not
> significant.
> 
> What I _am_ interested in, however, is feedback from a style perspective.
> 
> What do the rest of you think about this?

Readability is key. The first is instantly understandable; the second 
only if you are familiar with that particular programming construct. Explicit 
is better than implicit, so I'd go with the first form.


-- Ed Leafe



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


Generating PDF file in Python

2010-10-26 Thread Ed Keith
I need to generate PDF files and I'm exploring what tools to use. I was planing 
on using ReportLab, but recently found some references to pango 
(http://www.pango.org/) and ciaro (http://cairographics.org/) being able to 
generate PDF files. But am having difficulty finding details.

The program must be cross platform, it needs to run on both windows and Mac and 
might need to run on Linux in the future. It needs to generate both reports and 
tables and I would like to make the layout as user configurable as practical. 

Can pango - ciaro do  this. How do they compare to ReportLab? Are there other 
options I have overlooked?

 -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Debugger - fails to "continue" with breakpoint set

2010-09-15 Thread Ed Greenberg

On 09/15/2010 02:04 PM, Thomas Jollans wrote:

On Wednesday 15 September 2010, it occurred to Ed Greenberg to exclaim:
   

I'm pretty new to Python, but I am really enjoying it as an alternative
to Perl and PHP.

When I run the debugger [import pdb; pdb.set_trace()] and then do next
and step, and evaluate variables, etc, when I hit 'c' for continue, we
go to the end, just fine.

As soon as I set a breakpoint down the line, [b] the
behavior of 'c' changes. Instead of continuing until the breakpoint, or
until the end, if the breakpoint is hidden by a conditional, the
debugger starts to treat 'c' as a step (or a next, I'm not sure which.)

This behavior is repeatable and consistent.

I see this in python 2.6.4 on Ubuntu 9.10 and also in 2.5.2 on Ubuntu
8.04 (Hardy), both using the installed packages.

I must be missing something. Assistance will be welcome.
 

I can't reproduce this. Please post a small script and debugger session
transcript that illustrate the problem clearly.

Maybe, on the way, you'll discover something you'd been missing. Maybe someone
here will be able to help you then (maybe someone is now, but not me...).
Maybe it's a bug (which it would be, if it behaves as you describe, but as I
said, it appears to work for me).
   


Here is my debugger session as requested.  Note that I set a breakpoint 
at line 7, but c still stops at lines 4, 5 and 6.  I hope somebody can 
explain this.

-
r...@cloud4:~# python --version
Python 2.6.4
r...@cloud4:~# python test.py
> /root/test.py(3)()
-> a=1
(Pdb) l
  1  #!/usr/bin/python
  2  import pdb;pdb.set_trace()
  3  ->a=1
  4  b=2
  5  c=3
  6  d=4
  7  print a,b,c,d
  8
[EOF]
(Pdb) b 7
Breakpoint 1 at /root/test.py:7
(Pdb) c
> /root/test.py(4)()
-> b=2
(Pdb) c
> /root/test.py(5)()
-> c=3
(Pdb) c
> /root/test.py(6)()
-> d=4
(Pdb) c
> /root/test.py(7)()
-> print a,b,c,d
(Pdb) c
1 2 3 4
--Return--
> /root/test.py(7)()->None
-> print a,b,c,d
(Pdb) c
r...@cloud4:~#

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


Debugger - fails to "continue" with breakpoint set

2010-09-15 Thread Ed Greenberg
I'm pretty new to Python, but I am really enjoying it as an alternative 
to Perl and PHP.


When I run the debugger [import pdb; pdb.set_trace()] and then do next 
and step, and evaluate variables, etc, when I hit 'c' for continue, we 
go to the end, just fine.


As soon as I set a breakpoint down the line, [b ] the 
behavior of 'c' changes. Instead of continuing until the breakpoint, or 
until the end, if the breakpoint is hidden by a conditional, the 
debugger starts to treat 'c' as a step (or a next, I'm not sure which.)


This behavior is repeatable and consistent.

I see this in python 2.6.4 on Ubuntu 9.10 and also in 2.5.2 on Ubuntu 
8.04 (Hardy), both using the installed packages.


I must be missing something. Assistance will be welcome.

Thanks,

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


Re: WMI in Python

2010-09-13 Thread Ed Leafe
On Sep 13, 2010, at 9:51 AM, KING LABS wrote:

> I am trying to learn Python programming. Since I need a custom
> inventory management tool for my work place. I am considering it as a
> project in the process of learning Python.
> 
> I am not looking for easiest way of doing things.
> I am considering using Python . Also I would need to build a setup of
> the tool for easy installation.
> 
> Hope I am clear this time


If you're looking for a rich client (i.e., desktop) application, and 
not a web app, you should check out Dabo: http://dabodev.com. We have hundreds 
of developers around the world using Dabo to build many different kinds of 
business applications.


-- Ed Leafe



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


ANN: Dabo 0.9.3 released

2010-09-13 Thread Ed Leafe
It's been a while, but we've finally released version 0.9.3 of the Dabo 
framework! Since Dabo has a Web Update feature that lets developers receive 
regular updates between releases, the changes won't be too big for most current 
users of the framework, but compared to the 0.9.2 release, lots has been fixed 
and improved! Full release notes are at:
http://svn.dabodev.com/dabo/tags/dabo-0.9.3/ChangeLog

...but here are the major changes since 0.9.2:

- integration of the native Python logging module for all Dabo logging
- support for DES3 cryptography in Dabo encryption
- changed all pathing to be relative to the app's HomeDirectory
- full parameterization of SQL calls
- addition of the dRichTextBox control
- improvement of unicode support with the dabo.lib.ustr() method

You can grab the latest version, as always, from 
http://dabodev.com/download


-- Ed Leafe



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


Re: Static typing, Python, D, DbC

2010-09-12 Thread Ed Keith
--- On Sun, 9/12/10, Paul Rubin  wrote:

> From: Paul Rubin 
> Subject: Re: Static typing, Python, D, DbC
> To: python-list@python.org
> Date: Sunday, September 12, 2010, 4:28 PM
> Bearophile 
> writes:
> > I see DbC for Python as a way to avoid or fix some of
> the bugs of the
> > program, and not to perform proof of correctness of
> the code. Even if
> > you can't be certain, you are able reduce the
> probabilities of some
> > bugs to happen.
> 
> I think DbC as envisioned by the Eiffel guy who coined (and
> trademarked)
> the term is that it's a static verification technique,
> marketing-speak
> annotating subroutines with pre- and post- conditions that
> can be
> checked with Hoare logic.  Runtime checks wouldn't
> qualify as that.


Eiffel throws an exception when a contract is violated. That is run time 
behavior, not static verification.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: combined functionality of ipython's %whos and pdb's next (without a resource heavy IDE)

2010-07-30 Thread Ed Leafe
On Jul 29, 2010, at 3:39 PM, Benjamin J. Racine wrote:

> I am trying to combine the ability to move line-by-line through the code as 
> is done with pdb's "next" function with ipython's ability to list all 
> variables at once... without the use of a full-fledged IDE.
> 
> I am not seeing how this might be done.  Many thanks for your help...

Check out PuDB - I use it all the time. http://pypi.python.org/pypi/pudb

Intro screencast is at http://vimeo.com/5255125


-- Ed Leafe



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


Re: Help choosing license for new projects

2010-07-13 Thread Ed Keith
--- On Mon, 7/12/10, Jake b  wrote:

> I'm starting a new python code
> project. What license do you suggest? I
> am searching, but I'm not finding a simple comparison of
> licenses. So
> I don't know which to use. Maybe MIT or Apache or LGPL or
> BSD?
> 
> Are there certain licenses to avoid using because of
> interaction
> problems between libraries using GPL2 / GPL3 / MIT / LGPL.
> / BSD with
> my own?

I generally avoid GPL, one of the reasons in interaction with other licenses.

> 
> I want:
> 1] Pretty much let anyone use it. Users do not have to
> include source
> code, as long as I get credit. (which I think normallly is
> a textfile
> with project url + name?)

This rules out GPL.

> 
> 2] (if it matters) I will be using different combinations
> of pyglet,
> pygame, wxPython, etc.

You will need to look at the individual licenses to see is they have iterations 
with other licenses.

> 
> 3] I want the option to use my own code in something
> commercial at a later date.
> 
> Does #3 complicate things, or is fine when including author
> info?

You can always re-license i, as long as you have the copyright to all the code. 
If other people have made contributions you will need to get their permission 
before you can re-license.


> 
> The choices for google code projects are:
>   Apache License 2.0

I do not use it, but it is good.

>   Eclipse license 1.0

I have not read this one, so I can not comment.

>   GPLv2
>   GPLv3

Incomparable with point one.

>   GNU lesser GPL

You would need to decide whether this is comparable with your first 
requirement. 

LGPL requires that users be able to relink with new versions of the library.  
This has always bothered me because relinking without recompiling (even when 
dynamic linking) in C/C++ is a good way to crash a program. But this should not 
be a problem with Python.

>   MIT license

This one is good.

>   Mozilla Public license 1.1

I avoid this one.

>   New BSD License

This one is good.

I personalty like the Boost License, it has very few restrictions. 

I hope this helps,

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: python instructor

2010-07-09 Thread Ed Keith
Where are you located?

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


--- On Fri, 7/9/10, Greg  wrote:

> From: Greg 
> Subject: python instructor
> To: python-list@python.org
> Date: Friday, July 9, 2010, 10:09 AM
> We're looking for a first-rate python
> trainer to come to our
> organization for a day or two.  We are a small group
> of geospatial/
> remote sensing scientists whose research spans the gap
> between
> environmental accounting/monitoring and policy and human
> interaction.
> We have about 5-10 (or so) python users (and potential
> python users)
> who could potentially apply new skills to several in-house
> projects.
> The difficulty for the teacher would be covering breadth of
> experience
> we have currently.
> 
> Any thoughts or advice would be greatly appreciated. 
> Thanks very
> much,
> 
> Greg
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


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


Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Ed Keith
I downloaded the ISO, but it seems to be just a bit too big to fit on a CD!

This seems odd to me, has anyone else had this problem?

  -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


--- On Tue, 7/6/10, sturlamolden  wrote:

> From: sturlamolden 
> Subject: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP
> To: python-list@python.org
> Date: Tuesday, July 6, 2010, 11:50 AM
> 
> Just a little reminder:
> 
> Microsoft has withdrawn VS2008 in favor of VS2010. The
> express version
> is also unavailable for download. >:((
> 
> We can still get a VC++ 2008 compiler required to build
> extensions for
> the official Python 2.6 and 2.7 binary installers here
> (Windows 7 SDK
> for .NET 3.5 SP1):
> 
> http://www.microsoft.com/downloads/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&displaylang=en
> 
> Download today, before it goes away!
> 
> Microsoft has now published a download for Windows 7 SDK
> for .NET 4.
> It has the VC++ 2010 compiler. It can be a matter of days
> before the VC
> ++ 2008 compiler is totally unavailable.
> 
> It is possible to build C and Fortran extensions for
> official Python
> 2.6/2.7 binaries on x86 using mingw. AFAIK, Microsoft's
> compiler is
> required for C++ or amd64 though. (Intel's compiler
> requires VS2008,
> which has now perished.)
> 
> Remember Python on Windows will still require VS2008 for a
> long time.
> Just take a look at the recent Python 3 loath threads.
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


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


Re: python app development

2010-07-06 Thread Ed Leafe
On Jul 3, 2010, at 1:48 PM, mo reina wrote:

> an anyone recommend a resource (book,tutorial,etc.) that focuses on
> application development in python? something similar to Practical
> Django Projects, but for stand alone applications instead of web apps
> (for now).

You should definitely check out Dabo. Several years ago we were looking 
for something in Python for developing desktop apps, and while there were 
several useful tools, there wasn't anything that integrated them together. That 
was our motivation for creating Dabo.

We have a few screencasts to help you get acquainted with Dabo; I'd 
recommend these two to start:

http://cdn.cloudfiles.mosso.com/c129431/dataenvironment1.html
http://cdn.cloudfiles.mosso.com/c129432/dataenvironment1.html

We also have a pretty comprehensive tutorial document, available at:

http://dabodev.com/pycon_tutorial

If you have any other questions, join our email discussion list and 
post them there. There are many helpful people there to answer your questions.

http://leafe.com/mailman/listinfo/dabo-users



-- Ed Leafe



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


Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Ed Keith

--- On Wed, 6/23/10, Dennis Lee Bieber  wrote:

> From: Dennis Lee Bieber 
> Subject: Re: Should I Learn Python or Ruby next?
> To: python-list@python.org
> Date: Wednesday, June 23, 2010, 1:39 AM
> On Tue, 22 Jun 2010 15:55:51 -0700,
> Stephen Hansen
> 
> declaimed the following in
> gmane.comp.python.general:
> 
> > I second Forth. Learning and using that was --
> slightly painful, but
> 
>     Just pick up any advanced HP
> programmable calculator... RPL is a
> close substitute 
> 
> > really invigorating. And I also second learning a
> functional language
> > (though I don't know if I'd inflict Haskell on
> anyone).
> >
> 
>     Is APL still available?
>         4 5 $rho 20 ? 52
> (using a common means for lack of greek keyboard)
> -- 
>     Wulfraed       
>          Dennis Lee
> Bieber         AF6VN
>         wlfr...@ix.netcom.com 
>   HTTP://wlfraed.home.netcom.com/
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
Try J. It does not require a special keyboard.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Ed Keith
--- On Wed, 6/23/10, Stephen Hansen  wrote:

> From: Stephen Hansen 
> Subject: Re: Should I Learn Python or Ruby next?
> To: python-list@python.org
> Date: Wednesday, June 23, 2010, 1:51 AM
> On 6/22/10 10:39 PM, Dennis Lee
> Bieber wrote:
> > On Tue, 22 Jun 2010 15:55:51 -0700, Stephen Hansen
> > 
> declaimed the following in
> > gmane.comp.python.general:
> > 
> >> I second Forth. Learning and using that was --
> slightly painful, but
> > 
> >     Just pick up any advanced HP
> programmable calculator... RPL is a
> > close substitute 
> 
> That's just a start. The reverse and stack-oriented nature
> of the
> language makes you have to start thinking in an interesting
> way, and
> sure, a RPL/stack-calculator can get that for you.
> 
> But then going on and doing real programming with it,
> making your own
> words (functions), ... its fun.
> 
> -- 
> 
>    Stephen Hansen
>    ... Also: Ixokai
>    ... Mail: me+list/python (AT) ixokai
> (DOT) io
>    ... Blog: http://meh.ixokai.io/
> 
> 
> -Inline Attachment Follows-
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

I agree you should learn a DIFFERENT programming language. Perl, Python, & Ruby 
are all quite similar. If you want to expand your horizons, learn one of the 
following:

  Forth -lots of fun.

  Assembler - give you a much better understanding of what is really happening 
under the hood.

  Prolog - a very different way of thinking.

Give one of them a try.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: GUIs - A Modest Proposal

2010-06-14 Thread Ed Keith
Nice! I've been looking for that trick for some time.

Thank you,

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


--- On Mon, 6/14/10, AD.  wrote:

> From: AD. 
> Subject: Re: GUIs - A Modest Proposal
> To: python-list@python.org
> Date: Monday, June 14, 2010, 8:56 PM
> On Jun 15, 11:59 am, Ed Keith 
> wrote:
> > But that is in a fixed size field,
> 
> That's why I used the same image definition in two
> different sized
> divs to show that the images position wasn't determined by
> the divs
> size.
> 
> > can you make the height change based on the height of
> the browser window, and still keep it centered?
> 
> Like this? The div is sized according to the browser window
> and
> centered. The image is a fixed size, but still centered
> within the
> div.
> 
>  "DTD/xhtml1-
> strict.dtd">
> 
> 
> 
> 
> div {
>     position: absolute;
>     border: 1px solid blue;
>     margin: auto;
>     top: 10%;
>     bottom: 10%;
>     left: 10%;
>     right: 10%;
>     }
> 
> img {
>     position: absolute;
>     width:100px;
>     height: 100px;
>     margin: auto;
>     top: 0;
>     bottom: 0;
>     left: 0;
>     right: 0;
>     border: 1px solid red;
>     }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Cheers
> Anton
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


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


Re: GUIs - A Modest Proposal

2010-06-14 Thread Ed Keith

--- On Mon, 6/14/10, AD.  wrote:

> From: AD. 
> Subject: Re: GUIs - A Modest Proposal
> To: python-list@python.org
> Date: Monday, June 14, 2010, 7:51 PM
> On Jun 14, 2:34 am, Stephen Hansen
> 
> wrote:
> > HTML+CSS have some very strong advantages. Simplicity
> is not one of
> > them. Precision web design these days is a dark art.
> (Go center an image
> > vertically and horizontally in an arbitrary sized
> field!)
> 
> I agree, and I know that's a rhetorical question, but here
> goes
> 
> (I have no idea whether this works in IE though)
> 
>  "DTD/xhtml1-
> strict.dtd">
> 
> 
> 
> div {
>     position: absolute;
>     border: 1px solid blue;
>     margin: 10px;
>     }
> #one {
>     top: 50px;
>     width: 300px;
>     height: 300px;
>     }
> #two {
>     top: 400px;
>     width: 200px;
>     height: 200px;
>     }
> img {
>     position: absolute;
>     width:100px;
>     height: 100px;
>     margin: auto;
>     top: 0;
>     bottom: 0;
>     left: 0;
>     right: 0;
>     border: 1px solid red;
>     }
> 
> 
> 
>  />
>  />
> 
> 
> 
> 
> --
> Cheers
> Anton
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

But that is in a fixed size field, can you make the height change based on the 
height of the browser window, and still keep it centered?

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-18 Thread Ed Keith
--- On Tue, 5/18/10, Robert Kern  wrote:

> From: Robert Kern 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Tuesday, May 18, 2010, 12:03 PM
> On 2010-05-16 09:25 , Ed Keith
> wrote:
> >
> > --- On Sat, 5/15/10, Lawrence D'Oliveiro 
> wrote:
> >
> >> From: Lawrence D'Oliveiro
> >> Subject: Re: Picking a license
> >> To: python-list@python.org
> >> Date: Saturday, May 15, 2010, 11:09 PM
> >> In message,
> >> Ed Keith
> >> wrote:
> >>
> >>> But if my client give someone else a copy of
> the
> >> binary I gave them, they
> >>> are now in violation.
> >>
> >> Why would they be in violation? It seems to me a
> violation
> >> would only occur
> >> if someone asked them for the source, and they
> refused.
> >> --
> >> http://mail.python.org/mailman/listinfo/python-list
> >>
> >
> > No, the GPL makes it clear that the responsibly is on
> the distributor to either supply the source or written
> notice, Caveat venditor. The violation exists regardless of
> whether or not the recipient makes a request.
> 
> No, one of the options for you is that you make the source
> available upon request.
> 

But I am required to give written notice to that effect.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Picking a license

2010-05-18 Thread Ed Keith

--- On Sat, 5/15/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Saturday, May 15, 2010, 11:09 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > But if my client give someone else a copy of the
> binary I gave them, they
> > are now in violation.
> 
> Why would they be in violation? It seems to me a violation
> would only occur 
> if someone asked them for the source, and they refused.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

No, the GPL makes it clear that the responsibly is on the distributor to either 
supply the source or written notice, Caveat venditor. The violation exists 
regardless of whether or not the recipient makes a request.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-18 Thread Ed Keith
--- On Sat, 5/15/10, Duncan Booth  wrote:

> From: Duncan Booth 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Saturday, May 15, 2010, 8:52 AM
> Ed Keith 
> wrote:
> 
> > I can not imagine anyone being stupid enough to pay me
> for rights to
> > use code I had already published under the Boost
> License, which grants
> > then the rights to do anything they want with it
> without paying me
> > anything. 
> >   -EdK
> > 
> Really?
> 
> The Boost License says, amongst other things:
> 
> > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
> ANY KIND,
> > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
> WARRANTIES OF
> > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
> TITLE AND
> > NON-INFRINGEMENT. 
> 
> Are you sure you can't imagine anyone offering to pay you
> for an 
> alternative license that came with some kind of warranty or
> support?
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Would that be a license or a support contract?

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-18 Thread Ed Keith
--- On Sat, 5/15/10, Ben Finney  wrote:

> From: Ben Finney 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Saturday, May 15, 2010, 12:57 AM
> a...@pythoncraft.com
> (Aahz) writes:
> 
> > You can't really sell Open Source software in any
> practical way;
> > someone will always undercut you once it's out in the
> wild. You can
> > only sell support for the software, which is entirely
> different.
> 
> Not at all. I've been selling all the software I write for
> clients for
> the past ten years, and it's all free software. It's been
> very practical
> for me and those I've worked with.
> 
> You can't sell free software like selling loaves of bread,
> but that's a
> much more limited case and a far cry from your claim.
> Selling free
> software is quite practical and a good way to fund
> development of
> software that otherwise wouldn't be written as free
> software.
> 
> -- 
>  \     “Why am I an atheist? I ask
> you: Why is anybody not an atheist? |
>   `\      Everyone starts out being an
> atheist.” —Andy Rooney, _Boston |
> _o__)             
>                
>                
>   Globe_ 1982-05-30 |
> Ben Finney
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Why don't your own customers under cut you? If you sell someone GPLed 
software they have the right to redistribute it for less than you are 
distributing it for. That dose not strike me as a viable business model.

How do you make it work?

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-16 Thread Ed Keith
--- On Sat, 5/15/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Saturday, May 15, 2010, 11:06 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > On Fri, 5/14/10, Lawrence D'Oliveiro
> > 
> wrote:
> > 
> >> In message ,
> >> Ed Keith wrote:
> >> 
> >>> Yes, under the GPL every one has one set of
> freedoms,
> >>> under the MIT or Boost license every one has
> more freedoms. Under other
> >>> licenses they have fewer freedoms.
> >> 
> >> But what about the “freedom” to take away
> other
> >> people’s freedom? Is that really “freedom”?
> > 
> > Yes.
> 
> But that’s a “freedom” that non-GPL licences do not
> give you, that the GPL 
> does. So which licence gives you more “freedoms”,
> again?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


? You just answered your own question. The The GPL does not give you the 
freedoms to take away other people freedom, so the the less restrictive license 
have less restrictions (which is why they are called "less restrictive" by the 
way) "Less restrictions" is a synonym for "more freedoms". To the extent that 
something is "restricted" it is not "free". To the extent which something if 
"free" it is not "restricted". 

There is clearly some kind of communication problem here. Either were are 
speaking different languages with some faulty transaction program interviewing, 
or one of is is either stupid or senile (seems a bit early for me, but it is 
possible); or you are being disingenuous. 

If you type the word 'restrict' into thesaurus.com you will get the following 
antonyms: enlarge, expand, free, let go, release, Note the second word on the 
list. Please do not take my word for it, try it yourself. Try other sites, if 
you think I may have rigged this one.

 -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-16 Thread Ed Keith
--- On Sat, 5/15/10, Robert Kern  wrote:

> From: Robert Kern 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Saturday, May 15, 2010, 1:10 PM
> On 2010-05-14 21:37 , Steven D'Aprano
> wrote:
> > On Fri, 14 May 2010 06:42:31 -0700, Ed Keith wrote:
> > 
> >> I am not a lawyer, but as I understand the LGPL,
> If I give someone
> >> something that used any LGPLed code I must give
> them the ability to
> >> relink it with any future releases of the LGPLed
> code. I think that
> >> means that I need to give them a linker and teach
> them how to use it,
> >> and I do not want to go there.
> > 
> > Surely you're joking?
> > 
> > Does this mean that if they lose their hands in an
> accident, you have to
> > come sit at their computer and do their typing?
> > 
> > The LGPL and GPL don't grant people "the ability" to
> do anything, since
> > that's not within our power to grant. Some people
> don't want to, or
> > can't, program, or don't have time. It's not like the
> LGPL is the bite of
> > a radioactive spider that can grant superpowers. It is
> a licence which
> > grants *permissions*.
> 
> No, the LGPL requires you to do something extra to enable
> your users to be able to relink your program. You need to
> provide the ability to do this, up to some unspecified and
> untested limit of reasonableness (your example is obviously
> beyond the limit of reasonableness). You can't just give
> them, say, a statically linked program and nothing else. You
> can't require for-fee, proprietary linkers. This is usually
> not hard to do (just give them unlinked .o or .obj files and
> a Makefile or project file), but it is *not* just a matter
> of granting permissions.
> 
> But you're right, you don't have to teach them how to do
> it.
> 
> -- Robert Kern
> 
> "I have come to believe that the whole world is an enigma,
> a harmless enigma
>  that is made terrible by our own mad attempt to interpret
> it as though it had
>  an underlying truth."
>   -- Umberto Eco
> 
> -- http://mail.python.org/mailman/listinfo/python-list
> 

But most of my clients run MS-Windows, and I do most of my development in C++, 
so they would need to use a proprietary linker.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-15 Thread Ed Keith
--- On Thu, 5/13/10, Steven D'Aprano  
wrote:

> From: Steven D'Aprano 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 7:41 PM
> On Thu, 13 May 2010 06:24:04 -0700,
> Ed Keith wrote:
> 
> > --- On Thu, 5/13/10, Lawrence D'Oliveiro
> > 
> wrote:
> >>
> >> What have you got against LGPL for this purpose?
> --
> >> 
> > Most of my clients would not know how to relink a
> program if their life
> > depended on it. And I do not want to put then in DLL
> hell. So I avoid
> > the LGPL.
> 
> 
> Are you implying that by distributing your libraries under
> the MIT or 
> Apache licence, no linking is required? That's a cool
> trick, can you 
> explain how it works please?
> 
> 
> 
> -- 
> Steven
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Normally I link it for them. As I read the LGPL, if I use any LGPLed code I 
need to teach the client how to link the software against any possible future 
version of the LGPLed library. 

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-15 Thread Ed Keith
--- On Fri, 5/14/10, Steven D'Aprano  
wrote:

> From: Steven D'Aprano 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 10:59 PM
> On Fri, 14 May 2010 06:39:05 -0700,
> Ed Keith wrote:
> 
> > Yes, under the GPL every one has one set of freedoms,
> under the MIT or
> > Boost license every one has more freedoms. Under other
> licenses they
> > have fewer freedoms.
> 
> I think this talk about freedoms is dangerously incomplete,
> and is 
> confusing the issue rather than shedding more light. Both
> licences grant 
> the same positive freedoms (freedom to do something).
> MIT-style licences 
> grant permission to:
> 
> * make copies of the work;
> * make derivative works based on the work; and
> * distribute those derivative works to others.
> 
> The GPL grants precisely the same three rights. There is no
> difference in 
> the rights granted.
> 
> The MIT licence imposes an obligation on the licencee:
> 
> * you must include a copy of the licence and copyright
> notice with the 
> work and/or any derivative works.
> 
> 
> The GPL adds a further obligation:
> 
> * any derivative works must also be licenced under the
> GPL.
> 
> 

That is why I prefer Boost, which adds very few obligations.



> If we want to talk about "freedoms", rather than rights and
> obligations, 
> we need to distinguish between positive freedoms (freedom
> to do 
> something) and negative freedoms (freedoms from something)
> and not just 
> blithely mix them up.
> 

Good point.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Paul Boddie  wrote:

> From: Paul Boddie 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 8:12 PM
> On 14 Mai, 21:18, Ed Keith 
> wrote:
> >
> > The GPL is fine when all parties concern understand
> what source code is
> > and what to do with it. But when you add people like
> my father to the loop
> > if gets very ugly very fast.
> 
> Sure, and when I'm not otherwise being accused of pushing
> one
> apparently rather unpopular man's agenda, I am interested
> in knowing
> what the best practices should be and how they can be
> followed more
> widely.
> 
> Although Bill Gates once apparently claimed that no-one
> needs the
> source code for their word processor or office suite, there
> are still
> benefits in people like your father having access to the
> sources, even
> if this obviously means that he isn't going to recompile it
> himself:
> he can get others to fix things, particularly if his
> favourite version
> is no longer widely supported; if you were from a part of
> the planet
> where you were comfortable with a widely-spoken "global"
> language but
> your father could only converse in a less widely-spoken
> "minority"
> language not generally supported by such software, someone
> (perhaps
> you) could undertake the task of translating that
> software.
> 
> Whether or not one is comfortable with copyleft-style
> licences, there
> clearly is a benefit in providing access to software
> governed by those
> licences. Being able to do so responsibly is obviously a
> prerequisite
> to feeling comfortable about it.
> 
> Paul
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

But if I license my software with a less restrictive license, like MIT, Boost 
or Apache, programmers can access the source code, and people like my father 
can give the executable to their friends without violating the law. IMHO that 
is better for everybody.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 10:07 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > That is one good reason for choosing to use the GPL,
> instead of a less
> > restrictive license. You can license it, for a fee, to
> someone who wants
> > to use it in some way that is not allowed under the
> GPL.
> 
> Replace “GPL” with “” and your
> statement is no less (or more) 
> true.
> 
> Funny how a lot of the arguments people keep trying to put
> forward about the 
> GPL really have nothing to do with the GPL.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

I can not imagine anyone being stupid enough to pay me for rights to use code I 
had already published under the Boost License, which grants then the rights to 
do anything they want with it without paying me anything.

  -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 9:58 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > Yes, under the GPL every one has one set of freedoms,
> under the MIT or
> > Boost license every one has more freedoms. Under other
> licenses they have
> > fewer freedoms.
> 
> But what about the “freedom” to take away other
> people’s freedom? Is that 
> really “freedom”?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Yes.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Paul Boddie  wrote:


<<<>>
> 
> No, PySide is about permitting the development of
> proprietary
> applications by providing a solution to the all-important
> "ISVs" which
> lets them develop and deploy proprietary software. Do you
> really think
> a platform vendor whose "ISVs" routinely ship proprietary
> software on
> their platform and on other platforms, and who will demand
> the ability
> to continue to do so, now expects all these "ISVs" to
> provide their
> applications under the modified BSD licence? Sure, other
> developers
> can use the software - even people releasing GPL-licensed
> software -
> but that is highly unlikely to be the primary business
> motivation. If
> you think the mobile telephony vendors are a bunch of
> fluffy bunny
> rabbits playing with each other in sugary meadows of
> niceness, I don't
> want to be present when someone directly and finally
> disabuses you of
> this belief. It's all about people selling stuff to
> "consumers" over
> and over again, preferably with the "consumers" rarely if
> ever being
> able to opt-out and do things their own way.

Do you feel the same way about Python? It is released under a 
nonrestrictive license, since you are on this list I assume you use it.

If you want, I think you could use the existing Python code base to create 
a GPLed version of Python, I think the license is permissive enough to 
allow that. If you did, do you think more people would use the GPLed 
version? 

Personally, I would use the version with the more permissive license, unless 
the GPLed version offered a significant advantage of some kind.

 -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Paul Boddie  wrote:


<<< lots of stuff snipped >>>

> > > Like I said, if you really have a problem with
> Ubuntu shipping CDs and
> > > exposing others to copyright infringement
> litigation.


<<< A lot more stuff snipped >>>

Everyone is assuming a certain degree of computer savvy.

I have not installed Ubuntu, but I understand that they strive for ease of 
use, so I assume that if ant now, at some time in the near future, my 
farther, who knows very little about computers, could install it if I gave 
him a CD with it on it (He would never be able to burn it himself).

Supposes download the ISO image and burn a CD and give it to my father. 
(As I understand it I am now in violation of the GPL, but I may not be). 
My father installs it. He likes it, he gives it to a friend. 

Now suppose, just for the sake of argument, that Ubuntu forgets to renew 
their domain name and it gets taken over by a porn site (It happens to Web 
mechanic, it could happen to anyone). If my father's friend's teenage son 
wants the source code, he can not get it from his father, who does not 
even know what source code is. He does not know that I exist, because his 
father forgot where he got the disk. He can not get the source from the 
porn site. 

Clearly someone has violated the GPL, but I'm not sure who, I think it was me, 
but I may be wrong. If not me who? My father for giving the disk I gave him to 
a friend? My father's friend for not keeping track of who gave him the disk? 
Ubuntu, for not including the source in the ISO image I downloaded? or for 
allowing a porn site to take over their domain name?

It is questions like this that make me steer clear of the GPL. If I give 
my father a CD of Microsoft software, I know I'm breaking the law. If I 
give my father a CD of BSD software licensed software I'm on firm legal 
ground. If I give my father a CD of GPLed software, I'm on shaky ground 
unless I include all the source, which he has no use for, on a second 
disk. And if he give his friend the binary disk, but not the source disk 
(which is of no value to him or his friend), then he is in violation of 
the law, and he cannot even understand why.

The GPL is fine when all parties concern understand what source code is 
and what to do with it. But when you add people like my father to the loop 
if gets very ugly very fast.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Albert van der Horst  wrote:
 
> This is a big reason for me to release everything (see my
> website,
> it is a *lot*) under GPL. If someone wants to use it they
> can,
> if someone wants to use it commercially, they can too, as
> long
> as they pay me a little bit too. Really, I'm reasonable.

I have no problem with that. 

I have played with your forth assembler a bit. It is good work, and the 
best part is that I can read the source and learn from it. Putting it out 
under GPL allows me to learn from it, and you to profit from it, a real 
win/win. Thank you very much for making it available.

I'm working on an assembler myself. I may steal your ideas, but I will not 
steal your code. I'm writing it in ocaml, your forth code would not be 
easy to translate. When/if I finish I'll publish it under a less restrictive 
open source license, because I do not think I would be able to 
persuade anyone else to pay for a commercial license. But I do not fault 
you if you think you can. 

If I did use your code I would either publish under the GPL or not publish 
at all depending on the exact circumstances. I have been know, on rare 
occasions, to use GPLed code in my own work (mostly plug-ins for GPLed 
applications). I just refuse to use it in any code for a client, because I do 
not want to require someone who does not know source code from Morse code code 
to figure out what they need to do to avoid violating the license. When I 
deliver my code to the client they are always free to do whatever they want 
with it. 

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Tobiah  wrote:

> From: Tobiah 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 11:59 AM
> 
> > Assertion II:
> >    If person A is free do perform an action
> person B is not free to
> >    perform then person A is free to do more
> than person B.
> 
> This does not hold water.  Let's say there are only 10
> activities
> available.  Person A can do number 1 and person B can
> not.  Person
> B can do activities 2 through 10, while person A can
> not.  Therefore,
> Person A is indeed free to perform an action that person B
> is not
> free to perform, but person a is *not* free to do more than
> person B.

THat argument is valid if and only if the rights of B are not a strict subset 
of the rights of A. As far as I can tell, the rights granted by the GPL are a 
strict subset of the right granted by the Boost license. So your argument does 
not work.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Patrick Maupin  wrote:

> From: Patrick Maupin 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Friday, May 14, 2010, 11:47 AM
> On May 14, 6:13 am, Lawrence
> D'Oliveiro  central.gen.new_zealand> wrote:
> > In message
> > <2b17ee77-0e49-4a97-994c-7582f86c0...@r34g2000yqj.googlegroups.com>,
> Patrick
> >
> > Maupin wrote:
> > > On May 13, 10:06 pm, Lawrence D'Oliveiro
> > > 
> wrote:
> >
> > >> Under the GPL, everybody has exactly the same
> freedoms.
> >
> > > That's absolutely not true.  For a start, the
> original author can dual-
> > > license.
> >
> > That’s nothing to do with the GPL.
> 
> If you mean "that's out of the control of the GPL" I
> agree.  But the
> whole point of the discussion has been about how people
> can't take GPL
> licensed code proprietary, making enhancements, etc. and
> I'm just
> pointing out that this doesn't apply to the original
> author.  Someone
> can decide they aren't making enough money under the GPL
> and stop
> distributing that way, and make all their enhancements
> proprietary, if
> they are the original author.
> 

That is one good reason for choosing to use the GPL, instead of a less 
restrictive license. You can license it, for a fee, to someone who wants to use 
it in some way that is not allowed under the GPL. If you use a less 
restrictive license that is not an option. Of course you still could put 
restrictions on future enhancements, but the the original code cannot have 
new restrictions put on it, only taken off. If I release code under the GPL 
today, I can change my mind and release the same code under the Boost 
license tomorrow. But if I release it with the Boost license, while 
technically I can release it with the GPL tomorrow, in practice everyone 
will use the previously released Boost licensed version.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Steven D'Aprano  
wrote:

> The GPL ensures that once software has entered the commons
> (and therefore 
> available for all), it can never be removed from the
> commons. The MIT 
> licence does not. Now, you might argue that in practice
> once software is 
> released under an MIT licence, it is unlikely to ever
> disappear from the 
> commons. Well, perhaps, but if so, that's despite and not
> because of the 
> licence.


Several years ago I released a C++ library under the Boost license. I put it up 
on a small free server. Later my hard drive crashed, both my backup copies were 
corrupted, and when I went to retrieve it from the site I found it no longer 
existed.

I am recreating the code, and it will be MUCH better this time, and it is on 
three web sites, but are you telling me that of I have used the GPL instead of 
Boost I would not have had this problem?

I use the Boost Libraries (http://www.boost.org/) in most of my code. Do you 
believe they are likely to disappear because they are not covered by the GPL?

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Thu, 5/13/10, Patrick Maupin  wrote:

> From: Patrick Maupin 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 11:35 PM
> On May 13, 10:07 pm, Lawrence
> D'Oliveiro  central.gen.new_zealand> wrote:
> 
> > How exactly does the LGPL lead to a requirement to
> “relink”?
> 
> I think this might be a misconception, but I'm not 100%
> sure.  Since
> Ed gives his customers full source code, there may not be
> the
> requirement to directly provide the ability to relink,
> because "The
> “Corresponding Application Code” for a Combined Work
> means the object
> code and/or source code for the Application." and section
> 4d0 requires
> you to "permit the user to recombine or relink" where
> "recombine"
> isn't defined directly (perhaps in the underlying GPL?)

But if my client give someone else a copy of the binary I gave them, they are 
now in violation. I do not want to put my client in this position. 

When using the GPL or LGPL you can do anything you want as long as you do not 
let anyone else use your work, but if you let someone else have a copy of you 
work you are putting them in a position where that can easily/inadvertently 
violate the law. I do not want to put clients in legal jeopardy, so I do not 
use GPL, or LGPLed code.

I do not claim that using the GLP is immoral, nor deny others right to use it. 
I just feel the risks out way the benefits for me.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Fri, 5/14/10, Steven D'Aprano  
wrote:
> 
> The GPL ensures that once software has entered the commons
> (and therefore 
> available for all), it can never be removed from the
> commons. The MIT 
> licence does not. Now, you might argue that in practice
> once software is 
> released under an MIT licence, it is unlikely to ever
> disappear from the 
> commons. Well, perhaps, but if so, that's despite and not
> because of the 
> licence.

Why is MIT licensed code any more likely to dispersal from the common that 
GPLed code? Does using the GPL somehow grantee that my server will never crash?


> 
> In practice, I believe most MIT-licenced code never even
> makes it into 
> the commons in the first place. I'm willing to predict that
> the majority 
> of code you've written for paying customers (as opposed to
> specifically 
> for open source projects) has disappeared into their code
> base, never to 
> be seen by anyone outside of the company. Am I right?

Yes, but it was licensed to the client, and never enter into the commons, That 
which never enters into the commons can never be removed.

Any MIT licensed code that I may have used is still in the common. My using it 
did not reomove it from the common. 

Has the fact that Python has been used for many commercial/propitiatory 
projects reduced your ability to make use of it? If so how?

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Thu, 5/13/10, Patrick Maupin  wrote:

> From: Patrick Maupin 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 11:45 PM
> On May 13, 10:06 pm, Lawrence
> D'Oliveiro  central.gen.new_zealand> wrote:
> > In message ,
> Ed Keith
> > wrote:
> >
> >
> >
> > > Assertion I:
> > >    If person A is free to do more than person
> B, then person A has
> > >    more freedom then person B.
> >
> > > Assertion II:
> > >    If person A is free do perform an action
> person B is not free to
> > >    perform then person A is free to do more
> than person B.
> >
> > > Assertion III:
> > >   If person B is restricted in some way that
> person A is not them Person A
> > >   is free to do something Person B is not free
> to do.
> >
> > > Conclusion:
> > >   If person B is more resticted than Peston A,
> Person A has mor freedom
> > >   than person B.
> >
> > > Which step in this reasoning do you disagree
> with?
> >
> > Under the GPL, everybody has exactly the same
> freedoms. So which of your
> > assertions is supposedly a criticism of the GPL?
> 
> That's absolutely not true.  For a start, the original
> author can dual-
> license.  This is not a theoretical issue -- it is a
> multi-million
> dollar issue.
> 
> Regards,
> Pat
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Everyone I personally know who has released code under the GPL either 
dual-licenses, or hopes to.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Thu, 5/13/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 11:07 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > On Thu, 5/13/10, Lawrence D'Oliveiro
> > 
> wrote:
> > 
> >> In message ,
> >> Ed Keith wrote:
> >> 
> >>> So if you want me to even consider using your
> library
> >>> do not use GPL, or LGPL.
> >> 
> >> What have you got against LGPL for this purpose?
> > 
> > Most of my clients would not know how to relink a
> program if their life
> > depended on it. And I do not want to put then in DLL
> hell. So I avoid the
> > LGPL.
> 
> How exactly does the LGPL lead to a requirement to
> “relink”?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

I am not a lawyer, but as I understand the LGPL, If I give someone something 
that used any LGPLed code I must give them the ability to relink it with any 
future releases of the LGPLed code. I think that means that I need to give them 
a linker and teach them how to use it, and I do not want to go there.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-14 Thread Ed Keith
--- On Thu, 5/13/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 11:06 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > Assertion I:
> >    If person A is free to do more than
> person B, then person A has
> >    more freedom then person B.
> > 
> > Assertion II:
> >    If person A is free do perform an action
> person B is not free to
> >    perform then person A is free to do more
> than person B.
> > 
> > Assertion III:
> >   If person B is restricted in some way
> that person A is not them Person A
> >   is free to do something Person B is
> not free to do.
> > 
> > Conclusion:
> >   If person B is more resticted than
> Peston A, Person A has mor freedom
> >   than person B.
> > 
> > Which step in this reasoning do you disagree with?
> 
> Under the GPL, everybody has exactly the same freedoms. So
> which of your 
> assertions is supposedly a criticism of the GPL?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Yes, under the GPL every one has one set of freedoms, under the MIT or Boost 
license every one has more freedoms. Under other licenses they have fewer 
freedoms. 

None of my point criticize the GPL, they merely defend my claim that a more 
permissive license grants more freedom. You claimed the contrary. 

Are you withdrawing your previous claim, or will you directly refute my 
arguments?

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-13 Thread Ed Keith
--- On Thu, 5/13/10, Brendan Abel <007bren...@gmail.com> wrote:

> From: Brendan Abel <007bren...@gmail.com>
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 7:30 PM
> While I think most of the
> disagreement in this long thread results
> from different beliefs in what "freedom" means, I wanted to
> add, that
> most of the responses that argue that the MIT license
> permits the user
> more freedom than the GPL, suffer from the broken window
> fallacy.
> This fallacy results from the short-sided-ness of the user
> base, as it
> is only considering the first generation of derivative
> works.
> 
> I agree, that under an MIT license, the first generation of
> derivative
> works have more freedom.  But any extra freedom gained
> here comes at
> the direct expense of all future generations of derivative
> software.
> 
> Under a GPL license, it is true that the first generation
> will have
> less freedom to distribute their software as they would
> like.  But it
> also ensures that all subsequent generations of derivative
> works have
> the freedom to access all previous derivative works.
> 
> I also want to add that I think the GPL v3 has exceeded
> this
> fundamental concept.  GPL v2 really embodies this
> meaning of "freedom".
> -- 
> http://mail.python.org/mailman/listinfo/python-list

I ALWAYS give my client my source code. But I do not want to bind them to the 
requirements of the GPL, I want them to be free do do what they want with the 
program, so I never incorporate any GPLed code in my projects.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-13 Thread Ed Keith
--- On Thu, 5/13/10, Carl Banks  wrote:

> 
> The thing you GPL fanbois refuse to understand or accept is
> that, in
> the real world, a person or company who doesn't want to
> open source
> their "derivative work" will only rarely be forced to by
> the GPL.
> They'll work around it instead, vast majority of the
> time.  They
> could:
> 
> 1. Derive their work from a project with a license that
> grants the
> user more freedom
> 2. Reimplment the functionality seperately (*cough*
> PySide)
> 3. Ignore the license

I think you have over looked the most common, keep the software in house and 
not let anyone else use it. This way you are in full compliance with the GPL. 
If you let someone else use the software that you need to talk to a lawyer, or 
GPL your software.

> 
> And no, a small number of anecdotal counterexamples is not
> any strong
> evidence to the contrary.
> 
> On the other hand, those who intended to release their work
> as open
> source are going to do it even if the license is
> permissive.  The way
> some of you GPL fanbois talk you'd think the MIT license
> prohibitied
> open source derivatives.

If I use MIT licensed code, I can give someone else access to the program with 
out binding them to the legal restrictions of the GPL. 

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com


 


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


Re: Picking a license

2010-05-13 Thread Ed Keith
--- On Thu, 5/13/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 8:25 AM
> In message
> <155f1683-9bfd-4a83-b63f-7fb0fc2f5...@g21g2000yqk.googlegroups.com>,
> Patrick 
> Maupin wrote:
> 
> > On May 12, 10:48 pm, Lawrence D'Oliveiro
> > 
> wrote:
> >
> >> In message ,
> Ed
> >> Keith wrote:
> >>
> >> > ... but to claim that putting more
> restrictions on someone give them
> >> > more freedom is pure Orwellian double speak.
> >>
> >> What about the freedom to take away other
> people’s freedom?
> > 
> > The freedom to take away other people's freedom is a
> very serious
> > power that should only be used sparingly.
> 
> Given that the GPL restricts that power, then it must be
> all right.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

I do not think anyone is claiming it is not 'all right'. The claim is being 
made that it restricts freedom.

You are free to put any restrictions you want on your software. If you use the 
GPL on a library I will not use it because I need to make a living. I do not 
dispute your right to use the GPL. I just dispute your claim that you use it to 
give me 'more freedom'.

I do not know what your reason for using the GPL is, but most of the people I 
know who use it do so so that can charge a license fee to people who want to 
use the code with out the restrictions of the GPL. They do this so they can 
make a living, which is their right, and I do not hold it against them. If I 
ever develop a library I think people would be willing to pay to license, I'd 
to the same.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-13 Thread Ed Keith
--- On Wed, 5/12/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Wednesday, May 12, 2010, 11:48 PM
> In message ,
> Ed Keith 
> wrote:
> 
> > ... but to claim that putting more restrictions on
> someone give them more
> > freedom is pure Orwellian double speak.
> 
> What about the freedom to take away other people’s
> freedom? What tuple of 
> speak would that be?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Assertion I:
   If person A is free to do more than person B, then person A has 
   more freedom then person B.

Assertion II:
   If person A is free do perform an action person B is not free to 
   perform then person A is free to do more than person B.

Assertion III:
  If person B is restricted in some way that person A is not them Person A 
  is free to do something Person B is not free to do.

Conclusion:
  If person B is more resticted than Peston A, Person A has mor freedom
  than person B.

Which step in this reasoning do you disagree with?

 -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-13 Thread Ed Keith
Consider the following scenario:

Three programmers, call them A, B & C, independently develop three different 
algorithms to perform a O(ln(n)) search. Each decide to release it for 'free'.

A decides to make it 'free', by publishing compiled object code for all major 
platforms and putting them in the public domain.

B decides to make it 'free' by publishing the source code under the GPL.

C decides to make it 'free' by publishing the source code under the Boost 
license.

Which library should be incorporated into the next Python release?, and why?

I vote for C, but would like to hear any arguments for another position.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Picking a license

2010-05-13 Thread Ed Keith
--- On Thu, 5/13/10, Lawrence D'Oliveiro  
wrote:

> From: Lawrence D'Oliveiro 
> Subject: Re: Picking a license
> To: python-list@python.org
> Date: Thursday, May 13, 2010, 8:38 AM
> In message ,
> Ed Keith 
> wrote:
> 
> > If, on the other hand you are releasing a library, to
> be incorporated into
> > other products, If you release it under the GPL I will
> not take the time
> > to learn it. I do not want to have to think about what
> took I can legally
> > use for what job. Libraries with permissive licenses
> can be used in any
> > project. Many contracts prohibit the use of GPL or
> LGPL code. So I do not
> > waist my time learning to use libraries covered by
> restrictive licenses.
> > So if you want me to even consider using your library
> do not use GPL, or
> > LGPL.
> 
> What have you got against LGPL for this purpose?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Most of my clients would not know how to relink a program if their life 
depended on it. And I do not want to put then in DLL hell. So I avoid the LGPL.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-12 Thread Ed Keith
--- On Mon, 5/10/10, Ben Finney  wrote:

> So I object to muddying the issue by misrepresenting the
> source of that
> force. Whatever force there is in copyright comes from law,
> not any free
> software license.


You are the one muddying the waters. It does not mater whether you break my 
kneecaps, or hire someone else to break my kneecaps, either way my kneecaps are 
broken. 

You can use any license you want, but the simple fact is that if there are 
fewer restrictions in the license then the user has more freedom in how he uses 
the licensed code. If there are more restrictions he/she has less freedom in 
how he/she uses the licensed code. We can debate which is better (whether a man 
should be free to sell himself into slavery) but to claim that putting more 
restrictions on someone give them more freedom is pure Orwellian double speak. 

Sophistry is the last resort of those who have run out of good arguments. The 
more you engage in it the weaker you make your position.

This thread is generating more heat than light, and probably should be dropped.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Picking a license

2010-05-09 Thread Ed Keith
Stepping back from the political/philosophical/religious arguments, I'd like to 
give some adjectival advice based on my own perspective.

How you license your software should be based on how you want it to be used.

If you are releasing an end user application I do not care how you license it. 
If it is useful I will use it. If you believe some of the code is of commercial 
value, and that you hope to profit from it you should use the GPL, so you can 
license it separately to someone who wants to use it in a closed source 
product. 

If, on the other hand you are releasing a library, to be incorporated into 
other products, If you release it under the GPL I will not take the time to 
learn it. I do not want to have to think about what took I can legally use for 
what job. Libraries with permissive licenses can be used in any project. Many 
contracts prohibit the use of GPL or LGPL code. So I do not waist my time 
learning to use libraries covered by restrictive licenses. So if you want me to 
even consider using your library do not use GPL, or LGPL. I favor the Boost 
license in this case.

I hope this is useful.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Picking a license (an atempt to give real advice)

2010-05-09 Thread Ed Keith
Stepping back from the political/philosophical/religious arguments, I'd like to 
give some real advice based on my own perspective.

How you license your software should be based on how you want it to be used.

If you are releasing an end user application I do not care how you license it. 
If it is useful I will use it. If you believe some of the code is of commercial 
value, and that you hope to profit from it you should use the GPL, so you can 
license it separately to someone who wants to use it in a closed source 
product. 

If, on the other hand you are releasing a library, to be incorporated into 
other products, if you release it under the GPL I will not take the time to 
learn it. I do not want to have to think about what took I can legally use for 
what job. Libraries with permissive licenses can be used in any project. I can 
not use GPL or LGPL code in many contracts. So I do not waist my time learning 
to use libraries covered by restrictive licenses. So if you want me to even 
consider using your library do not use GPL, or LGPL. I favor the Boost license 
in this case. Again, if you want to also offer other licenses, for a fee, you 
should use GPL, I will not use it, but others might, and you may get paid for 
your work.

The bottom line is: if you want the largest possible user base, go with a less 
restrictive license; If you hope to profit financially from your work, use the 
GPL.

Just my $0.02, I hope it is helpful.

   -EdK

Ed Keith
e_...@yahoo.com
 
Blog: edkeith.blogspot.com



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


Re: Teaching Programming

2010-05-05 Thread Ed Keith
--- On Tue, 5/4/10, alex23  wrote:

> From: alex23 
> Subject: Re: Teaching Programming
> To: python-list@python.org
> Date: Tuesday, May 4, 2010, 8:47 PM
> Ed Keith 
> wrote:
> > Knuth wanted the generated source to be unreadable, so
> people would not be tempted to edit the generated code.
> 
> This is my biggest issue with Knuth's view of literate
> programming. If
> the generated source isn't readable, am I just supposed to
> trust it?
> How can I tell if an error lies in my expression of the
> algorithm or
> in the code generation itself?
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

My feelings exactly. I can see an argument for an option to emit obstructed 
code, but the default should be readable.

   -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Sharing a program I wrote

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Scott  wrote:

> From: Scott 
> Subject: Sharing a program I wrote
> To: python-list@python.org
> Date: Tuesday, May 4, 2010, 5:40 PM
> I'm looking for suggestions on what
> to do (and how to do it) if I want
> to share a program that I wrote in Python. There seem to be
> quite a
> few places to post code and I don't know how to choose.
> 
> I wrote a program (script?) that takes a text file
> containing the
> output of  the "show access-list" command on a Cisco
> PIX/ASA/FWSM
> firewall and any number of text files containing syslog
> output from
> the same firewall and creates a report showing which
> access-list rules
> allowed which actual connections. It is written in Python
> 2.6 and runs
> on Windows.
> 
> Since this is obviously something mankind has long been
> waiting for I
> am thinking about sharing it - but since I am new to Python
> and
> programming in general I am not at all familiar with
> dealing with
> source code.
> 
> I'm sure that improvements and additions could be made if
> it was
> reviewed by "actual programmers" but I wouldn't exactly
> call it a
> "project" either. Of course I'd love to add a gui
> interface...
> 
> I've seen pypi. It seems to index code that is posted on
> all sorts of
> sites - including pypi itself? And what is a "package"
> anyway? I've
> seen sourceforge. It looks like a good home for big
> applications or
> multi-developer projects. Freshmeat? Google code? My own
> website? Your
> blog?
> 
> Another detail is that my program uses a library that was
> written by
> someone else. It is the most excellent netaddr written by
> David P. D.
> Moss and it lives at code.google.com. It uses the New BSD
> License.
> Since this library is required would I simply provide a
> link to it?
> Would I post the actual library? Do I have to post a copy
> of his
> copyright info anywhere? Please don't tell me I have to
> write some
> kind of installer that takes care of providing that.
> 
> I really just want anyone who might need a little
> networking/security
> tool like this to be able to find it. Any advice?
> 
> Thanks,
> Scott
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


It depends on exactly what you want to do. I'd suggest you look at the 
following sites:

http://developer.berlios.de/
http://codepad.org/
http://pastebin.com/
http://ideone.com/

One of them might be what your looking for.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel  wrote:

> From: Stefan Behnel 
> Subject: Re: Teaching Programming
> To: python-list@python.org
> Date: Tuesday, May 4, 2010, 11:52 AM
> Ed Keith, 04.05.2010 17:43:
> > The PITA is having to keep track of the indentation of
> each embedded
> > chunk and summing it for each level of indentation.
> This requires a fair
> > amount of bookkeeping that would not otherwise be
> necessary.
> > 
> > The original prototype simply replaced each embedded
> chunk with the text
> > from the chunk definition, all indenting information
> was lost. It worked
> > for most languages, but not Python.
> > 
> > In testing the program I used two languages, Python
> and J.
> 
> Well, then both of the language generators have benefited
> from your effort because the generated complete code is
> properly indented and therefore much more readable during
> debugging. I'd say it was worth it.
> 
> Stefan
> 
> -- http://mail.python.org/mailman/listinfo/python-list
> 

I agree, but some propellants of literate programming would not. 

Knuth wanted the generated source to be unreadable, so people would not be 
tempted to edit the generated code.

 -EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel  wrote:

> From: Stefan Behnel 
> Subject: Re: Teaching Programming
> To: python-list@python.org
> Date: Tuesday, May 4, 2010, 11:33 AM
> Ed Keith, 04.05.2010 15:19:
> > --- On Tue, 5/4/10, Stefan Behnel wrote:
> >> Ed Keith, 04.05.2010 14:15:
> >>> Python is a great language to write in
> (although I do
> >>> wish it did a better job with closures). But
> it is a PITA to
> >>> generate code for!
> >> 
> >> Interesting. Could you elaborate a bit? Could you
> give a
> >> short example of what kind of document text you
> translate
> >> into what kind of Python code, and what the
> problems were
> >> that you faced in doing so?
> > 
> > The program is written using itself. If you click on
> the link above you
> > will see an HTML file that fully describes the
> program.
> 
> I did. I find it a bit hard to read due to the block
> splitting (basically like 'include' based spaghetti
> programming), but so far, the actual code that does the code
> merging looks pretty simple and I can't figure out where the
> "PITA" bit is on that page. That's why I asked.
> 
> Stefan
> 
> -- http://mail.python.org/mailman/listinfo/python-list
> 

The PITA is having to keep track of the indentation of each embedded chunk and 
summing it for each level of indentation. This requires a fair amount of 
bookkeeping that would not otherwise be necessary. 

The original prototype simply replaced each embedded chunk with the text from 
the chunk definition, all indenting information was lost. It worked for most 
languages, but not Python.

In testing the program I used two languages, Python and J. I figured if I could 
make both of them work I would not have any problem with anything else.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com



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


Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Andre Engels  wrote:

> From: Andre Engels 
> Subject: Re: Teaching Programming
> To: "James Mills" 
> Cc: "python list" 
> Date: Tuesday, May 4, 2010, 11:00 AM
> On Tue, May 4, 2010 at 4:35 PM, James
> Mills
> 
> wrote:
> > On Wed, May 5, 2010 at 12:21 AM, Ed Keith 
> wrote:
> >> To deal with indentation I had to
> >>
> >>   1) keep track of indentation of all chunks of
> code embedded in the
> >>      document and indent inserted chunks to the
> sum of all the
> >>      indentation of the enclosing chunks.
> >
> > In my experience of non-indentation sensitive
> languages
> > such as C-class (curly braces) it's just as hard to
> keep track
> > of opening and closing braces.
> 
> Although I have little or no experience with this, I still
> dare to say
> that I don't agree. The difference is that in C you do not
> _need_ to
> know where in the braces-defined hierarchy you are. You
> just embed or
> change a piece of code at the right location. In Python
> however you
> _do_ need to know how far your code is to be indented.
> 
> 

For a programmer, it is harder to keep track of braced.

For a code generator, it is harder to keep track of indentation.

It is a matter of which you are more interested in catering to. Python is 
easier to write, C is easier to generate.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, James Mills  wrote:

> From: James Mills 
> Subject: Re: Teaching Programming
> To: "python list" 
> Date: Tuesday, May 4, 2010, 10:35 AM
> On Wed, May 5, 2010 at 12:21 AM, Ed
> Keith 
> wrote:
> > To deal with indentation I had to
> >
> >   1) keep track of indentation of all chunks of code
> embedded in the
> >      document and indent inserted chunks to the sum
> of all the
> >      indentation of the enclosing chunks.
> 
> In my experience of non-indentation sensitive languages
> such as C-class (curly braces) it's just as hard to keep
> track
> of opening and closing braces.
> 
> --James
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Not in this case, because the user is required to include all text of the 
program in the chunks, the tools does not generate any text, It only needs to 
generate white space if the language is white space sensitive. 

I can see how it could be a problem in other cases.

In the interest of completeness, I should mention that I had to take care not 
to introduce extraneous line breaks for languages that are sensitive to them. 
It is much easier to generate code for languages that are completely white 
space agnostic. 

I actually find the fact that I need to think about where I can, and where I 
can not, break a line to be a bigger problem when write code, than keeping 
track of indentation level. And Python is not the only language that has this 
problem.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com




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


Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, alex23  wrote:

> From: alex23 
> Subject: Re: Teaching Programming
> To: python-list@python.org
> Date: Tuesday, May 4, 2010, 10:06 AM
> Ed Keith 
> wrote:
> > For more information on Literate Programming in
> general see the following links.
> 
> None of which address the question of what you found
> problematic about
> generating Python code. Was it issues with indentation?
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Yes, the problem was indentation.

To deal with indentation I had to 

   1) keep track of indentation of all chunks of code embedded in the 
  document and indent inserted chunks to the sum of all the 
  indentation of the enclosing chunks.

and

   2) expand all tabls to spaces and allow the user to set the tab 
  expansion size from the command line. Fortunately Python provides 
  good support for this.

Neither of these problems exist in languages that are not indention sensitive.

Tabs are always a problem when writing Python. I get around this problem by 
setting my text editor to expand all tabs with spaces when editing Python, but 
I have had problems when coworkers have not done this.

Don't get me wrong, I love working in Python. It is one of my favorite 
languages, but it, like all other languages, is not perfect.

-EdK

Ed Keith
e_...@yahoo.com

Blog: edkeith.blogspot.com





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


  1   2   3   4   >