Re: Efficient handling of fast, real-time hex data

2016-06-01 Thread Gregory Ewing

jlada...@itu.edu wrote:

One common data transmission error I've seen in other systems is
added/dropped bytes. I may add a CRC-8 error-checking byte in place of the
newline.


Also maybe add a start byte with a known value at the
beginning of each packet to help resynchronise if you
get out of step.

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


Re: Don't put your software in the public domain

2016-06-01 Thread Gregory Ewing

Steven D'Aprano wrote:


http://linuxmafia.com/faq/Licensing_and_Law/public-domain.html


From that:

It might be ruled to create a global licence for unrestricted use. That

> licence might or might not then be adjudicated to be revocable by subsequent
> copyright owners (heirs, divorcing spouses, creditors).

If that's possible, then could said heirs, divorcing spouses
and creditors also revoke supposedly permanent rights granted
under an explicit licence? Or is putting the word "irrevocable"
in the licence enough to prevent that?

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


Re: Finding .so files without setting LD_LIBRARY_PATH

2016-06-01 Thread Lawrence D’Oliveiro
On Thursday, May 12, 2016 at 9:51:02 AM UTC+12, Paul Smith wrote:
> ... here's the problem: because LD_LIBRARY_PATH is in
> Python's environment it is also passed down to programs invoked by
> Python.  That means if I (for example) invoke subprocess.call(['ssh',
> ...]) then it fails because the system ssh is looking for the system
> libcrypto.so, and when it finds the Python libcrypto.so instead
> (because of LD_LIBRARY_PATH) it fails.

That’s easy enough to fix: you can pass a custom environment down to 
subprocesses by using the “env” argument to the various subprocess calls 
.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's going on here?

2016-06-01 Thread Lawrence D’Oliveiro
On Monday, May 23, 2016 at 9:47:15 AM UTC+12, DFS wrote:
> def splitrange(b,e,g):
>   sr=[]
>   for i in range(b,e,g):
>   bg=i;eg=min(e,bg+g-1)
>   sr.append((bg,eg))
>   return sr

To be more in keeping with the Python ethos, I would take out the “-1”.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendation for Object-Oriented systems to study

2016-06-01 Thread Lawrence D’Oliveiro
On Monday, May 30, 2016 at 7:17:47 AM UTC+12, Alan Evangelista wrote:
> - Java forces everything to be implemented in OO model (classes)

After you have spend a few months battering your head against the rigidity and 
verbosity of Java, you will run back to Python with a sense of relief.

What a joy it is to use a language where functions are first-class objects...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner Question

2016-06-01 Thread Steven D'Aprano
On Thursday 02 June 2016 14:21, Igor Korot wrote:

> Hi, guys,
> 
> On Wed, Jun 1, 2016 at 9:42 PM, boB Stepp  wrote:
>> On Wed, Jun 1, 2016 at 7:55 PM, Marcin Rak 
>> wrote:
>>> Hi to all
>>>
>>> I have a beginner question to which I have not found an answer I was able
>>> to understand.  Could someone explain why the following program:
>>>
>>> def f(a, L=[]):
>>> L.append(a)
>>> return L
>>>
>>> print(f(1))
>>> print(f(2))
>>> print(f(3))
>>>
>>> gives us the following result:
>>>
>>> [1]
>>> [1,2]
>>> [1,2,3]
>>>
>>> How can this be, if we never catch the returned L when we call it, and we
>>> never pass it on back to f???
> 
> I think the OP question here is:
> 
> Why it is printing the array?

Because he calls the function, then prints the return result.

print(f(1))

calls f(1), which returns [1], then prints [1].

Then he calls:

print(f(2))

which returns [1, 2] (but he expects [2]), then prints it. And so on.


> There is no line like:
> 
> t = f(1)
> print t

Correct. But there are lines:

print(f(1))
print(f(2))
print(f(3))



-- 
Steve

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


Re: Beginner Question

2016-06-01 Thread Igor Korot
Hi, guys,

On Wed, Jun 1, 2016 at 9:42 PM, boB Stepp  wrote:
> On Wed, Jun 1, 2016 at 7:55 PM, Marcin Rak  
> wrote:
>> Hi to all
>>
>> I have a beginner question to which I have not found an answer I was able to 
>> understand.  Could someone explain why the following program:
>>
>> def f(a, L=[]):
>> L.append(a)
>> return L
>>
>> print(f(1))
>> print(f(2))
>> print(f(3))
>>
>> gives us the following result:
>>
>> [1]
>> [1,2]
>> [1,2,3]
>>
>> How can this be, if we never catch the returned L when we call it, and we 
>> never pass it on back to f???

