Re: python to enable javascript , tried selinium, ghost, pyQt4 already

2014-01-19 Thread Giorgos Tzampanakis
On 2014-01-18, Jaiprakash Singh wrote:

> hi,
>
>  can you please suggest me some method for  study so that i can
>  scrap a site having JavaScript behind it 
>
>
>  i have tried selenium, ghost, pyQt4,  but it is slow and as a am
>  working with thread it sinks my ram memory very fast.

I have tried selenium in the past and I remember it working reasonably
well. I am afraid you can't get around the slowness since you have to have
a web browser running.

-- 
Improve at backgammon rapidly through addictive quickfire position quizzes:
http://www.bgtrain.com/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: graphical python

2014-01-19 Thread Ian Kelly
On Sat, Jan 18, 2014 at 10:40 PM, buck  wrote:
> I'm trying to work through Skienna's algorithms handbook, and note that the 
> author often uses graphical representations of the diagrams to help 
> understand (and even debug) the algorithms. I'd like to reproduce this in 
> python.
>
> How would you go about this? pyQt, pygame and pyglet immediately come to 
> mind, but if I go that route the number of people that I can share my work 
> with becomes quite limited, as compared to the portability of javascript 
> projects.
>
> I guess my question really is: has anyone had success creating an interactive 
> graphical project in the browser using python?
>
> Is this a dream I should give up on, and just do this project in 
> coffeescript/d3?

You should be able to do something without much fuss using HTML 5 and
either Pyjamas (which compiles Python code to Javascript) or Brython
(a more or less complete implementation of Python within Javascript).
For example, see the clock demo on the Brython web page.

Pyjamas is the more established and probably more stable of the two
projects, but you should be aware that there are currently two active
forks of Pyjamas and some controversy surrounding the project
leadership.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Rustom Mody
On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote:
> On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote:
> > Because these two pieces of code
>  def foo(x): print x+1
>  def bar(x): return x+1
> > look identical (to a beginner at least)
>  foo(3)
> > 4
>  bar(3)
> > 4

> As do these pieces of code:

> >>> def quux1(x): return str(x+1)
> >>> def quux2(x): return hex(x+1)[2:]

They do? 

>>> quux1(2.3)
'3.3'

>>> quux2(2.3)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1, in quux2
TypeError: hex() argument can't be converted to hex


If you want to give an irrelevant example at least give a correct one :D
the difference between str and hex is an arcane difference (Ive never used hex)
the difference between functions and procedures is absolutely basic.

And python is worse than not just academic languages like haskell in this
respect but even worse than C/Pascal etc.

In Pascal, the difference between procedure and function is
fundamental to the lang and is key to Pascal being good for academic
purposes.

In C, the difference is not so well marked but at least trivial
code-examples found in books/the net wont run straight-off without
some main-printf-etc boiler-plate.

In python lots of easy to check examples run straight off --
convenient for programmers of course but a headache for teachers who
are trying to set habits of minimal hygiene

> But we don't decry hex or str because of it. Every function has its
> use and purpose. If someone uses the wrong tool for the job, s/he will
> have to figure that out at some point - it doesn't mean the tool is
> wrong.

> If you're not using the REPL, print is critical. Don't assume everyone
> uses interactive mode.

"Everyone uses interactive mode" is of course an unreasonable assumption
"Everyone needs to learn (something or other at some time or other)" is not

And print (especially in python) screws up the learning-curve

tl;dr
You are wearing 'professional programmer' hat
I am wearing 'teacher' hat
Not sure what hat Roy or Steven are wearing 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python declarative

2014-01-19 Thread sertorbe
El miércoles, 15 de enero de 2014 18:02:08 UTC+1, Sergio Tortosa Benedito  
escribió:
> Hi I'm developing a sort of language extension for writing GUI programs
> 
> called guilang, right now it's written in Lua but I'm considreing Python
> 
> instead (because it's more tailored to alone applications). My question
> 
> it's if I can achieve this declarative-thing in python. Here's an
> 
> example:
> 
> 
> 
> Window "myWindow" {
> 
>   title="Hello world";
> 
>   Button "myButton" {
> 
>   label="I'm a button";
> 
>   onClick=exit
> 
>   }
> 
> }
> 
> print(myWindow.myButton.label)
> 
> 
> 
> Of course it doesn't need to be 100% equal. Thanks in advance
> 
> 
> 
> Sergio

OK, thanks, maybe the to be read by python may be interesting .Anyway, I think 
I'll have to consider all the options I have right now (Lua,Python,A file 
readed by Python). Really, thanks, you are awesome.

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


python-daemon for Python v3

2014-01-19 Thread Asaf Las
Hi Community 

Is there ported to Python v3 python-daemon package?

https://pypi.python.org/pypi/python-daemon/

i am afraid it is not as simple as correction of relative path input 
feature and except clauses in mentioned package.

Thanks 

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Sun, Jan 19, 2014 at 7:26 PM, Rustom Mody  wrote:
> If you want to give an irrelevant example at least give a correct one :D
> the difference between str and hex is an arcane difference (Ive never used 
> hex)
> the difference between functions and procedures is absolutely basic.

They don't give the same result for every possible input, any more
than your two do:

>>> foo(1.234567890123456)
2.23456789012
>>> bar(1.234567890123456)
2.234567890123456

(Tested on 2.7.3 on Linux. YMMV.)

There's no difference in Python between functions and procedures. It's
all functions, and some of them implicitly return None. If there were
a difference, what would this be?

def none_if(value, predicate):
if not predicate(value): return value

Personally, I'm quite happy with Python and the print function. (Or
statement, if you prefer. Same difference.) The most fundamental
aspects of any program are input, output, and preferably some
computation in between; and the most fundamental forms of input are
the command line / console and the program's source, and the most
basic output is the console. So the most basic and obvious program
needs:

1) Access to the command-line arguments
2) The ability to read from the console
3) Some means of writing to the console.

Not every program will need all that, but they'd be the most obvious
and simplest methods of communication - especially since they're the
three that are easiest to automate. How do you run a GUI program
through automated testing? With difficulty. How do you run a stdio
program through automated testing? Pipe it some input and compare its
output to the standard. And that means people should be accustomed to
using print, and sys.argv, and (raw_)input.

