Re: Own network protocol

2015-01-02 Thread Connor

Hi,

You can use the TML/SIDEX SDK to setup a server on a Raspberry_Pi. It 
enables peer to peer communcation beased on the Blocks Extensible 
Exchange protocol. The Python interface is easy to use and you can find 
tutorial videos on youtube, how to install it on a raspberry_py.


Search for "How to install TML/SIDEX on Raspberry Pi" on youtube.

The SDK is available on multiple platforms and it is free for personal 
projects.


Cheers,
Connor

Am 27.12.2014 um 10:56 schrieb pfranke...@gmail.com:

Hello!

I am just about setting up a project with an Raspberry Pi that is connected to 
some hardware via its GPIO pins. Reading the data already works perfectly but 
now I want to distribute it to clients running in the network. Hence, I have to 
setup a server in Python.

I do not want to reinvent the wheel, so I am asking myself whether there is a 
good practice solution. It should basically work such that once value (can be 
either binary or an analog value) has changed on the server, it should send the 
update to the connected clients. At the same time, it should be possible for 
the client to send a particular request to the server as well, i.e., switch on 
LED X.

What kind of protocol do you recommend for this? UDP or TCP? Do you recommend 
the use of frameworks such as twisted?

Thanks for your input!


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


error handling in multithreaded extension callbacks

2014-02-14 Thread Connor

Hi,

In my extension I'm calling python functions as callbacks from a thread 
generated in an external module.

This works very well, but I'm not sure about the error handling.

1. Normally the python interpreter exits if it runs on an unhandled 
error. Is this the preferred standard behavior for this case too ?

2. How can I implement this in my error handling ?

Here is my code so far. If an error happens in the python code it is 
printed to stderr, but the python script is still running in the main 
thread.


void FUNC_C_DECL coreCommandReadyCallback(TML_COMMAND_HANDLE cmd, 
TML_POINTER data)

{
  // Calling Python out of a non- python created thread
  PyGILState_STATE gstate;
  try {
gstate = PyGILState_Ensure();

PythonCallbackData* callbackData = (PythonCallbackData*) data;

PyObject *arglist;

PyObject *pythonCBFunc = callbackData->pCBFunc;
/* Time to call the callback */
arglist = Py_BuildValue("(LO)", cmd, callbackData->pCBData);
PyObject* result = PyEval_CallObject(pythonCBFunc, arglist);
Py_DECREF(arglist);

if ( PyErr_Occurred() ) {
  PyErr_Print();
  PyErr_SetString(PyExc_TypeError, "PyErr_Occurred");
}


// Release calling Python out of a non- python created thread
PyGILState_Release(gstate);
  }
  catch (...) {
printf ("An Exception Happened\n");
  }
}

Cheers,
Connor

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


Copy-on-write when forking a python process

2011-04-08 Thread John Connor
Hi all,
Long time reader, first time poster.

I am wondering if anything can be done about the COW (copy-on-write)
problem when forking a python process.  I have found several
discussions of this problem, but I have seen no proposed solutions or
workarounds.  My understanding of the problem is that an object's
reference count is stored in the "ob_refcnt" field of the PyObject
structure itself.  When a process forks, its memory is initially not
copied. However, if any references to an object are made or destroyed
in the child process, the page in which the objects "ob_refcnt" field
is located in will be copied.

My first thought was the obvious one: make the ob_refcnt field a
pointer into an array of all object refcounts stored elsewhere.
However, I do not think that there would be a way of doing this
without adding a lot of complexity.  So my current thinking is that it
should be possible to disable refcounting for an object.  This could
be done by adding a field to PyObject named "ob_optout".  If ob_optout
is true then py_INCREF and py_DECREF will have no effect on the
object:


from refcount import optin, optout

class Foo: pass

mylist = [Foo() for _ in range(10)]
optout(mylist)  # Sets ob_optout to true
for element in mylist:
optout(element) # Sets ob_optout to true

Fork_and_block_while_doing_stuff(mylist)

optin(mylist) # Sets ob_optout to false
for element in mylist:
optin(element) # Sets ob_optout to false