I think the OP question here is:

Why it is printing the array?
There is no line like:

t = f(1)
print t

So, why the first print does print the list? The return value should
be thrown away...

Thank you.

>
> This comes up rather frequently.  In fact, if you just copy your
> function (Which is used in the official Python tutuorial.) and paste
> it into Google you will get some relevant hits.  One such is:
>
> https://pythonconquerstheuniverse.wordpress.com/category/python-gotchas/
>
> As the link will explain the behavior you observe is a consequence of
> two things:  When Python assigns the default argument for the empty
> list and that lists are *mutable*.
>
> Enjoy!
>
>
> --
> boB
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner Question

2016-06-01 Thread Steven D'Aprano
On Thursday 02 June 2016 10:55, Marcin Rak wrote:

> Hi to all
> 
> I have a beginner question to which I have not found an answer I was able to
> understand.  Could someone explain why the following program:
> 
> def f(a, L=[]):
> L.append(a)
> return L


The default value is set once, and once only, so you get the same list each 
time, not a new empty list.

Default values in Python are sort of like this:

HIDDEN_DEFAULT_VALUE = []  # initialised once
def f(a, L):
if L is not defined:
L = HIDDEN_DEFAULT_VALUE
L.append(a)
return L


except that HIDDEN_DEFAULT_VALUE is not actually a global variable. Every 
function gets its own storage for defaults. The technical term for this is 
"early binding of default values".

If you want to get a new, fresh list each time ("late binding of default 
values") you should use a sentinel value:


def f(a, L=None):
if L is None:
L = []  # new, fresh list each time
L.append(a)
return L




-- 
Steve

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


Re: for / while else doesn't make sense

2016-06-01 Thread Steven D'Aprano
On Thursday 02 June 2016 09:39, Lawrence D’Oliveiro wrote:

> Also, they let me declare a variable that is scoped to the loop


Why do you want variables scoped to the loop?



-- 
Steve

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


Re: Don't put your software in the public domain

2016-06-01 Thread Steven D'Aprano
On Thursday 02 June 2016 06:45, Lawrence D’Oliveiro wrote:

> On Thursday, June 2, 2016 at 3:00:05 AM UTC+12, Steven D'Aprano wrote:
>> ... because it is extremely unlikely to work.
> 
> Which is why CC0 https://creativecommons.org/publicdomain/zero/1.0/ was
> invented.


Very true. The purpose of CC0 is, in a nutshell, to say:

"Put this in the public domain if possible, and if not, have a liberal licence 
to use it for anything you want, with no warranty."

But the question is, since putting things into the public domain is legally 
dubious, the first part is very likely not possible, which makes it just a more 
complicated way of saying:

"... have a liberal licence to use it for anything you want, with no warranty."



-- 
Steve

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


Re: Don't put your software in the public domain

2016-06-01 Thread Steven D'Aprano
On Thursday 02 June 2016 07:00, John Wong wrote:

> On Wed, Jun 1, 2016 at 4:45 PM, Lawrence D’Oliveiro 
> wrote:
> 
>> On Thursday, June 2, 2016 at 3:00:05 AM UTC+12, Steven D'Aprano wrote:
>> > ... because it is extremely unlikely to work.
>>
>> Which is why CC0 https://creativecommons.org/publicdomain/zero/1.0/ was
>> invented.
>> --
>>
> 
> This does not solve the dependency copyright issue.


I do not know what the dependency copyright issue is.


-- 
Steve

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


Re: reduction

2016-06-01 Thread Fillmore


Thank you, guys. Your suggestions are avaluable. I think I'll go with the tree

On 05/31/2016 10:22 AM, Fillmore wrote:


My problem. I have lists of substrings associated to values:

['a','b','c','g'] => 1
['a','b','c','h'] => 1
['a','b','c','i'] => 1
['a','b','c','j'] => 1
['a','b','c','k'] => 1
['a','b','c','l'] => 0  # <- Black sheep!!!
['a','b','c','m'] => 1
['a','b','c','n'] => 1
['a','b','c','o'] => 1
['a','b','c','p'] => 1

I can check a bit of data against elements in this list
and determine whether the value to be associated to the data is 1 or 0.

I would like to make my matching algorithm smarter so I can
reduce the total number of lists:

['a','b','c','l'] => 0  # If "l" is in my data I have a zero
['a','b','c'] => 1  # or a more generic match will do the job

I am trying to think of a way to perform this "reduction", but
I have a feeling I am reinventing the wheel.

Is this a common problem that is already addressed by an existing module?

I realize this is vague. Apologies for that.

thank you


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


Re: Beginner Question

2016-06-01 Thread boB Stepp
On Wed, Jun 1, 2016 at 7:55 PM, Marcin Rak  wrote:
> Hi to all
>
> I have a beginner question to which I have not found an answer I was able to 
> understand.  Could someone explain why the following program:
>
> def f(a, L=[]):
> L.append(a)
> return L
>
> print(f(1))
> print(f(2))
> print(f(3))
>
> gives us the following result:
>
> [1]
> [1,2]
> [1,2,3]
>
> How can this be, if we never catch the returned L when we call it, and we 
> never pass it on back to f???

This comes up rather frequently.  In fact, if you just copy your
function (Which is used in the official Python tutuorial.) and paste
it into Google you will get some relevant hits.  One such is:

https://pythonconquerstheuniverse.wordpress.com/category/python-gotchas/

As the link will explain the behavior you observe is a consequence of
two things:  When Python assigns the default argument for the empty
list and that lists are *mutable*.

Enjoy!


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


Beginner Question

2016-06-01 Thread Marcin Rak
Hi to all

I have a beginner question to which I have not found an answer I was able to 
understand.  Could someone explain why the following program:

def f(a, L=[]):
L.append(a)
return L

print(f(1))
print(f(2))
print(f(3))

gives us the following result:

[1]
[1,2]
[1,2,3]

How can this be, if we never catch the returned L when we call it, and we never 
pass it on back to f???

Any help is appreciated.
Marcin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Manipulate GIL to have Python thread work with pthread native ones

2016-06-01 Thread Lawrence D’Oliveiro
On Tuesday, May 31, 2016 at 10:14:31 PM UTC+12, qsh...@alumni.sjtu.edu.cn wrote:
> PyGILState_Ensure/PyGILState_Release. Without a running sample, it is a
> little bit hard to understand how Python thread and the native pthread
> interact. 

Python threads *are* native threads (at least on Linux).

The place to release the GIL is where you are a) not making any Python API 
calls and b) doing something CPU-intensive. Point a) is essential.