Fortunately Python doesn't have ob_start() / ob_get_clean() to tempt
people to use print when they should use return. So there's no
problem.

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


Re: python-daemon for Python v3

2014-01-19 Thread Ben Finney
Asaf Las  writes:

> Is there ported to Python v3 python-daemon package?
>
> https://pypi.python.org/pypi/python-daemon/

Have a read through the archives for the ‘python-daemon-devel’
discussion forum
http://lists.alioth.debian.org/mailman/listinfo/python-daemon-devel>,
where we have had discussions about porting the library to Python 3.

I'd be interested to know who wants us to keep Python 2 compatibility.
If we can drop that, then a Python 3 version of the library would be
much easier to maintain.

We are also in need of an active maintainer for the ‘python-lockfile’
library https://pypi.python.org/pypi/lockfile/> which is commonly
used with ‘python-daemon’.

-- 
 \ “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\Brain, but if we give peas a chance, won't the lima beans feel |
_o__)left out?” —_Pinky and The Brain_ |
Ben Finney

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


Re: graphical python

2014-01-19 Thread Irmen de Jong
On 19-1-2014 6:40, buck wrote:
> I'm trying to work through Skienna's algorithms handbook, and note that the 
> author often uses graphical representations of the diagrams to help 
> understand (and even debug) the algorithms. I'd like to reproduce this in 
> python.
> 
> How would you go about this?

Would something like this help http://ipython.org/notebook.html  ?

Irmen

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


Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Sunday, January 19, 2014 12:41:31 PM UTC+2, Ben Finney wrote:
> Have a read through the archives for the ‘python-daemon-devel’
> discussion forum
> http://lists.alioth.debian.org/mailman/listinfo/python-daemon-devel>,
> where we have had discussions about porting the library to Python 3.
> I'd be interested to know who wants us to keep Python 2 compatibility.
> If we can drop that, then a Python 3 version of the library would be
> much easier to maintain.
Thanks. i have not seen this, but different port. it is on github.
yet got myself rid of errors during pip install, but was not sure about latter.

> We are also in need of an active maintainer for the ‘python-lockfile’
> library https://pypi.python.org/pypi/lockfile/> which is commonly
> used with ‘python-daemon’.

I would love to contribute but as a novice in Python, need time to make 
something valuable for community.

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


Re: Need help vectorizing code

2014-01-19 Thread Oscar Benjamin
On 18 January 2014 20:51, Kevin K  wrote:
> I have some code that I need help vectorizing.
> I want to convert the following to vector form, how can I? I want to get rid 
> of the inner loop - apparently, it's possible to do so.
> X is an NxD matrix. y is a 1xD vector.
>
> def foo(X, y, mylambda, N, D, epsilon):
> ...
> for j in xrange(D):
> aj = 0
> cj = 0
> for i in xrange(N):
> aj += 2 * (X[i,j] ** 2)
> cj += 2 * (X[i,j] * (y[i] - w.transpose()*X[i].transpose() + 
> w[j]*X[i,j]))

As Peter said the y[i] above suggests that y has the shape (1, N) or
(N, 1) or (N,) but not (1, D). Is that an error? Should it actually be
y[j]?

You don't give the shape of w but I guess that it is (1, D) since you
index it with j. That means that w.transpose() is (D, 1). But then
X[i] has the shape (D,). Broadcasting those two shapes gives a shape
of (D, D) for cj. OTOH if w has the shape (D, 1) then cj has the shape
(1, D).

Basically your description is insufficient for me to know what your
code is doing in terms of all the array shapes. So I can't really
offer a vectorisation of it.

>
> ...
>
> If I call numpy.vectorize() on the function, it throws an error at runtime.

You've misunderstood what the numpy.vectorize function is for. The
vectorize function is a convenient way of generating a function that
can operate on arrays of arbitrary shape out of a function that
operates only on scalar values.


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


Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-18, Terry Reedy  wrote:
> On 1/18/2014 1:30 PM, Roy Smith wrote:
>> Pardon me for being cynical, but in the entire history of the universe,
>> has anybody ever used input()/raw_input() for anything other than a
>> homework problem?
>
> Homework problems (and 'toy' programs, such as hangman), whether in a 
> programming class or elsewhere, are one of the intended use cases of 
> Python. How else would you get interactive input without the complexity 
> of a gui?

sys.stdin.readline()

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


Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Grant Edwards
On 2014-01-18, indar kumar  wrote:

> I want to show a code for review but afraid of plagiarism issues.
> Kindly, suggest how can I post it for review here without masking it
> visible for public

http://www.python.org/community/jobs/

I'm sure once you've agreed on contract and payment terms with whoever
you hire to do your private code review they will arrange a private
communications channel.



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


Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman

On 01/19/2014 12:26 AM, Rustom Mody wrote:

On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote:

On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote:



As do these pieces of code:

--> def quux1(x): return str(x+1)
--> def quux2(x): return hex(x+1)[2:]


They do?

--> quux1(2.3)
'3.3'

--> quux2(2.3)
Traceback (most recent call last):
   File "", line 1, in 
   File "", line 1, in quux2
TypeError: hex() argument can't be converted to hex


(Will be) fixed in 3.5 [1]  :)

--
~Ethan~

[1] Which is to say, both will raise an exception.
--
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 3:14 AM, Ethan Furman  wrote:
>>> --> def quux1(x): return str(x+1)
>> --> quux1(2.3)
>> '3.3'
>
> (Will be) fixed in 3.5 [1]  :)
> [1] Which is to say, both will raise an exception.

Why would that raise?

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-19, Dennis Lee Bieber  wrote:
> On Sun, 19 Jan 2014 16:14:48 + (UTC), Grant Edwards
> declaimed the following:
>
>>On 2014-01-18, Terry Reedy  wrote:
>>> On 1/18/2014 1:30 PM, Roy Smith wrote:
 Pardon me for being cynical, but in the entire history of the universe,
 has anybody ever used input()/raw_input() for anything other than a
 homework problem?