Has anyone else looked into the COW problem?  Are there workarounds
and/or other plans to fix it?  Does the solution I am proposing sound
reasonable, or does it seem like overkill?  Does anyone foresee any
problems with it?

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


Re: Retrieving Python Keywords

2011-04-09 Thread John Connor
Actually this is all it takes:
import keywords
print keywords.kwlist

--jac

On Sat, Apr 9, 2011 at 8:57 PM, Chris Angelico  wrote:
> On Sun, Apr 10, 2011 at 11:28 AM, candide  wrote:
>> Python is very good at introspection, so I was wondering if Python (2.7)
>> provides any feature to retrieve the list of its keywords (and, as, assert,
>> break, ...).
>
> I don't know about any other way, but here's a really REALLY stupid
> method. For every possible alphabetic string, attempt to eval() it; if
> you get NameError or no error at all, then it's not a keyword.
> SyntaxError means it's a keyword.
>
 eval("foo")
>
> Traceback (most recent call last):
>  File "", line 1, in 
>    eval("foo")
>  File "", line 1, in 
> NameError: name 'foo' is not defined
 eval("lambda")
>
> Traceback (most recent call last):
>  File "", line 1, in 
>    eval("lambda")
>  File "", line 1
>    lambda
>         ^
> SyntaxError: unexpected EOF while parsing
 eval("eval")
> 
>
> Yes, it's stupid. But I'm feeling rather mischievous today. :)
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic infinite for loop?

2011-04-14 Thread John Connor
If I understand  your question correctly, what you want is probably
something like:

i = 0
lst=[]
while True:
 try:
   lst.append(parse_kwdlist(dct["Keyword%d"%i]))
   i += 1
 except KeyError:
   break

--jac