Here  is one of my 
example extension modules. It doesn’t actually do any multithreading, but I put 
in the Py_{BEGIN,END}_ALLOW_THREADS calls where I thought it made sense to have 
them anyway.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to create development Python environment on Linux.

2016-06-01 Thread Lawrence D’Oliveiro
On Tuesday, May 17, 2016 at 4:26:23 AM UTC+12, Zachary Ware wrote:
> Not what you asked for, but I would encourage you to look into whether
> it's possible for you to use Python 3 instead of Python 2 for what
> you're doing.  If it's possible, starting with Python 3 will save you
> several headaches in the future.

Let me add my vote for this.

> sys.prefix is baked in at compile time of the python interpreter ...

ldo@theon:~> ~/virtualenv/jupyter/bin/python -c "import sys; 
print(sys.prefix)"
/home/ldo/virtualenv/jupyter
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for / while else doesn't make sense

2016-06-01 Thread Lawrence D’Oliveiro
On Friday, May 20, 2016 at 4:43:56 AM UTC+12, Herkermer Sherwood wrote:
> Most keywords in Python make linguistic sense, but using "else" in for and
> while structures is kludgy and misleading.

My objection is not to the choice of keyword, it’s to the whole design of the 
loop construct.

It turns out C-style for-loops “for (init; test; incr) ...” are very versatile. 
If my loop has more than one exit, I use the endless form “for (;;)” and do an 
explicit “break” for every exit condition.

Also, they let me declare a variable that is scoped to the loop, that is 
initialized just once before the loop starts, e.g.

for (int loopvar = initial_value;;)
  {
if (loopvar == limit)
break;
... processing ...
if (found_what_im_looking_for)
break;
++loopvar;
  } /*for*/

I wish I could do this in Python...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: reduction