>>>
>>> Homework problems (and 'toy' programs, such as hangman), whether in a 
>>> programming class or elsewhere, are one of the intended use cases of 
>>> Python. How else would you get interactive input without the complexity 
>>> of a gui?
>>
>>sys.stdin.readline()
>
>   At which point a simple:
>
> nm = raw_input("Enter your name: ")
> print "Hello, ", nm
>
> turns into (to duplicate the behavior WRT line endings, and to minimize the
> new features the student is exposed to)
>
> import sys
>
> sys.stdout.write("Enter your name: ")
> nm = sys.stdin.readline()
> nm.strip()
> sys.stdout.write("Hello, ")
> sys.stdout.write(nm)
> sys.stdout.write("\n")
> sys.stdout.flush()

The question was how to get input without using a GUI.  I presented an
answer.  You then conflated "whether or not to use input" with
"whether or not to use print" and proceeded to construct and knock
down a very nice straw man.  Kudos.

import sys
print "Enter your name: ",
nm = sys.stdin.readline().strip()
print "Hello, ", nm

> Yes, a non-beginner would have been exposed to formatting operations
> and been able to condense the three .write() calls into one...

1) I don't get why you jumped on the whole print vs. string formatting
   thing.  We're not talking about print vs write.  We're talking
   about whether or not people use input and raw_input.  I've been
   writing Python programs for 15 years, and I've never used either
   input or raw_input.

2) I didn't claim that sys.stdin.readline() was as simple as using
   input.  I didn't claim it was preferable.  I merely presented it as
   a refutation to the argument that if you don't use input/raw_input
   then you have to use a GUI toolkit.

-- 
Grant



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


Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 4:42 AM, Grant Edwards  wrote:
> 2) I didn't claim that sys.stdin.readline() was as simple as using
>input.  I didn't claim it was preferable.  I merely presented it as
>a refutation to the argument that if you don't use input/raw_input
>then you have to use a GUI toolkit.

I'd draw a subtle distinction here, btw. With sys.stdin.readline(),
you're asking to read a line from standard input, but with
(raw_)input(), you're asking to read one line from the console. If
it's been redirected, that's going to be equivalent (modulo newline
handling), but if not, it would make sense for (raw_)input() to call
on GNU Readline, where sys.stdin.readline() shouldn't. Calling a
method on a file-like object representing stdin feels lower level than
"ask the user for input with this prompt" (which might well do more
than that, too - eg it might flush sys.stdout).

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence

On 18/01/2014 18:41, Mark Lawrence wrote:

On 18/01/2014 18:30, Roy Smith wrote:

Pardon me for being cynical, but in the entire history of the universe,
has anybody ever used input()/raw_input() for anything other than a
homework problem?



Not me personally.  I guess raw_input must have been used somewhere at
some time for something, or it would have been scrapped in Python 3, not
renamed to input.



Actually, to go off at a tangent, I'm just getting into GUIs via 
wxPython.  I've discovered there are distinct advantages having to write 
endless lines of code just to get a piece of data.  For example on a 
Sunday it helps pass the time between the two sessions of the Masters 
Snooker final being shown on TV.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-19, Mark Lawrence  wrote:
> On 18/01/2014 18:41, Mark Lawrence wrote:
>> On 18/01/2014 18:30, Roy Smith wrote:
>>> Pardon me for being cynical, but in the entire history of the universe,
>>> has anybody ever used input()/raw_input() for anything other than a
>>> homework problem?
>>
>> Not me personally.  I guess raw_input must have been used somewhere at
>> some time for something, or it would have been scrapped in Python 3, not
>> renamed to input.
>
> Actually, to go off at a tangent, I'm just getting into GUIs via 
> wxPython.  I've discovered there are distinct advantages having to
> write endless lines of code just to get a piece of data.  For example
> on a Sunday it helps pass the time between the two sessions of the
> Masters Snooker final being shown on TV.

Fair enough, but what do you do to pass the time _during_ Snooker
being shown on TV?

I can still remember the point in my first trip to the UK when I
accidentally stumbled across darts on TV. Given the endless variety
(and quantity) of pointless crap that people watch here in the US, I
can't really explain why I was so baffled and amused by darts on TV --
but I was.

-- 
Grant Edwards   grant.b.edwardsYow! I want EARS!  I want
  at   two ROUND BLACK EARS
  gmail.comto make me feel warm
   'n secure!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman

On 01/19/2014 08:38 AM, Chris Angelico wrote:

On Mon, Jan 20, 2014 at 3:14 AM, Ethan Furman  wrote:

--> def quux1(x): return str(x+1)

--> quux1(2.3)
'3.3'


(Will be) fixed in 3.5 [1]  :)
[1] Which is to say, both will raise an exception.


Why would that raise?


Sorry, should have read that closer.  It will not raise.

The difference I was thinking of is:

  "%h" % 3.14  # this works

vs.

  hex(3.14)  # this raises

In 3.5 both will raise.

Apologies for the noise.

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Roy Smith
In article ,
 Grant Edwards  wrote:

> I can still remember the point in my first trip to the UK when I
> accidentally stumbled across darts on TV. Given the endless variety
> (and quantity) of pointless crap that people watch here in the US, I
> can't really explain why I was so baffled and amused by darts on TV --
> but I was.

What's so complicated?

points = 501
for dart in throws():
   if points - dart == 0 and dart.is_double():
  raise YouWin
   if points - dart < 0:
  continue
   points -= dart
   beer.drink()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman  wrote:
> The difference I was thinking of is:
>
>   "%h" % 3.14  # this works
>
> vs.
>
>   hex(3.14)  # this raises
>
> In 3.5 both will raise.

Now you have me *thoroughly* intrigued. It's not %h (incomplete format
- h is a modifier), nor %H (unsupported format character). Do you mean
%x? As of 3.4.0b2, that happily truncates a float:

>>> "%x" % 3.14
'3'

Is that changing in 3.5? Seems a relatively insignificant point, tbh!
Anyway, no biggie.

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 5:37 AM, Roy Smith  wrote:
> What's so complicated?
>
> points = 501
> for dart in throws():
>if points - dart == 0 and dart.is_double():
>   raise YouWin
>if points - dart < 0:
>   continue
>points -= dart
>beer.drink()

assert victory
raise beer

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


What’s wrong with scientific Python?

2014-01-19 Thread candide


http://cyrille.rossant.net/whats-wrong-with-scientific-python/


