Python Changing Default Mutable Value After Import


 
Thread Tools Search this Thread
Top Forums Programming Python Changing Default Mutable Value After Import
# 1  
Old 04-24-2017
Python Changing Default Mutable Value After Import

Is it possible to change a (just a snippet of all the code):

Code:
Class Setup(object):
def __init__(self, localm = 'http://127.0.0.1:1414', remotem = 'https://10.0.0.160:1414',
		license = "blah\n"
		"blah blah\n"
		"blah blah blah\n"
		):
		
		logging.basicConfig(level=logging.ERROR)
		
		self.lm = localm
		self.rm = remotem	
		self.lic = license



default mutable value after it is imported or after initialization of a class using ipython? For example:

Code:
cpaste

Class Setup(object):
def __init__(self, localm = 'http://127.0.0.1:1414', remotem = 'https://10.0.0.160:1414',
		license = "blah\n"
		"blah blah\n"
		"blah blah blah\n"
		):
		
		logging.basicConfig(level=logging.ERROR)
		
		self.lm = localm
		self.rm = remotem	
		self.lic = license
whos

Setup          type      <class '__main__.Setup'>
logging        module    <module 'logging' from '/<...>.7/logging/__init__.pyc'>
pasted_block   str       __init__stuff

Setup.__init__.__defaults__("remotem = 'https://10.0.0.162:1414'")
TypeError                                 Traceback (most recent call last)
<ipython-input-11-e07587c9ad62> in <module>()
----> 1 Setup.__init__.__defaults__("remotem = 'https://10.0.0.160:1414'")

TypeError: 'tuple' object is not callable

or after the class initialization? What I want to achieve in the above example is to change the ip address without having to modify my code that is in Eclipse.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies

2. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

3. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

4. UNIX for Dummies Questions & Answers

How to Import dump file with default value for single column?

Hi, I need to import more than 250K of records to another Database(Oracle).But I want particular column value to be changed in the destination table. Is it possible to do this during export or import process with out modifying data from original table.I do not want to run Update manually. ... (6 Replies)
Discussion started by: GOVINDARAJ.M
6 Replies

5. Shell Programming and Scripting

Python 2.5 / 2.2 import "errno" fails on AIX Server

I am trying to import the "xmlrpclib" Module from Activepython 2.5 in einer older Python 2.2. Already achived this on a SUSE Linux server, but I am now required to do it on a AIX server. Resolved the first few error messages by copying files from Activepython to Python but I can't get the... (0 Replies)
Discussion started by: frieling
0 Replies

6. Shell Programming and Scripting

Python- Changing background color on Button click

Hi, I am trying to write a python program which changes background color on click of button. However i am stuck up. Instead of changing the color currently it is creating a new frame every time. please look at the code and let me know how to correct it #!/usr/bin/env python from Tkinter... (0 Replies)
Discussion started by: vickylife
0 Replies

7. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies
Login or Register to Ask a Question