2016-06-01 Thread Lawrence D’Oliveiro
On Thursday, June 2, 2016 at 10:07:21 AM UTC+12, MRAB wrote:
> What is "this_list"? The main 'for' loop has "entry".

Sorry. :)

for entry in \
(
['a','b','c','l'],
['a','b','c'],
) \
:
flag = int(not any(m == "l" for m in entry))
... # flag is the 1/0 code you’re looking for ...
#end for
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: reduction

2016-06-01 Thread MRAB

On 2016-06-01 22:44, Lawrence D’Oliveiro wrote:

On Wednesday, June 1, 2016 at 2:22:42 AM UTC+12, Fillmore wrote:

['a','b','c','l'] => 0  # If "l" is in my data I have a zero
['a','b','c'] => 1  # or a more generic match will do the job


for entry in \
(
['a','b','c','l'],
['a','b','c'],
) \
:
flag = int(not any(m == "l" for m in this_list))
... # flag is the 1/0 code you’re looking for ...
#end for


What is "this_list"? The main 'for' loop has "entry".

A shorter way is to use sets:

for entry in \
(
['a','b','c','l'],
['a','b','c'],
) \
:
flag = int("l" not in set(entry))
... # flag is the 1/0 code you’re looking for ...
#end for

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


Re: reduction

2016-06-01 Thread Lawrence D’Oliveiro
On Wednesday, June 1, 2016 at 2:22:42 AM UTC+12, Fillmore wrote:
> ['a','b','c','l'] => 0  # If "l" is in my data I have a zero
> ['a','b','c'] => 1  # or a more generic match will do the job

for entry in \
(
['a','b','c','l'],
['a','b','c'],
) \
:
flag = int(not any(m == "l" for m in this_list))
... # flag is the 1/0 code you’re looking for ...
#end for
-- 
https://mail.python.org/mailman/listinfo/python-list


Yet Another Cairo API Binding

2016-06-01 Thread Lawrence D’Oliveiro
Thought I would mention Qahirah , which is yet 
another binding for the Cairo  graphics library. 
People using Cairo with Python are probably familiar with Pycairo. Qahirah is 
similar to Pycairo in some ways, but differs importantly in several others:

* It is implemented entirely in Python, using the ctypes module. This offers 
advantages: automatic support for passing arguments  by keyword, and argument 
names appearing in help() output. 

* It tries to operate at a higher level than the actual C-centric Cairo API, 
taking advantage of Python’s powerful data-manipulation facilities. This is 
explained in the README. 

* Because it is pure Python, the abstractions it implements are “leaky”. As 
Guido van Rossum has made clear, “We’re all consenting adults here”. If you 
want to bypass Qahirah’s facilities and make calls directly to the underlying 
Cairo library, there is nothing to prevent you from doing so. Whether your code 
will still work with a future version of Qahirah is another matter...

I have also published some examples  
of Qahirah in action. And if you know IPython/Jupyter, here 
 are some interactive notebooks 
illustrating various 2D graphics concepts using Qahirah.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Don't put your software in the public domain

2016-06-01 Thread John Wong
On Wed, Jun 1, 2016 at 4:45 PM, Lawrence D’Oliveiro 
wrote:

> On Thursday, June 2, 2016 at 3:00:05 AM UTC+12, Steven D'Aprano wrote:
> > ... because it is extremely unlikely to work.
>
> Which is why CC0 https://creativecommons.org/publicdomain/zero/1.0/ was
> invented.
> --
>

This does not solve the dependency copyright issue.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Don't put your software in the public domain

2016-06-01 Thread Lawrence D’Oliveiro
On Thursday, June 2, 2016 at 3:00:05 AM UTC+12, Steven D'Aprano wrote:
> ... because it is extremely unlikely to work.

Which is why CC0 https://creativecommons.org/publicdomain/zero/1.0/ was 
invented.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Self Learning Fortran Programming

2016-06-01 Thread Muhammad Ali

I don't know how to change the title now, but I am looking for python.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Efficient handling of fast, real-time hex data

2016-06-01 Thread jladasky
On Tuesday, May 31, 2016 at 9:37:18 PM UTC-7, Gregory Ewing wrote:
> > So, how can I take the byte sequence <0x01 0x02 0x03 0x04 0x05 0x06 \n> that
> > Serial.readline() returns to me,
> 
> Using readline() to read binary data doesn't sound like
> a good idea -- what happens if one of the data bytes
> happens to be 0x0a?
> 
> If you're going binary, it would be better to ditch the
> newlines and read a fixed number of bytes each time.