Any comments ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Scalability TCP Server + Background Game

2014-01-19 Thread Philip Werner
On Sat, 18 Jan 2014 13:19:24 +, Mark Lawrence wrote:

> On 18/01/2014 12:40, [email protected] wrote:
> 
> [snip the stuff I can't help with]
> 
> Here's the link you need to sort the problem with double spacing from
> google groups https://wiki.python.org/moin/GoogleGroupsPython

Thanks for the link. I've, hopefully, solved the issue by switching
to Pan instead of using google groups. :)

Regards,
Philip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Scalability TCP Server + Background Game

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 5:53 AM, Philip Werner  wrote:
> On Sat, 18 Jan 2014 13:19:24 +, Mark Lawrence wrote:
>
>> On 18/01/2014 12:40, [email protected] wrote:
>>
>> [snip the stuff I can't help with]
>>
>> Here's the link you need to sort the problem with double spacing from
>> google groups https://wiki.python.org/moin/GoogleGroupsPython
>
> Thanks for the link. I've, hopefully, solved the issue by switching
> to Pan instead of using google groups. :)

Looking a lot more normal and readable now. Thanks!

Note that some people have experienced odd issues with Pan, possibly
relating to having multiple instances running simultaneously. You may
want to take care not to let it open up a duplicate copy of itself.

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


Re: What’s wrong with scientific Python?

2014-01-19 Thread Mark Lawrence

On 19/01/2014 18:46, candide wrote:


http://cyrille.rossant.net/whats-wrong-with-scientific-python/

Any comments ?



Not worth reading as doesn't seem to have anything new to say.  As for 
Python 2 being obsolete, well I just give up :(


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-19, Roy Smith  wrote:
> In article ,
>  Grant Edwards  wrote:
>
>> I can still remember the point in my first trip to the UK when I
>> accidentally stumbled across darts on TV. Given the endless variety
>> (and quantity) of pointless crap that people watch here in the US, I
>> can't really explain why I was so baffled and amused by darts on TV --
>> but I was.
>
> What's so complicated?
>
> points = 501
> for dart in throws():
>if points - dart == 0 and dart.is_double():
>   raise YouWin
>if points - dart < 0:
>   continue
>points -= dart
>beer.drink()

That looks like an algorithm for _playing_ darts.  That I understand.
I have two dartboards (one real, one electronic) and a coule decent
sets of darts.  It's watching darts on TV that I don't get.

Actually, I don't really get watching any sort of sports on TV (even
the ones I play).  But there was just something about darts on TV that
seemed particularly beyond the pale.

-- 
Grant Edwards   grant.b.edwardsYow! But they went to MARS
  at   around 1953!!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence

On 19/01/2014 18:15, Grant Edwards wrote:

On 2014-01-19, Mark Lawrence  wrote:

On 18/01/2014 18:41, Mark Lawrence wrote:

On 18/01/2014 18:30, Roy Smith wrote:

Pardon me for being cynical, but in the entire history of the universe,
has anybody ever used input()/raw_input() for anything other than a
homework problem?


Not me personally.  I guess raw_input must have been used somewhere at
some time for something, or it would have been scrapped in Python 3, not
renamed to input.


Actually, to go off at a tangent, I'm just getting into GUIs via
wxPython.  I've discovered there are distinct advantages having to
write endless lines of code just to get a piece of data.  For example
on a Sunday it helps pass the time between the two sessions of the
Masters Snooker final being shown on TV.


Fair enough, but what do you do to pass the time _during_ Snooker
being shown on TV?

I can still remember the point in my first trip to the UK when I
accidentally stumbled across darts on TV. Given the endless variety
(and quantity) of pointless crap that people watch here in the US, I
can't really explain why I was so baffled and amused by darts on TV --
but I was.



Just no comparison, darts and snooker.  This is excellent though 
http://www.youtube.com/watch?v=sHnBppccI0o


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: What’s wrong with scientific Python?

2014-01-19 Thread Ben Finney
candide  writes:

> http://cyrille.rossant.net/whats-wrong-with-scientific-python/
> Any comments ?

It's in need of a good summary.

