On Thu, Sep 12, 2013 at 11:22 PM, Shabda Raaj wrote:
>> whole qx business than Python programmers are with os and subprocess.
>
> That because subprocess and os module have a very bad api. I prefer using
> envoy whenevr I can.
>
> https://github.com/kennethreitz/envoy
Interesting. Haven't worked
On Tue, Sep 10, 2013 at 10:14 AM, Shabda Raaj wrote:
> This is a popular talk on quircks of ruby/js
>
> https://www.destroyallsoftware.com/talks/wat
>
> What are the quircks/unexpected behavior you find in Python? (Aka Python
> "wats").
>
Wait a second... wasn't there a talk about just this capt
Jeffrey Jose writes:
[...]
> I come from a place where you use *batteries* as much as possible, and
> where shelling out is the last resort.
[...]
I think so too. Perl programmers are much more comfortable with the
whole qx business than Python programmers are with os and subprocess.
--
C
On Wed, Sep 11, 2013 at 9:02 PM, Vardhan Varma wrote:
> On Wed, Sep 11, 2013 at 8:42 PM, Pranjal Mittal <
> pranjal.mittal.ec...@iitbhu.ac.in> wrote:
>
> > Here you go-
> >
> > import socket
> > socket.gethostbyaddr(socket.gethostname())[2]
> >
> >
> > On Wed, Sep 11, 2013 at 8:16 PM, ashish makan
On Wed, Sep 11, 2013 at 8:42 PM, Pranjal Mittal <
pranjal.mittal.ec...@iitbhu.ac.in> wrote:
> Here you go-
>
> import socket
> socket.gethostbyaddr(socket.gethostname())[2]
>
>
> On Wed, Sep 11, 2013 at 8:16 PM, ashish makani >wrote:
>
> > Found this quick, nifty way to determine the ip address o
Here you go-
import socket
socket.gethostbyaddr(socket.gethostname())[2]
On Wed, Sep 11, 2013 at 8:16 PM, ashish makani wrote:
> Found this quick, nifty way to determine the ip address of the machine your
> py script is running on
>
> import commands
> commands.getoutput("/sbin/ifconfig").split
Found this quick, nifty way to determine the ip address of the machine your
py script is running on
import commands
commands.getoutput("/sbin/ifconfig").split("\n")[1].split()[1][5:]
( via http://stackoverflow.com/a/3177266/559456 )
cheers
ashish
*The only way to do great work is to love what y
We must be thankful for the people who invented the keyboard and stopped
with single SPACE and TAB keys for column indentation.
Every time you edit, mind compile the Python code on production critical
time, there could be a landmine hidden in the white space on nano or remote
vi.
On Tue, Sep
On Tue, Sep 10, 2013 at 11:10 AM, Bibhas wrote:
>
>
> Anand Chitipothu wrote:
> >On Tue, Sep 10, 2013 at 10:57 AM, Shabda Raaj
> >wrote:
> >
> >> > A variable is either local or global. It is decided at the compile
> >time.
> >>
> >> Erm, compile?
> >>
> >
> >well, you may call it module/script
Of course it is possible to force byte-compile the Python scripts. You can also
use 'pycompile' command for that. I meant python by default byte-compiles the
scripts that are imported so that they can be imported faster the next time.
Jeffrey Jose wrote:
>On Tue, Sep 10, 2013 at 11:10 AM, Bib
Anand B Pillai wrote:
>-BEGIN PGP SIGNED MESSAGE-
>Hash: SHA1
>
>On Tuesday 10 September 2013 10:57 AM, Shabda Raaj wrote:
>>> A variable is either local or global. It is decided at the
>>> compile time.
>>
>> Erm, compile?
>>
>>
>> Python's scoping rules are , erm, interesting:
>>
>
On Tue, Sep 10, 2013 at 11:10 AM, Bibhas wrote:
> Only the scripts that have been imported somewhere. Right?
>
Not necessarily -
>>> import py_compile
>>> py_compile.compile
Byte-compile one Python source file to Python bytecode.
Arguments:
file:source filename
cfile:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 10:57 AM, Shabda Raaj wrote:
>> A variable is either local or global. It is decided at the
>> compile time.
>
> Erm, compile?
>
>
> Python's scoping rules are , erm, interesting:
>
> http://me.veekun.com/blog/2011/04/24
Anand Chitipothu wrote:
>On Tue, Sep 10, 2013 at 10:57 AM, Shabda Raaj
>wrote:
>
>> > A variable is either local or global. It is decided at the compile
>time.
>>
>> Erm, compile?
>>
>
>well, you may call it module/script load time. But python compiles the
>code
>and generates bytecode before e
On Tue, Sep 10, 2013 at 10:57 AM, Shabda Raaj wrote:
> > A variable is either local or global. It is decided at the compile time.
>
> Erm, compile?
>
well, you may call it module/script load time. But python compiles the code
and generates bytecode before executing it.
$ file a.pyc
a.pyc: pytho
> A variable is either local or global. It is decided at the compile time.
Erm, compile?
Python's scoping rules are , erm, interesting:
http://me.veekun.com/blog/2011/04/24/gotcha-python-scoping-closures/
The mnemonic for scoping is LEGB:
http://stackoverflow.com/questions/291978/short-descrip
On Tue, Sep 10, 2013 at 10:46 AM, Ramchandra Apte wrote:
> I get UnboundLocalError: local variable 'x' referenced before assignment.
> That's strange, I'd expect the first print statement to print 10, not
> generate an exception.
>
A variable is either local or global. It is decided at the compil
I get UnboundLocalError: local variable 'x' referenced before assignment.
That's strange, I'd expect the first print statement to print 10, not
generate an exception.
On 10 September 2013 10:39, Anand Chitipothu wrote:
> On Tue, Sep 10, 2013 at 10:37 AM, Ramchandra Apte >wrote:
>
> > On 10 Se
On Tue, Sep 10, 2013 at 10:37 AM, Ramchandra Apte wrote:
> On 10 September 2013 10:21, Anand Chitipothu wrote:
>
> > On Tue, Sep 10, 2013 at 10:14 AM, Shabda Raaj wrote:
> >
> > > This is a popular talk on quircks of ruby/js
> > >
> > > https://www.destroyallsoftware.com/talks/wat
> > >
> > > Wh
On 10 September 2013 10:21, Anand Chitipothu wrote:
> On Tue, Sep 10, 2013 at 10:14 AM, Shabda Raaj wrote:
>
> > This is a popular talk on quircks of ruby/js
> >
> > https://www.destroyallsoftware.com/talks/wat
> >
> > What are the quircks/unexpected behavior you find in Python? (Aka Python
> >
On Tue, Sep 10, 2013 at 10:14 AM, Shabda Raaj wrote:
> This is a popular talk on quircks of ruby/js
>
> https://www.destroyallsoftware.com/talks/wat
>
> What are the quircks/unexpected behavior you find in Python? (Aka Python
> "wats").
>
x = 10
class Foo:
print x
x = 0
print x
21 matches
Mail list logo