Hi Greg,

Of course you're correct.  In my very first version of this system, I 
piggybacked the transmission of data on the routines that I used to transmit 
text.  That won't be a permanent state of affairs.

I guess that I should have posted my example string without the newline, which 
I will of course strip off before parsing the string into 16-bit integers.  
Also, now that I've verified that the CPU's at both ends of the line are 
little-endian, I should have swapped every other byte.  :^)

One common data transmission error I've seen in other systems is added/dropped 
bytes.  I'm not sure whether to expect this problem with a USB/UART setup.  I 
may add a CRC-8 error-checking byte in place of the newline.

> Regarding speed, if struct.unpack or numpy isn't fast
> enough, you may need to deal with the data in bigger
> chunks.
> 
> Although if you're not doing a huge amount of processing
> with them, I'd expect it to be plenty fast enough.
> I just did a quick test, and I was able to unpack
> about 700,000 random 6-byte strings per second on
> a 2.8GHz Xeon.

That's an encouraging speed.  I'm sure that I'm not doing everything as 
efficiently as possible yet.

I've done some Multiprocessing work before.  To speed things up further, I 
might implement the live graphics in one process and the I/O in another.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Self Learning Fortran Programming

2016-06-01 Thread Peter Pearson
On Tue, 31 May 2016 21:50:33 -0700 (PDT), Muhammad Ali wrote:
>
> I am interested in Python programming,
[snip]

Just out of curiosity, why do you seem to be confused about whether
your interest is in FORTRAN or Python?

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


SQLObject 3.0.0

2016-06-01 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.0.0, the first stable release of branch
3.0 of SQLObject.


What's new in SQLObject
===

Features


* Support for Python 2 and Python 3 with one codebase!
  (Python version >= 3.4 currently required.)

Minor features
--

* PyDispatcher (>=2.0.4) was made an external dependency.

Development
---

* Source code was made flake8-clean.

Documentation
-

* Documentation is published at http://sqlobject.readthedocs.org/ in
  Sphinx format.

Contributors for this release are Ian Cordasco, Neil Muller,
Lukasz Dobrzanski, Gregor Horvath, Nathan Edwards.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.6, 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

Download:
https://pypi.python.org/pypi/SQLObject/3.0.0

News and changes:
http://sqlobject.org/News.html

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
-- 
https://mail.python.org/mailman/listinfo/python-list


Breaking down network range to individual networks

2016-06-01 Thread Aaron Christensen
Hello,

Does anyone know about a feature of ipaddress that will take the following
network range:

"10.224.16.0-10.224.23.0"

and convert it to individual networks?

I am trying to figure out the best way to take a network range and break it
up into the largest possible networks.

I started working out some things on paper but I don't want to get too far
ahead of myself in case there is a function or easy way that already does
this.

Thank you for your help!
Aaron




-
Pasted some brainstorming below to show that I am actively working this and
not just asking before trying.