-- 
 \ “I have never imputed to Nature a purpose or a goal, or |
  `\anything that could be understood as anthropomorphic.” —Albert |
_o__)Einstein, unsent letter, 1955 |
Ben Finney

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


Re: question about input() and/or raw_input()

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence  wrote:
> On 19/01/2014 18:15, Grant Edwards wrote:
>>
>> On 2014-01-19, Mark Lawrence  wrote:
>>> Actually, to go off at a tangent, I'm just getting into GUIs via
>>> wxPython.  I've discovered there are distinct advantages having to
>>> write endless lines of code just to get a piece of data.  For example
>>> on a Sunday it helps pass the time between the two sessions of the
>>> Masters Snooker final being shown on TV.
>>
>>
>> Fair enough, but what do you do to pass the time _during_ Snooker
>> being shown on TV?
>>
>> I can still remember the point in my first trip to the UK when I
>> accidentally stumbled across darts on TV. Given the endless variety
>> (and quantity) of pointless crap that people watch here in the US, I
>> can't really explain why I was so baffled and amused by darts on TV --
>> but I was.
>>
>
> Just no comparison, darts and snooker.  This is excellent though
> http://www.youtube.com/watch?v=sHnBppccI0o

Now that we're way off on the tangent of what some people consider
boring and others don't, I'm really looking forward to watching
curling in the upcoming Olympics.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence

On 19/01/2014 19:24, Larry Martell wrote:

On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence  wrote:

On 19/01/2014 18:15, Grant Edwards wrote:


On 2014-01-19, Mark Lawrence  wrote:

Actually, to go off at a tangent, I'm just getting into GUIs via
wxPython.  I've discovered there are distinct advantages having to
write endless lines of code just to get a piece of data.  For example
on a Sunday it helps pass the time between the two sessions of the
Masters Snooker final being shown on TV.



Fair enough, but what do you do to pass the time _during_ Snooker
being shown on TV?

I can still remember the point in my first trip to the UK when I
accidentally stumbled across darts on TV. Given the endless variety
(and quantity) of pointless crap that people watch here in the US, I
can't really explain why I was so baffled and amused by darts on TV --
but I was.



Just no comparison, darts and snooker.  This is excellent though
http://www.youtube.com/watch?v=sHnBppccI0o


Now that we're way off on the tangent of what some people consider
boring and others don't, I'm really looking forward to watching
curling in the upcoming Olympics.



Curling, now there's another good reason to allow Scottish independance :)

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: python-daemon for Python v3

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 3:30 AM, Asaf Las  wrote:
> Hi Community
>
> Is there ported to Python v3 python-daemon package?
>
> https://pypi.python.org/pypi/python-daemon/
>
> i am afraid it is not as simple as correction of relative path input
> feature and except clauses in mentioned package.

I use this technique for demonizing:

http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/

And has been ported to 3:

http://www.jejik.com/files/examples/daemon3x.py
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: graphical python

2014-01-19 Thread buck
On Sunday, January 19, 2014 12:19:29 AM UTC-8, Ian wrote:
> On Sat, Jan 18, 2014 at 10:40 PM, buck  wrote:
> 
> > I'm trying to work through Skienna's algorithms handbook, and note that the 
> > author often uses graphical representations of the diagrams to help 
> > understand (and even debug) the algorithms. I'd like to reproduce this in 
> > python.
> 
> >
> 
> > How would you go about this? pyQt, pygame and pyglet immediately come to 
> > mind, but if I go that route the number of people that I can share my work 
> > with becomes quite limited, as compared to the portability of javascript 
> > projects.
> 
> >
> 
> > I guess my question really is: has anyone had success creating an 
> > interactive graphical project in the browser using python?
> 
> >
> 
> > Is this a dream I should give up on, and just do this project in 
> > coffeescript/d3?
> 
> 
> 
> You should be able to do something without much fuss using HTML 5 and
> 
> either Pyjamas (which compiles Python code to Javascript) or Brython
> 
> (a more or less complete implementation of Python within Javascript).
> 
> For example, see the clock demo on the Brython web page.
> 
> 
> 
> Pyjamas is the more established and probably more stable of the two
> 
> projects, but you should be aware that there are currently two active
> 
> forks of Pyjamas and some controversy surrounding the project
> 
> leadership.

Thanks Ian. 
Have you personally used pyjs successfully?
It's ominous that the examples pages are broken...

I was impressed with the accuracy of the Brython implementation. I hope they're 
able to decrease the web weight in future versions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman

On 01/19/2014 10:41 AM, Chris Angelico wrote:

On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman  wrote:

The difference I was thinking of is:

   "%h" % 3.14  # this works

vs.

   hex(3.14)  # this raises

In 3.5 both will raise.


Now you have me *thoroughly* intrigued. It's not %h (incomplete format
- h is a modifier), nor %H (unsupported format character). Do you mean
%x? As of 3.4.0b2, that happily truncates a float:


"%x" % 3.14

'3'

Is that changing in 3.5? Seems a relatively insignificant point, tbh!


Argh.  Yes, %x or %X.

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


Re: Help with simple code that has database defined

2014-01-19 Thread Denis McMahon
On Sat, 18 Jan 2014 18:23:01 -0800, indar kumar wrote:

> I have to save students information in a database that is keeping
> continuously track of the information. Format is as follows:

You probably need to use one of the database modules.

> Note: if this name already exists there in database, just update the
> information of that(name) e.g course,grade and date. Otherwise, add it.

That sounds like an sql issue specific to your chosen database, not a 
python issue.

> This is just part because this is what I know how to do, for rest have
> no idea

I suggest you get idea fast. Or ask your lecturers for advice. Or return 
the advance you were paid on this coding job, because you don't seem to 
have the skills to do it.

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Gene Heskett
On Sunday 19 January 2014 15:11:52 Larry Martell did opine:

> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence  
wrote:
> > On 19/01/2014 18:15, Grant Edwards wrote:
> >> On 2014-01-19, Mark Lawrence  wrote:
> >>> Actually, to go off at a tangent, I'm just getting into GUIs via
> >>> wxPython.  I've discovered there are distinct advantages having to
> >>> write endless lines of code just to get a piece of data.  For
> >>> example on a Sunday it helps pass the time between the two sessions
> >>> of the Masters Snooker final being shown on TV.
> >> 
> >> Fair enough, but what do you do to pass the time _during_ Snooker
> >> being shown on TV?
> >> 
> >> I can still remember the point in my first trip to the UK when I
> >> accidentally stumbled across darts on TV. Given the endless variety
> >> (and quantity) of pointless crap that people watch here in the US, I
> >> can't really explain why I was so baffled and amused by darts on TV
> >> -- but I was.
> > 
> > Just no comparison, darts and snooker.  This is excellent though
> > http://www.youtube.com/watch?v=sHnBppccI0o
> 
> Now that we're way off on the tangent of what some people consider
> boring and others don't, I'm really looking forward to watching
> curling in the upcoming Olympics.

I have Larry, and the suspense is not good for those with high blood 
pressure.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
Required reading: 

I've enjoyed just about as much of this as I can stand.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Gene Heskett
On Sunday 19 January 2014 15:08:31 Roy Smith did opine:

> In article ,
> 
>  Grant Edwards  wrote:
> > I can still remember the point in my first trip to the UK when I
> > accidentally stumbled across darts on TV. Given the endless variety
> > (and quantity) of pointless crap that people watch here in the US, I
> > can't really explain why I was so baffled and amused by darts on TV --
> > but I was.
> 
> What's so complicated?
> 
> points = 501
> for dart in throws():
>if points - dart == 0 and dart.is_double():
>   raise YouWin
>if points - dart < 0:
>   continue
>points -= dart
>beer.drink()

Aren't you missing a fi there, or a next dart? ;-)

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
Required reading: 

Baseball is a skilled game.  It's America's game - it, and high taxes.
-- The Best of Will Rogers
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: graphical python

2014-01-19 Thread Ian Kelly
On Sun, Jan 19, 2014 at 12:30 PM, buck  wrote:
> Thanks Ian.
> Have you personally used pyjs successfully?
> It's ominous that the examples pages are broken...

I don't have any personal experience with either project.  I don't
know what's going on with pyjs.org currently, but the examples at the
pyj.be fork seem to be in working order.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about input() and/or raw_input()

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 1:12 PM, Gene Heskett  wrote:
> On Sunday 19 January 2014 15:11:52 Larry Martell did opine:
>
>> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence 
> wrote:
>> > On 19/01/2014 18:15, Grant Edwards wrote:
>> >> On 2014-01-19, Mark Lawrence  wrote:
>> >>> Actually, to go off at a tangent, I'm just getting into GUIs via
>> >>> wxPython.  I've discovered there are distinct advantages having to
>> >>> write endless lines of code just to get a piece of data.  For
>> >>> example on a Sunday it helps pass the time between the two sessions
>> >>> of the Masters Snooker final being shown on TV.
>> >>
>> >> Fair enough, but what do you do to pass the time _during_ Snooker
>> >> being shown on TV?
>> >>
>> >> I can still remember the point in my first trip to the UK when I
>> >> accidentally stumbled across darts on TV. Given the endless variety
>> >> (and quantity) of pointless crap that people watch here in the US, I
>> >> can't really explain why I was so baffled and amused by darts on TV
>> >> -- but I was.
>> >
>> > Just no comparison, darts and snooker.  This is excellent though
>> > http://www.youtube.com/watch?v=sHnBppccI0o
>>
>> Now that we're way off on the tangent of what some people consider
>> boring and others don't, I'm really looking forward to watching
>> curling in the upcoming Olympics.
>
> I have Larry, and the suspense is not good for those with high blood
> pressure.

Then don't watch the women:
http://oglympics.com/2010/02/16/women-of-curling-fire-on-ice/
-- 
https://mail.python.org/mailman/listinfo/python-list


Documentation of dict views change request

2014-01-19 Thread Charles Hixson
Could it please be clearly documented that keys(), values(), and items() 
are not writeable.  I agree that this is how they should be, but it 
would be still better if they were clearly documented as such.  The 
labeling of them as dynamic, while true, was a bit confusing here.  
(I.e., it was talking about changing their value through other means of 
access rather than directly through the returned values.)


P.S.:  Is it reasonable to return the items() of a dict in order to pass 
a read only copy of the values?


--
Charles Hixson

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


Re: Documentation of dict views change request

2014-01-19 Thread Mark Lawrence

On 19/01/2014 21:26, Charles Hixson wrote:

Could it please be clearly documented that keys(), values(), and items()
are not writeable.  I agree that this is how they should be, but it
would be still better if they were clearly documented as such.  The
labeling of them as dynamic, while true, was a bit confusing here.
(I.e., it was talking about changing their value through other means of
access rather than directly through the returned values.)

P.S.:  Is it reasonable to return the items() of a dict in order to pass
a read only copy of the values?



Just raise an issue here http://bugs.python.org/

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Documentation of dict views change request

2014-01-19 Thread Roy Smith
In article ,
 Charles Hixson  wrote:

> Could it please be clearly documented that keys(), values(), and items() 
> are not writeable.

We'll, technically, they are.

>>> d = {'foo': 1, 'bar':2}
>>> k = d.keys()
>>> k
['foo', 'bar']
>>> k[0] = "some other key"
>>> k
['some other key', 'bar']

Of course, this only changes the list that keys() returns, it doesn't 
affect the dictionary itself (which, I assume, is what you were really 
talking about).

Think this one through.  How *could* altering what keys() returns 
possibly affect the dict?  If it did, that means you could do something 
like:

some_dict.keys().append("some other key")

what would that mean?  You've added a key, but what's the corresponding 
value?  I will admit, the picture becomes a bit fuzzier if you consider:

some_dict.items().append(("some other key", 42))

which you could at least imagine would affect the underlying dict.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Documentation of dict views change request

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 8:40 AM, Roy Smith  wrote:
> In article ,
>  Charles Hixson  wrote:
>
>> Could it please be clearly documented that keys(), values(), and items()
>> are not writeable.
>
> We'll, technically, they are.
>
> Of course, this only changes the list that keys() returns, it doesn't
> affect the dictionary itself (which, I assume, is what you were really
> talking about).

In Python 3, they return views, not lists. So they really are read-only.

On Mon, Jan 20, 2014 at 8:26 AM, Charles Hixson
 wrote:
> P.S.:  Is it reasonable to return the items() of a dict in order to pass a
> read only copy of the values?

No, because it isn't a copy. At least, not in Python 3; if you're
using Python 2, then the wording of your subject line is inaccurate,
see above.

>>> d = {"a":1,"b":2,"c":3}
>>> i = d.items()
>>> del d["b"]
>>> list(i)
[('a', 1), ('c', 3)]

If you returned i from a function and expected it to be a copy, you'd
be in for a nasty shock. Try the .copy() method for a shallow copy, or
look up deepcopy if you need a recursive copy.

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


Re: How to write this as a list comprehension?

2014-01-19 Thread Piet van Oostrum
John Allsup  writes:

> Hi,
>
> I'd agree with the advice that it's not the best idea: readability sucks
> here, but consider the following:
>
>
> import time
>
> def somefunc(a,b,c,d): # dummy function
> return "{} - {} - {} : {}".format(a,b,c,d)
> l = [(time.time(),"name {}".format(n)) for n in range(100)] # dummy data
>
> # the line in question
> labels = [somefunc(*(lambda t,n:
> (t.tm_mon,t.tm_mday,t.tm_wday,n))(time.localtime(x[0]),x[1])) for x in
> l]
>
>
> print(labels) # just to see the result
>
>
> If you find that hard to decipher, the consider the maintainability of
> code you write that uses such comprehensions.  You need to include
> comments that explain what this does, and it is easier to write a
> longhand version using .append() and variable assignments.  I presume
> performance won't be an issue determining the right approach, since then
> you'd be using C or C++.

I'll stay with

labels = [somefunc(mn, day, wd, name) 
for then, name in mylist
for _, mn, dy, _, _, _, wd, _, _ in [localtime(then)]]

where (sic!) the last part means as much as 
   where _, mn, dy, _, _, _, wd, _, _ = localtime(then)

I find the list comprehension preferable because it makes it more clear
that a new list is constructed from an existing list, something that is
not as immediately clear with the append construction.
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Documentation of dict views change request

2014-01-19 Thread Terry Reedy

On 1/19/2014 4:41 PM, Mark Lawrence wrote:

On 19/01/2014 21:26, Charles Hixson wrote:

Could it please be clearly documented that keys(), values(), and items()
are not writeable.  I agree that this is how they should be, but it
would be still better if they were clearly documented as such.  The
labeling of them as dynamic, while true, was a bit confusing here.
(I.e., it was talking about changing their value through other means of
access rather than directly through the returned values.)

P.S.:  Is it reasonable to return the items() of a dict in order to pass
a read only copy of the values?



Just raise an issue here http://bugs.python.org/


The relevant section is

4.10.1. Dictionary view objects¶

The objects returned by dict.keys(), dict.values() and dict.items() are 
view objects.


The 'view object' are implicitly 'read-only' because no syntax is given 
to write to them, but ahead and propose adding 'read-only' to make the 
above explicitly say "read-only view objects".


--
Terry Jan Reedy


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


Re: Python program distribution - a source of constant friction

2014-01-19 Thread Göktuğ Kayaalp
On Mon, Jan 06, 2014 at 11:39:13PM +, Nicholas Cole wrote:
> This email is inspired by a YouTube video of a talk that Jessica McKellar

Could you please share the link to the video please?

> recently gave.  I was struck by her analysis that it is hard to remain a
> popular language (as Python currently is) and her call to action to address
> friction points that make it hard for a non-Python audience to use Python
> and applications developed in Python.
> 
> Well, here is one.
> 
> All of the early books one reads on Python compare it to Java or similar
> languages.  Write code once, is the promise, and as long as your target
> computer has a Python interpreter, your code will run.  For Java, I have to
> say! this really does seem true.  Once I have a Java environment installed,
> Java applications work seamlessly.  I download them, execute them, and,
> unless they are very old and give themselves away by using a non-native set
> of GUI widgets, I probably forget that I am running Java at all.
> 
> But as we all know, Python isn't that simple.  I'm not talking about the
> problems of cross-platform GUIs or other such things.  I'm taking about the
> problem of distributing anything more complicated than a single-file
> program to end users.
> 
> I realise that I'm not really, either, taking about the much written
> about Python packaging problem.  I was going to berate the packaging
> documentation for not really helping with the problem I have in mind, but I
> realised that actually the kinds of packages that the Packaging Guide is
> taking about are the kinds of things that developers and python-proficient
> system administrators will be installing.
> 
> But what about the end-user?  The end-user who just wants a blob (he
> doesn't care about what language it is in - he just wants to solve the
> problem at hand with your shiny, cool, problem-solving application).  He is
> hopefully using a system on which Python comes as default.  At most one
> might get him to install a new Python interpreter and standard library, but
> asking him to do more than that is simply asking more than he will do.
>  Will your code run or not? (i.e. without him having to learn what pip is!)
> 
> There are tools that will package up binaries of python and create
> something that will even run without an interpreter installed on the target
> system.  If only they were better documented, less fragile and worked
> consistently with Python 3!  Even then, I'm not sure this is the answer -
> anything like that is bound to be a bit fragile and break one of the
> attractive features of Python - that all things being equal, I don't need
> to maintain development environments for every possible target platform to
> get code to run.
> 
> What would be nice is something much less complicated.  Something , for
> example, that just takes everything except the python interpreter from a
> virtual environment, packs it up and turns it into a zip archive that
> really will run on a user's python installation without any additional
> steps.  There are a couple of tools to do something close to this, but they
> are hardly well signposted in the python documentation (in fact I only
> found them with the help of this list), and even these tools need more than
> a little experimentation to get right.  No doubt even here some extra glue
> or magic would be useful - what is the right thing to do when C modules are
> needed?  But at any rate, I think that some more thought in this area would
> be very useful.
> 
> And what about WSGI apps?  I regard WSGI as one of the great features of
> modern Python.  But again, end users don't really want to have to learn all
> about python and proxy servers running in front of special WSGI servers.
>  Most are not going to serve hundreds of thousands of users, but probably
> do need a little more than one connection at a time.  Even if the right
> solution is to create these complicated setups, I defy anyone to find me a
> page I could point a competent system administrator (but non-Python
> developer) at and say, "here is my code, install it in this directory and
> set up a webserver according to the instructions on this single web page
> and everything will just work."
> 
> We are even further away from saying, "Here is a special zip file. Make
> sure you have a Python 3 interpreter ready and then just treat this file as
> you would any other service on your system.  Have it started by whatever
> daemon manages services on your server, and it will all just work and be
> able to handle a reasonable number of users with a reasonable level of
> security and reliability.  Of course, if you end up with more than a few
> hundred users, you will need something more specialised."
> 
> Python *packaging* looks as if it is getting sorted out.  Pip is going to
> be part of Python 3.4 and PyPI works very well. The instructions on the net
> for packaging things for a Python audience are extremely good.  Sending
> python cod

Re: How to write this as a list comprehension?

2014-01-19 Thread Rhodri James
On Sat, 18 Jan 2014 16:00:45 -, Jussi Piitulainen  
 wrote:



Rustom Mody writes:


On Saturday, January 18, 2014 2:06:29 PM UTC+5:30, Peter Otten wrote:

> What would a list-comp with `let` or `where` look like? Would it
> win the beauty contest against the loop?

For me this is neat

[somefunc(mn,day,wd,name) for (then, name) in mylist let  
(_,mn,dy,_,_,_,wd,_,_) = localtime(then)]


Others may not find it so!


Count me firmly in the "others" camp.  It looks ugly, it flows appallingly  
badly as English, and its only going to get worse as you pile in more  
variables and expressions.  -100 from me.



See it across > 1 line (as I guess it will come after being posted!)
and its not so neat.


I would write that on three lines anyway, properly indented:

  [ somefunc(mn,day,wd,name)
for (then, name) in mylist
let (_,mn,dy,_,_,_,wd,_,_) = localtime(then) ]

It could be made to use existing keywords:

  [ somefunc(mn,day,wd,name)
for (then, name) in mylist
with localtime(then) as (_,mn,dy,_,_,_,wd,_,_) ]


Better, in that it's readable.  It's still storing up trouble, though.

Seriously, what's inelegant about this?

def meaningful_name(then, name):
_,mn,dy,_,_,_,wd,_,_ = localtime(then)
return somefunc(mn, dy, wd, name)

...

[meaningful_name(then, name) for (then, name) in mylist]

I assume there's some good reason you didn't want somefunc() to do the  
localtime() itself?


--
Rhodri James *-* Wildebeest Herder to the Masses
--
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-19 Thread Jean Dupont
Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
> On 18 January 2014 14:52, Jean Dupont  wrote:
> >
> > Thanks Peter and Terry Jan for the useful suggestions. One thing which I 
> >find a bit weird: when asking for Python-help concerning raspberry pi code 
> > or problems, a lot of people don't seem to be interested in helping out, 
> > that's of course their choice, but maybe they don't seem to be aware the 
> > raspberry pi is often the motivation for starting to learn to program in 
> >Python. And as such such a reaction is a bit disappointing.
> Hi Jean,
> What makes you say that? Did you previously ask questions about
> Rasberry Pi code on this list?
It was not about code but about python-coding in IDLE (that's the default
on raspbian):
I started a thread "[newbie] starting geany from within idle does not
work" both here and in the raspberry pi forum. I just wondered why I never
got an answer concerning that topic.

> If you did I wouldn't have answered those questions because I've never
> used a Raspberry Pi and know nothing about them (except that they
> encourage using Python somehow). I think that there's actually a list
> that is specifically for Raspberry Pi Python questions that might be
> more helpful although I don't know what it is...
Here is the url to that forum

http://www.raspberrypi.org/forum/

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Sunday, January 19, 2014 9:30:21 PM UTC+2, [email protected] wrote:
> On Sun, Jan 19, 2014 at 3:30 AM, Asaf Las  wrote:
> I use this technique for demonizing:
> http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
> And has been ported to 3:
> http://www.jejik.com/files/examples/daemon3x.py

Thanks! i have seen this code before. Did you encounter any problem with 
it before for long running tasks? 

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


Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Dan Stromberg
On Sat, Jan 18, 2014 at 10:31 PM, Steven D'Aprano
 wrote:
> On Sat, 18 Jan 2014 14:32:21 -0800, indar kumar wrote:
>
>> @Roy Smith
>>
>> Can you help me privately because its an assignment and have to submit
>> plagiarism free
>
> Then don't plagiarise.
>
>
> Plagiarism means YOU copy other people. You shouldn't get in trouble
> because other people copy you.

I did a short time of teaching while I was in school.  If three
students all turned in the same assignment, they all got docked
significantly.  There was no "who copied off of whom?", it was
"someone shared when they shouldn't have."
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python-daemon for Python v3

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 9:57 PM, Asaf Las  wrote:
> On Sunday, January 19, 2014 9:30:21 PM UTC+2, [email protected] wrote:
>> On Sun, Jan 19, 2014 at 3:30 AM, Asaf Las  wrote:
>> I use this technique for demonizing:
>> http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
>> And has been ported to 3:
>> http://www.jejik.com/files/examples/daemon3x.py
>
> Thanks! i have seen this code before. Did you encounter any problem with
> it before for long running tasks?

Nope, no problems at all.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 4:21 PM, Dan Stromberg  wrote:
> I did a short time of teaching while I was in school.  If three
> students all turned in the same assignment, they all got docked
> significantly.  There was no "who copied off of whom?", it was
> "someone shared when they shouldn't have."

What a wonderful way to promote an attitude of "my code is MY CODE and
should never leave my sight". What a delightful way of thinking to
unleash on the world.

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


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 3:04 PM, Jean Dupont  wrote:
> I started a thread "[newbie] starting geany from within idle does not
> work" both here and in the raspberry pi forum. I just wondered why I never
> got an answer concerning that topic.

I saw that thread. It looked like a R-Pi problem, not a Python one, so
I didn't respond because I don't have an R-Pi. If you get no response
on the R-Pi forum, you might want to see if you can duplicate the
issue on a desktop computer - preferably on Win/Mac/Lin, as those are
the platforms most people use. That, with exact steps to repro (which
it looks like you gave for the R-Pi, though again I can't verify),
would get some interest.

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


Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Monday, January 20, 2014 8:19:04 AM UTC+2, [email protected] wrote:
> Nope, no problems at all.

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


Re: Python declarative

2014-01-19 Thread Francesco Bochicchio
Looking at my own code after four years, I just realized that most of 
parentheses can be avoided by redefining the += operators to be a synonym of 
the add method.

Go figure, I guess that with age it _does_ come a little wisdom ... :-)

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


Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Ben Finney
Chris Angelico  writes:

> On Mon, Jan 20, 2014 at 4:21 PM, Dan Stromberg  wrote:
> > I did a short time of teaching while I was in school. If three
> > students all turned in the same assignment, they all got docked
> > significantly. There was no "who copied off of whom?", it was
> > "someone shared when they shouldn't have."
>
> What a wonderful way to promote an attitude of "my code is MY CODE and
> should never leave my sight". What a delightful way of thinking to
> unleash on the world.

Teachers are asked to grade each student on how that student exercises
the relevant skills.

Sometimes the relevant skills include collaboration, in which case the
students should be expected and encouraged to base their work directly
on the work of others. In these cases, we would expect the teacher not
to discourage sharing of information.

But sometimes different skills are being examined, and the student
should be exercising skills on their own without basing it directly on
the work of others. In these cases, penalties for plagiarism are
appropriate, would you agree?

-- 
 \  “When I wake up in the morning, I just can't get started until |
  `\ I've had that first, piping hot pot of coffee. Oh, I've tried |
_o__)other enemas...” —Emo Philips |
Ben Finney

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


Generating documentation for Python and JavaScript/AngularJS to the one doc server?

2014-01-19 Thread Alec Taylor
The advantages of this approach include:
  - Consistent docstring syntax everywhere
  - Centralsied documentation server; find all your docs in one place
Search and jump-to-source from any documented function or class; in either 
language

Are there any modules integrating with Sphinx or similar; which generate+put 
your JavaScript and Python documentation in one place?

Thanks for all suggestions
-- 
https://mail.python.org/mailman/listinfo/python-list