« first day (2023 days earlier)      last day (2941 days later) » 
00:00 - 20:0020:00 - 23:00

8:16 PM
cbg
 
cabbage
 
I am running a for loo. within the for loop I want to make an integer into a tuple object
 
(intvar,)?
 
but I get the error that integer is not iterable
 
tuple(x) is not inserting x into a tuple, it's literally trying to convert it to a tuple.
 
8:19 PM
sorry that's what I mean. I'm a green bean so my the way I describe my code won't be great
 
DSM
It's the difference between putting a book in a bag and trying to make the book into a bag.
 
Is there anyway I can convert the integer into a tuple in a for loop
 
Yes. See what Andras said.
You create a tuple with the integer in, rather than converting the integer into a tuple directly.
It's a very subtle but important difference.
 
okay, is that what intvar does? I can't see that in the standard python documentation
 
That was just what he called the variable
 
8:21 PM
No intvar is an integer variable.
We don't know what your variable is called because you've not produced any code.
 
some_int = 9

a_tuple = (some_int,)
 
So Andras was making one up.
 
sorry my bad
 
sorry, made an MCVE for you, forgot to specify:P
 
I understand and that has worked.
Thanks for that
When I did it without the comma it didn't work, what effect does the comma have? Does that confirm to python it is a tuple due to its syntax?
 
8:27 PM
Yes
 
It distinguishes it from just brackets.
 
penny is dropping
 
Tuples don't really require brackets, it's actually the comma that does the magicks.
a = 1,2,3 is just as valid as b = (4,5,6)
And as such, there is a difference between c = (1) and d = (2,)
 
that makes sense
 
DSM
8:30 PM
Excellent. That'll be 50$, donated to the cabbage-themed charity of your choice.
 
Fizzy and Bobby Make A Wish Foundation is the official room charity.
 
Am I a fool if I just googled that charity?
 
Give me 10 minutes then no, you're not
 
haha
 
8:32 PM
FABMAW is a genuine charity that has an underground web presence.
 
And don't worry about your question; tuples are a bit of a weird syntax but they make sense after a while
 
Yeah people assume that they're just round-bracketed-lists.
For a list you need the [...] for example.
 
I learnt python about 6 months ago as my first programming language doing LPTHW. I am trying to get a web application completed for European Football Championships which has meant I am having to rush some of my learning on python!
After I am done I am going to go back to basics
 
LPTHW isn't really recommended - when you're done we can recommend better stuff :)
 
how come?
 
8:35 PM
We don't have lists like that for every tutorial, but LPTHW has some issues which other material doesn't
 
I must admit, past the first half of the book, I felt a bit in the wilderness
I swear one of the exercises is "go away and read the documentation for web.py" now try and write a basic web application using python
 
Haha
It's okay; there's some good stuff in there. Just might have to unlearn a few things. But that's learning, right? It's never 100% first time.
 
Yeah. I have the feeling I will look back at my current web application and see quite a lot that I would change
What is hard is I need to use elements of other languages now like javascript for example. And this looks a lot more daunting than python!
 
JS is a simpler language than Python (I think) but you're probably using a framework you have to learn on top of that, which makes it a steep learning curve
 
@RobertGrant as someone who came from MATLAB, they make sense pretty quickly without any a priori knowledge
 
8:48 PM
Fair enough
 
or maybe I just kick ass, we can never know
 
It's definitely that
 
If I wanted to look at becoming a developer in the future for a career, is python a good way to go?
 
I think it's very cool as a career language
 
DSM
Very few developers are monolingual these days, so you'll wind up knowing a handful whatever you do.
 
8:49 PM
Yeah
 
DSM
I do know some people who are 95%+ Java. I pity those people.
 
If I have no prior experience, am I best just writing a few applications using a combination of a few different languages and then putting myself out there?
 
Master one language at a time tbh
 
Okay. It's hard to know when to make the leap to look at making it a career and a career that pays well
 
@DSM one of the main IT departments at our customer uses exclusively Oracle APEX, which is writing applications using only PL/SQL. Those people can barely glimpse comparative wonders such as Java.
 
8:56 PM
I wouldn't say "master one language at a time" because it takes N years to "master" a language truly.
 
Well I mean it depends on how fast you need a job
 
I'd have to agree with the above. Not many people truly master a language. I'd certainly say I'm competent in a number of languages, but not really a master of any.
 
There's no problem with working with different languages at the same time, especially if they are for different use cases, for example JS frontend and python backend
 
What I think is really hard is that if I want to write a python web application, I will inevitably have to learn some javascript, css, sql to get it to work. But whilst I am comfortable with my learning of python, I am just fudging my way through the other languages because I don't have the time yet to read all of their docuemntation
 
if you have years of focused experience in one language you will be a much more appealing applicant
 
8:57 PM
@Ffisegydd that's a confusing message though - it's definitely better to learn a lot about one language before branching out sideways to others
 
but in general concepts of cs are more important than knowing all the intricacies of a specific language
 
DSM
I picked up Java and JS simultaneously for the backend/frontend reason. Eventually I realized that the alleged advantages of Java were heavy on the alleged and light on the advantage.
 
@RobertGrant I'm not sure. However, i would say, get the principles of programming, control flow, logic etc in one language before branching out.
 
DSM
I do think it's a good idea for a real beginner to learn something relatively deeply.
 
@DSM Harsh. Possibly true, but harsh :)
 
8:59 PM
You can also start to learn sdlc concepts such as source control, testing, releases, support, design and migration with one language
 
Disappointed I didn't make more of control flow in close proximity to the words branching out.
my dad-puns are slipping.
 