ipaddress.ip_network('10.224.16.0/24') - (ipaddress.ip_network('
10.224.23.0/24'))
IPv4Network

IPv4Network('10.224.16.0/24').compare_networks(IPv4Network('10.224.23.0/24')
)



str(ipaddress.IPv4Address('192.168.0.1'))

IPv4Address('10.224.16.0') + 3

ipaddress.ip_address('10.224.16.0') + 256


0.0.x=0.0
/24 x + 0
/23 x + 1 = 0.0.0.0
/22 x + 3 = 0.0.0.0

1  can be /18 if x = 0
2  can be /19 if x = 0, 32
4  can be /20 if x = 0, 16, 32, 48
8  can be /21 if x = 0, 8, 16, 24, 32, 40, 48, 56
16 can be /22 if x = 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52,
56, 60
32 can be /23 if x = 0 through 62


64 can be /24 if x = 0 though 255

10.224.255.0

start > can be
odd  > /24
even > /24/23
0  >  /22/21/20/19/18...
4  >  /22
8  >  /22/21
12 >  /22
16 >  /22/21/20
20 >  /22
24 >  /22/21
28 >  /22
32 >  /22/21/20/19
36 >  /22
40 >  /22/21
44 >  /22
48 >  /22/21/20
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Don't put your software in the public domain

2016-06-01 Thread Marko Rauhamaa
Steven D'Aprano :

> ... because it is extremely unlikely to work. If you actually want
> your users to be legally able to use your software without a
> commercial licence, use a recognised open licence like the MIT
> licence. Public domain dedications are on extremely shaky ground and
> give your users no protection.
>
> http://linuxmafia.com/faq/Licensing_and_Law/public-domain.html

http://www.wtfpl.net/faq/

I say, abolish the copyright from the laws altogether.


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


Re: re.search - Pattern matching review

2016-06-01 Thread Ganesh Pal
Thanks works fine : )
-- 
https://mail.python.org/mailman/listinfo/python-list


Don't put your software in the public domain

2016-06-01 Thread Steven D'Aprano
... because it is extremely unlikely to work. If you actually want your
users to be legally able to use your software without a commercial licence,
use a recognised open licence like the MIT licence. Public domain
dedications are on extremely shaky ground and give your users no
protection.

http://linuxmafia.com/faq/Licensing_and_Law/public-domain.html




-- 
Steven

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


Re: Recommendation for Object-Oriented systems to study

2016-06-01 Thread Terry Reedy

On 5/31/2016 1:52 PM, Ankush Thakur wrote:

Hi Terry,

Can you point me towards the source code?


For IDLE 3.4.4 or 3.5.1: /Lib/idlelib/help.py, at least on 
Windows.


> by "after reading it carefully", do you mean you or me? :D

You.  I wrote it and already read it carefully.


Beyond "pick a module with classes that interest you", I can suggest
idlelib.help, which I helped to write.  If you ask, after reading it
carefully, I will point out what I consider positive features.


--
Terry Jan Reedy

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


Re: Self Learning Fortran Programming

2016-06-01 Thread Stephen Tucker
Hi, there, Muhammad,

I have found Learning Python by Mark Lutz helpful. The fourth edition
covers both Python 2.6 and 3.x. Although it is a text book for a course
that Mark delivers, there are useful summaries of the various functions and
methods for strings, integers, etc at various spots in the book.

Stephen Tucker.


Virus-free.
www.avast.com

<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Jun 1, 2016 at 6:47 AM, Joel Goldstick 
wrote:

> start here:
>
>
> https://www.python.org/about/gettingstarted/
>
> On Wed, Jun 1, 2016 at 12:50 AM, Muhammad Ali
>  wrote:
> >
> > Hello,
> >
> > I am interested in Python programming, however, it will be my first
> serious attempt towards coding/simulation/programming. My back ground is
> Physics, no practical experience with programming languages.
> >
> > So, this post is for the valuable suggestions from the experts that how
> can I start self learning Python from scratch to advanced level in minimum
> time. For this, please recommend Python version, literature, text books,
> websites, video lectures, your personnel tips, etc. In addition, you may
> also add some extra suggestions for shell script writing as well. You may
> recommend for both Linux and Windows operating systems.
> >
> > Looking for your posts.
> >
> > Thank you.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
>
>
> --
> Joel Goldstick
> http://joelgoldstick.com/blog
> http://cc-baseballstats.info/stats/birthdays
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable argument unpacking

2016-06-01 Thread Alexandre Paloschi Horta
The way you defined the function:

def a(a = 1, b = 2, c = 3, *d, **e):
print(a, b, c)
print(d)
print(e)

a, b and c are positional arguments. d will be filled with the excess arguments 
and e will receive a dictionary, if supplied.

One thing is the function definition, another is the function call. If you pass 
a number of arguments, the first three will be assigned to a, b and c no matter 
what, even if you supplied defaults.

Peter's solution turns a, b and c into keyword arguments. That way you can call 
the function with an arbitrary number of arguments and a, b and c will keep the 
default values, unless you be explicit about the values you want to assign to 
a, b and c.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Manipulate GIL to have Python thread work with pthread native ones

2016-06-01 Thread dieter
qshh...@alumni.sjtu.edu.cn writes:
... Python/C++ integration ...

When I learn about a task to integrate Python with C or C++,
I first think of "cython". "cython" facilitates those integrations.
Especially, it has annotations to control the GIL.

I have used "cython" for the implementation of a Python binding
to the XML security library. The result ist "dm.xmlsec.binding".
There, I use both ("cython") annotations to release the GIL when
passing over control from Python to C; as well as ("cython")
features to implement a callback from C to Python.

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