On Thu, Apr 14, 2011 at 9:10 PM, Chris Angelico  wrote:
> Apologies for interrupting the vital off-topic discussion, but I have
> a real Python question to ask.
>
> I'm doing something that needs to scan a dictionary for elements that
> have a particular beginning and a numeric tail, and turn them into a
> single list with some processing. I have a function parse_kwdlist()
> which takes a string (the dictionary's value) and returns the content
> I want out of it, so I'm wondering what the most efficient and
> Pythonic way to do this is.
>
> My first draft looks something like this. The input dictionary is
> called dct, the output list is lst.
>
> lst=[]
> for i in xrange(1,1000): # arbitrary top, don't like this
>  try:
>    lst.append(parse_kwdlist(dct["Keyword%d"%i]))
>  except KeyError:
>    break
>
> I'm wondering two things. One, is there a way to make an xrange object
> and leave the top off? (Sounds like I'm risking the numbers
> evaporating or something.) And two, can the entire thing be turned
> into a list comprehension or something? Generally any construct with a
> for loop that appends to a list is begging to become a list comp, but
> I can't see how to do that when the input comes from a dictionary.
>
> In the words of Adam Savage: "Am I about to feel really, really stupid?"
>
> Thanks in advance for help... even if it is just "hey you idiot, you
> forgot about X"!
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: De-tupleizing a list

2011-04-25 Thread John Connor
itertools can help you do this too:

import itertools
tl = [('0A',), ('1B',), ('2C',), ('3D',)]

itertools.chain.from_iterable(tl)


list(itertools.chain.from_iterable(tl))
['0A', '1B', '2C', '3D']


Checkout http://docs.python.org/library/itertools.html#itertools.chain
for more info.

On Mon, Apr 25, 2011 at 11:08 PM, Paul Rubin  wrote:
> Gnarlodious  writes:
>> I have an SQLite query that returns a list of tuples:
>> [('0A',), ('1B',), ('2C',), ('3D',),...
>> What is the most Pythonic way to loop through the list returning a
>> list like this?:
>> ['0A', '1B', '2C', '3D',...
>
> Try:
>
>    tlist = [('0A',), ('1B',), ('2C',), ('3D',)]
>    alist = [x for (x,) in tlist]
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Errors in python\3.8.3\Lib\nntplib.py

2020-04-29 Thread G Connor
module: python\3.8.2\Lib\nntplib.py
lines 903-907
---
for line in f:
if not line.endswith(_CRLF):
line = line.rstrip(b"\r\n") + _CRLF
if line.startswith(b'.'):
line = b'.' + line
---

When I try to submit a Usenet post, I get this:


Traceback (most recent call last):
  File "D:\python\3xcode\Usenet\posting\NNTP_post.py", line 12, in 
news.post(f)
  File "D:\python\3.8.2\lib\nntplib.py", line 918, in post
return self._post('POST', data)
  File "D:\python\3.8.2\lib\nntplib.py", line 904, in _post
if not line.endswith(_CRLF):
TypeError: endswith first arg must be str or a tuple of str, not bytes


Also, line 906:
if line.startswith(b'.'):
 looks like it should be:
if not line.startswith(b'.'):
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Errors in python\3.8.3\Lib\nntplib.py

2020-04-29 Thread G Connor
On 4/29/2020 5:29 PM, Chris Angelico wrote:


> Try opening the file in binary mode instead.


Changed:  f = open(postfile,'r')to :  f = open(postfile,'rb')
and it worked.

Thanks man!





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


Re: Microsoft Hatred FAQ

2005-10-19 Thread Alan Connor
On comp.os.linux.misc, in <[EMAIL PROTECTED]>, "Michael Heiming" wrote:


This is your 7th post on this thread, Michael.

You spend a lot of time griping about trolls. Maybe you should
consider not feeding them, you stupid hypocrite.

To all the shit-for-brains trolls that are polluting these groups
with this crap, which I haven't even bothered to read:

I've killfiled every one of your aliases here, and I'm sure that
they aren't the first of your aliases I've killfiled and that
they won't be the last.

I don't hate M$, I LOVE Linux.

As for what YOU punks think about it, I couldn't care less.

Aren't your Mommys coming home soon? You know what will happen
if she finds you playing with her computer again.

AC


-- 
Homepage: http://home.earthlink.net/~alanconnor/
Fanclub: http://www.pearlgates.net/nanae/kooks/alanconnor.shtml
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread Alan Connor
On comp.os.linux.misc, in <[EMAIL PROTECTED]>, "Tim Slattery" wrote:






Three OS's from corporate kings in their towers of glass,
Seven from valley lords where orchards used to grow,
Nine from dotcoms doomed to die,
One from the Dark Lord Gates on his dark throne
In the Land of Redmond where the Shadows lie.

One OS to rule them all,
one OS to find them,
One OS to bring them all
and in the darkness bind them,
In the Land of Redmond where the Shadows lie.




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


Re: Microsoft Hatred FAQ

2005-10-23 Thread Alan Connor
"Matt Garrish" wrote:


That does it. From this point on my newsfilter is killing
(leaving on the server) any articles cross-posted to more than
three groups.

To all of the snivelling punks polluting the Usenet with their
verbal diarrhea here:

Shut up and go away.

Done.

(I haven't read a single post here, but don't need to. A bunch
of aliases with no posting histories equals trolls equals verbal
diarrhea.)

And my killfile thanks you for the sumptuous feast all of the
aliases used on this thread have given it.

Do your Mommy's know that you are playing with their computers
again?


AC


-- 
Homepage: http://home.earthlink.net/~alanconnor/
Fanclub: http://www.pearlgates.net/nanae/kooks/alanconnor.shtml
-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] John Salerno (was: and i thought windows made a mess of files...)

2006-08-11 Thread Alan Connor
On alt.os.linux, in <[EMAIL PROTECTED]>, "John Salerno" wrote:
> Path: 
> text.usenetserver.com!atl-c01.usenetserver.com!news.usenetserver.com!atl-c03.usenetserver.com!news.usenetserver.com!news.glorb.com!news.astraweb.com!router2.astraweb.com!not-for-mail
> Date: Fri, 11 Aug 2006 22:19:06 -0400
> From: John Salerno <[EMAIL PROTECTED]>

http://groups.google.com/advanced_group_search
John Salerno
Results 1 - 100 of 1,650 posts in the last year
  2 alt.cellular.sprintpcs
  1 alt.games.morrowind
  2 alt.games.neverwinter-nights
 11 alt.html
 25 alt.music.dave-matthews
  2 alt.os.linux
  4 comp.editors
  1 comp.lang.javascript
 44 comp.lang.python
  1 macromedia.dreamweaver
  7 microsoft.public.dotnet.languages.csharp

Are all of those yours, or did you steal someone's alias?

Either way, I don't see many posts on Linux groups.

Looks like you don't know anything about Linux.

And that your problems are your fault.

> User-Agent: Thunderbird 1.5.0.5 (X11/20060728)

Maybe. Maybe you just copied that from someone else's 
headers.

It looks remarkably like your Windows User-Agent header
too (see copied headers below).

> MIME-Version: 1.0
> Newsgroups: alt.os.linux
> Subject: and i thought windows made a mess of files...
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
> Lines: 19
> Message-ID: <[EMAIL PROTECTED]>
> Organization: Unlimited download news at news.astraweb.com
> NNTP-Posting-Host: 60df7692.news.astraweb.com
> X-Trace: DXC=\AE;PX=>0<[EMAIL PROTECTED]
> Xref: usenetserver.com alt.os.linux:422359
> X-Received-Date: Fri, 11 Aug 2006 22:19:14 EDT (text.usenetserver.com)

No posting IP. What a surprise.

http://slrn.sourceforge.net/docs/README.offline>

Your only other post on any linux group was here and you were
using a completely different newsserver and Windows.

# Path: 
text.usenetserver.com!atl-c01.usenetserver.com!news.usenetserver.com!atl-c05.usenetserver.com!news.usenetserver.com!postnews.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.rcn.net!news.rcn.net.POSTED!not-for-mail
# NNTP-Posting-Date: Sat, 05 Aug 2006 17:46:49 -0500
# Date: Sat, 05 Aug 2006 18:44:32 -0400
# From: John Salerno <[EMAIL PROTECTED]>
# User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
# MIME-Version: 1.0
# Newsgroups: alt.os.linux
# Subject: should the root partition be a primary partition?
# Content-Type: text/plain; charset=ISO-8859-1; format=flowed
# Content-Transfer-Encoding: 7bit
# Message-ID: <[EMAIL PROTECTED]>
# Lines: 14
# NNTP-Posting-Host: 209.6.130.27

Almost certainly bogus. I wouldn't believe anything in this
fellow's headers or articles.

# X-Trace: 
sv3-qhiskzmd0+yq2C/ol14t8YRbXZ1SJjjLsvy6mDFGsrGVCOJevDD+CHmcpbqOvh/3Cbh2xj35Ck 
yCu9w!CFnCWRzTvsRwip4yXzppHgVtS9ha+HYUZU1Jx0lCRvkBf0qEXLMVZXH32ON4dUNiSDLaQ3duWtvd
# X-Complaints-To: [EMAIL PROTECTED]
# X-DMCA-Complaints-To: [EMAIL PROTECTED]
# X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
# X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint
#   properly
# X-Postfilter: 1.3.32
# Xref: usenetserver.com alt.os.linux:422211
# X-Received-Date: Sat, 05 Aug 2006 18:46:49 EDT (text.usenetserver.com)

And here we have you on comp.editors using yet another
newsserver:

# Path: 
text.usenetserver.com!atl-c01.usenetserver.com!news.usenetserver.com!atl-c02.usenetserver.com!news.usenetserver.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!NNTP.WPI.EDU!news.tufts.edu!not-for-mail
# From: John Salerno <[EMAIL PROTECTED]>
# Organization: Tufts University
# User-Agent: Thunderbird 1.5 (Windows/20051201)
# MIME-Version: 1.0
# Newsgroups: comp.editors
# Subject: newbie to vim, question about moving to end of line
# Content-Type: text/plain; charset=ISO-8859-1; format=flowed
# Content-Transfer-Encoding: 7bit
# Lines: 24
# Message-ID: <[EMAIL PROTECTED]>
# Date: Fri, 28 Jul 2006 18:16:42 GMT
# NNTP-Posting-Host: 130.64.67.227
# X-Complaints-To: [EMAIL PROTECTED]
# X-Trace: news.tufts.edu 1154110602 130.64.67.227 (Fri, 28 Jul 2006 14:16:42 
EDT)
# NNTP-Posting-Date: Fri, 28 Jul 2006 14:16:42 EDT
# Xref: usenetserver.com comp.editors:161026
# X-Received-Date: Fri, 28 Jul 2006 14:16:43 EDT (text.usenetserver.com)

TROLL. 

I don't help trolls.

And I don't think you could run Linux if your life depended on
it.

You'd actually have to take a break from running your mouth on
hundreds of groups under dozens of aliases to do some homework.

Phuk off (again).

Done.

Note: I won't be downloading any articles on this thread.

Alan

-- 
Challenge-Response Systems are the best garbage-mail blockers
in the world. Spammers and trolls can't beat them and you
don't need to be a geek to use them. A brief introduction:
http://home.earthlink.net/~alanconnor/cr.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] John Salerno

2006-08-12 Thread Alan Connor
On alt.os.linux, in <[EMAIL PROTECTED]>, "John Salerno" wrote:

Correction: Someone who _sometimes_ calls himself "John Salerno"
wrote:

http://slrn.sourceforge.net/docs/README.offline>

So. You post using three different newsservers, which no one who
posts under the same alias all the time does.

And are attacking Linux in your original subject:

> Subject: and i thought windows made a mess of files...

With the typical display of non-literacy of a troll: No caps
where caps belong.

Your User-Agent string in your headers reads Windows, until
this thread, where it is modified only to say Linux instead of
Windows, but otherwise the same newsreader.

And there are virtually no Linux groups in your posting history 
for the last year.

You are a stinking troll and you will wear a gag when you are
in my newsreader. Nor will anyone be allowed to send replies to
yourarticles to my newsreader.

Regardless of which alias you are hiding behind at the moment,
with your tail between your legs where your balls should be.

No way I am going to help a stinking troll learn Linux.

If you are even trying to, that is...

Note: I won't be downloading any articles on this thread.

Alan

-- 
Challenge-Response Systems are the best garbage-mail blockers
in the world. Spammers and trolls can't beat them and you
don't need to be a geek to use them. A brief introduction:
http://home.earthlink.net/~alanconnor/cr.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] John Salerno

2006-08-12 Thread Alan Connor
On alt.os.linux, in <[EMAIL PROTECTED]>, "jason" wrote:
> Path: 
> text.usenetserver.com!atl-c01.usenetserver.com!news.usenetserver.com!atl-c05.usenetserver.com!news.usenetserver.com!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!4.24.21.153!newsfeed3.dallas1.level3.net!news.level3.com!newsfeed1.easynews.com!easynews.com!easynews!easynews-local!fe12.news.easynews.com.POSTED!not-for-mail
> From: jason <[EMAIL PROTECTED]>
> User-Agent: Debian Thunderbird 1.0.2 (X11/20060724)
> X-Accept-Language: en-us, en
> MIME-Version: 1.0
> Newsgroups: alt.os.linux,comp.editors,comp.lang.python
> Subject: Re: [OT] John Salerno
> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
> In-Reply-To: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
> Lines: 16
> Message-ID: <[EMAIL PROTECTED]>
> X-Complaints-To: [EMAIL PROTECTED]
> Organization: EasyNews, UseNet made Easy!
> X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise 
> we will be unable to process your complaint properly.
> Date: Sun, 13 Aug 2006 03:11:58 GMT
> Xref: usenetserver.com alt.os.linux:422390 comp.editors:161251 
> comp.lang.python:548515
> X-Received-Date: Sat, 12 Aug 2006 23:11:58 EDT (text.usenetserver.com)

http://slrn.sourceforge.net/docs/README.offline>

Posting through easynews. Let's see who else posts through
easynews on the groups I am subscribed to:

#From: "Ciaran Keating" <[EMAIL PROTECTED]>
#From: "Clayton Sutton" <[EMAIL PROTECTED]>
#From: "DanielP" <[EMAIL PROTECTED]>
#From: "Snoopy :-))" <[EMAIL PROTECTED]>
#From: "smtjs" <[EMAIL PROTECTED]>
#From: <[EMAIL PROTECTED]>
#From: "Ciaran Keating" <[EMAIL PROTECTED]>
#From: "Clayton Sutton" <[EMAIL PROTECTED]>
#From: "DanielP" <[EMAIL PROTECTED]>
#From: "Snoopy :-))" <[EMAIL PROTECTED]>
#From: "William B. Cattell" <[EMAIL PROTECTED]>
#From: <[EMAIL PROTECTED]>
#From: "Ciaran Keating" <[EMAIL PROTECTED]>
#From: "Clayton Sutton" <[EMAIL PROTECTED]>
#From: "DanielP" <[EMAIL PROTECTED]>
#From: "Snoopy :-))" <[EMAIL PROTECTED]>
#From: "William B. Cattell" <[EMAIL PROTECTED]>
#From: <[EMAIL PROTECTED]>
#From: Alan Connor <[EMAIL PROTECTED]>
 
A troll forging my name. I only post through Earthlink.
 
#From: Andrew Schulman <[EMAIL PROTECTED]>
#From: Aratzio <[EMAIL PROTECTED]>
#From: Bosco Pelone <[EMAIL PROTECTED]>
#From: Bretts Christ <[EMAIL PROTECTED]>
#From: Bretts of God <[EMAIL PROTECTED]>
#From: Bretts of The Apocalypse <[EMAIL PROTECTED]>
#From: Cam <[EMAIL PROTECTED]>
#From: Derek Munsley <[EMAIL PROTECTED]>
#From: Elo Magar <[EMAIL PROTECTED]>
#From: Gospel Bretts <[EMAIL PROTECTED]>
#From: Gospel Bretts <[EMAIL PROTECTED]>
#From: Hallelujah Bretts <[EMAIL PROTECTED]>
#From: Hallelujah Bretts <[EMAIL PROTECTED]>
#From: Holy Brett McCoy <[EMAIL PROTECTED]>
#From: Holy Bretts <[EMAIL PROTECTED]>
#From: Jason <[EMAIL PROTECTED]>
#From: John <[EMAIL PROTECTED]>
#From: John Blake <[EMAIL PROTECTED]>
#From: Mark Healey <[EMAIL PROTECTED]>
#From: Mark Healey <[EMAIL PROTECTED]>
#From: McBretts of God <[EMAIL PROTECTED]>
#From: Mike Coddington <[EMAIL PROTECTED]>
#From: Paul Colquhoun <[EMAIL PROTECTED]>
#From: Realto Margarino <[EMAIL PROTECTED]>
#From: River <[EMAIL PROTECTED]>
#From: SINNER <[EMAIL PROTECTED]>
#From: The Apostle Bretts <[EMAIL PROTECTED]>
#From: The Beloved Disciple Bretts <[EMAIL PROTECTED]>
#From: The Holy Apostle <[EMAIL PROTECTED]>
#From: The Holy Trinity of Bretts <[EMAIL PROTECTED]>
#From: The Reverend Doctor Bretts <[EMAIL PROTECTED]>
#From: To Garo <[EMAIL PROTECTED]>
#From: Uni <[EMAIL PROTECTED]>
#From: Wes Gray <[EMAIL PROTECTED]>
#From: WhyMe <[EMAIL PROTECTED]>
#From: ea aro <[EMAIL PROTECTED]>
#From: jason <[EMAIL PROTECTED]>
#From: le seigneur des rateaux <[EMAIL PROTECTED]>
#From: lordy <[EMAIL PROTECTED]>
#From: [EMAIL PROTECTED] (beginner_girl)

Looks like pretty much all trolls to me. 

Note: I won't be downloading any articles on this thread.

Alan

-- 
Challenge-Response Systems are the best garbage-mail blockers
in the world. Spammers and trolls can't beat them and you
don't need to be a geek to use them. A brief introduction:
http://home.earthlink.net/~alanconnor/cr.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Homework help

2008-04-01 Thread bobby . connor
Hey guys
I haev this homework assignment due today
I don't necessarily want the answers, but need help on how to approach
it/the steps i need to solve the problems
Thanks

#  (2 Points) Write a python function howMany(item,lst) which accepts
an item and a lst of items and returns the number of times item occurs
in lst. For example, howMany(3,[1,2,3,2,3]) should return 2.

# (2 Points) Write a python function upTo(n) which accepts a non-
negative number n and returns a list of numbers from 0 to n. For
example, upTo(3) should return the list [0, 1, 2, 3].

# (2 Points) Write a python function duplicate(lst) which accepts a
lst of items and returns a list with the items duplicated. For
example, duplicate([1,2,2,3]) should return the list [1, 1, 2, 2, 2,
2, 3, 3].

# (2 Points) Write a python function dotProduct(a,b) which accepts two
lists of integers a and b that are of equal length and which returns
the dot product of a and b. I.e., the sum a0 * b0 + ... + an-1 * bn-1
where n is the length of the lists. For example:

dotProduct([1,2,3],[4,5,6]) is 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32

# (2 Points) A pair (exp0, exp1) is a combination of expressions that
are attached together by their joint membership in the pair. For
example:

>>> (1+2, 'This')
(3, 'This')

A component of a pair can be obtained using an index in brackets as
with lists (and strings!). For example:

>>> (33,44)[0]
33

Write a function zip(lst1, lst2) such that zip accepts two equal
length lists and returns a list of pairs. For example, zip(['a', 'b',
'c'], [10, 20, 30]) should evaluate to the list [('a', 10), ('b', 20),
('c', 30)].

# (2 Points) Write a function unzip(lst) such that unzip accepts a
list of pairs and returns two lists such that lst == zip(unzip(lst)).
For example, unzip([('a', 10), ('b', 20), ('c', 30)] should evaluate
to the pair (['a', 'b', 'c'], [10, 20, 30]).

# (2 Points) Write a python function isAscending(lst) which accepts a
non-empty list of integers and returns True if the numbers in the list
are in ascending order. Otherwise it should return False. For example,
isAscending([1]) should evaluate to True while isAscending([1,2,2])
should return False.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Homework help

2008-04-01 Thread bobby . connor
On Apr 1, 12:17 pm, Paul Rubin  wrote:
> [EMAIL PROTECTED] writes:
> > I don't necessarily want the answers, but need help on how to approach
> > it/the steps i need to solve the problems
>
> What parts are you having difficulty with?  Are there some course
> materials and have you read them yet?

I just don't know how to start the problems off
-- 
http://mail.python.org/mailman/listinfo/python-list


Format Logfile Name with logging.ini

2020-05-29 Thread connor . r . novak
In an effort to clean up my python logging practices when creating libraries, I 
have begun reading into "Advanced Logging" and converting my logging practices 
into logging configuration `.ini` files:

[link](https://docs.python.org/3.4/howto/logging.html#configuring-logging)

My question is: When defining a FileHandler in a `.ini` file, all of the 
examples that I've seen hardcode the name and location of the log file. In the 
code snippet below, `python.log` is hardcoded into the `.ini` file:

```
[handler_hand02]
class=FileHandler
level=DEBUG
formatter=form02
args=('python.log', 'w')
```
[code reference 
link](https://docs.python.org/3.4/library/logging.config.html#logging-config-fileformat)

Desired Behavior:
On each run of the program, a new logfile is created in the `logs/` directory 
named "_program.log".

Current Behavior: 
The format in the example above overwrites a single file called "python.log" on 
each run, which is not the desired behavior.

Question: Is there a standard procedure for using .ini files to create a new 
logfile prepended with the current Unix timestamp on each run of the program?
-- 
https://mail.python.org/mailman/listinfo/python-list