I was more taking issue with the idea of mastering one at a time. I'll rephrase though: learn programming basics (loops, conditionals, etc) in whatever language first, then learn whatever you want with multiple languages if necessary.
"First learn to program, then learn programming languages"
And you'll find that as you work with different languages you'll pick up more of the programming theory.
 
Not much coming from a noob but that sounds like a sensible approach to me atm
 
For example I'd never done async until learning node.
 
DSM
If I were training a dev from scratch -- undergrad -- I'd teach 'em low-level stuff in C and algorithms in Python simultaneously. Then we'd dabble in wildly different languages: Scheme, Haskell, etc., to make sure they knew (1) just because one language does something a certain way doesn't mean it's The Way, and (2) that they pick up the nebulous learn-how-to-learn gift.
 
9:05 PM
@Natecat really? I'm going to bed in a minute so can't discuss it much but I'm going into some interviews in the next few weeks and would be much more impressed with someone who has experimented with a variety of languages as opposed to someone who learned Java and then did nothing else.
 
I think it depends on the company, but I doubt many companies would want to hire someone who is just mediocore in a bunch of languages
 
@DSM very much considering taking the C with Python approach to teaching a group of total non-programming engineers u/g the basics next year
 
You don't have to be mediocre though.
 
Is it normal to find programming in python easier on a linux machine?
 
Yeah a bit
 
9:08 PM
It's normal to find programming easier on linux
windows is very much a consumer platform
 
I'd rather have someone with 4 years experience doing 4 languages for a year each than 4 years of doing one thing exactly.
 
It's already installed on Linux.
 
@Natecat pretty sure even with Mono C# dev is still a billion times better on Windows
 
that makes me feel better
 
I don't think you understand linux. Nothing is 'already installed', it varies distro to distro
 
9:09 PM
I just personally feel that variety is important. Variety in other things makes me a better python programmer.
 
Well if you're coding for windows specifically then obviously windows is gonna be a better platform
 
@Ffisegydd yeah but you happen to do something that requires a bit of a few different techs
 
But what popular Linux distro doesn't come with Python?
 
If you're doing huge, complex Spring applications (or whatever) then you probably pick the person with four years of Spring and Java
 
@Robert nowadays I'd be shocked if most people don't need multiple languages. At least from my experience so far.
Anyway, bed time.
 
9:11 PM
@tjohnson Arch for one
 
hangs head in shame
 
Just because it's not just about the language itself, but all the supporting libraries, frameworks and weird nuances that only come with experience
 
I thought that said Swing for a second and was wondering why anyone would want something coded with swing
 
Ask someone with 1 year of Java the right size for the Young generation for an application and they'll probably stare at you blankly
 
I can't really think of a practical application for that though
unless you are making your own jvm
 
DSM
9:16 PM
When I hear "Young generation" I think of a row of a Young tableau. I don't think I'm going to make it as a Java dev.
 
@Natecat you need to do that to tune the JVM, not to make it
@DSM without finishing the first sentence of that wikipedia article I can tell you you made the right choice
 
9:54 PM
Hi, I have [this question](https://stackoverflow.com/questions/36212132/how-to-use-threads-for-functional-tests-of-client-server-application) for which I ended giving up on using threads because I couldn't find any usable solution (threads are not the right tool for that use case). And because in the end with processes I achieved a good performances in the startup time of the client and server. (each test have to launch them).

What should I do with my question?
 
@tuxayo Hi! does it have answers?
 
@tuxayo You can answer it yourself if you'd like
 
@AndrasDeak Yes but one that couldn't lead to a usable result.
@Natecat Is giving up on threads and going for processes an answer?
 
it can be
 
If your question is answered by it, it is an answer
 
9:58 PM
imagine yourself to be a random person stumbling into your question
Would it help them if they saw your solution? (Probably yes.)
Would someone struggling with the same problem be likely to find your question? If so, even more yes.
anyway, people are always encouraged to give valuable answers to questions, worst case is that community downvotes the contribution:P
 
Actually I could achieve what I wanted with processes so yeah that would be an answer.
 
If you do self-answer, make it informative. Note that you solved it without the threads which the question is about, but you expect it to be of use to future readers (that would be enough for me to not downvote:P)
and give a proper answer to the question "how do I do this with processes instead?"
 
Hi! How to call the basic function getattr inside the overload method getattr?
 
What do you mean
Like call it in your super class?
super().__getattr__()
 
@Natecat I want to get something like it:
class Model:
    def __getattr__(self, item):
        if item in self.fields:
            return item
        else:
            return getattr(self, item)
 
10:05 PM
The code I gave will work then?
 
@Natecat I will try now
 
don't you have to inherit from a base class for that?
as in class Model(base)?
or is there a default base?
 
@AndrasDeak yes it is
 
That was awfully ambigious
 
is it "object" or something?
@Natecat it wasn't, with a directed reply:)
 
10:07 PM
@AndrasDeak @Natecat Thanks for your advice I'll try the make a good answer in the following days. Have a nice day/evening :)
 
@tuxayo good luck, you too
 
@Natecat no, it doesn't work: 'super' object has no attribute 'getattr'
 
Are you inheriting from a class?
if super() doesn't have __getattr__ then idk what you're trying to do
 
@Natecat Model is the base class
 
what do you want __getattr__ to do if item isn't in self.fields
 
10:11 PM
@Natecat I want only return that attribute from the object, like self[item] in JS
 
so like locals()[item]?
 
@QueueOverflow don't you have to do something like class Not_a_model(Model):?
 
@Natecat yes, it works! Thanks you!
 
wait actually that's probably a bad idea
 
@AndrasDeak yes I will
 
10:15 PM
use self.__dict__[item] instead
 
@Natecat OK
@Natecat I am not a native speaker, so I forgot the correct spell :)
 
00:00 - 20:0020:00 - 23:00

« first day (2023 days earlier)      last day (2941 days later) »